diff --git a/app/sdks/0.6.2/client-flutter-dev/CHANGELOG.md b/app/sdks/0.6.2/client-flutter-dev/CHANGELOG.md new file mode 100644 index 0000000000..2e9b0e0a91 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/CHANGELOG.md @@ -0,0 +1,64 @@ +## 0.3.2 + +- Fixed package namespaces + +## 0.3.1 + +- Downgraded meta package version to 1.1.8 + +## 0.3.0 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + +## 0.2.3 + +- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie + +## 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 + +## 0.1.0 + +- Added examples file +- Some minor style fixes + +## 0.0.14 + +- Using MultipartFile for file uploads + +## 0.0.13 + +- Fix for file upload method + +## 0.0.12 + +- Added file upload support for storage service + +## 0.0.11 + +- Added integration with web auth plugin to support Appwrite OAuth API + +## 0.0.9 + +- Updated deafult params + +## 0.0.8 + +- Fixed compilation error in Client class +- Shorter description for package \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/LICENSE b/app/sdks/0.6.2/client-flutter-dev/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/README.md b/app/sdks/0.6.2/client-flutter-dev/README.md new file mode 100644 index 0000000000..2c0ba754c3 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/README.md @@ -0,0 +1,38 @@ +# Appwrite Flutter (Dev Channel) SDK + +[![pub package](https://img.shields.io/pub/v/appwrite.svg)](https://pub.dartlang.org/packages/appwrite) +![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter-dev.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.6.2. 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 Flutter (Dev Channel) 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +Add this to your package's `pubspec.yaml` file: + +```yml +dependencies: + appwrite_dev: ^0.3.2 +``` + +You can install packages from the command line: + +```bash +pub get appwrite_dev +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-o-auth2session.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..b3cb8831ee --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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: 'amazon', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-recovery.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..32fe469cff --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-recovery.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/create-session.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-session.md new file mode 100644 index 0000000000..a5930877f4 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-session.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/create-verification.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..738f22df42 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create-verification.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/create.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create.md new file mode 100644 index 0000000000..1f92976c39 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/create.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/delete-session.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..95b3641387 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/delete-session.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/delete-sessions.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..8aaef86816 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/delete-sessions.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/delete.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/delete.md new file mode 100644 index 0000000000..e6e29f53aa --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/delete.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/get-logs.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..92d9e47916 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get-logs.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/get-prefs.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..02874f2251 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get-prefs.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/get-sessions.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..ace4b1b6c1 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get-sessions.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/get.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get.md new file mode 100644 index 0000000000..4651559afb --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/get.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/update-email.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-email.md new file mode 100644 index 0000000000..9fc86a7aae --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-email.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/update-name.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-name.md new file mode 100644 index 0000000000..e5e218a515 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-name.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/update-password.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-password.md new file mode 100644 index 0000000000..869b4d9a30 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-password.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/update-prefs.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..0d50469742 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-prefs.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/update-recovery.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..e028e60a7d --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-recovery.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/account/update-verification.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..48d669efcc --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/account/update-verification.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..dec7863b1f --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-browser.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..e2746c4999 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..1c56335b9f --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-favicon.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..8a91f608ce --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-flag.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..a2cbea98e3 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-image.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..5f9353feae --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +import 'package:appwrite_dev/appwrite_dev.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.getInitials( + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..2737297082 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/avatars/get-q-r.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/database/create-document.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/create-document.md new file mode 100644 index 0000000000..6fc27bdfbb --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/create-document.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/database/delete-document.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..74bcd69d9a --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/delete-document.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/database/get-document.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/get-document.md new file mode 100644 index 0000000000..639209ed3c --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/get-document.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/database/list-documents.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..41eac5dd9a --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/list-documents.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/database/update-document.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/update-document.md new file mode 100644 index 0000000000..0b153b1595 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/database/update-document.md @@ -0,0 +1,26 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..cae4365382 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-continents.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..c326461bef --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..afd3f5d5be --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..e4fc236949 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-countries.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..d3eb30533e --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-currencies.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..32b2a700c0 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get-languages.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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.getLanguages(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get.md new file mode 100644 index 0000000000..b0cca45924 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/locale/get.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/create-file.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..d824bd5831 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/create-file.md @@ -0,0 +1,25 @@ +import 'dart:io'; +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..88e7b8815c --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/delete-file.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..483340e24a --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file-download.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..dd8d924fe7 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file-preview.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..8ed6a946e0 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file-view.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/get-file.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..4e398f88fd --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/get-file.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/list-files.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..d72ba29e03 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/list-files.md @@ -0,0 +1,21 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/storage/update-file.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..95e213ddc2 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/storage/update-file.md @@ -0,0 +1,24 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..31bf7ec1af --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/create-membership.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/create.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/create.md new file mode 100644 index 0000000000..e50279de01 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/create.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..015507d3a2 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/delete-membership.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/delete.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/delete.md new file mode 100644 index 0000000000..6cc1367f9b --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/delete.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..d427c9ac47 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/get-memberships.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/get.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/get.md new file mode 100644 index 0000000000..1bca70a23f --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/get.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/list.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/list.md new file mode 100644 index 0000000000..c56e7a5dd5 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/list.md @@ -0,0 +1,21 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/update-membership-status.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..6098b38ed9 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/update-membership-status.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/docs/examples/teams/update.md b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/update.md new file mode 100644 index 0000000000..2494f408d9 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/docs/examples/teams/update.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.6.2/client-flutter-dev/example/README.md b/app/sdks/0.6.2/client-flutter-dev/example/README.md new file mode 100644 index 0000000000..f6768a5f85 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/example/README.md @@ -0,0 +1,55 @@ +# Examples + +Init your Appwrite client: + +```dart + Client client = Client(); + + client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production + ; + +``` + +Create a new user and session: + +```dart +Account account = Account(client); + +Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name'); + +Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); + +``` + +Fetch user profile: + +```dart +Account account = Account(client); + +Response profile = await account.get(); +``` + +Upload File: + +```dart +Storage storage = Storage(client); + +MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg'); + +storage.createFile( + file: file, + read: ['*'], + write: [] +) +.then((response) { + print(response); // File uploaded! +}) +.catchError((error) { + print(error.response); +}); +``` + +All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/appwrite_dev.dart b/app/sdks/0.6.2/client-flutter-dev/lib/appwrite_dev.dart new file mode 100644 index 0000000000..95d0b72cfe --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/appwrite_dev.dart @@ -0,0 +1,10 @@ +export 'package:dio/dio.dart' show Response; + +export 'client.dart'; +export 'enums.dart'; +export 'services/account.dart'; +export 'services/avatars.dart'; +export 'services/database.dart'; +export 'services/locale.dart'; +export 'services/storage.dart'; +export 'services/teams.dart'; diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/client.dart b/app/sdks/0.6.2/client-flutter-dev/lib/client.dart new file mode 100644 index 0000000000..b874b7e9e5 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/client.dart @@ -0,0 +1,144 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; +import 'package:dio/adapter.dart'; +import 'package:dio_cookie_manager/dio_cookie_manager.dart'; +import 'package:cookie_jar/cookie_jar.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:package_info/package_info.dart'; + +import 'enums.dart'; + +class Client { + String endPoint; + String type = 'unknown'; + Map headers; + Map config; + bool selfSigned; + bool initialized = false; + Dio http; + PersistCookieJar cookieJar; + + Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() { + // Platform is not supported in web so if web, set type to web automatically and skip Platform check + if(kIsWeb) { + type = 'web'; + }else{ + type = (Platform.isIOS) ? 'ios' : type; + type = (Platform.isMacOS) ? 'macos' : type; + type = (Platform.isAndroid) ? 'android' : type; + type = (Platform.isLinux) ? 'linux' : type; + type = (Platform.isWindows) ? 'windows' : type; + type = (Platform.isFuchsia) ? 'fuchsia' : type; + } + + this.headers = { + 'content-type': 'application/json', + 'x-sdk-version': 'appwrite:flutter:0.3.2', + }; + + this.config = {}; + + assert(endPoint.startsWith(RegExp("http://|https://")), "endPoint $endPoint must start with 'http'"); + } + + Future _getCookiePath() async { + final directory = await getApplicationDocumentsDirectory(); + final path = directory.path; + final Directory dir = new Directory('$path/cookies'); + await dir.create(); + return dir; + } + + /// Your project ID + Client setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + + Client setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + + Client setSelfSigned({bool status = true}) { + selfSigned = status; + return this; + } + + Client setEndpoint(String endPoint) { + this.endPoint = endPoint; + this.http.options.baseUrl = this.endPoint; + return this; + } + + Client addHeader(String key, String value) { + headers[key] = value; + + return this; + } + + Future init() async { + if(!initialized) { + // if web skip cookie implementation and origin header as those are automatically handled by browsers + if(!kIsWeb) { + final Directory cookieDir = await _getCookiePath(); + cookieJar = new PersistCookieJar(dir:cookieDir.path); + this.http.interceptors.add(CookieManager(cookieJar)); + if(Platform.isAndroid || Platform.isIOS) { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); + } else if(Platform.isLinux) { + addHeader('Origin', 'appwrite-linux://'); + } else if(Platform.isMacOS) { + addHeader('Origin', 'appwrite-macos://'); + } else if(Platform.isWindows) { + addHeader('Origin', 'appwrite-windows://'); + } else if(Platform.isFuchsia) { + addHeader('Origin', 'appwrite-fuchsia://'); + } + }else{ + // if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work + this.http.options.extra['withCredentials'] = true; + } + + this.http.options.baseUrl = this.endPoint; + this.http.options.validateStatus = (status) => status < 400; + } + } + + Future call(HttpMethod method, {String path = '', Map headers = const {}, Map params = const {}}) async { + if(selfSigned && !kIsWeb) { + // Allow self signed requests + (http.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (HttpClient client) { + client.badCertificateCallback = (X509Certificate cert, String host, int port) => true; + return client; + }; + } + + await this.init(); + + // Origin is hardcoded for testing + Options options = Options( + headers: {...this.headers, ...headers}, + method: method.name(), + ); + + if(headers['content-type'] == 'multipart/form-data') { + return http.request(path, data: FormData.fromMap(params), options: options); + } + + if (method == HttpMethod.get) { + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + return http.get(path, queryParameters: params, options: options); + } else { + return http.request(path, data: params, options: options); + } + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/enums.dart b/app/sdks/0.6.2/client-flutter-dev/lib/enums.dart new file mode 100644 index 0000000000..2757f6073e --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/enums.dart @@ -0,0 +1,15 @@ +enum HttpMethod { get, post, put, delete, patch } + +extension HttpMethodString on HttpMethod { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} + +enum OrderType { asc, desc } + +extension OrderTypeString on OrderType { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/service.dart b/app/sdks/0.6.2/client-flutter-dev/lib/service.dart new file mode 100644 index 0000000000..1ae319b705 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/service.dart @@ -0,0 +1,7 @@ +import 'client.dart'; + +class Service { + final Client client; + + const Service(this.client); +} diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/services/account.dart b/app/sdks/0.6.2/client-flutter-dev/lib/services/account.dart new file mode 100644 index 0000000000..890303a9d6 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/services/account.dart @@ -0,0 +1,435 @@ + +import 'dart:io'; +import 'package:universal_html/html.dart' as html; + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_web_auth/flutter_web_auth.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Account extends Service { + Account(Client client): super(client); + + /// Get Account + /// + /// Get currently logged in user data as JSON object. + /// + Future get() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account + /// + /// Use this endpoint to allow a new user to register a new account in your + /// project. After the user registration completes successfully, you can use + /// the [/account/verfication](/docs/client/account#createVerification) route + /// to start verifying the user email address. To allow your new user to login + /// to his new account, you need to create a new [account + /// session](/docs/client/account#createSession). + /// + Future create({@required String email, @required String password, String name = ''}) { + final String path = '/account'; + + final Map params = { + 'email': email, + 'password': password, + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Account + /// + /// Delete a currently logged in user account. Behind the scene, the user + /// record is not deleted but permanently blocked from any access. This is done + /// to avoid deleted accounts being overtaken by new users with the same email + /// address. Any user-related resources like documents or storage files should + /// be deleted separately. + /// + Future delete() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Account Email + /// + /// Update currently logged in user account email address. After changing user + /// address, user confirmation status is being reset and a new confirmation + /// mail is sent. For security measures, user password is required to complete + /// this request. + /// + Future updateEmail({@required String email, @required String password}) { + final String path = '/account/email'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Logs + /// + /// Get currently logged in user list of latest security activity logs. Each + /// log returns user IP address, location and date and time of log. + /// + Future getLogs() { + final String path = '/account/logs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Name + /// + /// Update currently logged in user account name. + /// + Future updateName({@required String name}) { + final String path = '/account/name'; + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Update Account Password + /// + /// Update currently logged in user password. For validation, user is required + /// to pass the password twice. + /// + Future updatePassword({@required String password, @required String oldPassword}) { + final String path = '/account/password'; + + final Map params = { + 'password': password, + 'oldPassword': oldPassword, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Preferences + /// + /// Get currently logged in user preferences as a key-value object. + /// + Future getPrefs() { + final String path = '/account/prefs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Preferences + /// + /// Update currently logged in user account preferences. You can pass only the + /// specific settings you wish to update. + /// + Future updatePrefs({@required dynamic prefs}) { + final String path = '/account/prefs'; + + final Map params = { + 'prefs': prefs, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Create Password Recovery + /// + /// Sends the user an email with a temporary secret key for password reset. + /// When the user clicks the confirmation link he is redirected back to your + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + /// endpoint to complete the process. + /// + Future createRecovery({@required String email, @required String url}) { + final String path = '/account/recovery'; + + final Map params = { + 'email': email, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Password Recovery + /// + /// Use this endpoint to complete the user account password reset. Both the + /// **userId** and **secret** arguments will be passed as query parameters to + /// the redirect URL you have provided when sending your request to the [POST + /// /account/recovery](/docs/client/account#createRecovery) endpoint. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + Future updateRecovery({@required String userId, @required String secret, @required String password, @required String passwordAgain}) { + final String path = '/account/recovery'; + + final Map params = { + 'userId': userId, + 'secret': secret, + 'password': password, + 'passwordAgain': passwordAgain, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Get Account Sessions + /// + /// Get currently logged in user list of active sessions across different + /// devices. + /// + Future getSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account Session + /// + /// Allow the user to login into his account by providing a valid email and + /// password combination. This route will create a new session for the user. + /// + Future createSession({@required String email, @required String password}) { + final String path = '/account/sessions'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete All Account Sessions + /// + /// Delete all sessions from the user account and remove any sessions cookies + /// from the end client. + /// + Future deleteSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Account Session with OAuth2 + /// + /// Allow the user to login to his account using the OAuth2 provider of his + /// choice. Each OAuth2 provider should be enabled from the Appwrite console + /// 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://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure', List scopes = const []}) { + final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider); + + final Map params = { + 'success': success, + 'failure': failure, + 'scopes': scopes, + 'project': client.config['project'], + }; + + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } + else { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + query: query.join('&') + ); + + if(kIsWeb) { + html.window.location.href = url.toString(); + return null; + }else{ + + return FlutterWebAuth.authenticate( + url: url.toString(), + callbackUrlScheme: "appwrite-callback-" + client.config['project'] + ).then((value) async { + Uri url = Uri.parse(value); + Cookie cookie = new Cookie(url.queryParameters['key'], url.queryParameters['secret']); + cookie.domain = Uri.parse(client.endPoint).host; + cookie.httpOnly = true; + cookie.path = '/'; + List cookies = [cookie]; + await client.init(); + client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies); + }); + } + + } + + /// Delete Account Session + /// + /// Use this endpoint to log out the currently logged in user from all his + /// account sessions across all his different devices. When using the option id + /// argument, only the session unique ID provider will be deleted. + /// + Future deleteSession({@required String sessionId}) { + final String path = '/account/sessions/{sessionId}'.replaceAll(RegExp('{sessionId}'), sessionId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Email Verification + /// + /// Use this endpoint to send a verification message to your user email address + /// to confirm they are the valid owners of that address. Both the **userId** + /// and **secret** arguments will be passed as query parameters to the URL you + /// have provided to be attached to the verification email. The provided URL + /// should redirect the user back to your app and allow you to complete the + /// verification process by verifying both the **userId** and **secret** + /// parameters. Learn more about how to [complete the verification + /// process](/docs/client/account#updateAccountVerification). + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + /// + Future createVerification({@required String url}) { + final String path = '/account/verification'; + + final Map params = { + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Email Verification + /// + /// Use this endpoint to complete the user email verification process. Use both + /// the **userId** and **secret** parameters that were attached to your app URL + /// to verify the user email ownership. If confirmed this route will return a + /// 200 status code. + /// + Future updateVerification({@required String userId, @required String secret}) { + final String path = '/account/verification'; + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/services/avatars.dart b/app/sdks/0.6.2/client-flutter-dev/lib/services/avatars.dart new file mode 100644 index 0000000000..b7fa6393ef --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/services/avatars.dart @@ -0,0 +1,238 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Avatars extends Service { + Avatars(Client client): super(client); + + /// Get Browser Icon + /// + /// You can use this endpoint to show different browser icons to your users. + /// The code argument receives the browser code as it appears in your user + /// /account/sessions endpoint. Use width, height and quality arguments to + /// change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Credit Card Icon + /// + /// Need to display your users with your billing method or their payment + /// methods? The credit card endpoint will return you the icon of the credit + /// card provider you need. Use width, height and quality arguments to change + /// the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Favicon + /// + /// Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + /// website URL. + /// + String getFavicon({@required String url}) { + final String path = '/avatars/favicon'; + + final Map params = { + 'url': url, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Country Flag + /// + /// You can use this endpoint to show different country flags icons to your + /// users. The code argument receives the 2 letter country code. Use width, + /// height and quality arguments to change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Image from URL + /// + /// Use this endpoint to fetch a remote image URL and crop it to any image size + /// you want. This endpoint is very useful if you need to crop and display + /// remote images in your app or in case you want to make sure a 3rd party + /// image is properly served using a TLS protocol. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get User Initials + /// + /// Use this endpoint to show your user initials avatar icon on your website or + /// app. By default, this route will try to print your logged-in user name or + /// email initials. You can also overwrite the user name if you pass the 'name' + /// parameter. If no name is given and no user is logged, an empty avatar will + /// be returned. + /// + /// You can use the color and background params to change the avatar colors. By + /// default, a random theme will be selected. The random theme will persist for + /// the user's initials when reloading the same theme will always return for + /// the same initials. + /// + String getInitials({String name = '', int width = 500, int height = 500, String color = '', String background = ''}) { + final String path = '/avatars/initials'; + + final Map params = { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get QR Code + /// + /// 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. + /// + String getQR({@required String text, int size = 400, int margin = 1, bool download = false}) { + final String path = '/avatars/qr'; + + final Map params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/services/database.dart b/app/sdks/0.6.2/client-flutter-dev/lib/services/database.dart new file mode 100644 index 0000000000..0fec1fb4d6 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/services/database.dart @@ -0,0 +1,119 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Database extends Service { + Database(Client client): super(client); + + /// List Documents + /// + /// Get a list of all the user documents. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project documents. [Learn more about different API + /// modes](/docs/admin). + /// + Future listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = ''}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'filters': filters, + 'offset': offset, + 'limit': limit, + 'orderField': orderField, + 'orderType': orderType.name(), + 'orderCast': orderCast, + 'search': search, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Document + /// + /// Create a new Document. Before using this route, you should create a new + /// collection resource using either a [server + /// integration](/docs/server/database?sdk=nodejs#createCollection) API or + /// directly from your database console. + /// + Future createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Document + /// + /// Get document by its unique ID. This endpoint response returns a JSON object + /// with the document data. + /// + Future getDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Document + Future updateDocument({@required String collectionId, @required String documentId, @required dynamic data, @required List read, @required List write}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Delete Document + /// + /// Delete document by its unique ID. This endpoint deletes only the parent + /// documents, his attributes and relations to other documents. Child documents + /// **will not** be deleted. + /// + Future deleteDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/services/locale.dart b/app/sdks/0.6.2/client-flutter-dev/lib/services/locale.dart new file mode 100644 index 0000000000..095af4792c --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/services/locale.dart @@ -0,0 +1,143 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Locale extends Service { + Locale(Client client): super(client); + + /// Get User Locale + /// + /// Get the current user location based on IP. Returns an object with user + /// country code, country name, continent name, continent code, ip address and + /// suggested currency. You can use the locale header to get the data in a + /// supported language. + /// + /// ([IP Geolocation by DB-IP](https://db-ip.com)) + /// + Future get() { + final String path = '/locale'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Continents + /// + /// List of all continents. You can use the locale header to get the data in a + /// supported language. + /// + Future getContinents() { + final String path = '/locale/continents'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries + /// + /// List of all countries. You can use the locale header to get the data in a + /// supported language. + /// + Future getCountries() { + final String path = '/locale/countries'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List EU Countries + /// + /// List of all countries that are currently members of the EU. You can use the + /// locale header to get the data in a supported language. + /// + Future getCountriesEU() { + final String path = '/locale/countries/eu'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries Phone Codes + /// + /// List of all countries phone codes. You can use the locale header to get the + /// data in a supported language. + /// + Future getCountriesPhones() { + final String path = '/locale/countries/phones'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Currencies + /// + /// List of all currencies, including currency symbol, name, plural, and + /// decimal digits for all major and minor currencies. You can use the locale + /// header to get the data in a supported language. + /// + Future getCurrencies() { + final String path = '/locale/currencies'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Languages + /// + /// List of all languages classified by ISO 639-1 including 2-letter code, name + /// in English, and name in the respective language. + /// + Future getLanguages() { + final String path = '/locale/languages'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/services/storage.dart b/app/sdks/0.6.2/client-flutter-dev/lib/services/storage.dart new file mode 100644 index 0000000000..51f9345050 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/services/storage.dart @@ -0,0 +1,203 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Storage extends Service { + Storage(Client client): super(client); + + /// List Files + /// + /// Get a list of all the user files. You can use the query params to filter + /// your results. On admin mode, this endpoint will return a list of all of the + /// project files. [Learn more about different API modes](/docs/admin). + /// + Future listFiles({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/storage/files'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create File + /// + /// Create a new file. The user who creates the file will automatically be + /// assigned to read and write access unless he has passed custom values for + /// read and write arguments. + /// + Future createFile({@required MultipartFile file, @required List read, @required List write}) { + final String path = '/storage/files'; + + final Map params = { + 'file': file, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'multipart/form-data', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get File + /// + /// Get file by its unique ID. This endpoint response returns a JSON object + /// with the file metadata. + /// + Future getFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update File + /// + /// Update file by its unique ID. Only users with write permissions have access + /// to update this resource. + /// + Future updateFile({@required String fileId, @required List read, @required List write}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete File + /// + /// Delete a file by its unique ID. Only users with write permissions have + /// access to delete this resource. + /// + Future deleteFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get File for Download + /// + /// Get file content by its unique ID. The endpoint response return with a + /// 'Content-Disposition: attachment' header that tells the browser to start + /// downloading the file to user downloads directory. + /// + String getFileDownload({@required String fileId}) { + final String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File Preview + /// + /// Get a file preview image. Currently, this method supports preview for image + /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + /// and spreadsheets, will return the file icon image. You can also pass query + /// string arguments for cutting and resizing your preview image. + /// + String getFilePreview({@required String fileId, int width = 0, int height = 0, int quality = 100, String background = '', String output = ''}) { + final String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File for View + /// + /// Get file content by its unique ID. This endpoint is similar to the download + /// method but returns with no 'Content-Disposition: attachment' header. + /// + String getFileView({@required String fileId, String as = ''}) { + final String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'as': as, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/lib/services/teams.dart b/app/sdks/0.6.2/client-flutter-dev/lib/services/teams.dart new file mode 100644 index 0000000000..b9205da455 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/lib/services/teams.dart @@ -0,0 +1,207 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Teams extends Service { + Teams(Client client): super(client); + + /// List Teams + /// + /// Get a list of all the current user teams. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project teams. [Learn more about different API modes](/docs/admin). + /// + Future list({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team + /// + /// Create a new team. The user who creates the team will automatically be + /// assigned as the owner of the team. The team owner can invite new members, + /// who will be able add new owners and update or delete the team from your + /// project. + /// + Future create({@required String name, List roles = const ["owner"]}) { + final String path = '/teams'; + + final Map params = { + 'name': name, + 'roles': roles, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Team + /// + /// Get team by its unique ID. All team members have read access for this + /// resource. + /// + Future get({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Team + /// + /// Update team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future update({@required String teamId, @required String name}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete Team + /// + /// Delete team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future delete({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get Team Memberships + /// + /// Get team members by the team unique ID. All team members have read access + /// for this list of resources. + /// + Future getMemberships({@required String teamId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team Membership + /// + /// Use this endpoint to invite a new member to join your team. An email with a + /// link to join the team will be sent to the new member email address if the + /// member doesn't exist in the project it will be created automatically. + /// + /// Use the 'URL' parameter to redirect the user from the invitation email back + /// to your app. When the user is redirected, use the [Update Team Membership + /// Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + /// user to accept the invitation to the team. + /// + /// Please note that in order to avoid a [Redirect + /// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URL's are the once from domains you have set when + /// added your platforms in the console interface. + /// + Future createMembership({@required String teamId, @required String email, @required List roles, @required String url, String name = ''}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Team Membership + /// + /// This endpoint allows a user to leave a team or for a team owner to delete + /// the membership of any other team member. You can also use this endpoint to + /// delete a user membership even if he didn't accept it. + /// + Future deleteMembership({@required String teamId, @required String inviteId}) { + final String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Team Membership Status + /// + /// Use this endpoint to allow a user to accept an invitation to join a team + /// after he is being redirected back to your app from the invitation email he + /// was sent. + /// + Future updateMembershipStatus({@required String teamId, @required String inviteId, @required String userId, @required String secret}) { + final String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter-dev/pubspec.yaml b/app/sdks/0.6.2/client-flutter-dev/pubspec.yaml new file mode 100644 index 0000000000..2b2da51d3b --- /dev/null +++ b/app/sdks/0.6.2/client-flutter-dev/pubspec.yaml @@ -0,0 +1,24 @@ +name: appwrite_dev +version: 0.3.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-flutter-dev +issue_tracker: https://github.com/appwrite/sdk-generator/issues +documentation: https://appwrite.io/support +environment: + sdk: '>=2.6.0 <3.0.0' +dependencies: + meta: ^1.1.8 + path_provider: ^1.6.14 + package_info: ^0.4.3 + dio: ^3.0.10 + cookie_jar: ^1.0.1 + dio_cookie_manager: ^1.0.0 + flutter_web_auth: ^0.2.4 + universal_html: ^1.2.3 + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/CHANGELOG.md b/app/sdks/0.6.2/client-flutter/CHANGELOG.md new file mode 100644 index 0000000000..a584ad8b9a --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/CHANGELOG.md @@ -0,0 +1,60 @@ +## 0.3.0-dev.2 + +- Fix for an error when using a self-signed certificate for Web + +## 0.3.0-dev.1 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + +## 0.2.3 + +- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie + +## 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 + +## 0.1.0 + +- Added examples file +- Some minor style fixes + +## 0.0.14 + +- Using MultipartFile for file uploads + +## 0.0.13 + +- Fix for file upload method + +## 0.0.12 + +- Added file upload support for storage service + +## 0.0.11 + +- Added integration with web auth plugin to support Appwrite OAuth API + +## 0.0.9 + +- Updated deafult params + +## 0.0.8 + +- Fixed compilation error in Client class +- Shorter description for package \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/LICENSE b/app/sdks/0.6.2/client-flutter/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/README.md b/app/sdks/0.6.2/client-flutter/README.md new file mode 100644 index 0000000000..d272426ee3 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/README.md @@ -0,0 +1,38 @@ +# Appwrite Flutter SDK + +[![pub package](https://img.shields.io/pub/v/appwrite.svg)](https://pub.dartlang.org/packages/appwrite) +![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.6.2. 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 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +Add this to your package's `pubspec.yaml` file: + +```yml +dependencies: + appwrite: ^0.3.0-dev.2 +``` + +You can install packages from the command line: + +```bash +pub get appwrite +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/docs/examples/account/create-o-auth2session.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..0e26dd27af --- /dev/null +++ b/app/sdks/0.6.2/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: 'amazon', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/docs/examples/account/create-recovery.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..50db45b15d --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/create-session.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/create-session.md new file mode 100644 index 0000000000..ef824b4eca --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/create-verification.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..6b9b1ace40 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/create.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/create.md new file mode 100644 index 0000000000..384258ae68 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/delete-session.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..80a3f505d0 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/delete-sessions.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..74e494db25 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/delete.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/delete.md new file mode 100644 index 0000000000..2d9d302af0 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/get-logs.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..4240e55eec --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/get-prefs.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..d98dcd7290 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/get-sessions.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..b5ecd34e45 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/get.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/get.md new file mode 100644 index 0000000000..a77fbf3ad5 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/update-email.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/update-email.md new file mode 100644 index 0000000000..4a1a002db4 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/update-name.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/update-name.md new file mode 100644 index 0000000000..fa432bb34a --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/update-password.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/update-password.md new file mode 100644 index 0000000000..9bd8ad9b77 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/update-prefs.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..443252f89a --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/update-recovery.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..5140235d49 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/account/update-verification.md b/app/sdks/0.6.2/client-flutter/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..b795cde92d --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..464767c4c0 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..482c642402 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..60397b0af2 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..a9f7a711d9 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..7cead1cb2f --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..b2e70788d6 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +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.getInitials( + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/client-flutter/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..a5bcfd2c05 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/database/create-document.md b/app/sdks/0.6.2/client-flutter/docs/examples/database/create-document.md new file mode 100644 index 0000000000..b7d540bc2d --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/database/delete-document.md b/app/sdks/0.6.2/client-flutter/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..40c1cbdfe2 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/database/get-document.md b/app/sdks/0.6.2/client-flutter/docs/examples/database/get-document.md new file mode 100644 index 0000000000..0c98142315 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/database/list-documents.md b/app/sdks/0.6.2/client-flutter/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..0685e7f1aa --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/database/update-document.md b/app/sdks/0.6.2/client-flutter/docs/examples/database/update-document.md new file mode 100644 index 0000000000..2f37cd767a --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..60d4f32c4f --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..766006fecc --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..786eeb0b70 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..0570421ef9 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..7846c3c710 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..4f526383fa --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get-languages.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.getLanguages(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/docs/examples/locale/get.md b/app/sdks/0.6.2/client-flutter/docs/examples/locale/get.md new file mode 100644 index 0000000000..2dbdd47f63 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/create-file.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..9f61be12f4 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..271ed7b2dd --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..be3385a61b --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..8bd1a47457 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..5803fd409f --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/get-file.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..feca667fa9 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/list-files.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..1963ec694d --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/storage/update-file.md b/app/sdks/0.6.2/client-flutter/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..a5ecbfe987 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..e5e82de7b4 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/create.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/create.md new file mode 100644 index 0000000000..d11958ae6d --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..3f57b840fe --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/delete.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/delete.md new file mode 100644 index 0000000000..9fb488afec --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..4edadfa2b4 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/get.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/get.md new file mode 100644 index 0000000000..083565f7a6 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/list.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/list.md new file mode 100644 index 0000000000..665020e928 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/update-membership-status.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..616f64e148 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/docs/examples/teams/update.md b/app/sdks/0.6.2/client-flutter/docs/examples/teams/update.md new file mode 100644 index 0000000000..915fb57d38 --- /dev/null +++ b/app/sdks/0.6.2/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/0.6.2/client-flutter/example/README.md b/app/sdks/0.6.2/client-flutter/example/README.md new file mode 100644 index 0000000000..f6768a5f85 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/example/README.md @@ -0,0 +1,55 @@ +# Examples + +Init your Appwrite client: + +```dart + Client client = Client(); + + client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production + ; + +``` + +Create a new user and session: + +```dart +Account account = Account(client); + +Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name'); + +Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); + +``` + +Fetch user profile: + +```dart +Account account = Account(client); + +Response profile = await account.get(); +``` + +Upload File: + +```dart +Storage storage = Storage(client); + +MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg'); + +storage.createFile( + file: file, + read: ['*'], + write: [] +) +.then((response) { + print(response); // File uploaded! +}) +.catchError((error) { + print(error.response); +}); +``` + +All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/appwrite.dart b/app/sdks/0.6.2/client-flutter/lib/appwrite.dart new file mode 100644 index 0000000000..95d0b72cfe --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/appwrite.dart @@ -0,0 +1,10 @@ +export 'package:dio/dio.dart' show Response; + +export 'client.dart'; +export 'enums.dart'; +export 'services/account.dart'; +export 'services/avatars.dart'; +export 'services/database.dart'; +export 'services/locale.dart'; +export 'services/storage.dart'; +export 'services/teams.dart'; diff --git a/app/sdks/0.6.2/client-flutter/lib/client.dart b/app/sdks/0.6.2/client-flutter/lib/client.dart new file mode 100644 index 0000000000..96fbf60780 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/client.dart @@ -0,0 +1,144 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; +import 'package:dio/adapter.dart'; +import 'package:dio_cookie_manager/dio_cookie_manager.dart'; +import 'package:cookie_jar/cookie_jar.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:package_info/package_info.dart'; + +import 'enums.dart'; + +class Client { + String endPoint; + String type = 'unknown'; + Map headers; + Map config; + bool selfSigned; + bool initialized = false; + Dio http; + PersistCookieJar cookieJar; + + Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() { + // Platform is not supported in web so if web, set type to web automatically and skip Platform check + if(kIsWeb) { + type = 'web'; + }else{ + type = (Platform.isIOS) ? 'ios' : type; + type = (Platform.isMacOS) ? 'macos' : type; + type = (Platform.isAndroid) ? 'android' : type; + type = (Platform.isLinux) ? 'linux' : type; + type = (Platform.isWindows) ? 'windows' : type; + type = (Platform.isFuchsia) ? 'fuchsia' : type; + } + + this.headers = { + 'content-type': 'application/json', + 'x-sdk-version': 'appwrite:flutter:0.3.0-dev.2', + }; + + this.config = {}; + + assert(endPoint.startsWith(RegExp("http://|https://")), "endPoint $endPoint must start with 'http'"); + } + + Future _getCookiePath() async { + final directory = await getApplicationDocumentsDirectory(); + final path = directory.path; + final Directory dir = new Directory('$path/cookies'); + await dir.create(); + return dir; + } + + /// Your project ID + Client setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + + Client setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + + Client setSelfSigned({bool status = true}) { + selfSigned = status; + return this; + } + + Client setEndpoint(String endPoint) { + this.endPoint = endPoint; + this.http.options.baseUrl = this.endPoint; + return this; + } + + Client addHeader(String key, String value) { + headers[key] = value; + + return this; + } + + Future init() async { + if(!initialized) { + // if web skip cookie implementation and origin header as those are automatically handled by browsers + if(!kIsWeb) { + final Directory cookieDir = await _getCookiePath(); + cookieJar = new PersistCookieJar(dir:cookieDir.path); + this.http.interceptors.add(CookieManager(cookieJar)); + if(Platform.isAndroid || Platform.isIOS) { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); + } else if(Platform.isLinux) { + addHeader('Origin', 'appwrite-linux://'); + } else if(Platform.isMacOS) { + addHeader('Origin', 'appwrite-macos://'); + } else if(Platform.isWindows) { + addHeader('Origin', 'appwrite-windows://'); + } else if(Platform.isFuchsia) { + addHeader('Origin', 'appwrite-fuchsia://'); + } + }else{ + // if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work + this.http.options.extra['withCredentials'] = true; + } + + this.http.options.baseUrl = this.endPoint; + this.http.options.validateStatus = (status) => status < 400; + } + } + + Future call(HttpMethod method, {String path = '', Map headers = const {}, Map params = const {}}) async { + if(selfSigned && !kIsWeb) { + // Allow self signed requests + (http.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (HttpClient client) { + client.badCertificateCallback = (X509Certificate cert, String host, int port) => true; + return client; + }; + } + + await this.init(); + + // Origin is hardcoded for testing + Options options = Options( + headers: {...this.headers, ...headers}, + method: method.name(), + ); + + if(headers['content-type'] == 'multipart/form-data') { + return http.request(path, data: FormData.fromMap(params), options: options); + } + + if (method == HttpMethod.get) { + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + return http.get(path, queryParameters: params, options: options); + } else { + return http.request(path, data: params, options: options); + } + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/enums.dart b/app/sdks/0.6.2/client-flutter/lib/enums.dart new file mode 100644 index 0000000000..2757f6073e --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/enums.dart @@ -0,0 +1,15 @@ +enum HttpMethod { get, post, put, delete, patch } + +extension HttpMethodString on HttpMethod { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} + +enum OrderType { asc, desc } + +extension OrderTypeString on OrderType { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} diff --git a/app/sdks/0.6.2/client-flutter/lib/service.dart b/app/sdks/0.6.2/client-flutter/lib/service.dart new file mode 100644 index 0000000000..1ae319b705 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/service.dart @@ -0,0 +1,7 @@ +import 'client.dart'; + +class Service { + final Client client; + + const Service(this.client); +} diff --git a/app/sdks/0.6.2/client-flutter/lib/services/account.dart b/app/sdks/0.6.2/client-flutter/lib/services/account.dart new file mode 100644 index 0000000000..890303a9d6 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/services/account.dart @@ -0,0 +1,435 @@ + +import 'dart:io'; +import 'package:universal_html/html.dart' as html; + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_web_auth/flutter_web_auth.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Account extends Service { + Account(Client client): super(client); + + /// Get Account + /// + /// Get currently logged in user data as JSON object. + /// + Future get() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account + /// + /// Use this endpoint to allow a new user to register a new account in your + /// project. After the user registration completes successfully, you can use + /// the [/account/verfication](/docs/client/account#createVerification) route + /// to start verifying the user email address. To allow your new user to login + /// to his new account, you need to create a new [account + /// session](/docs/client/account#createSession). + /// + Future create({@required String email, @required String password, String name = ''}) { + final String path = '/account'; + + final Map params = { + 'email': email, + 'password': password, + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Account + /// + /// Delete a currently logged in user account. Behind the scene, the user + /// record is not deleted but permanently blocked from any access. This is done + /// to avoid deleted accounts being overtaken by new users with the same email + /// address. Any user-related resources like documents or storage files should + /// be deleted separately. + /// + Future delete() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Account Email + /// + /// Update currently logged in user account email address. After changing user + /// address, user confirmation status is being reset and a new confirmation + /// mail is sent. For security measures, user password is required to complete + /// this request. + /// + Future updateEmail({@required String email, @required String password}) { + final String path = '/account/email'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Logs + /// + /// Get currently logged in user list of latest security activity logs. Each + /// log returns user IP address, location and date and time of log. + /// + Future getLogs() { + final String path = '/account/logs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Name + /// + /// Update currently logged in user account name. + /// + Future updateName({@required String name}) { + final String path = '/account/name'; + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Update Account Password + /// + /// Update currently logged in user password. For validation, user is required + /// to pass the password twice. + /// + Future updatePassword({@required String password, @required String oldPassword}) { + final String path = '/account/password'; + + final Map params = { + 'password': password, + 'oldPassword': oldPassword, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Preferences + /// + /// Get currently logged in user preferences as a key-value object. + /// + Future getPrefs() { + final String path = '/account/prefs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Preferences + /// + /// Update currently logged in user account preferences. You can pass only the + /// specific settings you wish to update. + /// + Future updatePrefs({@required dynamic prefs}) { + final String path = '/account/prefs'; + + final Map params = { + 'prefs': prefs, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Create Password Recovery + /// + /// Sends the user an email with a temporary secret key for password reset. + /// When the user clicks the confirmation link he is redirected back to your + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + /// endpoint to complete the process. + /// + Future createRecovery({@required String email, @required String url}) { + final String path = '/account/recovery'; + + final Map params = { + 'email': email, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Password Recovery + /// + /// Use this endpoint to complete the user account password reset. Both the + /// **userId** and **secret** arguments will be passed as query parameters to + /// the redirect URL you have provided when sending your request to the [POST + /// /account/recovery](/docs/client/account#createRecovery) endpoint. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + Future updateRecovery({@required String userId, @required String secret, @required String password, @required String passwordAgain}) { + final String path = '/account/recovery'; + + final Map params = { + 'userId': userId, + 'secret': secret, + 'password': password, + 'passwordAgain': passwordAgain, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Get Account Sessions + /// + /// Get currently logged in user list of active sessions across different + /// devices. + /// + Future getSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account Session + /// + /// Allow the user to login into his account by providing a valid email and + /// password combination. This route will create a new session for the user. + /// + Future createSession({@required String email, @required String password}) { + final String path = '/account/sessions'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete All Account Sessions + /// + /// Delete all sessions from the user account and remove any sessions cookies + /// from the end client. + /// + Future deleteSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Account Session with OAuth2 + /// + /// Allow the user to login to his account using the OAuth2 provider of his + /// choice. Each OAuth2 provider should be enabled from the Appwrite console + /// 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://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure', List scopes = const []}) { + final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider); + + final Map params = { + 'success': success, + 'failure': failure, + 'scopes': scopes, + 'project': client.config['project'], + }; + + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } + else { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + query: query.join('&') + ); + + if(kIsWeb) { + html.window.location.href = url.toString(); + return null; + }else{ + + return FlutterWebAuth.authenticate( + url: url.toString(), + callbackUrlScheme: "appwrite-callback-" + client.config['project'] + ).then((value) async { + Uri url = Uri.parse(value); + Cookie cookie = new Cookie(url.queryParameters['key'], url.queryParameters['secret']); + cookie.domain = Uri.parse(client.endPoint).host; + cookie.httpOnly = true; + cookie.path = '/'; + List cookies = [cookie]; + await client.init(); + client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies); + }); + } + + } + + /// Delete Account Session + /// + /// Use this endpoint to log out the currently logged in user from all his + /// account sessions across all his different devices. When using the option id + /// argument, only the session unique ID provider will be deleted. + /// + Future deleteSession({@required String sessionId}) { + final String path = '/account/sessions/{sessionId}'.replaceAll(RegExp('{sessionId}'), sessionId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Email Verification + /// + /// Use this endpoint to send a verification message to your user email address + /// to confirm they are the valid owners of that address. Both the **userId** + /// and **secret** arguments will be passed as query parameters to the URL you + /// have provided to be attached to the verification email. The provided URL + /// should redirect the user back to your app and allow you to complete the + /// verification process by verifying both the **userId** and **secret** + /// parameters. Learn more about how to [complete the verification + /// process](/docs/client/account#updateAccountVerification). + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + /// + Future createVerification({@required String url}) { + final String path = '/account/verification'; + + final Map params = { + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Email Verification + /// + /// Use this endpoint to complete the user email verification process. Use both + /// the **userId** and **secret** parameters that were attached to your app URL + /// to verify the user email ownership. If confirmed this route will return a + /// 200 status code. + /// + Future updateVerification({@required String userId, @required String secret}) { + final String path = '/account/verification'; + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/services/avatars.dart b/app/sdks/0.6.2/client-flutter/lib/services/avatars.dart new file mode 100644 index 0000000000..b7fa6393ef --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/services/avatars.dart @@ -0,0 +1,238 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Avatars extends Service { + Avatars(Client client): super(client); + + /// Get Browser Icon + /// + /// You can use this endpoint to show different browser icons to your users. + /// The code argument receives the browser code as it appears in your user + /// /account/sessions endpoint. Use width, height and quality arguments to + /// change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Credit Card Icon + /// + /// Need to display your users with your billing method or their payment + /// methods? The credit card endpoint will return you the icon of the credit + /// card provider you need. Use width, height and quality arguments to change + /// the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Favicon + /// + /// Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + /// website URL. + /// + String getFavicon({@required String url}) { + final String path = '/avatars/favicon'; + + final Map params = { + 'url': url, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Country Flag + /// + /// You can use this endpoint to show different country flags icons to your + /// users. The code argument receives the 2 letter country code. Use width, + /// height and quality arguments to change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Image from URL + /// + /// Use this endpoint to fetch a remote image URL and crop it to any image size + /// you want. This endpoint is very useful if you need to crop and display + /// remote images in your app or in case you want to make sure a 3rd party + /// image is properly served using a TLS protocol. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get User Initials + /// + /// Use this endpoint to show your user initials avatar icon on your website or + /// app. By default, this route will try to print your logged-in user name or + /// email initials. You can also overwrite the user name if you pass the 'name' + /// parameter. If no name is given and no user is logged, an empty avatar will + /// be returned. + /// + /// You can use the color and background params to change the avatar colors. By + /// default, a random theme will be selected. The random theme will persist for + /// the user's initials when reloading the same theme will always return for + /// the same initials. + /// + String getInitials({String name = '', int width = 500, int height = 500, String color = '', String background = ''}) { + final String path = '/avatars/initials'; + + final Map params = { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get QR Code + /// + /// 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. + /// + String getQR({@required String text, int size = 400, int margin = 1, bool download = false}) { + final String path = '/avatars/qr'; + + final Map params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/services/database.dart b/app/sdks/0.6.2/client-flutter/lib/services/database.dart new file mode 100644 index 0000000000..0fec1fb4d6 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/services/database.dart @@ -0,0 +1,119 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Database extends Service { + Database(Client client): super(client); + + /// List Documents + /// + /// Get a list of all the user documents. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project documents. [Learn more about different API + /// modes](/docs/admin). + /// + Future listDocuments({@required String collectionId, List filters = const [], int offset = 0, int limit = 50, String orderField = '\$id', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = ''}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'filters': filters, + 'offset': offset, + 'limit': limit, + 'orderField': orderField, + 'orderType': orderType.name(), + 'orderCast': orderCast, + 'search': search, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Document + /// + /// Create a new Document. Before using this route, you should create a new + /// collection resource using either a [server + /// integration](/docs/server/database?sdk=nodejs#createCollection) API or + /// directly from your database console. + /// + Future createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Document + /// + /// Get document by its unique ID. This endpoint response returns a JSON object + /// with the document data. + /// + Future getDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Document + Future updateDocument({@required String collectionId, @required String documentId, @required dynamic data, @required List read, @required List write}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Delete Document + /// + /// Delete document by its unique ID. This endpoint deletes only the parent + /// documents, his attributes and relations to other documents. Child documents + /// **will not** be deleted. + /// + Future deleteDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/services/locale.dart b/app/sdks/0.6.2/client-flutter/lib/services/locale.dart new file mode 100644 index 0000000000..095af4792c --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/services/locale.dart @@ -0,0 +1,143 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Locale extends Service { + Locale(Client client): super(client); + + /// Get User Locale + /// + /// Get the current user location based on IP. Returns an object with user + /// country code, country name, continent name, continent code, ip address and + /// suggested currency. You can use the locale header to get the data in a + /// supported language. + /// + /// ([IP Geolocation by DB-IP](https://db-ip.com)) + /// + Future get() { + final String path = '/locale'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Continents + /// + /// List of all continents. You can use the locale header to get the data in a + /// supported language. + /// + Future getContinents() { + final String path = '/locale/continents'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries + /// + /// List of all countries. You can use the locale header to get the data in a + /// supported language. + /// + Future getCountries() { + final String path = '/locale/countries'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List EU Countries + /// + /// List of all countries that are currently members of the EU. You can use the + /// locale header to get the data in a supported language. + /// + Future getCountriesEU() { + final String path = '/locale/countries/eu'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries Phone Codes + /// + /// List of all countries phone codes. You can use the locale header to get the + /// data in a supported language. + /// + Future getCountriesPhones() { + final String path = '/locale/countries/phones'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Currencies + /// + /// List of all currencies, including currency symbol, name, plural, and + /// decimal digits for all major and minor currencies. You can use the locale + /// header to get the data in a supported language. + /// + Future getCurrencies() { + final String path = '/locale/currencies'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Languages + /// + /// List of all languages classified by ISO 639-1 including 2-letter code, name + /// in English, and name in the respective language. + /// + Future getLanguages() { + final String path = '/locale/languages'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/services/storage.dart b/app/sdks/0.6.2/client-flutter/lib/services/storage.dart new file mode 100644 index 0000000000..51f9345050 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/services/storage.dart @@ -0,0 +1,203 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Storage extends Service { + Storage(Client client): super(client); + + /// List Files + /// + /// Get a list of all the user files. You can use the query params to filter + /// your results. On admin mode, this endpoint will return a list of all of the + /// project files. [Learn more about different API modes](/docs/admin). + /// + Future listFiles({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/storage/files'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create File + /// + /// Create a new file. The user who creates the file will automatically be + /// assigned to read and write access unless he has passed custom values for + /// read and write arguments. + /// + Future createFile({@required MultipartFile file, @required List read, @required List write}) { + final String path = '/storage/files'; + + final Map params = { + 'file': file, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'multipart/form-data', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get File + /// + /// Get file by its unique ID. This endpoint response returns a JSON object + /// with the file metadata. + /// + Future getFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update File + /// + /// Update file by its unique ID. Only users with write permissions have access + /// to update this resource. + /// + Future updateFile({@required String fileId, @required List read, @required List write}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete File + /// + /// Delete a file by its unique ID. Only users with write permissions have + /// access to delete this resource. + /// + Future deleteFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get File for Download + /// + /// Get file content by its unique ID. The endpoint response return with a + /// 'Content-Disposition: attachment' header that tells the browser to start + /// downloading the file to user downloads directory. + /// + String getFileDownload({@required String fileId}) { + final String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File Preview + /// + /// Get a file preview image. Currently, this method supports preview for image + /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + /// and spreadsheets, will return the file icon image. You can also pass query + /// string arguments for cutting and resizing your preview image. + /// + String getFilePreview({@required String fileId, int width = 0, int height = 0, int quality = 100, String background = '', String output = ''}) { + final String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File for View + /// + /// Get file content by its unique ID. This endpoint is similar to the download + /// method but returns with no 'Content-Disposition: attachment' header. + /// + String getFileView({@required String fileId, String as = ''}) { + final String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'as': as, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/lib/services/teams.dart b/app/sdks/0.6.2/client-flutter/lib/services/teams.dart new file mode 100644 index 0000000000..b9205da455 --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/lib/services/teams.dart @@ -0,0 +1,207 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Teams extends Service { + Teams(Client client): super(client); + + /// List Teams + /// + /// Get a list of all the current user teams. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project teams. [Learn more about different API modes](/docs/admin). + /// + Future list({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team + /// + /// Create a new team. The user who creates the team will automatically be + /// assigned as the owner of the team. The team owner can invite new members, + /// who will be able add new owners and update or delete the team from your + /// project. + /// + Future create({@required String name, List roles = const ["owner"]}) { + final String path = '/teams'; + + final Map params = { + 'name': name, + 'roles': roles, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Team + /// + /// Get team by its unique ID. All team members have read access for this + /// resource. + /// + Future get({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Team + /// + /// Update team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future update({@required String teamId, @required String name}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete Team + /// + /// Delete team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future delete({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get Team Memberships + /// + /// Get team members by the team unique ID. All team members have read access + /// for this list of resources. + /// + Future getMemberships({@required String teamId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team Membership + /// + /// Use this endpoint to invite a new member to join your team. An email with a + /// link to join the team will be sent to the new member email address if the + /// member doesn't exist in the project it will be created automatically. + /// + /// Use the 'URL' parameter to redirect the user from the invitation email back + /// to your app. When the user is redirected, use the [Update Team Membership + /// Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + /// user to accept the invitation to the team. + /// + /// Please note that in order to avoid a [Redirect + /// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URL's are the once from domains you have set when + /// added your platforms in the console interface. + /// + Future createMembership({@required String teamId, @required String email, @required List roles, @required String url, String name = ''}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Team Membership + /// + /// This endpoint allows a user to leave a team or for a team owner to delete + /// the membership of any other team member. You can also use this endpoint to + /// delete a user membership even if he didn't accept it. + /// + Future deleteMembership({@required String teamId, @required String inviteId}) { + final String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Team Membership Status + /// + /// Use this endpoint to allow a user to accept an invitation to join a team + /// after he is being redirected back to your app from the invitation email he + /// was sent. + /// + Future updateMembershipStatus({@required String teamId, @required String inviteId, @required String userId, @required String secret}) { + final String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-flutter/pubspec.yaml b/app/sdks/0.6.2/client-flutter/pubspec.yaml new file mode 100644 index 0000000000..cabc271c5e --- /dev/null +++ b/app/sdks/0.6.2/client-flutter/pubspec.yaml @@ -0,0 +1,24 @@ +name: appwrite +version: 0.3.0-dev.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-flutter +issue_tracker: https://github.com/appwrite/sdk-generator/issues +documentation: https://appwrite.io/support +environment: + sdk: '>=2.6.0 <3.0.0' +dependencies: + meta: ^1.1.8 + path_provider: ^1.6.14 + package_info: ^0.4.3 + dio: ^3.0.10 + cookie_jar: ^1.0.1 + dio_cookie_manager: ^1.0.0 + flutter_web_auth: ^0.2.4 + universal_html: ^1.2.3 + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/CHANGELOG.md b/app/sdks/0.6.2/client-web/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/client-web/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/LICENSE b/app/sdks/0.6.2/client-web/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/client-web/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/README.md b/app/sdks/0.6.2/client-web/README.md new file mode 100644 index 0000000000..c2e3689cd9 --- /dev/null +++ b/app/sdks/0.6.2/client-web/README.md @@ -0,0 +1,59 @@ +# Appwrite Web SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +### NPM + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install appwrite --save +``` + +If you're using a bundler (like [Browserify](http://browserify.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it: + +```js +import * as Appwrite from "appwrite"; +``` + +### CDN + +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 Web SDK +var appwrite = new Appwrite(); + +appwrite + .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution + .setProject('455x34dfkj') // Your Appwrite Project UID +; + +``` + + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/create-o-auth2session.md b/app/sdks/0.6.2/client-web/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..25b02e632e --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,10 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +// Go to OAuth provider login page +sdk.account.createOAuth2Session('amazon'); + diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/create-recovery.md b/app/sdks/0.6.2/client-web/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..72130f4de4 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.createRecovery('email@example.com', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/create-session.md b/app/sdks/0.6.2/client-web/docs/examples/account/create-session.md new file mode 100644 index 0000000000..4a7682c13d --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/create-session.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.createSession('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/create-verification.md b/app/sdks/0.6.2/client-web/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..7903384a9f --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/create-verification.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.createVerification('https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/create.md b/app/sdks/0.6.2/client-web/docs/examples/account/create.md new file mode 100644 index 0000000000..c9ce798b6a --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/create.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/delete-session.md b/app/sdks/0.6.2/client-web/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..581e5d132d --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/delete-session.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.deleteSession('[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/delete-sessions.md b/app/sdks/0.6.2/client-web/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..d037673eb3 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/delete-sessions.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.deleteSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/delete.md b/app/sdks/0.6.2/client-web/docs/examples/account/delete.md new file mode 100644 index 0000000000..d952d77d7a --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/delete.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.delete(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/get-logs.md b/app/sdks/0.6.2/client-web/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..c53e0446e9 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/get-logs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.getLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/get-prefs.md b/app/sdks/0.6.2/client-web/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..75835e37fb --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/get-prefs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.getPrefs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/get-sessions.md b/app/sdks/0.6.2/client-web/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..b4434de336 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/get-sessions.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.getSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/get.md b/app/sdks/0.6.2/client-web/docs/examples/account/get.md new file mode 100644 index 0000000000..f0184a8513 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/update-email.md b/app/sdks/0.6.2/client-web/docs/examples/account/update-email.md new file mode 100644 index 0000000000..f48fed78bc --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/update-email.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateEmail('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/update-name.md b/app/sdks/0.6.2/client-web/docs/examples/account/update-name.md new file mode 100644 index 0000000000..e03e72c4b2 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/update-name.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateName('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/update-password.md b/app/sdks/0.6.2/client-web/docs/examples/account/update-password.md new file mode 100644 index 0000000000..22539f3f64 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/update-password.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updatePassword('password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/update-prefs.md b/app/sdks/0.6.2/client-web/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..b2d4ff175e --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/update-prefs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updatePrefs({}); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/update-recovery.md b/app/sdks/0.6.2/client-web/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..33cf1b63c9 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/account/update-verification.md b/app/sdks/0.6.2/client-web/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..a80e125e30 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/account/update-verification.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateVerification('[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..0855209f58 --- /dev/null +++ b/app/sdks/0.6.2/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 \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..1aa595bd65 --- /dev/null +++ b/app/sdks/0.6.2/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 \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..a945e50bb2 --- /dev/null +++ b/app/sdks/0.6.2/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 \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..222b388afc --- /dev/null +++ b/app/sdks/0.6.2/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 \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..3f15981c71 --- /dev/null +++ b/app/sdks/0.6.2/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 \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..ef04988e2d --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-initials.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.getInitials(); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/client-web/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..9d9ee3fea2 --- /dev/null +++ b/app/sdks/0.6.2/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 \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/database/create-document.md b/app/sdks/0.6.2/client-web/docs/examples/database/create-document.md new file mode 100644 index 0000000000..e04f73f73e --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/database/create-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/database/delete-document.md b/app/sdks/0.6.2/client-web/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..79799b6907 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/database/delete-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/database/get-document.md b/app/sdks/0.6.2/client-web/docs/examples/database/get-document.md new file mode 100644 index 0000000000..b9605dccc6 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/database/get-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/database/list-documents.md b/app/sdks/0.6.2/client-web/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..14f8a423a1 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/database/list-documents.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/database/update-document.md b/app/sdks/0.6.2/client-web/docs/examples/database/update-document.md new file mode 100644 index 0000000000..9104b77a71 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/database/update-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..1dfdf8013b --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get-continents.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getContinents(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..6b3f210a1e --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..f35e2152e4 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..53b96375a1 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get-countries.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCountries(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..57db66401f --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get-currencies.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..04e3063ee7 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get-languages.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getLanguages(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/locale/get.md b/app/sdks/0.6.2/client-web/docs/examples/locale/get.md new file mode 100644 index 0000000000..469a046dbc --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/locale/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/create-file.md b/app/sdks/0.6.2/client-web/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..b23c47027a --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/create-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/client-web/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..c38ab4ba9c --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..1323b8b8df --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-download.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.storage.getFileDownload('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..5ede9fdb93 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-preview.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.storage.getFilePreview('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..53877ae352 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file-view.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.storage.getFileView('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/get-file.md b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..a1f94c08a6 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/get-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/list-files.md b/app/sdks/0.6.2/client-web/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..c489a0b46d --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/list-files.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.listFiles(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/storage/update-file.md b/app/sdks/0.6.2/client-web/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..2a2f579b3b --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/storage/update-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/client-web/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..78b2d7fa77 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/create-membership.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/create.md b/app/sdks/0.6.2/client-web/docs/examples/teams/create.md new file mode 100644 index 0000000000..43205ba888 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/create.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/client-web/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..1b85ef08da --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/delete.md b/app/sdks/0.6.2/client-web/docs/examples/teams/delete.md new file mode 100644 index 0000000000..4665ad5773 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/delete.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/client-web/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..6235ce33f4 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/get-memberships.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/get.md b/app/sdks/0.6.2/client-web/docs/examples/teams/get.md new file mode 100644 index 0000000000..f4b0f040b1 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/list.md b/app/sdks/0.6.2/client-web/docs/examples/teams/list.md new file mode 100644 index 0000000000..c4229e2400 --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/list.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/update-membership-status.md b/app/sdks/0.6.2/client-web/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..e8b3de0a0b --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/update-membership-status.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.updateMembershipStatus('[TEAM_ID]', '[INVITE_ID]', '[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/docs/examples/teams/update.md b/app/sdks/0.6.2/client-web/docs/examples/teams/update.md new file mode 100644 index 0000000000..bbab80937d --- /dev/null +++ b/app/sdks/0.6.2/client-web/docs/examples/teams/update.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/package.json b/app/sdks/0.6.2/client-web/package.json new file mode 100644 index 0000000000..26dd06fb94 --- /dev/null +++ b/app/sdks/0.6.2/client-web/package.json @@ -0,0 +1,17 @@ +{ + "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.1.0", + "license": "BSD-3-Clause", + "main": "src/sdk.js", + "types": "types/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-js" + }, + "devDependencies": { + "typescript": "^3.6.4" + }, + "dependencies": {} +} \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/src/sdk.js b/app/sdks/0.6.2/client-web/src/sdk.js new file mode 100644 index 0000000000..96b29b2845 --- /dev/null +++ b/app/sdks/0.6.2/client-web/src/sdk.js @@ -0,0 +1,2386 @@ +(function (window) { + + 'use strict'; + + window.Appwrite = function () { + + let config = { + endpoint: 'https://appwrite.io/v1', + project: '', + locale: '', + }; + + /** + * @param {string} endpoint + * @returns {this} + */ + let setEndpoint = function(endpoint) { + config.endpoint = endpoint; + + return this; + }; + + /** + * Set Project + * + * Your project ID + * + * @param value string + * + * @return this + */ + let setProject = function (value) + { + http.addGlobalHeader('X-Appwrite-Project', value); + + config.project = value; + + return this; + }; + + /** + * Set Locale + * + * @param value string + * + * @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; + }; + + /** + * @param {Object} params + * @returns {string} + */ + let buildQuery = function(params) { + let str = []; + + for (let p in params) { + if(Array.isArray(params[p])) { + for (let index = 0; index < params[p].length; index++) { + let param = params[p][index]; + str.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(params[p])); + } + } + + return str.join("&"); + }; + + let addGlobalHeader = function(key, value) { + globalHeaders[key] = {key: key.toLowerCase(), value: value.toLowerCase()}; + }; + + let addGlobalParam = function(key, value) { + globalParams.push({key: key, value: value}); + }; + + addGlobalHeader('x-sdk-version', 'appwrite:web:1.1.0'); + addGlobalHeader('content-type', ''); + + /** + * @param {string} method + * @param {string} path string + * @param {Object} headers + * @param {Object} params + * @param {function} progress + * @returns {Promise} + */ + let call = function (method, path, headers = {}, params = {}, progress = null) { + let i; + + path = config.endpoint + path; + + if (-1 === ['GET', 'POST', 'PUT', 'DELETE', 'TRACE', 'HEAD', 'OPTIONS', 'CONNECT', 'PATCH'].indexOf(method)) { + throw new Error('var method must contain a valid HTTP method name'); + } + + if (typeof path !== 'string') { + throw new Error('var path must be of type string'); + } + + if (typeof headers !== 'object') { + throw new Error('var headers must be of type object'); + } + + for (i = 0; i < globalParams.length; i++) { // Add global params to URL + path = addParam(path, globalParams[i].key, globalParams[i].value); + } + + if(window.localStorage && window.localStorage.getItem('cookieFallback')) { + headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback'); + } + + for (let key in globalHeaders) { // Add Global Headers + if (globalHeaders.hasOwnProperty(key)) { + if (!headers[globalHeaders[key].key]) { + headers[globalHeaders[key].key] = globalHeaders[key].value; + } + } + } + + if(method === 'GET') { + for (let param in params) { + if (param.hasOwnProperty(key)) { + path = addParam(path, key + (Array.isArray(param) ? '[]' : ''), params[key]); + } + } + } + + switch (headers['content-type']) { // Parse request by content type + case 'application/json': + params = JSON.stringify(params); + break; + + case 'multipart/form-data': + let formData = new FormData(); + + Object.keys(params).forEach(function(key) { + let param = params[key]; + formData.append(key + (Array.isArray(param) ? '[]' : ''), param); + }); + + params = formData; + break; + } + + return new Promise(function (resolve, reject) { + + let request = new XMLHttpRequest(), key; + + request.withCredentials = true; + request.open(method, path, true); + + for (key in headers) { // Set Headers + if (headers.hasOwnProperty(key)) { + if (key === 'content-type' && headers[key] === 'multipart/form-data') { // Skip to avoid missing boundary + continue; + } + + request.setRequestHeader(key, headers[key]); + } + } + + request.onload = function () { + let data = request.response; + let contentType = this.getResponseHeader('content-type') || ''; + contentType = contentType.substring(0, contentType.indexOf(';')); + + switch (contentType) { + case 'application/json': + data = JSON.parse(data); + break; + } + + let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || ''; + + if(window.localStorage && cookieFallback) { + window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); + window.localStorage.setItem('cookieFallback', cookieFallback); + } + + if (4 === request.readyState && 399 >= request.status) { + resolve(data); + } else { + reject(data); + } + }; + + if (progress) { + request.addEventListener('progress', progress); + request.upload.addEventListener('progress', progress, false); + } + + // Handle network errors + request.onerror = function () { + reject(new Error("Network Error")); + }; + + request.send(params); + }) + }; + + return { + 'get': function(path, headers = {}, params = {}) { + return call('GET', path + ((Object.keys(params).length > 0) ? '?' + buildQuery(params) : ''), headers, {}); + }, + 'post': function(path, headers = {}, params = {}, progress = null) { + return call('POST', path, headers, params, progress); + }, + 'put': function(path, headers = {}, params = {}, progress = null) { + return call('PUT', path, headers, params, progress); + }, + 'patch': function(path, headers = {}, params = {}, progress = null) { + return call('PATCH', path, headers, params, progress); + }, + 'delete': function(path, headers = {}, params = {}, progress = null) { + return call('DELETE', path, headers, params, progress); + }, + 'addGlobalParam': addGlobalParam, + 'addGlobalHeader': addGlobalHeader + } + }(window.document); + + let account = { + + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/account'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete: function() { + let path = '/account'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/email'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs: function() { + let path = '/account/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName: function(name) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/account/name'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword: function(password, oldPassword) { + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(oldPassword === undefined) { + throw new Error('Missing required parameter: "oldPassword"'); + } + + let path = '/account/password'; + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + if(oldPassword) { + payload['oldPassword'] = oldPassword; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs: function() { + let path = '/account/prefs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(prefs) { + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/account/prefs'; + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery: function(email, url) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery: function(userId, secret, password, passwordAgain) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(passwordAgain === undefined) { + throw new Error('Missing required parameter: "passwordAgain"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + if(password) { + payload['password'] = password; + } + + if(passwordAgain) { + payload['passwordAgain'] = passwordAgain; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session + * + * Allow the user to login into his account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/sessions'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to his account using the OAuth2 provider of his + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) { + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}', 'g'), provider); + + let payload = {}; + + if(success) { + payload['success'] = success; + } + + if(failure) { + payload['failure'] = failure; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + window.location = config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all his + * account sessions across all his different devices. When using the option id + * argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(sessionId) { + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}', 'g'), sessionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateAccountVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification: function(userId, secret) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let avatars = { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/avatars/favicon'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials: function(name = '', width = 500, height = 500, color = '', background = '') { + let path = '/avatars/initials'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(color) { + payload['color'] = color; + } + + if(background) { + payload['background'] = background; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR: function(text, size = 400, margin = 1, download = false) { + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let database = { + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} offset + * @param {number} limit + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments: function(collectionId, filters = [], offset = 0, limit = 50, orderField = '$id', orderType = 'ASC', orderCast = 'string', search = '') { + 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; + } + + if(orderField) { + payload['orderField'] = orderField; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + if(orderCast) { + payload['orderCast'] = orderCast; + } + + if(search) { + payload['search'] = search; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument: function(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(parentDocument) { + payload['parentDocument'] = parentDocument; + } + + if(parentProperty) { + payload['parentProperty'] = parentProperty; + } + + if(parentPropertyType) { + payload['parentPropertyType'] = parentPropertyType; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument: function(collectionId, documentId, data, read, write) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let locale = { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/locale'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents: function() { + let path = '/locale/continents'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries: function() { + let path = '/locale/countries'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU: function() { + let path = '/locale/countries/eu'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones: function() { + let path = '/locale/countries/phones'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies: function() { + let path = '/locale/currencies'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages: function() { + let path = '/locale/languages'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let storage = { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile: function(file, read, write) { + if(file === undefined) { + throw new Error('Missing required parameter: "file"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files'; + + let payload = {}; + + if(file) { + payload['file'] = file; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + }, + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile: function(fileId, read, write) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + if(background) { + payload['background'] = background; + } + + if(output) { + payload['output'] = output; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView: function(fileId, as = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(as) { + payload['as'] = as; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let teams = { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create: function(name, roles = ["owner"]) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update: function(teamId, name) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships: function(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership: function(teamId, email, roles, url, name = '') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(roles === undefined) { + throw new Error('Missing required parameter: "roles"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership: function(teamId, inviteId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after he is being redirected back to your app from the invitation email he + * was sent. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus: function(teamId, inviteId, userId, secret) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + return { + setEndpoint: setEndpoint, + setProject: setProject, + setLocale: setLocale, + account: account, + avatars: avatars, + database: database, + locale: locale, + storage: storage, + teams: teams + }; + }; + + if(typeof module !== "undefined") { + module.exports = window.Appwrite; + } + +})((typeof window !== "undefined") ? window : {}); \ No newline at end of file diff --git a/app/sdks/0.6.2/client-web/src/sdk.min.js b/app/sdks/0.6.2/client-web/src/sdk.min.js new file mode 100644 index 0000000000..a01ec37c8e --- /dev/null +++ b/app/sdks/0.6.2/client-web/src/sdk.min.js @@ -0,0 +1,187 @@ +(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;index=request.status){resolve(data)}else{reject(data)}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)} +request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +if(name){payload.name=name} +return http.post(path,{'content-type':'application/json',},payload)},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/email';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.patch(path,{'content-type':'application/json',},payload)},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"')} +let path='/account/name';let payload={};if(name){payload.name=name} +return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} +let path='/account/password';let payload={};if(password){payload.password=password} +if(oldPassword){payload.oldPassword=oldPassword} +return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} +let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} +return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(url===undefined){throw new Error('Missing required parameter: "url"')} +let path='/account/recovery';let payload={};if(email){payload.email=email} +if(url){payload.url=url} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +if(secret===undefined){throw new Error('Missing required parameter: "secret"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')} +let path='/account/recovery';let payload={};if(userId){payload.userId=userId} +if(secret){payload.secret=secret} +if(password){payload.password=password} +if(passwordAgain){payload.passwordAgain=passwordAgain} +return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/sessions';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} +if(failure){payload.failure=failure} +if(scopes){payload.scopes=scopes} +payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index; + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create(email: string, password: string, name?: string): Promise; + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete(): Promise; + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail(email: string, password: string): Promise; + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs(): Promise; + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName(name: string): Promise; + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword(password: string, oldPassword: string): Promise; + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs(): Promise; + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs(prefs: object): Promise; + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery(email: string, url: string): Promise; + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise; + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions(): Promise; + + /** + * Create Account Session + * + * Allow the user to login into his account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession(email: string, password: string): Promise; + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions(): Promise; + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to his account using the OAuth2 provider of his + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): Promise; + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all his + * account sessions across all his different devices. When using the option id + * argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession(sessionId: string): Promise; + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateAccountVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification(url: string): Promise; + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification(userId: string, secret: string): Promise; + + } + + export interface Avatars { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getCreditCard(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon(url: string): string; + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getFlag(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + getImage(url: string, width?: number, height?: number): string; + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials(name?: string, width?: number, height?: number, color?: string, background?: string): string; + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR(text: string, size?: number, margin?: number, download?: boolean): string; + + } + + export interface Database { + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} offset + * @param {number} limit + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments(collectionId: string, filters?: string[], offset?: number, limit?: number, orderField?: string, orderType?: string, orderCast?: string, search?: string): Promise; + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument(collectionId: string, data: object, read: string[], write: string[], parentDocument?: string, parentProperty?: string, parentPropertyType?: string): Promise; + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument(collectionId: string, documentId: string): Promise; + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument(collectionId: string, documentId: string, data: object, read: string[], write: string[]): Promise; + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument(collectionId: string, documentId: string): Promise; + + } + + export interface Locale { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents(): Promise; + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries(): Promise; + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU(): Promise; + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones(): Promise; + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies(): Promise; + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages(): Promise; + + } + + export interface Storage { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile(file: File, read: string[], write: string[]): Promise; + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile(fileId: string): Promise; + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile(fileId: string, read: string[], write: string[]): Promise; + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile(fileId: string): Promise; + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload(fileId: string): string; + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview(fileId: string, width?: number, height?: number, quality?: number, background?: string, output?: string): string; + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView(fileId: string, as?: string): string; + + } + + export interface Teams { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create(name: string, roles?: string[]): Promise; + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get(teamId: string): Promise; + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update(teamId: string, name: string): Promise; + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete(teamId: string): Promise; + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships(teamId: string, search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership(teamId: string, email: string, roles: string[], url: string, name?: string): Promise; + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership(teamId: string, inviteId: string): Promise; + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after he is being redirected back to your app from the invitation email he + * was sent. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus(teamId: string, inviteId: string, userId: string, secret: string): Promise; + + } + + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/CHANGELOG.md b/app/sdks/0.6.2/console-web/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/console-web/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/LICENSE b/app/sdks/0.6.2/console-web/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/console-web/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/README.md b/app/sdks/0.6.2/console-web/README.md new file mode 100644 index 0000000000..a74d6ec924 --- /dev/null +++ b/app/sdks/0.6.2/console-web/README.md @@ -0,0 +1,59 @@ +# Appwrite Console SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +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 Console 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) + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +### NPM + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install appwrite --save +``` + +If you're using a bundler (like [Browserify](http://browserify.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it: + +```js +import * as Appwrite from "appwrite"; +``` + +### CDN + +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 Web SDK +var appwrite = new Appwrite(); + +appwrite + .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution + .setProject('455x34dfkj') // Your Appwrite Project UID +; + +``` + + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/create-o-auth2session.md b/app/sdks/0.6.2/console-web/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..3a2dcba651 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +// Go to OAuth provider login page +sdk.account.createOAuth2Session('amazon'); + diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/create-recovery.md b/app/sdks/0.6.2/console-web/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..d69269b351 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/create-recovery.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.createRecovery('email@example.com', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/create-session.md b/app/sdks/0.6.2/console-web/docs/examples/account/create-session.md new file mode 100644 index 0000000000..0734a84aaa --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/create-session.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.createSession('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/create-verification.md b/app/sdks/0.6.2/console-web/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..1211b5c642 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/create-verification.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.createVerification('https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/create.md b/app/sdks/0.6.2/console-web/docs/examples/account/create.md new file mode 100644 index 0000000000..e61b1fbac4 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/delete-session.md b/app/sdks/0.6.2/console-web/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..84505281f0 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/delete-session.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.deleteSession('[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/delete-sessions.md b/app/sdks/0.6.2/console-web/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..61bec86399 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/delete-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.deleteSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/delete.md b/app/sdks/0.6.2/console-web/docs/examples/account/delete.md new file mode 100644 index 0000000000..dbb8dbf250 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.delete(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/get-logs.md b/app/sdks/0.6.2/console-web/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..12e6656c96 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/get-logs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.getLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/get-prefs.md b/app/sdks/0.6.2/console-web/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..e328baba32 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/get-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.getPrefs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/get-sessions.md b/app/sdks/0.6.2/console-web/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..cb281dd4db --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/get-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.getSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/get.md b/app/sdks/0.6.2/console-web/docs/examples/account/get.md new file mode 100644 index 0000000000..82c96fb9db --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/update-email.md b/app/sdks/0.6.2/console-web/docs/examples/account/update-email.md new file mode 100644 index 0000000000..c2caaf060e --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/update-email.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateEmail('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/update-name.md b/app/sdks/0.6.2/console-web/docs/examples/account/update-name.md new file mode 100644 index 0000000000..047eba688b --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/update-name.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateName('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/update-password.md b/app/sdks/0.6.2/console-web/docs/examples/account/update-password.md new file mode 100644 index 0000000000..d305031fa0 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/update-password.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updatePassword('password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/update-prefs.md b/app/sdks/0.6.2/console-web/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..8c4e402ae1 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/update-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updatePrefs({}); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/update-recovery.md b/app/sdks/0.6.2/console-web/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..235a4db481 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/update-recovery.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/account/update-verification.md b/app/sdks/0.6.2/console-web/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..ef2c384853 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/account/update-verification.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateVerification('[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..bbbdb9738f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-browser.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getBrowser('aa'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..e1fab01cf2 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getCreditCard('amex'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..397986b11a --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-favicon.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getFavicon('https://example.com'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..6e90b72feb --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-flag.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getFlag('af'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..afd1a17cb5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-image.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getImage('https://example.com'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..dab6417ca5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-initials.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getInitials(); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..31f490cedd --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/avatars/get-q-r.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getQR('[TEXT]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/bar/delete.md b/app/sdks/0.6.2/console-web/docs/examples/bar/delete.md new file mode 100644 index 0000000000..c60d7a75f0 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/bar/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.bar.delete('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/bar/get.md b/app/sdks/0.6.2/console-web/docs/examples/bar/get.md new file mode 100644 index 0000000000..a690ffc039 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/bar/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.bar.get('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/bar/patch.md b/app/sdks/0.6.2/console-web/docs/examples/bar/patch.md new file mode 100644 index 0000000000..46ac2d7438 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/bar/patch.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.bar.patch('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/bar/post.md b/app/sdks/0.6.2/console-web/docs/examples/bar/post.md new file mode 100644 index 0000000000..4b21090c3f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/bar/post.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.bar.post('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/bar/put.md b/app/sdks/0.6.2/console-web/docs/examples/bar/put.md new file mode 100644 index 0000000000..8eac3ebad8 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/bar/put.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.bar.put('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/create-collection.md b/app/sdks/0.6.2/console-web/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..a7a4b90197 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/create-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.createCollection('[NAME]', [], [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/create-document.md b/app/sdks/0.6.2/console-web/docs/examples/database/create-document.md new file mode 100644 index 0000000000..64809c6156 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/create-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/delete-collection.md b/app/sdks/0.6.2/console-web/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..bfb0706bf5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/delete-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.deleteCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/delete-document.md b/app/sdks/0.6.2/console-web/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..356a71a437 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/delete-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/get-collection.md b/app/sdks/0.6.2/console-web/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..d74d4b3225 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/get-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.getCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/get-document.md b/app/sdks/0.6.2/console-web/docs/examples/database/get-document.md new file mode 100644 index 0000000000..51638880c5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/get-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/list-collections.md b/app/sdks/0.6.2/console-web/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..8a18249748 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/list-collections.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.listCollections(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/list-documents.md b/app/sdks/0.6.2/console-web/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..1d895a566a --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/list-documents.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/update-collection.md b/app/sdks/0.6.2/console-web/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..f00a6c6f8c --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/update-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/database/update-document.md b/app/sdks/0.6.2/console-web/docs/examples/database/update-document.md new file mode 100644 index 0000000000..52c172ab6a --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/database/update-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/foo/delete.md b/app/sdks/0.6.2/console-web/docs/examples/foo/delete.md new file mode 100644 index 0000000000..715289a5b8 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/foo/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.foo.delete('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/foo/get.md b/app/sdks/0.6.2/console-web/docs/examples/foo/get.md new file mode 100644 index 0000000000..cb3ee31c9d --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/foo/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.foo.get('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/foo/patch.md b/app/sdks/0.6.2/console-web/docs/examples/foo/patch.md new file mode 100644 index 0000000000..e39222e71d --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/foo/patch.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.foo.patch('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/foo/post.md b/app/sdks/0.6.2/console-web/docs/examples/foo/post.md new file mode 100644 index 0000000000..4c236776f6 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/foo/post.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.foo.post('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/foo/put.md b/app/sdks/0.6.2/console-web/docs/examples/foo/put.md new file mode 100644 index 0000000000..d13c4c44ff --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/foo/put.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.foo.put('[]', null, []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/general/empty.md b/app/sdks/0.6.2/console-web/docs/examples/general/empty.md new file mode 100644 index 0000000000..50fd0e8a5c --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/general/empty.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.general.empty(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/general/get-cookie.md b/app/sdks/0.6.2/console-web/docs/examples/general/get-cookie.md new file mode 100644 index 0000000000..5785a0323f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/general/get-cookie.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.general.getCookie(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/general/redirect.md b/app/sdks/0.6.2/console-web/docs/examples/general/redirect.md new file mode 100644 index 0000000000..769533f6f6 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/general/redirect.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.general.redirect(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/general/redirected.md b/app/sdks/0.6.2/console-web/docs/examples/general/redirected.md new file mode 100644 index 0000000000..712e614ac9 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/general/redirected.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.general.redirected(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/general/set-cookie.md b/app/sdks/0.6.2/console-web/docs/examples/general/set-cookie.md new file mode 100644 index 0000000000..ee0f85cc1f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/general/set-cookie.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.general.setCookie(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/general/upload.md b/app/sdks/0.6.2/console-web/docs/examples/general/upload.md new file mode 100644 index 0000000000..bbc2bee92a --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/general/upload.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.general.upload('[]', null, [], document.getElementById('uploader').files[0]); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-anti-virus.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..95b671992b --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-anti-virus.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getAntiVirus(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-cache.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..5c41d81868 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-cache.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getCache(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-d-b.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..407f87e2a1 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-d-b.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getDB(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-certificates.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..a115c869ba --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-functions.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..3c0dc33acf --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueFunctions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-logs.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..b3d41b49c6 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-tasks.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..4f34f670a6 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-usage.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..3d234be2de --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..c5825dcf6c --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-storage-local.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..7287745704 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-storage-local.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get-time.md b/app/sdks/0.6.2/console-web/docs/examples/health/get-time.md new file mode 100644 index 0000000000..b6087b73d5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get-time.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getTime(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/health/get.md b/app/sdks/0.6.2/console-web/docs/examples/health/get.md new file mode 100644 index 0000000000..1e7d6fe4e8 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/health/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..93144335ea --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get-continents.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getContinents(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..fffc8696e8 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..751f4f6cc4 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..30b1dd95c7 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get-countries.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCountries(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..4c92714062 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get-currencies.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..2d1f713eeb --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get-languages.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getLanguages(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/locale/get.md b/app/sdks/0.6.2/console-web/docs/examples/locale/get.md new file mode 100644 index 0000000000..1fba9877b5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/locale/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/create-domain.md b/app/sdks/0.6.2/console-web/docs/examples/projects/create-domain.md new file mode 100644 index 0000000000..756b869a85 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/create-domain.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createDomain('[PROJECT_ID]', ''); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/create-key.md b/app/sdks/0.6.2/console-web/docs/examples/projects/create-key.md new file mode 100644 index 0000000000..9556f5b7f7 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/create-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createKey('[PROJECT_ID]', '[NAME]', []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/create-platform.md b/app/sdks/0.6.2/console-web/docs/examples/projects/create-platform.md new file mode 100644 index 0000000000..f4476fe599 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/create-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createPlatform('[PROJECT_ID]', 'web', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/create-task.md b/app/sdks/0.6.2/console-web/docs/examples/projects/create-task.md new file mode 100644 index 0000000000..9b0f3c1e03 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/create-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', false, 'GET', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/create-webhook.md b/app/sdks/0.6.2/console-web/docs/examples/projects/create-webhook.md new file mode 100644 index 0000000000..971319f212 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/create-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', false); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/create.md b/app/sdks/0.6.2/console-web/docs/examples/projects/create.md new file mode 100644 index 0000000000..8041ed154e --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.create('[NAME]', '[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/delete-domain.md b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-domain.md new file mode 100644 index 0000000000..1b3df9363b --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-domain.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteDomain('[PROJECT_ID]', '[DOMAIN_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/delete-key.md b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-key.md new file mode 100644 index 0000000000..dc855bcc30 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteKey('[PROJECT_ID]', '[KEY_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/delete-platform.md b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-platform.md new file mode 100644 index 0000000000..2a180c47e4 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deletePlatform('[PROJECT_ID]', '[PLATFORM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/delete-task.md b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-task.md new file mode 100644 index 0000000000..b7f9ad3e47 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteTask('[PROJECT_ID]', '[TASK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/delete-webhook.md b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-webhook.md new file mode 100644 index 0000000000..c5e0588ad1 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/delete-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteWebhook('[PROJECT_ID]', '[WEBHOOK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/delete.md b/app/sdks/0.6.2/console-web/docs/examples/projects/delete.md new file mode 100644 index 0000000000..20b67370f0 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.delete('[PROJECT_ID]', '[PASSWORD]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get-domain.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get-domain.md new file mode 100644 index 0000000000..1622546719 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get-domain.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getDomain('[PROJECT_ID]', '[DOMAIN_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get-key.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get-key.md new file mode 100644 index 0000000000..8bb458c335 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getKey('[PROJECT_ID]', '[KEY_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get-platform.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get-platform.md new file mode 100644 index 0000000000..bfeb49393b --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getPlatform('[PROJECT_ID]', '[PLATFORM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get-task.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get-task.md new file mode 100644 index 0000000000..c405299d74 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getTask('[PROJECT_ID]', '[TASK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get-usage.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get-usage.md new file mode 100644 index 0000000000..e024a2966c --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get-usage.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getUsage('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get-webhook.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get-webhook.md new file mode 100644 index 0000000000..2629d4424d --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getWebhook('[PROJECT_ID]', '[WEBHOOK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/get.md b/app/sdks/0.6.2/console-web/docs/examples/projects/get.md new file mode 100644 index 0000000000..bcfb35186b --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.get('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/list-domains.md b/app/sdks/0.6.2/console-web/docs/examples/projects/list-domains.md new file mode 100644 index 0000000000..5ddfec49b5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/list-domains.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listDomains('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/list-keys.md b/app/sdks/0.6.2/console-web/docs/examples/projects/list-keys.md new file mode 100644 index 0000000000..497ddf9bac --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/list-keys.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listKeys('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/list-platforms.md b/app/sdks/0.6.2/console-web/docs/examples/projects/list-platforms.md new file mode 100644 index 0000000000..4fd2d311f3 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/list-platforms.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listPlatforms('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/list-tasks.md b/app/sdks/0.6.2/console-web/docs/examples/projects/list-tasks.md new file mode 100644 index 0000000000..d42efc2b80 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/list-tasks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listTasks('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/list-webhooks.md b/app/sdks/0.6.2/console-web/docs/examples/projects/list-webhooks.md new file mode 100644 index 0000000000..6c45849399 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/list-webhooks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listWebhooks('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/list.md b/app/sdks/0.6.2/console-web/docs/examples/projects/list.md new file mode 100644 index 0000000000..428fc4545f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update-domain-verification.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update-domain-verification.md new file mode 100644 index 0000000000..ea53295bcf --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update-domain-verification.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateDomainVerification('[PROJECT_ID]', '[DOMAIN_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update-key.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update-key.md new file mode 100644 index 0000000000..f19b593c9f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateKey('[PROJECT_ID]', '[KEY_ID]', '[NAME]', []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update-o-auth2.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update-o-auth2.md new file mode 100644 index 0000000000..479c5e9d30 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update-o-auth2.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateOAuth2('[PROJECT_ID]', 'amazon'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update-platform.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update-platform.md new file mode 100644 index 0000000000..0e22080ed0 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updatePlatform('[PROJECT_ID]', '[PLATFORM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update-task.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update-task.md new file mode 100644 index 0000000000..38744a36bd --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', false, 'GET', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update-webhook.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update-webhook.md new file mode 100644 index 0000000000..1e8c6f4a0f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], '[URL]', false); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/projects/update.md b/app/sdks/0.6.2/console-web/docs/examples/projects/update.md new file mode 100644 index 0000000000..9d06850534 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/projects/update.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.update('[PROJECT_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/create-file.md b/app/sdks/0.6.2/console-web/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..673777e380 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/create-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/console-web/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..7278b682ae --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..0a4677fe80 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-download.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.storage.getFileDownload('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..a44cb6479c --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-preview.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.storage.getFilePreview('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..adfb6320c3 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file-view.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.storage.getFileView('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/get-file.md b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..9691be3056 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/get-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/list-files.md b/app/sdks/0.6.2/console-web/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..5c2560d06d --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/list-files.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.listFiles(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/storage/update-file.md b/app/sdks/0.6.2/console-web/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..c053d60470 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/storage/update-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/console-web/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..534577ead3 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/create-membership.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/create.md b/app/sdks/0.6.2/console-web/docs/examples/teams/create.md new file mode 100644 index 0000000000..6f7232b9c5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/console-web/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..fa1efe401b --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/delete.md b/app/sdks/0.6.2/console-web/docs/examples/teams/delete.md new file mode 100644 index 0000000000..cacad26c02 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/console-web/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..e1b959d1eb --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/get-memberships.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/get.md b/app/sdks/0.6.2/console-web/docs/examples/teams/get.md new file mode 100644 index 0000000000..a8496ad76d --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/list.md b/app/sdks/0.6.2/console-web/docs/examples/teams/list.md new file mode 100644 index 0000000000..b94d6c32ff --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/update-membership-status.md b/app/sdks/0.6.2/console-web/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..4931f02689 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/update-membership-status.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.updateMembershipStatus('[TEAM_ID]', '[INVITE_ID]', '[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/teams/update.md b/app/sdks/0.6.2/console-web/docs/examples/teams/update.md new file mode 100644 index 0000000000..5b73121518 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/teams/update.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/create.md b/app/sdks/0.6.2/console-web/docs/examples/users/create.md new file mode 100644 index 0000000000..9adc060ff5 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/delete-session.md b/app/sdks/0.6.2/console-web/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..96a9b5c94f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/delete-session.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/delete-sessions.md b/app/sdks/0.6.2/console-web/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..56092ab5fc --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/get-logs.md b/app/sdks/0.6.2/console-web/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..c349383ec1 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/get-logs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.getLogs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/get-prefs.md b/app/sdks/0.6.2/console-web/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..7d8a3cd33f --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.getPrefs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/get-sessions.md b/app/sdks/0.6.2/console-web/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..1b7535855e --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/get-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.getSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/get.md b/app/sdks/0.6.2/console-web/docs/examples/users/get.md new file mode 100644 index 0000000000..751798de39 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/list.md b/app/sdks/0.6.2/console-web/docs/examples/users/list.md new file mode 100644 index 0000000000..bbc4895412 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/update-prefs.md b/app/sdks/0.6.2/console-web/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..877aa309a1 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.updatePrefs('[USER_ID]', {}); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/docs/examples/users/update-status.md b/app/sdks/0.6.2/console-web/docs/examples/users/update-status.md new file mode 100644 index 0000000000..6c432ff4c6 --- /dev/null +++ b/app/sdks/0.6.2/console-web/docs/examples/users/update-status.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/package.json b/app/sdks/0.6.2/console-web/package.json new file mode 100644 index 0000000000..6c53a70307 --- /dev/null +++ b/app/sdks/0.6.2/console-web/package.json @@ -0,0 +1,17 @@ +{ + "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.0", + "license": "BSD-3-Clause", + "main": "src/sdk.js", + "types": "types/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-console" + }, + "devDependencies": { + "typescript": "^3.6.4" + }, + "dependencies": {} +} \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/src/sdk.js b/app/sdks/0.6.2/console-web/src/sdk.js new file mode 100644 index 0000000000..387d3a4121 --- /dev/null +++ b/app/sdks/0.6.2/console-web/src/sdk.js @@ -0,0 +1,5088 @@ +(function (window) { + + 'use strict'; + + window.Appwrite = function () { + + let config = { + endpoint: 'https://appwrite.io/v1', + project: '', + key: '', + locale: '', + mode: '', + }; + + /** + * @param {string} endpoint + * @returns {this} + */ + let setEndpoint = function(endpoint) { + config.endpoint = endpoint; + + return this; + }; + + /** + * Set Project + * + * Your project ID + * + * @param value string + * + * @return this + */ + let setProject = function (value) + { + http.addGlobalHeader('X-Appwrite-Project', value); + + config.project = value; + + return this; + }; + + /** + * Set Key + * + * Your secret API key + * + * @param value string + * + * @return this + */ + let setKey = function (value) + { + http.addGlobalHeader('X-Appwrite-Key', value); + + config.key = value; + + return this; + }; + + /** + * Set Locale + * + * @param value string + * + * @return this + */ + let setLocale = function (value) + { + http.addGlobalHeader('X-Appwrite-Locale', value); + + config.locale = value; + + return this; + }; + + /** + * Set Mode + * + * @param value string + * + * @return this + */ + let setMode = function (value) + { + http.addGlobalHeader('X-Appwrite-Mode', value); + + config.mode = 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; + }; + + /** + * @param {Object} params + * @returns {string} + */ + let buildQuery = function(params) { + let str = []; + + for (let p in params) { + if(Array.isArray(params[p])) { + for (let index = 0; index < params[p].length; index++) { + let param = params[p][index]; + str.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(params[p])); + } + } + + return str.join("&"); + }; + + let addGlobalHeader = function(key, value) { + globalHeaders[key] = {key: key.toLowerCase(), value: value.toLowerCase()}; + }; + + let addGlobalParam = function(key, value) { + globalParams.push({key: key, value: value}); + }; + + addGlobalHeader('x-sdk-version', 'appwrite:web:1.0.0'); + addGlobalHeader('content-type', ''); + + /** + * @param {string} method + * @param {string} path string + * @param {Object} headers + * @param {Object} params + * @param {function} progress + * @returns {Promise} + */ + let call = function (method, path, headers = {}, params = {}, progress = null) { + let i; + + path = config.endpoint + path; + + if (-1 === ['GET', 'POST', 'PUT', 'DELETE', 'TRACE', 'HEAD', 'OPTIONS', 'CONNECT', 'PATCH'].indexOf(method)) { + throw new Error('var method must contain a valid HTTP method name'); + } + + if (typeof path !== 'string') { + throw new Error('var path must be of type string'); + } + + if (typeof headers !== 'object') { + throw new Error('var headers must be of type object'); + } + + for (i = 0; i < globalParams.length; i++) { // Add global params to URL + path = addParam(path, globalParams[i].key, globalParams[i].value); + } + + if(window.localStorage && window.localStorage.getItem('cookieFallback')) { + headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback'); + } + + for (let key in globalHeaders) { // Add Global Headers + if (globalHeaders.hasOwnProperty(key)) { + if (!headers[globalHeaders[key].key]) { + headers[globalHeaders[key].key] = globalHeaders[key].value; + } + } + } + + if(method === 'GET') { + for (let param in params) { + if (param.hasOwnProperty(key)) { + path = addParam(path, key + (Array.isArray(param) ? '[]' : ''), params[key]); + } + } + } + + switch (headers['content-type']) { // Parse request by content type + case 'application/json': + params = JSON.stringify(params); + break; + + case 'multipart/form-data': + let formData = new FormData(); + + Object.keys(params).forEach(function(key) { + let param = params[key]; + formData.append(key + (Array.isArray(param) ? '[]' : ''), param); + }); + + params = formData; + break; + } + + return new Promise(function (resolve, reject) { + + let request = new XMLHttpRequest(), key; + + request.withCredentials = true; + request.open(method, path, true); + + for (key in headers) { // Set Headers + if (headers.hasOwnProperty(key)) { + if (key === 'content-type' && headers[key] === 'multipart/form-data') { // Skip to avoid missing boundary + continue; + } + + request.setRequestHeader(key, headers[key]); + } + } + + request.onload = function () { + let data = request.response; + let contentType = this.getResponseHeader('content-type') || ''; + contentType = contentType.substring(0, contentType.indexOf(';')); + + switch (contentType) { + case 'application/json': + data = JSON.parse(data); + break; + } + + let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || ''; + + if(window.localStorage && cookieFallback) { + window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); + window.localStorage.setItem('cookieFallback', cookieFallback); + } + + if (4 === request.readyState && 399 >= request.status) { + resolve(data); + } else { + reject(data); + } + }; + + if (progress) { + request.addEventListener('progress', progress); + request.upload.addEventListener('progress', progress, false); + } + + // Handle network errors + request.onerror = function () { + reject(new Error("Network Error")); + }; + + request.send(params); + }) + }; + + return { + 'get': function(path, headers = {}, params = {}) { + return call('GET', path + ((Object.keys(params).length > 0) ? '?' + buildQuery(params) : ''), headers, {}); + }, + 'post': function(path, headers = {}, params = {}, progress = null) { + return call('POST', path, headers, params, progress); + }, + 'put': function(path, headers = {}, params = {}, progress = null) { + return call('PUT', path, headers, params, progress); + }, + 'patch': function(path, headers = {}, params = {}, progress = null) { + return call('PATCH', path, headers, params, progress); + }, + 'delete': function(path, headers = {}, params = {}, progress = null) { + return call('DELETE', path, headers, params, progress); + }, + 'addGlobalParam': addGlobalParam, + 'addGlobalHeader': addGlobalHeader + } + }(window.document); + + let account = { + + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/account'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete: function() { + let path = '/account'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/email'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs: function() { + let path = '/account/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName: function(name) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/account/name'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword: function(password, oldPassword) { + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(oldPassword === undefined) { + throw new Error('Missing required parameter: "oldPassword"'); + } + + let path = '/account/password'; + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + if(oldPassword) { + payload['oldPassword'] = oldPassword; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs: function() { + let path = '/account/prefs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(prefs) { + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/account/prefs'; + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery: function(email, url) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery: function(userId, secret, password, passwordAgain) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(passwordAgain === undefined) { + throw new Error('Missing required parameter: "passwordAgain"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + if(password) { + payload['password'] = password; + } + + if(passwordAgain) { + payload['passwordAgain'] = passwordAgain; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session + * + * Allow the user to login into his account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/sessions'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to his account using the OAuth2 provider of his + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session: function(provider, success = '/auth/oauth2/success', failure = '/auth/oauth2/failure', scopes = []) { + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}', 'g'), provider); + + let payload = {}; + + if(success) { + payload['success'] = success; + } + + if(failure) { + payload['failure'] = failure; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + window.location = config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all his + * account sessions across all his different devices. When using the option id + * argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(sessionId) { + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}', 'g'), sessionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateAccountVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification: function(userId, secret) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let avatars = { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/avatars/favicon'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials: function(name = '', width = 500, height = 500, color = '', background = '') { + let path = '/avatars/initials'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(color) { + payload['color'] = color; + } + + if(background) { + payload['background'] = background; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR: function(text, size = 400, margin = 1, download = false) { + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let database = { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listCollections: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/database/collections'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Collection + * + * Create a new Collection. + * + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + createCollection: function(name, read, write, rules) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + if(rules === undefined) { + throw new Error('Missing required parameter: "rules"'); + } + + let path = '/database/collections'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(rules) { + payload['rules'] = rules; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollection: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param {string} collectionId + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + updateCollection: function(collectionId, name, read, write, rules = []) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(rules) { + payload['rules'] = rules; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + deleteCollection: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} offset + * @param {number} limit + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments: function(collectionId, filters = [], offset = 0, limit = 50, orderField = '$id', orderType = 'ASC', orderCast = 'string', search = '') { + 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; + } + + if(orderField) { + payload['orderField'] = orderField; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + if(orderCast) { + payload['orderCast'] = orderCast; + } + + if(search) { + payload['search'] = search; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument: function(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(parentDocument) { + payload['parentDocument'] = parentDocument; + } + + if(parentProperty) { + payload['parentProperty'] = parentProperty; + } + + if(parentPropertyType) { + payload['parentPropertyType'] = parentPropertyType; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument: function(collectionId, documentId, data, read, write) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let health = { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/health'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getAntiVirus: function() { + let path = '/health/anti-virus'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {Error} + * @return {Promise} + */ + getCache: function() { + let path = '/health/cache'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getDB: function() { + let path = '/health/db'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueCertificates: function() { + let path = '/health/queue/certificates'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Functions Queue + * + * + * @throws {Error} + * @return {Promise} + */ + getQueueFunctions: function() { + let path = '/health/queue/functions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueLogs: function() { + let path = '/health/queue/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueTasks: function() { + let path = '/health/queue/tasks'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueUsage: function() { + let path = '/health/queue/usage'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueWebhooks: function() { + let path = '/health/queue/webhooks'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageLocal: function() { + let path = '/health/storage/local'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws {Error} + * @return {Promise} + */ + getTime: function() { + let path = '/health/time'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let locale = { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/locale'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents: function() { + let path = '/locale/continents'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries: function() { + let path = '/locale/countries'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU: function() { + let path = '/locale/countries/eu'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones: function() { + let path = '/locale/countries/phones'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies: function() { + let path = '/locale/currencies'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages: function() { + let path = '/locale/languages'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let bar = { + + /** + * Mock a get request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + get: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/bar'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a post request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + post: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/bar'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a put request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + put: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/bar'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a patch request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + patch: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/bar'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a delete request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + delete: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/bar'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let foo = { + + /** + * Mock a get request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + get: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/foo'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a post request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + post: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/foo'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a put request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + put: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/foo'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a patch request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + patch: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/foo'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a delete request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + delete: function(x, y, z) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + let path = '/mock/tests/foo'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let general = { + + /** + * Mock a post request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + empty: function() { + let path = '/mock/tests/general/empty'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a cookie request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + getCookie: function() { + let path = '/mock/tests/general/get-cookie'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a post request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + redirect: function() { + let path = '/mock/tests/general/redirect'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a post request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + redirected: function() { + let path = '/mock/tests/general/redirected'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a cookie request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + setCookie: function() { + let path = '/mock/tests/general/set-cookie'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Mock a post request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @param {File} file + * @throws {Error} + * @return {Promise} + */ + upload: function(x, y, z, file) { + if(x === undefined) { + throw new Error('Missing required parameter: "x"'); + } + + if(y === undefined) { + throw new Error('Missing required parameter: "y"'); + } + + if(z === undefined) { + throw new Error('Missing required parameter: "z"'); + } + + if(file === undefined) { + throw new Error('Missing required parameter: "file"'); + } + + let path = '/mock/tests/general/upload'; + + let payload = {}; + + if(x) { + payload['x'] = x; + } + + if(y) { + payload['y'] = y; + } + + if(z) { + payload['z'] = z; + } + + if(file) { + payload['file'] = file; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + } + }; + + let projects = { + + /** + * List Projects + * + * + * @throws {Error} + * @return {Promise} + */ + list: function() { + let path = '/projects'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Project + * + * + * @param {string} name + * @param {string} teamId + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + create: function(name, teamId, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/projects'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(teamId) { + payload['teamId'] = teamId; + } + + if(description) { + payload['description'] = description; + } + + if(logo) { + payload['logo'] = logo; + } + + if(url) { + payload['url'] = url; + } + + if(legalName) { + payload['legalName'] = legalName; + } + + if(legalCountry) { + payload['legalCountry'] = legalCountry; + } + + if(legalState) { + payload['legalState'] = legalState; + } + + if(legalCity) { + payload['legalCity'] = legalCity; + } + + if(legalAddress) { + payload['legalAddress'] = legalAddress; + } + + if(legalTaxId) { + payload['legalTaxId'] = legalTaxId; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + get: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Project + * + * + * @param {string} projectId + * @param {string} name + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + update: function(projectId, name, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(description) { + payload['description'] = description; + } + + if(logo) { + payload['logo'] = logo; + } + + if(url) { + payload['url'] = url; + } + + if(legalName) { + payload['legalName'] = legalName; + } + + if(legalCountry) { + payload['legalCountry'] = legalCountry; + } + + if(legalState) { + payload['legalState'] = legalState; + } + + if(legalCity) { + payload['legalCity'] = legalCity; + } + + if(legalAddress) { + payload['legalAddress'] = legalAddress; + } + + if(legalTaxId) { + payload['legalTaxId'] = legalTaxId; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Project + * + * + * @param {string} projectId + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + delete: function(projectId, password) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Domains + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listDomains: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/domains'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Domain + * + * + * @param {string} projectId + * @param {string} domain + * @throws {Error} + * @return {Promise} + */ + createDomain: function(projectId, domain) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domain === undefined) { + throw new Error('Missing required parameter: "domain"'); + } + + let path = '/projects/{projectId}/domains'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(domain) { + payload['domain'] = domain; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + getDomain: function(projectId, domainId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domainId === undefined) { + throw new Error('Missing required parameter: "domainId"'); + } + + let path = '/projects/{projectId}/domains/{domainId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{domainId}', 'g'), domainId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + deleteDomain: function(projectId, domainId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domainId === undefined) { + throw new Error('Missing required parameter: "domainId"'); + } + + let path = '/projects/{projectId}/domains/{domainId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{domainId}', 'g'), domainId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Domain Verification Status + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + updateDomainVerification: function(projectId, domainId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domainId === undefined) { + throw new Error('Missing required parameter: "domainId"'); + } + + let path = '/projects/{projectId}/domains/{domainId}/verification'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{domainId}', 'g'), domainId); + + let payload = {}; + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Keys + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listKeys: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Key + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createKey: function(projectId, name, scopes) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(scopes === undefined) { + throw new Error('Missing required parameter: "scopes"'); + } + + let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + getKey: function(projectId, keyId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Key + * + * + * @param {string} projectId + * @param {string} keyId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + updateKey: function(projectId, keyId, name, scopes) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(scopes === undefined) { + throw new Error('Missing required parameter: "scopes"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + deleteKey: function(projectId, keyId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Project OAuth2 + * + * + * @param {string} projectId + * @param {string} provider + * @param {string} appId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateOAuth2: function(projectId, provider, appId = '', secret = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/projects/{projectId}/oauth2'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(provider) { + payload['provider'] = provider; + } + + if(appId) { + payload['appId'] = appId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Platforms + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listPlatforms: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Platform + * + * + * @param {string} projectId + * @param {string} type + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + createPlatform: function(projectId, type, name, key = '', store = '', hostname = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(type === undefined) { + throw new Error('Missing required parameter: "type"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(type) { + payload['type'] = type; + } + + if(name) { + payload['name'] = name; + } + + if(key) { + payload['key'] = key; + } + + if(store) { + payload['store'] = store; + } + + if(hostname) { + payload['hostname'] = hostname; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + getPlatform: function(projectId, platformId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + updatePlatform: function(projectId, platformId, name, key = '', store = '', hostname = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(key) { + payload['key'] = key; + } + + if(store) { + payload['store'] = store; + } + + if(hostname) { + payload['hostname'] = hostname; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + deletePlatform: function(projectId, platformId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Tasks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listTasks: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Task + * + * + * @param {string} projectId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createTask: function(projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + if(schedule === undefined) { + throw new Error('Missing required parameter: "schedule"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + if(httpMethod === undefined) { + throw new Error('Missing required parameter: "httpMethod"'); + } + + if(httpUrl === undefined) { + throw new Error('Missing required parameter: "httpUrl"'); + } + + let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(status) { + payload['status'] = status; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(security) { + payload['security'] = security; + } + + if(httpMethod) { + payload['httpMethod'] = httpMethod; + } + + if(httpUrl) { + payload['httpUrl'] = httpUrl; + } + + if(httpHeaders) { + payload['httpHeaders'] = httpHeaders; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + getTask: function(projectId, taskId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Task + * + * + * @param {string} projectId + * @param {string} taskId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateTask: function(projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + if(schedule === undefined) { + throw new Error('Missing required parameter: "schedule"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + if(httpMethod === undefined) { + throw new Error('Missing required parameter: "httpMethod"'); + } + + if(httpUrl === undefined) { + throw new Error('Missing required parameter: "httpUrl"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(status) { + payload['status'] = status; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(security) { + payload['security'] = security; + } + + if(httpMethod) { + payload['httpMethod'] = httpMethod; + } + + if(httpUrl) { + payload['httpUrl'] = httpUrl; + } + + if(httpHeaders) { + payload['httpHeaders'] = httpHeaders; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + deleteTask: function(projectId, taskId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Project + * + * + * @param {string} projectId + * @param {string} range + * @throws {Error} + * @return {Promise} + */ + getUsage: function(projectId, range = 'last30') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/usage'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(range) { + payload['range'] = range; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Webhooks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listWebhooks: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Webhook + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createWebhook: function(projectId, name, events, url, security, httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(events === undefined) { + throw new Error('Missing required parameter: "events"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(events) { + payload['events'] = events; + } + + if(url) { + payload['url'] = url; + } + + if(security) { + payload['security'] = security; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + getWebhook: function(projectId, webhookId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateWebhook: function(projectId, webhookId, name, events, url, security, httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(events === undefined) { + throw new Error('Missing required parameter: "events"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(events) { + payload['events'] = events; + } + + if(url) { + payload['url'] = url; + } + + if(security) { + payload['security'] = security; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + deleteWebhook: function(projectId, webhookId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let storage = { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile: function(file, read, write) { + if(file === undefined) { + throw new Error('Missing required parameter: "file"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files'; + + let payload = {}; + + if(file) { + payload['file'] = file; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + }, + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile: function(fileId, read, write) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + if(background) { + payload['background'] = background; + } + + if(output) { + payload['output'] = output; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView: function(fileId, as = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(as) { + payload['as'] = as; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let teams = { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create: function(name, roles = ["owner"]) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update: function(teamId, name) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships: function(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership: function(teamId, email, roles, url, name = '') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(roles === undefined) { + throw new Error('Missing required parameter: "roles"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership: function(teamId, inviteId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after he is being redirected back to your app from the invitation email he + * was sent. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus: function(teamId, inviteId, userId, secret) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let users = { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/users'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create User + * + * Create a new user. + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/users'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User + * + * Get user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + get: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getLogs: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getPrefs: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param {string} userId + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(userId, prefs) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getSessions: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param {string} userId + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(userId, sessionId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param {string} userId + * @param {string} status + * @throws {Error} + * @return {Promise} + */ + updateStatus: function(userId, status) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(status) { + payload['status'] = status; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + return { + setEndpoint: setEndpoint, + setProject: setProject, + setKey: setKey, + setLocale: setLocale, + setMode: setMode, + account: account, + avatars: avatars, + database: database, + health: health, + locale: locale, + bar: bar, + foo: foo, + general: general, + projects: projects, + storage: storage, + teams: teams, + users: users + }; + }; + + if(typeof module !== "undefined") { + module.exports = window.Appwrite; + } + +})((typeof window !== "undefined") ? window : {}); \ No newline at end of file diff --git a/app/sdks/0.6.2/console-web/src/sdk.min.js b/app/sdks/0.6.2/console-web/src/sdk.min.js new file mode 100644 index 0000000000..a801231ada --- /dev/null +++ b/app/sdks/0.6.2/console-web/src/sdk.min.js @@ -0,0 +1,447 @@ +(function(window){'use strict';window.Appwrite=function(){let config={endpoint:'https://appwrite.io/v1',project:'',key:'',locale:'',mode:'',};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 setKey=function(value){http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let setMode=function(value){http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=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;index=request.status){resolve(data)}else{reject(data)}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)} +request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +if(name){payload.name=name} +return http.post(path,{'content-type':'application/json',},payload)},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/email';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.patch(path,{'content-type':'application/json',},payload)},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"')} +let path='/account/name';let payload={};if(name){payload.name=name} +return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} +let path='/account/password';let payload={};if(password){payload.password=password} +if(oldPassword){payload.oldPassword=oldPassword} +return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} +let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} +return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(url===undefined){throw new Error('Missing required parameter: "url"')} +let path='/account/recovery';let payload={};if(email){payload.email=email} +if(url){payload.url=url} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +if(secret===undefined){throw new Error('Missing required parameter: "secret"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')} +let path='/account/recovery';let payload={};if(userId){payload.userId=userId} +if(secret){payload.secret=secret} +if(password){payload.password=password} +if(passwordAgain){payload.passwordAgain=passwordAgain} +return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/sessions';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='/auth/oauth2/success',failure='/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} +if(failure){payload.failure=failure} +if(scopes){payload.scopes=scopes} +payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index; + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow your new user to login + * to his new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create(email: string, password: string, name?: string): Promise; + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete(): Promise; + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail(email: string, password: string): Promise; + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs(): Promise; + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName(name: string): Promise; + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword(password: string, oldPassword: string): Promise; + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs(): Promise; + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs(prefs: object): Promise; + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery(email: string, url: string): Promise; + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise; + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions(): Promise; + + /** + * Create Account Session + * + * Allow the user to login into his account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession(email: string, password: string): Promise; + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions(): Promise; + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to his account using the OAuth2 provider of his + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): Promise; + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all his + * account sessions across all his different devices. When using the option id + * argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession(sessionId: string): Promise; + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateAccountVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification(url: string): Promise; + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification(userId: string, secret: string): Promise; + + } + + export interface Avatars { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getCreditCard(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon(url: string): string; + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getFlag(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + getImage(url: string, width?: number, height?: number): string; + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials(name?: string, width?: number, height?: number, color?: string, background?: string): string; + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR(text: string, size?: number, margin?: number, download?: boolean): string; + + } + + export interface Database { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listCollections(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Collection + * + * Create a new Collection. + * + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + createCollection(name: string, read: string[], write: string[], rules: string[]): Promise; + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollection(collectionId: string): Promise; + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param {string} collectionId + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + updateCollection(collectionId: string, name: string, read: string[], write: string[], rules?: string[]): Promise; + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + deleteCollection(collectionId: string): Promise; + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} offset + * @param {number} limit + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments(collectionId: string, filters?: string[], offset?: number, limit?: number, orderField?: string, orderType?: string, orderCast?: string, search?: string): Promise; + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument(collectionId: string, data: object, read: string[], write: string[], parentDocument?: string, parentProperty?: string, parentPropertyType?: string): Promise; + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument(collectionId: string, documentId: string): Promise; + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument(collectionId: string, documentId: string, data: object, read: string[], write: string[]): Promise; + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument(collectionId: string, documentId: string): Promise; + + } + + export interface Health { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getAntiVirus(): Promise; + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {Error} + * @return {Promise} + */ + getCache(): Promise; + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getDB(): Promise; + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueCertificates(): Promise; + + /** + * Get Functions Queue + * + * + * @throws {Error} + * @return {Promise} + */ + getQueueFunctions(): Promise; + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueLogs(): Promise; + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueTasks(): Promise; + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueUsage(): Promise; + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueWebhooks(): Promise; + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageLocal(): Promise; + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws {Error} + * @return {Promise} + */ + getTime(): Promise; + + } + + export interface Locale { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents(): Promise; + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries(): Promise; + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU(): Promise; + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones(): Promise; + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies(): Promise; + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages(): Promise; + + } + + export interface Bar { + + /** + * Mock a get request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + get(x: string, y: number, z: string[]): Promise; + + /** + * Mock a post request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + post(x: string, y: number, z: string[]): Promise; + + /** + * Mock a put request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + put(x: string, y: number, z: string[]): Promise; + + /** + * Mock a patch request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + patch(x: string, y: number, z: string[]): Promise; + + /** + * Mock a delete request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + delete(x: string, y: number, z: string[]): Promise; + + } + + export interface Foo { + + /** + * Mock a get request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + get(x: string, y: number, z: string[]): Promise; + + /** + * Mock a post request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + post(x: string, y: number, z: string[]): Promise; + + /** + * Mock a put request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + put(x: string, y: number, z: string[]): Promise; + + /** + * Mock a patch request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + patch(x: string, y: number, z: string[]): Promise; + + /** + * Mock a delete request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @throws {Error} + * @return {Promise} + */ + delete(x: string, y: number, z: string[]): Promise; + + } + + export interface General { + + /** + * Mock a post request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + empty(): Promise; + + /** + * Mock a cookie request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + getCookie(): Promise; + + /** + * Mock a post request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + redirect(): Promise; + + /** + * Mock a post request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + redirected(): Promise; + + /** + * Mock a cookie request for SDK tests + * + * + * @throws {Error} + * @return {Promise} + */ + setCookie(): Promise; + + /** + * Mock a post request for SDK tests + * + * + * @param {string} x + * @param {number} y + * @param {string[]} z + * @param {File} file + * @throws {Error} + * @return {Promise} + */ + upload(x: string, y: number, z: string[], file: File): Promise; + + } + + export interface Projects { + + /** + * List Projects + * + * + * @throws {Error} + * @return {Promise} + */ + list(): Promise; + + /** + * Create Project + * + * + * @param {string} name + * @param {string} teamId + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + create(name: string, teamId: string, description?: string, logo?: string, url?: string, legalName?: string, legalCountry?: string, legalState?: string, legalCity?: string, legalAddress?: string, legalTaxId?: string): Promise; + + /** + * Get Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + get(projectId: string): Promise; + + /** + * Update Project + * + * + * @param {string} projectId + * @param {string} name + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + update(projectId: string, name: string, description?: string, logo?: string, url?: string, legalName?: string, legalCountry?: string, legalState?: string, legalCity?: string, legalAddress?: string, legalTaxId?: string): Promise; + + /** + * Delete Project + * + * + * @param {string} projectId + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + delete(projectId: string, password: string): Promise; + + /** + * List Domains + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listDomains(projectId: string): Promise; + + /** + * Create Domain + * + * + * @param {string} projectId + * @param {string} domain + * @throws {Error} + * @return {Promise} + */ + createDomain(projectId: string, domain: string): Promise; + + /** + * Get Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + getDomain(projectId: string, domainId: string): Promise; + + /** + * Delete Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + deleteDomain(projectId: string, domainId: string): Promise; + + /** + * Update Domain Verification Status + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + updateDomainVerification(projectId: string, domainId: string): Promise; + + /** + * List Keys + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listKeys(projectId: string): Promise; + + /** + * Create Key + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createKey(projectId: string, name: string, scopes: string[]): Promise; + + /** + * Get Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + getKey(projectId: string, keyId: string): Promise; + + /** + * Update Key + * + * + * @param {string} projectId + * @param {string} keyId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + updateKey(projectId: string, keyId: string, name: string, scopes: string[]): Promise; + + /** + * Delete Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + deleteKey(projectId: string, keyId: string): Promise; + + /** + * Update Project OAuth2 + * + * + * @param {string} projectId + * @param {string} provider + * @param {string} appId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateOAuth2(projectId: string, provider: string, appId?: string, secret?: string): Promise; + + /** + * List Platforms + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listPlatforms(projectId: string): Promise; + + /** + * Create Platform + * + * + * @param {string} projectId + * @param {string} type + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + createPlatform(projectId: string, type: string, name: string, key?: string, store?: string, hostname?: string): Promise; + + /** + * Get Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + getPlatform(projectId: string, platformId: string): Promise; + + /** + * Update Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + updatePlatform(projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string): Promise; + + /** + * Delete Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + deletePlatform(projectId: string, platformId: string): Promise; + + /** + * List Tasks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listTasks(projectId: string): Promise; + + /** + * Create Task + * + * + * @param {string} projectId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createTask(projectId: string, name: string, status: string, schedule: string, security: boolean, httpMethod: string, httpUrl: string, httpHeaders?: string[], httpUser?: string, httpPass?: string): Promise; + + /** + * Get Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + getTask(projectId: string, taskId: string): Promise; + + /** + * Update Task + * + * + * @param {string} projectId + * @param {string} taskId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateTask(projectId: string, taskId: string, name: string, status: string, schedule: string, security: boolean, httpMethod: string, httpUrl: string, httpHeaders?: string[], httpUser?: string, httpPass?: string): Promise; + + /** + * Delete Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + deleteTask(projectId: string, taskId: string): Promise; + + /** + * Get Project + * + * + * @param {string} projectId + * @param {string} range + * @throws {Error} + * @return {Promise} + */ + getUsage(projectId: string, range?: string): Promise; + + /** + * List Webhooks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listWebhooks(projectId: string): Promise; + + /** + * Create Webhook + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createWebhook(projectId: string, name: string, events: string[], url: string, security: boolean, httpUser?: string, httpPass?: string): Promise; + + /** + * Get Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + getWebhook(projectId: string, webhookId: string): Promise; + + /** + * Update Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateWebhook(projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, httpUser?: string, httpPass?: string): Promise; + + /** + * Delete Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + deleteWebhook(projectId: string, webhookId: string): Promise; + + } + + export interface Storage { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile(file: File, read: string[], write: string[]): Promise; + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile(fileId: string): Promise; + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile(fileId: string, read: string[], write: string[]): Promise; + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile(fileId: string): Promise; + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload(fileId: string): string; + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview(fileId: string, width?: number, height?: number, quality?: number, background?: string, output?: string): string; + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView(fileId: string, as?: string): string; + + } + + export interface Teams { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create(name: string, roles?: string[]): Promise; + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get(teamId: string): Promise; + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update(teamId: string, name: string): Promise; + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete(teamId: string): Promise; + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships(teamId: string, search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership(teamId: string, email: string, roles: string[], url: string, name?: string): Promise; + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership(teamId: string, inviteId: string): Promise; + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after he is being redirected back to your app from the invitation email he + * was sent. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus(teamId: string, inviteId: string, userId: string, secret: string): Promise; + + } + + export interface Users { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create User + * + * Create a new user. + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create(email: string, password: string, name?: string): Promise; + + /** + * Get User + * + * Get user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + get(userId: string): Promise; + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getLogs(userId: string): Promise; + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getPrefs(userId: string): Promise; + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param {string} userId + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs(userId: string, prefs: object): Promise; + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getSessions(userId: string): Promise; + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteSessions(userId: string): Promise; + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param {string} userId + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession(userId: string, sessionId: string): Promise; + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param {string} userId + * @param {string} status + * @throws {Error} + * @return {Promise} + */ + updateStatus(userId: string, status: string): Promise; + + } + + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/CHANGELOG.md b/app/sdks/0.6.2/server-deno/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/LICENSE b/app/sdks/0.6.2/server-deno/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/README.md b/app/sdks/0.6.2/server-deno/README.md new file mode 100644 index 0000000000..82bd02c8ef --- /dev/null +++ b/app/sdks/0.6.2/server-deno/README.md @@ -0,0 +1,28 @@ +# Appwrite Deno SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.6.2. 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 Deno 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +```javascript +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..27c0336054 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-browser.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getBrowser('aa'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..998356a106 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getCreditCard('amex'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..43afe096c4 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-favicon.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getFavicon('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..6b28e5db2f --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-flag.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getFlag('af'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..0a2693c768 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-image.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getImage('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..af35445bb3 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-initials.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getInitials(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..6d8446b105 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/avatars/get-q-r.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getQR('[TEXT]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/create-collection.md b/app/sdks/0.6.2/server-deno/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..316ae6b222 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/create-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.createCollection('[NAME]', [], [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/create-document.md b/app/sdks/0.6.2/server-deno/docs/examples/database/create-document.md new file mode 100644 index 0000000000..ef78a839a4 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/create-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/delete-collection.md b/app/sdks/0.6.2/server-deno/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..e9b5d6392b --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/delete-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.deleteCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/delete-document.md b/app/sdks/0.6.2/server-deno/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..b7d3f52c71 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/delete-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/get-collection.md b/app/sdks/0.6.2/server-deno/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..323bc7ec74 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/get-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.getCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/get-document.md b/app/sdks/0.6.2/server-deno/docs/examples/database/get-document.md new file mode 100644 index 0000000000..7a0332251a --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/get-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/list-collections.md b/app/sdks/0.6.2/server-deno/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..292e46f860 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/list-collections.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.listCollections(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/list-documents.md b/app/sdks/0.6.2/server-deno/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..bb22a3956a --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/list-documents.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/update-collection.md b/app/sdks/0.6.2/server-deno/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..8239e45f28 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/update-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/database/update-document.md b/app/sdks/0.6.2/server-deno/docs/examples/database/update-document.md new file mode 100644 index 0000000000..cd079c8f2d --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/database/update-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-anti-virus.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..e06fbf86de --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-anti-virus.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getAntiVirus(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-cache.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..b58ca1bc15 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-cache.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getCache(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-d-b.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..946cfb03a8 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-d-b.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getDB(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-certificates.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..a86358bb22 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-functions.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..033248b118 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-functions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueFunctions(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-logs.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..d4c3300a35 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-logs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-tasks.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..01e3094ffc --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-usage.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..d0d8faf7b6 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-usage.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..268c521373 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-storage-local.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..77bb658f9a --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-storage-local.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get-time.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get-time.md new file mode 100644 index 0000000000..0e5205b075 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get-time.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getTime(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/health/get.md b/app/sdks/0.6.2/server-deno/docs/examples/health/get.md new file mode 100644 index 0000000000..c2e6ecdf65 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/health/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..18221d44b4 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-continents.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getContinents(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..4a3e49f755 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..61a1790806 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..20f544e617 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-countries.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCountries(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..13b975291d --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-currencies.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..95c5c6b355 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get-languages.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getLanguages(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/locale/get.md b/app/sdks/0.6.2/server-deno/docs/examples/locale/get.md new file mode 100644 index 0000000000..2336c3289d --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/locale/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/create-file.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..5b446e1a38 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/create-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.createFile(new File([fileBlob], 'file.png'), [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..6469308c74 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/delete-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..4510257bad --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-download.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFileDownload('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..282fb30324 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-preview.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFilePreview('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..8af5391017 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file-view.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFileView('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..393ce229cb --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/get-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/list-files.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..0e57cd01de --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/list-files.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.listFiles(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/storage/update-file.md b/app/sdks/0.6.2/server-deno/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..33b2263540 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/storage/update-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..b277899c91 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/create.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/create.md new file mode 100644 index 0000000000..1ef3e01b81 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/create.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..911fa30075 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/delete-membership.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/delete.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/delete.md new file mode 100644 index 0000000000..61ac03483f --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/delete.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..b652f8e4e5 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/get-memberships.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/get.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/get.md new file mode 100644 index 0000000000..69496e3eef --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/list.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/list.md new file mode 100644 index 0000000000..70851dda51 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/list.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/teams/update.md b/app/sdks/0.6.2/server-deno/docs/examples/teams/update.md new file mode 100644 index 0000000000..7b815b4050 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/teams/update.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/create.md b/app/sdks/0.6.2/server-deno/docs/examples/users/create.md new file mode 100644 index 0000000000..593eee6e9f --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/create.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/delete-session.md b/app/sdks/0.6.2/server-deno/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..e4940773e4 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/delete-session.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/delete-sessions.md b/app/sdks/0.6.2/server-deno/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..e772c00a5f --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/delete-sessions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/get-logs.md b/app/sdks/0.6.2/server-deno/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..58cc4fc529 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/get-logs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.getLogs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/get-prefs.md b/app/sdks/0.6.2/server-deno/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..4cda0bb73e --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/get-prefs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.getPrefs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/get-sessions.md b/app/sdks/0.6.2/server-deno/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..6686e21564 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/get-sessions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.getSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/get.md b/app/sdks/0.6.2/server-deno/docs/examples/users/get.md new file mode 100644 index 0000000000..dce73d62c5 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/list.md b/app/sdks/0.6.2/server-deno/docs/examples/users/list.md new file mode 100644 index 0000000000..b089c3e7e9 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/list.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/update-prefs.md b/app/sdks/0.6.2/server-deno/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..b06185ee91 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/update-prefs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.updatePrefs('[USER_ID]', {}); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/docs/examples/users/update-status.md b/app/sdks/0.6.2/server-deno/docs/examples/users/update-status.md new file mode 100644 index 0000000000..a0f028bde5 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/docs/examples/users/update-status.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/mod.ts b/app/sdks/0.6.2/server-deno/mod.ts new file mode 100644 index 0000000000..3e51466fe6 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/mod.ts @@ -0,0 +1,19 @@ +import { Client } from "./src/client.ts"; +import { Avatars } from "./src/services/avatars.ts"; +import { Database } from "./src/services/database.ts"; +import { Health } from "./src/services/health.ts"; +import { Locale } from "./src/services/locale.ts"; +import { Storage } from "./src/services/storage.ts"; +import { Teams } from "./src/services/teams.ts"; +import { Users } from "./src/services/users.ts"; + +export { + Client, + Avatars, + Database, + Health, + Locale, + Storage, + Teams, + Users, +}; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/client.ts b/app/sdks/0.6.2/server-deno/src/client.ts new file mode 100644 index 0000000000..3bf22034b8 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/client.ts @@ -0,0 +1,138 @@ +export interface DocumentData { + [key: string]: any; +} + +export class Client { + + endpoint: string = 'https://appwrite.io/v1'; + headers: DocumentData = { + 'content-type': '', + 'x-sdk-version': 'appwrite:deno:0.0.2', + }; + + /** + * Set Project + * + * Your project ID + * + * @param string value + * + * @return self + */ + setProject(value: string): this { + this.addHeader('X-Appwrite-Project', value); + + return this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string value + * + * @return self + */ + setKey(value: string): this { + this.addHeader('X-Appwrite-Key', value); + + return this; + } + + /** + * Set Locale + * + * @param string value + * + * @return self + */ + setLocale(value: string): this { + this.addHeader('X-Appwrite-Locale', value); + + return this; + } + + + /*** + * @param endpoint + * @return this + */ + setEndpoint(endpoint: string): this { + this.endpoint = endpoint; + + return this; + } + + /** + * @param key string + * @param value string + */ + addHeader(key: string, value: string): this { + this.headers[key.toLowerCase()] = value.toLowerCase(); + + return this; + } + + withoutHeader(key: string, headers: DocumentData): DocumentData { + return Object.keys(headers).reduce((acc: DocumentData, cv) => { + if (cv == 'content-type') return acc + acc[cv] = headers[cv] + return acc + }, {}) + } + + async call(method: string, path: string = '', headers: DocumentData = {}, params: DocumentData = {}) { + headers = Object.assign(this.headers, headers); + + let body; + const url = new URL(this.endpoint + path) + if (method.toUpperCase() === 'GET') { + url.search = new URLSearchParams(this.flatten(params)).toString() + body = null + } else if (headers['content-type'].toLowerCase().startsWith('multipart/form-data')) { + headers = this.withoutHeader('content-type', headers) + const formData = new FormData() + const flatParams = this.flatten(params) + for (const key in flatParams) { + formData.append(key, flatParams[key]); + } + body = formData + } else { + body = JSON.stringify(params) + } + + const options = { + method: method.toUpperCase(), + headers: headers, + body: body, + }; + + let response = await fetch(url.toString(), options); + const contentType = response.headers.get('content-type'); + + if (contentType && contentType.includes('application/json')) { + return response.json() + } + + return response; + } + + flatten(data: DocumentData, prefix = '') { + let output: DocumentData = {}; + + for (const key in data) { + let value = data[key]; + let finalKey = prefix ? prefix + '[' + key +']' : key; + + if (Array.isArray(value)) { + output = Object.assign(output, this.flatten(value, finalKey)); // @todo: handle name collision here if needed + } + else { + output[finalKey] = value; + } + } + + return output; + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/service.ts b/app/sdks/0.6.2/server-deno/src/service.ts new file mode 100644 index 0000000000..ceedf1a0c3 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/service.ts @@ -0,0 +1,13 @@ +import { Client } from "./client.ts"; + +export abstract class Service { + + client: Client; + + /** + * @param client + */ + constructor(client: Client) { + this.client = client; + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/avatars.ts b/app/sdks/0.6.2/server-deno/src/services/avatars.ts new file mode 100644 index 0000000000..398afc1833 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/avatars.ts @@ -0,0 +1,200 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Avatars extends Service { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return Promise + */ + async getBrowser(code: string, width: number = 100, height: number = 100, quality: number = 100): Promise { + let path = '/avatars/browsers/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return Promise + */ + async getCreditCard(code: string, width: number = 100, height: number = 100, quality: number = 100): Promise { + let path = '/avatars/credit-cards/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param string url + * @throws Exception + * @return Promise + */ + async getFavicon(url: string): Promise { + let path = '/avatars/favicon'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url + }); + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return Promise + */ + async getFlag(code: string, width: number = 100, height: number = 100, quality: number = 100): Promise { + let path = '/avatars/flags/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param string url + * @param number width + * @param number height + * @throws Exception + * @return Promise + */ + async getImage(url: string, width: number = 400, height: number = 400): Promise { + let path = '/avatars/image'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url, + 'width': width, + 'height': height + }); + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param string name + * @param number width + * @param number height + * @param string color + * @param string background + * @throws Exception + * @return Promise + */ + async getInitials(name: string = '', width: number = 500, height: number = 500, color: string = '', background: string = ''): Promise { + let path = '/avatars/initials'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background + }); + } + + /** + * Get QR Code + * + * 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. + * + * @param string text + * @param number size + * @param number margin + * @param boolean download + * @throws Exception + * @return Promise + */ + async getQR(text: string, size: number = 400, margin: number = 1, download: boolean = false): Promise { + let path = '/avatars/qr'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/database.ts b/app/sdks/0.6.2/server-deno/src/services/database.ts new file mode 100644 index 0000000000..ad50a51893 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/database.ts @@ -0,0 +1,264 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Database extends Service { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async listCollections(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/database/collections'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Collection + * + * Create a new Collection. + * + * @param string name + * @param Array read + * @param Array write + * @param Array rules + * @throws Exception + * @return Promise + */ + async createCollection(name: string, read: Array, write: Array, rules: Array): Promise { + let path = '/database/collections'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string collectionId + * @throws Exception + * @return Promise + */ + async getCollection(collectionId: string): Promise { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param string collectionId + * @param string name + * @param Array read + * @param Array write + * @param Array rules + * @throws Exception + * @return Promise + */ + async updateCollection(collectionId: string, name: string, read: Array, write: Array, rules: Array = []): Promise { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string collectionId + * @throws Exception + * @return Promise + */ + async deleteCollection(collectionId: string): Promise { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param string collectionId + * @param Array filters + * @param number offset + * @param number limit + * @param string orderField + * @param string orderType + * @param string orderCast + * @param string search + * @throws Exception + * @return Promise + */ + async listDocuments(collectionId: string, filters: Array = [], offset: number = 0, limit: number = 50, orderField: string = '$id', orderType: string = 'ASC', orderCast: string = 'string', search: string = ''): Promise { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'filters': filters, + 'offset': offset, + 'limit': limit, + 'orderField': orderField, + 'orderType': orderType, + 'orderCast': orderCast, + 'search': search + }); + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param string collectionId + * @param DocumentData data + * @param Array read + * @param Array write + * @param string parentDocument + * @param string parentProperty + * @param string parentPropertyType + * @throws Exception + * @return Promise + */ + async createDocument(collectionId: string, data: DocumentData, read: Array, write: Array, parentDocument: string = '', parentProperty: string = '', parentPropertyType: string = 'assign'): Promise { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType + }); + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return Promise + */ + async getDocument(collectionId: string, documentId: string): Promise { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Document + * + * @param string collectionId + * @param string documentId + * @param DocumentData data + * @param Array read + * @param Array write + * @throws Exception + * @return Promise + */ + async updateDocument(collectionId: string, documentId: string, data: DocumentData, read: Array, write: Array): Promise { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write + }); + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return Promise + */ + async deleteDocument(collectionId: string, documentId: string): Promise { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/health.ts b/app/sdks/0.6.2/server-deno/src/services/health.ts new file mode 100644 index 0000000000..df5c18a2cb --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/health.ts @@ -0,0 +1,232 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Health extends Service { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws Exception + * @return Promise + */ + async get(): Promise { + let path = '/health'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return Promise + */ + async getAntiVirus(): Promise { + let path = '/health/anti-virus'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return Promise + */ + async getCache(): Promise { + let path = '/health/cache'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return Promise + */ + async getDB(): Promise { + let path = '/health/db'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return Promise + */ + async getQueueCertificates(): Promise { + let path = '/health/queue/certificates'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Functions Queue + * + * @throws Exception + * @return Promise + */ + async getQueueFunctions(): Promise { + let path = '/health/queue/functions'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueLogs(): Promise { + let path = '/health/queue/logs'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueTasks(): Promise { + let path = '/health/queue/tasks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueUsage(): Promise { + let path = '/health/queue/usage'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueWebhooks(): Promise { + let path = '/health/queue/webhooks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return Promise + */ + async getStorageLocal(): Promise { + let path = '/health/storage/local'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return Promise + */ + async getTime(): Promise { + let path = '/health/time'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/locale.ts b/app/sdks/0.6.2/server-deno/src/services/locale.ts new file mode 100644 index 0000000000..9d8e066c70 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/locale.ts @@ -0,0 +1,143 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Locale extends Service { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws Exception + * @return Promise + */ + async get(): Promise { + let path = '/locale'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return Promise + */ + async getContinents(): Promise { + let path = '/locale/continents'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return Promise + */ + async getCountries(): Promise { + let path = '/locale/countries'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return Promise + */ + async getCountriesEU(): Promise { + let path = '/locale/countries/eu'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return Promise + */ + async getCountriesPhones(): Promise { + let path = '/locale/countries/phones'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return Promise + */ + async getCurrencies(): Promise { + let path = '/locale/currencies'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return Promise + */ + async getLanguages(): Promise { + let path = '/locale/languages'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/storage.ts b/app/sdks/0.6.2/server-deno/src/services/storage.ts new file mode 100644 index 0000000000..b663739e05 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/storage.ts @@ -0,0 +1,198 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Storage extends Service { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async listFiles(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/storage/files'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param File | Blob file + * @param Array read + * @param Array write + * @throws Exception + * @return Promise + */ + async createFile(file: File | Blob, read: Array, write: Array): Promise { + let path = '/storage/files'; + + return await this.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, + { + 'file': file, + 'read': read, + 'write': write + }); + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string fileId + * @throws Exception + * @return Promise + */ + async getFile(fileId: string): Promise { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param string fileId + * @param Array read + * @param Array write + * @throws Exception + * @return Promise + */ + async updateFile(fileId: string, read: Array, write: Array): Promise { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'read': read, + 'write': write + }); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string fileId + * @throws Exception + * @return Promise + */ + async deleteFile(fileId: string): Promise { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string fileId + * @throws Exception + * @return Promise + */ + async getFileDownload(fileId: string): Promise { + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param string fileId + * @param number width + * @param number height + * @param number quality + * @param string background + * @param string output + * @throws Exception + * @return Promise + */ + async getFilePreview(fileId: string, width: number = 0, height: number = 0, quality: number = 100, background: string = '', output: string = ''): Promise { + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output + }); + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param string fileId + * @param string as + * @throws Exception + * @return Promise + */ + async getFileView(fileId: string, as: string = ''): Promise { + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'as': as + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/teams.ts b/app/sdks/0.6.2/server-deno/src/services/teams.ts new file mode 100644 index 0000000000..16f5c20053 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/teams.ts @@ -0,0 +1,209 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Teams extends Service { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async list(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/teams'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param string name + * @param Array roles + * @throws Exception + * @return Promise + */ + async create(name: string, roles: Array = ["owner"]): Promise { + let path = '/teams'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'roles': roles + }); + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return Promise + */ + async get(teamId: string): Promise { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @param string name + * @throws Exception + * @return Promise + */ + async update(teamId: string, name: string): Promise { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name + }); + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return Promise + */ + async delete(teamId: string): Promise { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param string teamId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async getMemberships(teamId: string, search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param string teamId + * @param string email + * @param Array roles + * @param string url + * @param string name + * @throws Exception + * @return Promise + */ + async createMembership(teamId: string, email: string, roles: Array, url: string, name: string = ''): Promise { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url + }); + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param string teamId + * @param string inviteId + * @throws Exception + * @return Promise + */ + async deleteMembership(teamId: string, inviteId: string): Promise { + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-deno/src/services/users.ts b/app/sdks/0.6.2/server-deno/src/services/users.ts new file mode 100644 index 0000000000..ac48507f08 --- /dev/null +++ b/app/sdks/0.6.2/server-deno/src/services/users.ts @@ -0,0 +1,214 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Users extends Service { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async list(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/users'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create User + * + * Create a new user. + * + * @param string email + * @param string password + * @param string name + * @throws Exception + * @return Promise + */ + async create(email: string, password: string, name: string = ''): Promise { + let path = '/users'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'password': password, + 'name': name + }); + } + + /** + * Get User + * + * Get user by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async get(userId: string): Promise { + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async getLogs(userId: string): Promise { + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async getPrefs(userId: string): Promise { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param string userId + * @param DocumentData prefs + * @throws Exception + * @return Promise + */ + async updatePrefs(userId: string, prefs: DocumentData): Promise { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'prefs': prefs + }); + } + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async getSessions(userId: string): Promise { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async deleteSessions(userId: string): Promise { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param string userId + * @param string sessionId + * @throws Exception + * @return Promise + */ + async deleteSession(userId: string, sessionId: string): Promise { + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param string userId + * @param string status + * @throws Exception + * @return Promise + */ + async updateStatus(userId: string, status: string): Promise { + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'status': status + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/CHANGELOG.md b/app/sdks/0.6.2/server-nodejs/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/LICENSE b/app/sdks/0.6.2/server-nodejs/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/README.md b/app/sdks/0.6.2/server-nodejs/README.md new file mode 100644 index 0000000000..b3f2006d1e --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/README.md @@ -0,0 +1,28 @@ +# Appwrite Node.js SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +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 Node.js 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install node-appwrite --save +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..2a670ce08b --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-browser.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getBrowser('aa'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..afd38f5a97 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getCreditCard('amex'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..bb347371d4 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-favicon.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getFavicon('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..db677bc4f8 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-flag.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getFlag('af'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..efa871ea63 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-image.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getImage('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..d6175bff13 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-initials.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getInitials(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..e79b3235af --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/avatars/get-q-r.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getQR('[TEXT]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/create-collection.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..c0207f30f0 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/create-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.createCollection('[NAME]', [], [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/create-document.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/create-document.md new file mode 100644 index 0000000000..8676dfb84d --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/create-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/delete-collection.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..503da98a73 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/delete-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.deleteCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/delete-document.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..f14c985e83 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/delete-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/get-collection.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..a14ce0d49a --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/get-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.getCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/get-document.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/get-document.md new file mode 100644 index 0000000000..55cce32b9b --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/get-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/list-collections.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..bacfdb062c --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/list-collections.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.listCollections(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/list-documents.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..ad02d05e2a --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/list-documents.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/update-collection.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..eb9326565a --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/update-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/database/update-document.md b/app/sdks/0.6.2/server-nodejs/docs/examples/database/update-document.md new file mode 100644 index 0000000000..131722cd26 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/database/update-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-anti-virus.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..c08e612bcf --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-anti-virus.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getAntiVirus(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-cache.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..d19cc8abd5 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-cache.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getCache(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-d-b.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..08505367d4 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-d-b.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getDB(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-certificates.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..2eb69e0126 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-functions.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..9470e11646 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-functions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueFunctions(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-logs.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..10f1cb24e3 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-logs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-tasks.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..c159f4e6ee --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-usage.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..6286c741ee --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-usage.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..3a788eb895 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-storage-local.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..84b8fb47a6 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-storage-local.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-time.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-time.md new file mode 100644 index 0000000000..563bf2fb52 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get-time.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getTime(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/health/get.md b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get.md new file mode 100644 index 0000000000..20c3d40801 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/health/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..323237b4ab --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-continents.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getContinents(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..fc9170dba4 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..42be901677 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..437c9bb502 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-countries.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCountries(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..1b7d605760 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-currencies.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..b6f45311b3 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get-languages.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getLanguages(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get.md b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get.md new file mode 100644 index 0000000000..2f2eb95d90 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/locale/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/create-file.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..1eda9fd868 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/create-file.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); +const fs = require('fs'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.createFile(fs.createReadStream(__dirname + '/file.png')), [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..9ce0ff7f2e --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/delete-file.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..1683ed87e0 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-download.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFileDownload('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..771dcd35f0 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-preview.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFilePreview('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..83029ecdee --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file-view.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFileView('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..2a76fdf189 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/get-file.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/list-files.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..e11fd95300 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/list-files.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.listFiles(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/storage/update-file.md b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..4726169146 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/storage/update-file.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..cd17042e58 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/create.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/create.md new file mode 100644 index 0000000000..c0d0611a49 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/create.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..f9a76f3ec0 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/delete-membership.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/delete.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/delete.md new file mode 100644 index 0000000000..e833fdfb9b --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/delete.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..75cdf38e5c --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/get-memberships.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/get.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/get.md new file mode 100644 index 0000000000..a51322df27 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/list.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/list.md new file mode 100644 index 0000000000..259bbd22b2 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/list.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/teams/update.md b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/update.md new file mode 100644 index 0000000000..2118e8a90f --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/teams/update.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/create.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/create.md new file mode 100644 index 0000000000..83704cbd9d --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/create.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/delete-session.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..22308d4fa6 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/delete-session.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/delete-sessions.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..75f8f96bda --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/delete-sessions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-logs.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..1287b5ef5f --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-logs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.getLogs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-prefs.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..088e6b0811 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-prefs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.getPrefs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-sessions.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..f5ad029ebe --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get-sessions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.getSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/get.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get.md new file mode 100644 index 0000000000..5b91577284 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/list.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/list.md new file mode 100644 index 0000000000..0bc83b06bf --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/list.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/update-prefs.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..7d1011d6be --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/update-prefs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.updatePrefs('[USER_ID]', {}); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/docs/examples/users/update-status.md b/app/sdks/0.6.2/server-nodejs/docs/examples/users/update-status.md new file mode 100644 index 0000000000..86f54381da --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/docs/examples/users/update-status.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/index.js b/app/sdks/0.6.2/server-nodejs/index.js new file mode 100644 index 0000000000..f5259f59dc --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/index.js @@ -0,0 +1,19 @@ +const Client = require('./lib/client.js'); +const Avatars = require('./lib/services/avatars.js'); +const Database = require('./lib/services/database.js'); +const Health = require('./lib/services/health.js'); +const Locale = require('./lib/services/locale.js'); +const Storage = require('./lib/services/storage.js'); +const Teams = require('./lib/services/teams.js'); +const Users = require('./lib/services/users.js'); + +module.exports = { + Client, + Avatars, + Database, + Health, + Locale, + Storage, + Teams, + Users, +}; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/client.js b/app/sdks/0.6.2/server-nodejs/lib/client.js new file mode 100644 index 0000000000..821ef5f424 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/client.js @@ -0,0 +1,152 @@ +const URL = require('url').URL; +const axios = require('axios'); +const FormData = require('form-data'); + +class Client { + + constructor() { + this.endpoint = 'https://appwrite.io/v1'; + this.headers = { + 'content-type': '', + 'x-sdk-version': 'appwrite:nodejs:1.1.0', + }; + this.selfSigned = false; + } + + /** + * Set Project + * + * Your project ID + * + * @param string value + * + * @return self + */ + setProject(value) { + this.addHeader('X-Appwrite-Project', value); + + return this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string value + * + * @return self + */ + setKey(value) { + this.addHeader('X-Appwrite-Key', value); + + return this; + } + + /** + * Set Locale + * + * @param string value + * + * @return self + */ + setLocale(value) { + this.addHeader('X-Appwrite-Locale', value); + + return this; + } + + /*** + * @param bool status + * @return this + */ + setSelfSigned(status = true) { + this.selfSigned = status; + + return this; + } + + /*** + * @param endpoint + * @return this + */ + setEndpoint(endpoint) + { + this.endpoint = endpoint; + + return this; + } + + /** + * @param key string + * @param value string + */ + addHeader(key, value) { + this.headers[key.toLowerCase()] = value.toLowerCase(); + + return this; + } + + async call(method, path = '', headers = {}, params = {}) { + if(this.selfSigned) { // Allow self signed requests + process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; + } + + headers = Object.assign(this.headers, headers); + + let contentType = headers['content-type'].toLowerCase(); + + let formData = null; + + // Compute FormData for axios and appwrite. + if (contentType.startsWith('multipart/form-data')) { + const form = new FormData(); + + let flatParams = this.flatten(params); + + for (const key in flatParams) { + form.append(key, flatParams[key]) + } + + headers = { + ...headers, + ...form.getHeaders() + }; + + formData = form; + } + + let options = { + method: method.toUpperCase(), + url: this.endpoint + path, + params: (method.toUpperCase() === 'GET') ? params : {}, + headers: headers, + data: (method.toUpperCase() === 'GET' || contentType.startsWith('multipart/form-data')) ? formData : params, + json: (contentType.startsWith('application/json')) + }; + + let response = await axios(options); + + return response.data; + } + + flatten(data, prefix = '') { + let output = {}; + + for (const key in data) { + let value = data[key]; + let finalKey = prefix ? prefix + '[' + key +']' : key; + + if (Array.isArray(value)) { + output = Object.assign(output, this.flatten(value, finalKey)); // @todo: handle name collision here if needed + } + else { + output[finalKey] = value; + } + } + + return output; + } +} + +module.exports = Client; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/service.js b/app/sdks/0.6.2/server-nodejs/lib/service.js new file mode 100644 index 0000000000..e799c064be --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/service.js @@ -0,0 +1,10 @@ +class Service { + /** + * @param client + */ + constructor(client) { + this.client = client; + } +} + +module.exports = Service; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/avatars.js b/app/sdks/0.6.2/server-nodejs/lib/services/avatars.js new file mode 100644 index 0000000000..048501e73a --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/avatars.js @@ -0,0 +1,201 @@ +const Service = require('../service.js'); + +class Avatars extends Service { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return {} + */ + async getBrowser(code, width = 100, height = 100, quality = 100) { + let path = '/avatars/browsers/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return {} + */ + async getCreditCard(code, width = 100, height = 100, quality = 100) { + let path = '/avatars/credit-cards/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param string url + * @throws Exception + * @return {} + */ + async getFavicon(url) { + let path = '/avatars/favicon'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url + }); + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return {} + */ + async getFlag(code, width = 100, height = 100, quality = 100) { + let path = '/avatars/flags/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param string url + * @param number width + * @param number height + * @throws Exception + * @return {} + */ + async getImage(url, width = 400, height = 400) { + let path = '/avatars/image'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url, + 'width': width, + 'height': height + }); + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param string name + * @param number width + * @param number height + * @param string color + * @param string background + * @throws Exception + * @return {} + */ + async getInitials(name = '', width = 500, height = 500, color = '', background = '') { + let path = '/avatars/initials'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background + }); + } + + /** + * Get QR Code + * + * 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. + * + * @param string text + * @param number size + * @param number margin + * @param boolean download + * @throws Exception + * @return {} + */ + async getQR(text, size = 400, margin = 1, download = false) { + let path = '/avatars/qr'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download + }); + } +} + +module.exports = Avatars; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/database.js b/app/sdks/0.6.2/server-nodejs/lib/services/database.js new file mode 100644 index 0000000000..68bd06216d --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/database.js @@ -0,0 +1,265 @@ +const Service = require('../service.js'); + +class Database extends Service { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async listCollections(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/database/collections'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Collection + * + * Create a new Collection. + * + * @param string name + * @param string[] read + * @param string[] write + * @param string[] rules + * @throws Exception + * @return {} + */ + async createCollection(name, read, write, rules) { + let path = '/database/collections'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string collectionId + * @throws Exception + * @return {} + */ + async getCollection(collectionId) { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param string collectionId + * @param string name + * @param string[] read + * @param string[] write + * @param string[] rules + * @throws Exception + * @return {} + */ + async updateCollection(collectionId, name, read, write, rules = []) { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string collectionId + * @throws Exception + * @return {} + */ + async deleteCollection(collectionId) { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param string collectionId + * @param string[] filters + * @param number offset + * @param number limit + * @param string orderField + * @param string orderType + * @param string orderCast + * @param string search + * @throws Exception + * @return {} + */ + async listDocuments(collectionId, filters = [], offset = 0, limit = 50, orderField = '$id', orderType = 'ASC', orderCast = 'string', search = '') { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'filters': filters, + 'offset': offset, + 'limit': limit, + 'orderField': orderField, + 'orderType': orderType, + 'orderCast': orderCast, + 'search': search + }); + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param string collectionId + * @param object data + * @param string[] read + * @param string[] write + * @param string parentDocument + * @param string parentProperty + * @param string parentPropertyType + * @throws Exception + * @return {} + */ + async createDocument(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType + }); + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return {} + */ + async getDocument(collectionId, documentId) { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Document + * + * @param string collectionId + * @param string documentId + * @param object data + * @param string[] read + * @param string[] write + * @throws Exception + * @return {} + */ + async updateDocument(collectionId, documentId, data, read, write) { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write + }); + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return {} + */ + async deleteDocument(collectionId, documentId) { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Database; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/health.js b/app/sdks/0.6.2/server-nodejs/lib/services/health.js new file mode 100644 index 0000000000..a0aed052ce --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/health.js @@ -0,0 +1,233 @@ +const Service = require('../service.js'); + +class Health extends Service { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws Exception + * @return {} + */ + async get() { + let path = '/health'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getAntiVirus() { + let path = '/health/anti-virus'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return {} + */ + async getCache() { + let path = '/health/cache'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getDB() { + let path = '/health/db'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return {} + */ + async getQueueCertificates() { + let path = '/health/queue/certificates'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Functions Queue + * + * @throws Exception + * @return {} + */ + async getQueueFunctions() { + let path = '/health/queue/functions'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueLogs() { + let path = '/health/queue/logs'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueTasks() { + let path = '/health/queue/tasks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueUsage() { + let path = '/health/queue/usage'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueWebhooks() { + let path = '/health/queue/webhooks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getStorageLocal() { + let path = '/health/storage/local'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return {} + */ + async getTime() { + let path = '/health/time'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Health; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/locale.js b/app/sdks/0.6.2/server-nodejs/lib/services/locale.js new file mode 100644 index 0000000000..8bb45bf45e --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/locale.js @@ -0,0 +1,144 @@ +const Service = require('../service.js'); + +class Locale extends Service { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws Exception + * @return {} + */ + async get() { + let path = '/locale'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return {} + */ + async getContinents() { + let path = '/locale/continents'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return {} + */ + async getCountries() { + let path = '/locale/countries'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return {} + */ + async getCountriesEU() { + let path = '/locale/countries/eu'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return {} + */ + async getCountriesPhones() { + let path = '/locale/countries/phones'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return {} + */ + async getCurrencies() { + let path = '/locale/currencies'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return {} + */ + async getLanguages() { + let path = '/locale/languages'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Locale; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/storage.js b/app/sdks/0.6.2/server-nodejs/lib/services/storage.js new file mode 100644 index 0000000000..2b670db31a --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/storage.js @@ -0,0 +1,199 @@ +const Service = require('../service.js'); + +class Storage extends Service { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async listFiles(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param File file + * @param string[] read + * @param string[] write + * @throws Exception + * @return {} + */ + async createFile(file, read, write) { + let path = '/storage/files'; + + return await this.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, + { + 'file': file, + 'read': read, + 'write': write + }); + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string fileId + * @throws Exception + * @return {} + */ + async getFile(fileId) { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param string fileId + * @param string[] read + * @param string[] write + * @throws Exception + * @return {} + */ + async updateFile(fileId, read, write) { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'read': read, + 'write': write + }); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string fileId + * @throws Exception + * @return {} + */ + async deleteFile(fileId) { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string fileId + * @throws Exception + * @return {} + */ + async getFileDownload(fileId) { + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param string fileId + * @param number width + * @param number height + * @param number quality + * @param string background + * @param string output + * @throws Exception + * @return {} + */ + async getFilePreview(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output + }); + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param string fileId + * @param string as + * @throws Exception + * @return {} + */ + async getFileView(fileId, as = '') { + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'as': as + }); + } +} + +module.exports = Storage; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/teams.js b/app/sdks/0.6.2/server-nodejs/lib/services/teams.js new file mode 100644 index 0000000000..7e3b92b7d3 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/teams.js @@ -0,0 +1,210 @@ +const Service = require('../service.js'); + +class Teams extends Service { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param string name + * @param string[] roles + * @throws Exception + * @return {} + */ + async create(name, roles = ["owner"]) { + let path = '/teams'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'roles': roles + }); + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return {} + */ + async get(teamId) { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @param string name + * @throws Exception + * @return {} + */ + async update(teamId, name) { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name + }); + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return {} + */ + async delete(teamId) { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param string teamId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async getMemberships(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param string teamId + * @param string email + * @param string[] roles + * @param string url + * @param string name + * @throws Exception + * @return {} + */ + async createMembership(teamId, email, roles, url, name = '') { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url + }); + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param string teamId + * @param string inviteId + * @throws Exception + * @return {} + */ + async deleteMembership(teamId, inviteId) { + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Teams; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/lib/services/users.js b/app/sdks/0.6.2/server-nodejs/lib/services/users.js new file mode 100644 index 0000000000..2292fb2664 --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/lib/services/users.js @@ -0,0 +1,215 @@ +const Service = require('../service.js'); + +class Users extends Service { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/users'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create User + * + * Create a new user. + * + * @param string email + * @param string password + * @param string name + * @throws Exception + * @return {} + */ + async create(email, password, name = '') { + let path = '/users'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'password': password, + 'name': name + }); + } + + /** + * Get User + * + * Get user by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async get(userId) { + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async getLogs(userId) { + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async getPrefs(userId) { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param string userId + * @param object prefs + * @throws Exception + * @return {} + */ + async updatePrefs(userId, prefs) { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'prefs': prefs + }); + } + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async getSessions(userId) { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async deleteSessions(userId) { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param string userId + * @param string sessionId + * @throws Exception + * @return {} + */ + async deleteSession(userId, sessionId) { + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param string userId + * @param string status + * @throws Exception + * @return {} + */ + async updateStatus(userId, status) { + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'status': status + }); + } +} + +module.exports = Users; \ No newline at end of file diff --git a/app/sdks/0.6.2/server-nodejs/package.json b/app/sdks/0.6.2/server-nodejs/package.json new file mode 100644 index 0000000000..c38677a33b --- /dev/null +++ b/app/sdks/0.6.2/server-nodejs/package.json @@ -0,0 +1,17 @@ +{ + "name": "node-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.1.0", + "license": "BSD-3-Clause", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-node" + }, + "devDependencies": {}, + "dependencies": { + "axios": "^0.20.0", + "form-data": "^3.0.0" + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/CHANGELOG.md b/app/sdks/0.6.2/server-php/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/server-php/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/LICENSE b/app/sdks/0.6.2/server-php/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/server-php/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/README.md b/app/sdks/0.6.2/server-php/README.md new file mode 100644 index 0000000000..d93cb2347d --- /dev/null +++ b/app/sdks/0.6.2/server-php/README.md @@ -0,0 +1,28 @@ +# Appwrite PHP SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +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 PHP 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [Composer](http://getcomposer.org/): + +```bash +composer require appwrite/appwrite +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/composer.json b/app/sdks/0.6.2/server-php/composer.json new file mode 100644 index 0000000000..64d2e1746f --- /dev/null +++ b/app/sdks/0.6.2/server-php/composer.json @@ -0,0 +1,26 @@ +{ + "name": "appwrite/appwrite", + "description": "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 PHP 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)", + "type": "library", + "license": "BSD-3-Clause", + "support": { + "url": "https://appwrite.io/support", + "email": "team@localhost.test" + }, + "autoload": { + "psr-4": { + "Appwrite\\": "src/Appwrite" + } + }, + "require": { + "php": ">=7.1.0", + "ext-curl": "*", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "3.7.35" + }, + "minimum-stability": "dev" +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/avatars.md b/app/sdks/0.6.2/server-php/docs/avatars.md new file mode 100644 index 0000000000..224e4735a9 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/avatars.md @@ -0,0 +1,120 @@ +# Avatars Service + +## Get Browser Icon + +```http request +GET https://appwrite.io/v1/avatars/browsers/{code} +``` + +** You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Browser Code. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Credit Card Icon + +```http request +GET https://appwrite.io/v1/avatars/credit-cards/{code} +``` + +** Need to display your users with your billing method or their payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Favicon + +```http request +GET https://appwrite.io/v1/avatars/favicon +``` + +** Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote website URL. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | **Required** Website URL which you want to fetch the favicon from. | | + +## Get Country Flag + +```http request +GET https://appwrite.io/v1/avatars/flags/{code} +``` + +** You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Country Code. ISO Alpha-2 country code format. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Image from URL + +```http request +GET https://appwrite.io/v1/avatars/image +``` + +** Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | **Required** Image URL which you want to crop. | | +| width | integer | Resize preview image width, Pass an integer between 0 to 2000. | 400 | +| height | integer | Resize preview image height, Pass an integer between 0 to 2000. | 400 | + +## Get User Initials + +```http request +GET https://appwrite.io/v1/avatars/initials +``` + +** Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + +You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Full Name. When empty, current user name or email will be used. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 500 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 500 | +| color | string | Changes text color. By default a random color will be picked and stay will persistent to the given name. | | +| background | string | Changes background color. By default a random color will be picked and stay will persistent to the given name. | | + +## Get QR Code + +```http request +GET https://appwrite.io/v1/avatars/qr +``` + +** 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. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| text | string | **Required** Plain text to be converted to QR code image. | | +| size | integer | QR code size. Pass an integer between 0 to 1000. Defaults to 400. | 400 | +| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 | +| download | boolean | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | | + diff --git a/app/sdks/0.6.2/server-php/docs/database.md b/app/sdks/0.6.2/server-php/docs/database.md new file mode 100644 index 0000000000..bc448bc3ba --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/database.md @@ -0,0 +1,169 @@ +# Database Service + +## List Collections + +```http request +GET https://appwrite.io/v1/database/collections +``` + +** Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project collections. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Collection + +```http request +POST https://appwrite.io/v1/database/collections +``` + +** Create a new Collection. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Collection name. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation. | | + +## Get Collection + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId} +``` + +** Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | + +## Update Collection + +```http request +PUT https://appwrite.io/v1/database/collections/{collectionId} +``` + +** Update collection by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | +| name | string | Collection name. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation. | [] | + +## Delete Collection + +```http request +DELETE https://appwrite.io/v1/database/collections/{collectionId} +``` + +** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | + +## List Documents + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/documents +``` + +** Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| filters | array | Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'. | [] | +| offset | integer | Offset value. Use this value to manage pagination. | 0 | +| limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. | 50 | +| orderField | string | Document field that results will be sorted by. | $id | +| orderType | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC | +| orderCast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string | +| search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. | | + +## Create Document + +```http request +POST https://appwrite.io/v1/database/collections/{collectionId}/documents +``` + +** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/database?sdk=nodejs#createCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| data | object | Document data as JSON object. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| parentDocument | string | Parent document unique ID. Use when you want your new document to be a child of a parent document. | | +| parentProperty | string | Parent document property name. Use when you want your new document to be a child of a parent document. | | +| parentPropertyType | string | Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document. | assign | + +## Get Document + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +** Get document by its unique ID. This endpoint response returns a JSON object with the document data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | + +## Update Document + +```http request +PATCH https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | +| data | object | Document data as JSON object. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Delete Document + +```http request +DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +** Delete document by its unique ID. This endpoint deletes only the parent documents, his attributes and relations to other documents. Child documents **will not** be deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | + diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..795d79157e --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-browser.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getBrowser('aa'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..33879d0179 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getCreditCard('amex'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..dee19dbf04 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-favicon.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getFavicon('https://example.com'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..d70d7e43ec --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-flag.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getFlag('af'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..a46b9fbe37 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-image.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getImage('https://example.com'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..f5e549ace6 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getInitials(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..95b5a6d7b3 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/avatars/get-q-r.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getQR('[TEXT]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/create-collection.md b/app/sdks/0.6.2/server-php/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..276d5049fe --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/create-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->createCollection('[NAME]', [], [], []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/create-document.md b/app/sdks/0.6.2/server-php/docs/examples/database/create-document.md new file mode 100644 index 0000000000..6c32cdf950 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/create-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->createDocument('[COLLECTION_ID]', [], [], []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/delete-collection.md b/app/sdks/0.6.2/server-php/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..4018420188 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/delete-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->deleteCollection('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/delete-document.md b/app/sdks/0.6.2/server-php/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..3ed45d6ee1 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/delete-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/get-collection.md b/app/sdks/0.6.2/server-php/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..a088b24bb6 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/get-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->getCollection('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/get-document.md b/app/sdks/0.6.2/server-php/docs/examples/database/get-document.md new file mode 100644 index 0000000000..d506bd8414 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/get-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/list-collections.md b/app/sdks/0.6.2/server-php/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..4f4aa1b775 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/list-collections.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->listCollections(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/list-documents.md b/app/sdks/0.6.2/server-php/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..359da4ce33 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/list-documents.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->listDocuments('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/update-collection.md b/app/sdks/0.6.2/server-php/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..70d596066a --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/update-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->updateCollection('[COLLECTION_ID]', '[NAME]', [], []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/database/update-document.md b/app/sdks/0.6.2/server-php/docs/examples/database/update-document.md new file mode 100644 index 0000000000..4389034640 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/database/update-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', [], [], []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-anti-virus.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..89a5fb2a7a --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-anti-virus.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getAntiVirus(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-cache.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..e654c26f51 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-cache.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getCache(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-d-b.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..2d37991a3d --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-d-b.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getDB(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-certificates.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..57f2c5793e --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueCertificates(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-functions.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..8ff6510e1c --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-functions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueFunctions(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-logs.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..fa723d7391 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-logs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueLogs(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-tasks.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..b8f1794a1a --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueTasks(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-usage.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..371d02f5b4 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-usage.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueUsage(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..af48a72d06 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueWebhooks(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-storage-local.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..eba15a1652 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-storage-local.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getStorageLocal(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get-time.md b/app/sdks/0.6.2/server-php/docs/examples/health/get-time.md new file mode 100644 index 0000000000..849f499460 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get-time.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getTime(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/health/get.md b/app/sdks/0.6.2/server-php/docs/examples/health/get.md new file mode 100644 index 0000000000..9f1ec8970c --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/health/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->get(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..bb099d31f5 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get-continents.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getContinents(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..87287a5cea --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCountriesEU(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..71a39303da --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCountriesPhones(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..1c8f863a76 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get-countries.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCountries(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..b799bf6b80 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get-currencies.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCurrencies(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..47fdc6eb34 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get-languages.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getLanguages(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/locale/get.md b/app/sdks/0.6.2/server-php/docs/examples/locale/get.md new file mode 100644 index 0000000000..8e11f17689 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/locale/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->get(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/create-file.md b/app/sdks/0.6.2/server-php/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..ba533dd2e7 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/create-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), [], []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/server-php/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..23d4013d22 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/delete-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->deleteFile('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..3064481141 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-download.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFileDownload('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..00cb63696b --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-preview.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFilePreview('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..07b7ab32ba --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file-view.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFileView('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/get-file.md b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..c8b6495f18 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/get-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFile('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/list-files.md b/app/sdks/0.6.2/server-php/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..787c38e320 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/list-files.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->listFiles(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/storage/update-file.md b/app/sdks/0.6.2/server-php/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..7515217b97 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/storage/update-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->updateFile('[FILE_ID]', [], []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/server-php/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..9c88b1bba5 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/create-membership.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/create.md b/app/sdks/0.6.2/server-php/docs/examples/teams/create.md new file mode 100644 index 0000000000..7b0946bc83 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/create.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->create('[NAME]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/server-php/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..ca9d3d57c0 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/delete-membership.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->deleteMembership('[TEAM_ID]', '[INVITE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/delete.md b/app/sdks/0.6.2/server-php/docs/examples/teams/delete.md new file mode 100644 index 0000000000..394a1940fc --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/delete.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->delete('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/server-php/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..56f6d59063 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/get-memberships.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->getMemberships('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/get.md b/app/sdks/0.6.2/server-php/docs/examples/teams/get.md new file mode 100644 index 0000000000..6f0b705707 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->get('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/list.md b/app/sdks/0.6.2/server-php/docs/examples/teams/list.md new file mode 100644 index 0000000000..d17bb7689b --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/list.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->list(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/teams/update.md b/app/sdks/0.6.2/server-php/docs/examples/teams/update.md new file mode 100644 index 0000000000..945001dc36 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/teams/update.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->update('[TEAM_ID]', '[NAME]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/create.md b/app/sdks/0.6.2/server-php/docs/examples/users/create.md new file mode 100644 index 0000000000..53497b4277 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/create.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->create('email@example.com', 'password'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/delete-session.md b/app/sdks/0.6.2/server-php/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..ead6de7549 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/delete-session.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->deleteSession('[USER_ID]', '[SESSION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/delete-sessions.md b/app/sdks/0.6.2/server-php/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..968d788ea7 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/delete-sessions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->deleteSessions('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/get-logs.md b/app/sdks/0.6.2/server-php/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..5602536920 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/get-logs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->getLogs('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/get-prefs.md b/app/sdks/0.6.2/server-php/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..1c9978a0fb --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/get-prefs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->getPrefs('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/get-sessions.md b/app/sdks/0.6.2/server-php/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..fef9f1db74 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/get-sessions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->getSessions('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/get.md b/app/sdks/0.6.2/server-php/docs/examples/users/get.md new file mode 100644 index 0000000000..16c29f9a5a --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->get('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/list.md b/app/sdks/0.6.2/server-php/docs/examples/users/list.md new file mode 100644 index 0000000000..efce771ea1 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/list.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->list(); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/update-prefs.md b/app/sdks/0.6.2/server-php/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..9e9141f8a7 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/update-prefs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->updatePrefs('[USER_ID]', []); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/examples/users/update-status.md b/app/sdks/0.6.2/server-php/docs/examples/users/update-status.md new file mode 100644 index 0000000000..87f9bceb46 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/examples/users/update-status.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->updateStatus('[USER_ID]', '1'); \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/docs/health.md b/app/sdks/0.6.2/server-php/docs/health.md new file mode 100644 index 0000000000..38b814b633 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/health.md @@ -0,0 +1,96 @@ +# Health Service + +## Get HTTP + +```http request +GET https://appwrite.io/v1/health +``` + +** Check the Appwrite HTTP server is up and responsive. ** + +## Get Anti virus + +```http request +GET https://appwrite.io/v1/health/anti-virus +``` + +** Check the Appwrite Anti Virus server is up and connection is successful. ** + +## Get Cache + +```http request +GET https://appwrite.io/v1/health/cache +``` + +** Check the Appwrite in-memory cache server is up and connection is successful. ** + +## Get DB + +```http request +GET https://appwrite.io/v1/health/db +``` + +** Check the Appwrite database server is up and connection is successful. ** + +## Get Certificate Queue + +```http request +GET https://appwrite.io/v1/health/queue/certificates +``` + +** Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. ** + +## Get Functions Queue + +```http request +GET https://appwrite.io/v1/health/queue/functions +``` + +## Get Logs Queue + +```http request +GET https://appwrite.io/v1/health/queue/logs +``` + +** Get the number of logs that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Tasks Queue + +```http request +GET https://appwrite.io/v1/health/queue/tasks +``` + +** Get the number of tasks that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Usage Queue + +```http request +GET https://appwrite.io/v1/health/queue/usage +``` + +** Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Webhooks Queue + +```http request +GET https://appwrite.io/v1/health/queue/webhooks +``` + +** Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Local Storage + +```http request +GET https://appwrite.io/v1/health/storage/local +``` + +** Check the Appwrite local storage device is up and connection is successful. ** + +## Get Time + +```http request +GET https://appwrite.io/v1/health/time +``` + +** Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. ** + diff --git a/app/sdks/0.6.2/server-php/docs/locale.md b/app/sdks/0.6.2/server-php/docs/locale.md new file mode 100644 index 0000000000..1591f4a1a8 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/locale.md @@ -0,0 +1,60 @@ +# Locale Service + +## Get User Locale + +```http request +GET https://appwrite.io/v1/locale +``` + +** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + +([IP Geolocation by DB-IP](https://db-ip.com)) ** + +## List Continents + +```http request +GET https://appwrite.io/v1/locale/continents +``` + +** List of all continents. You can use the locale header to get the data in a supported language. ** + +## List Countries + +```http request +GET https://appwrite.io/v1/locale/countries +``` + +** List of all countries. You can use the locale header to get the data in a supported language. ** + +## List EU Countries + +```http request +GET https://appwrite.io/v1/locale/countries/eu +``` + +** List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. ** + +## List Countries Phone Codes + +```http request +GET https://appwrite.io/v1/locale/countries/phones +``` + +** List of all countries phone codes. You can use the locale header to get the data in a supported language. ** + +## List Currencies + +```http request +GET https://appwrite.io/v1/locale/currencies +``` + +** List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. ** + +## List Languages + +```http request +GET https://appwrite.io/v1/locale/languages +``` + +** List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. ** + diff --git a/app/sdks/0.6.2/server-php/docs/storage.md b/app/sdks/0.6.2/server-php/docs/storage.md new file mode 100644 index 0000000000..2138f901a8 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/storage.md @@ -0,0 +1,127 @@ +# Storage Service + +## List Files + +```http request +GET https://appwrite.io/v1/storage/files +``` + +** Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project files. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create File + +```http request +POST https://appwrite.io/v1/storage/files +``` + +** Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| file | file | Binary File. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Get File + +```http request +GET https://appwrite.io/v1/storage/files/{fileId} +``` + +** Get file by its unique ID. This endpoint response returns a JSON object with the file metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Update File + +```http request +PUT https://appwrite.io/v1/storage/files/{fileId} +``` + +** Update file by its unique ID. Only users with write permissions have access to update this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Delete File + +```http request +DELETE https://appwrite.io/v1/storage/files/{fileId} +``` + +** Delete a file by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Get File for Download + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/download +``` + +** Get file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Get File Preview + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/preview +``` + +** Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID | | +| width | integer | Resize preview image width, Pass an integer between 0 to 4000. | 0 | +| height | integer | Resize preview image height, Pass an integer between 0 to 4000. | 0 | +| quality | integer | Preview image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | +| background | string | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. | | +| output | string | Output format type (jpeg, jpg, png, gif and webp). | | + +## Get File for View + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/view +``` + +** Get file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | +| as | string | Choose a file format to convert your file to. Currently you can only convert word and pdf files to pdf or txt. This option is currently experimental only, use at your own risk. | | + diff --git a/app/sdks/0.6.2/server-php/docs/teams.md b/app/sdks/0.6.2/server-php/docs/teams.md new file mode 100644 index 0000000000..ff569c0d68 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/teams.md @@ -0,0 +1,132 @@ +# Teams Service + +## List Teams + +```http request +GET https://appwrite.io/v1/teams +``` + +** Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project teams. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Team + +```http request +POST https://appwrite.io/v1/teams +``` + +** Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Team name. | | +| roles | array | Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). | ["owner"] | + +## Get Team + +```http request +GET https://appwrite.io/v1/teams/{teamId} +``` + +** Get team by its unique ID. All team members have read access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | + +## Update Team + +```http request +PUT https://appwrite.io/v1/teams/{teamId} +``` + +** Update team by its unique ID. Only team owners have write access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| name | string | Team name. | | + +## Delete Team + +```http request +DELETE https://appwrite.io/v1/teams/{teamId} +``` + +** Delete team by its unique ID. Only team owners have write access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | + +## Get Team Memberships + +```http request +GET https://appwrite.io/v1/teams/{teamId}/memberships +``` + +** Get team members by the team unique ID. All team members have read access for this list of resources. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Team Membership + +```http request +POST https://appwrite.io/v1/teams/{teamId}/memberships +``` + +** Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn't exist in the project it will be created automatically. + +Use the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + +Please note that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| email | string | New team member email. | | +| name | string | New team member name. | | +| roles | array | 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). | | +| url | string | 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. | | + +## Delete Team Membership + +```http request +DELETE https://appwrite.io/v1/teams/{teamId}/memberships/{inviteId} +``` + +** This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if he didn't accept it. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| inviteId | string | **Required** Invite unique ID. | | + diff --git a/app/sdks/0.6.2/server-php/docs/users.md b/app/sdks/0.6.2/server-php/docs/users.md new file mode 100644 index 0000000000..fd83fa4ad6 --- /dev/null +++ b/app/sdks/0.6.2/server-php/docs/users.md @@ -0,0 +1,150 @@ +# Users Service + +## List Users + +```http request +GET https://appwrite.io/v1/users +``` + +** Get a list of all the project users. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create User + +```http request +POST https://appwrite.io/v1/users +``` + +** Create a new user. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| password | string | User password. Must be between 6 to 32 chars. | | +| name | string | User name. | | + +## Get User + +```http request +GET https://appwrite.io/v1/users/{userId} +``` + +** Get user by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Get User Logs + +```http request +GET https://appwrite.io/v1/users/{userId}/logs +``` + +** Get user activity logs list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Get User Preferences + +```http request +GET https://appwrite.io/v1/users/{userId}/prefs +``` + +** Get user preferences by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Update User Preferences + +```http request +PATCH https://appwrite.io/v1/users/{userId}/prefs +``` + +** Update user preferences by its unique ID. You can pass only the specific settings you wish to update. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | +| prefs | object | Prefs key-value JSON object. | | + +## Get User Sessions + +```http request +GET https://appwrite.io/v1/users/{userId}/sessions +``` + +** Get user sessions list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Delete User Sessions + +```http request +DELETE https://appwrite.io/v1/users/{userId}/sessions +``` + +** Delete all user sessions by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Delete User Session + +```http request +DELETE https://appwrite.io/v1/users/{userId}/sessions/{sessionId} +``` + +** Delete user sessions by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | +| sessionId | string | **Required** User unique session ID. | | + +## Update User Status + +```http request +PATCH https://appwrite.io/v1/users/{userId}/status +``` + +** Update user status by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | +| status | string | User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0 | | + diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Client.php b/app/sdks/0.6.2/server-php/src/Appwrite/Client.php new file mode 100644 index 0000000000..b87c929b9b --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Client.php @@ -0,0 +1,240 @@ + '', + 'x-sdk-version' => 'appwrite:php:1.1.0', + ]; + + /** + * SDK constructor. + */ + public function __construct() + { + } + + /** + * Set Project + * + * Your project ID + * + * @param string $value + * + * @return Client + */ + public function setProject($value) + { + $this->addHeader('X-Appwrite-Project', $value); + + return $this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string $value + * + * @return Client + */ + public function setKey($value) + { + $this->addHeader('X-Appwrite-Key', $value); + + return $this; + } + + /** + * Set Locale + * + * @param string $value + * + * @return Client + */ + public function setLocale($value) + { + $this->addHeader('X-Appwrite-Locale', $value); + + return $this; + } + + + /*** + * @param bool $status + * @return $this + */ + public function setSelfSigned($status = true) + { + $this->selfSigned = $status; + + return $this; + } + + /*** + * @param $endpoint + * @return $this + */ + public function setEndpoint($endpoint) + { + $this->endpoint = $endpoint; + + return $this; + } + + /** + * @param $key + * @param $value + */ + public function addHeader($key, $value) + { + $this->headers[strtolower($key)] = strtolower($value); + + return $this; + } + + /** + * Call + * + * Make an API call + * + * @param string $method + * @param string $path + * @param array $params + * @param array $headers + * @return array|string + * @throws Exception + */ + public function call($method, $path = '', $headers = array(), array $params = array()) + { + $headers = array_merge($this->headers, $headers); + $ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); + $responseHeaders = []; + $responseStatus = -1; + $responseType = ''; + $responseBody = ''; + + switch ($headers['content-type']) { + case 'application/json': + $query = json_encode($params); + break; + + case 'multipart/form-data': + $query = $this->flatten($params); + break; + + default: + $query = http_build_query($params); + break; + } + + foreach ($headers as $i => $header) { + $headers[] = $i . ':' . $header; + unset($headers[$i]); + } + + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_USERAGENT, php_uname('s') . '-' . php_uname('r') . ':php-' . phpversion()); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { + $len = strlen($header); + $header = explode(':', strtolower($header), 2); + + if (count($header) < 2) { // ignore invalid headers + return $len; + } + + $responseHeaders[strtolower(trim($header[0]))] = trim($header[1]); + + return $len; + }); + + if($method != self::METHOD_GET) { + curl_setopt($ch, CURLOPT_POSTFIELDS, $query); + } + + // Allow self signed certificates + if($this->selfSigned) { + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + } + + $responseBody = curl_exec($ch); + $responseType = $responseHeaders['content-type'] ?? ''; + $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + switch(substr($responseType, 0, strpos($responseType, ';'))) { + case 'application/json': + $responseBody = json_decode($responseBody, true); + break; + } + + if ((curl_errno($ch)/* || 200 != $responseStatus*/)) { + throw new Exception(curl_error($ch) . ' with status code ' . $responseStatus, $responseStatus); + } + + curl_close($ch); + + return $responseBody; + } + + /** + * Flatten params array to PHP multiple format + * + * @param array $data + * @param string $prefix + * @return array + */ + protected function flatten(array $data, $prefix = '') { + $output = []; + + foreach($data as $key => $value) { + $finalKey = $prefix ? "{$prefix}[{$key}]" : $key; + + if (is_array($value)) { + $output += $this->flatten($value, $finalKey); // @todo: handle name collision here if needed + } + else { + $output[$finalKey] = $value; + } + } + + return $output; + } +} diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Service.php b/app/sdks/0.6.2/server-php/src/Appwrite/Service.php new file mode 100644 index 0000000000..ea3ad92e2d --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Service.php @@ -0,0 +1,19 @@ +client = $client; + } +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Avatars.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Avatars.php new file mode 100644 index 0000000000..3ebbb357f8 --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Avatars.php @@ -0,0 +1,213 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param string $code + * @param int $width + * @param int $height + * @param int $quality + * @throws Exception + * @return array + */ + public function getCreditCard(string $code, int $width = 100, int $height = 100, int $quality = 100):array + { + $path = str_replace(['{code}'], [$code], '/avatars/credit-cards/{code}'); + $params = []; + + $params['width'] = $width; + $params['height'] = $height; + $params['quality'] = $quality; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of a any remote + * website URL. + * + * @param string $url + * @throws Exception + * @return array + */ + public function getFavicon(string $url):array + { + $path = str_replace([], [], '/avatars/favicon'); + $params = []; + + $params['url'] = $url; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param string $code + * @param int $width + * @param int $height + * @param int $quality + * @throws Exception + * @return array + */ + public function getFlag(string $code, int $width = 100, int $height = 100, int $quality = 100):array + { + $path = str_replace(['{code}'], [$code], '/avatars/flags/{code}'); + $params = []; + + $params['width'] = $width; + $params['height'] = $height; + $params['quality'] = $quality; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param string $url + * @param int $width + * @param int $height + * @throws Exception + * @return array + */ + public function getImage(string $url, int $width = 400, int $height = 400):array + { + $path = str_replace([], [], '/avatars/image'); + $params = []; + + $params['url'] = $url; + $params['width'] = $width; + $params['height'] = $height; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param string $name + * @param int $width + * @param int $height + * @param string $color + * @param string $background + * @throws Exception + * @return array + */ + public function getInitials(string $name = '', int $width = 500, int $height = 500, string $color = '', string $background = ''):array + { + $path = str_replace([], [], '/avatars/initials'); + $params = []; + + $params['name'] = $name; + $params['width'] = $width; + $params['height'] = $height; + $params['color'] = $color; + $params['background'] = $background; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get QR Code + * + * 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. + * + * @param string $text + * @param int $size + * @param int $margin + * @param boolean $download + * @throws Exception + * @return array + */ + public function getQR(string $text, int $size = 400, int $margin = 1, boolean $download = false):array + { + $path = str_replace([], [], '/avatars/qr'); + $params = []; + + $params['text'] = $text; + $params['size'] = $size; + $params['margin'] = $margin; + $params['download'] = $download; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Database.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Database.php new file mode 100644 index 0000000000..bc5266f17e --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Database.php @@ -0,0 +1,280 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Collection + * + * Create a new Collection. + * + * @param string $name + * @param array $read + * @param array $write + * @param array $rules + * @throws Exception + * @return array + */ + public function createCollection(string $name, array $read, array $write, array $rules):array + { + $path = str_replace([], [], '/database/collections'); + $params = []; + + $params['name'] = $name; + $params['read'] = $read; + $params['write'] = $write; + $params['rules'] = $rules; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string $collectionId + * @throws Exception + * @return array + */ + public function getCollection(string $collectionId):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param string $collectionId + * @param string $name + * @param array $read + * @param array $write + * @param array $rules + * @throws Exception + * @return array + */ + public function updateCollection(string $collectionId, string $name, array $read, array $write, array $rules = []):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); + $params = []; + + $params['name'] = $name; + $params['read'] = $read; + $params['write'] = $write; + $params['rules'] = $rules; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string $collectionId + * @throws Exception + * @return array + */ + public function deleteCollection(string $collectionId):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param string $collectionId + * @param array $filters + * @param int $offset + * @param int $limit + * @param string $orderField + * @param string $orderType + * @param string $orderCast + * @param string $search + * @throws Exception + * @return array + */ + public function listDocuments(string $collectionId, array $filters = [], int $offset = 0, int $limit = 50, string $orderField = '$id', string $orderType = 'ASC', string $orderCast = 'string', string $search = ''):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents'); + $params = []; + + $params['filters'] = $filters; + $params['offset'] = $offset; + $params['limit'] = $limit; + $params['orderField'] = $orderField; + $params['orderType'] = $orderType; + $params['orderCast'] = $orderCast; + $params['search'] = $search; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param string $collectionId + * @param array $data + * @param array $read + * @param array $write + * @param string $parentDocument + * @param string $parentProperty + * @param string $parentPropertyType + * @throws Exception + * @return array + */ + public function createDocument(string $collectionId, array $data, array $read, array $write, string $parentDocument = '', string $parentProperty = '', string $parentPropertyType = 'assign'):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents'); + $params = []; + + $params['data'] = $data; + $params['read'] = $read; + $params['write'] = $write; + $params['parentDocument'] = $parentDocument; + $params['parentProperty'] = $parentProperty; + $params['parentPropertyType'] = $parentPropertyType; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param string $collectionId + * @param string $documentId + * @throws Exception + * @return array + */ + public function getDocument(string $collectionId, string $documentId):array + { + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Document + * + * @param string $collectionId + * @param string $documentId + * @param array $data + * @param array $read + * @param array $write + * @throws Exception + * @return array + */ + public function updateDocument(string $collectionId, string $documentId, array $data, array $read, array $write):array + { + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); + $params = []; + + $params['data'] = $data; + $params['read'] = $read; + $params['write'] = $write; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, his attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param string $collectionId + * @param string $documentId + * @throws Exception + * @return array + */ + public function deleteDocument(string $collectionId, string $documentId):array + { + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Health.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Health.php new file mode 100644 index 0000000000..d39f1f406d --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Health.php @@ -0,0 +1,250 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getAntiVirus():array + { + $path = str_replace([], [], '/health/anti-virus'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return array + */ + public function getCache():array + { + $path = str_replace([], [], '/health/cache'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getDB():array + { + $path = str_replace([], [], '/health/db'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return array + */ + public function getQueueCertificates():array + { + $path = str_replace([], [], '/health/queue/certificates'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Functions Queue + * + * @throws Exception + * @return array + */ + public function getQueueFunctions():array + { + $path = str_replace([], [], '/health/queue/functions'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueLogs():array + { + $path = str_replace([], [], '/health/queue/logs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueTasks():array + { + $path = str_replace([], [], '/health/queue/tasks'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueUsage():array + { + $path = str_replace([], [], '/health/queue/usage'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueWebhooks():array + { + $path = str_replace([], [], '/health/queue/webhooks'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getStorageLocal():array + { + $path = str_replace([], [], '/health/storage/local'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return array + */ + public function getTime():array + { + $path = str_replace([], [], '/health/time'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Locale.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Locale.php new file mode 100644 index 0000000000..93318d57cb --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Locale.php @@ -0,0 +1,156 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + public function getContinents():array + { + $path = str_replace([], [], '/locale/continents'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + public function getCountries():array + { + $path = str_replace([], [], '/locale/countries'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return array + */ + public function getCountriesEU():array + { + $path = str_replace([], [], '/locale/countries/eu'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return array + */ + public function getCountriesPhones():array + { + $path = str_replace([], [], '/locale/countries/phones'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return array + */ + public function getCurrencies():array + { + $path = str_replace([], [], '/locale/currencies'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return array + */ + public function getLanguages():array + { + $path = str_replace([], [], '/locale/languages'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Storage.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Storage.php new file mode 100644 index 0000000000..09b74fbf8f --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Storage.php @@ -0,0 +1,212 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param \CurlFile $file + * @param array $read + * @param array $write + * @throws Exception + * @return array + */ + public function createFile(\CurlFile $file, array $read, array $write):array + { + $path = str_replace([], [], '/storage/files'); + $params = []; + + $params['file'] = $file; + $params['read'] = $read; + $params['write'] = $write; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'multipart/form-data', + ], $params); + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string $fileId + * @throws Exception + * @return array + */ + public function getFile(string $fileId):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param string $fileId + * @param array $read + * @param array $write + * @throws Exception + * @return array + */ + public function updateFile(string $fileId, array $read, array $write):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); + $params = []; + + $params['read'] = $read; + $params['write'] = $write; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string $fileId + * @throws Exception + * @return array + */ + public function deleteFile(string $fileId):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string $fileId + * @throws Exception + * @return array + */ + public function getFileDownload(string $fileId):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/download'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param string $fileId + * @param int $width + * @param int $height + * @param int $quality + * @param string $background + * @param string $output + * @throws Exception + * @return array + */ + public function getFilePreview(string $fileId, int $width = 0, int $height = 0, int $quality = 100, string $background = '', string $output = ''):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/preview'); + $params = []; + + $params['width'] = $width; + $params['height'] = $height; + $params['quality'] = $quality; + $params['background'] = $background; + $params['output'] = $output; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param string $fileId + * @param string $as + * @throws Exception + * @return array + */ + public function getFileView(string $fileId, string $as = ''):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/view'); + $params = []; + + $params['as'] = $as; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Teams.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Teams.php new file mode 100644 index 0000000000..16da2a215f --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Teams.php @@ -0,0 +1,223 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param string $name + * @param array $roles + * @throws Exception + * @return array + */ + public function create(string $name, array $roles = ["owner"]):array + { + $path = str_replace([], [], '/teams'); + $params = []; + + $params['name'] = $name; + $params['roles'] = $roles; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param string $teamId + * @throws Exception + * @return array + */ + public function get(string $teamId):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string $teamId + * @param string $name + * @throws Exception + * @return array + */ + public function update(string $teamId, string $name):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $params = []; + + $params['name'] = $name; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string $teamId + * @throws Exception + * @return array + */ + public function delete(string $teamId):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param string $teamId + * @param string $search + * @param int $limit + * @param int $offset + * @param string $orderType + * @throws Exception + * @return array + */ + public function getMemberships(string $teamId, string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); + $params = []; + + $params['search'] = $search; + $params['limit'] = $limit; + $params['offset'] = $offset; + $params['orderType'] = $orderType; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param string $teamId + * @param string $email + * @param array $roles + * @param string $url + * @param string $name + * @throws Exception + * @return array + */ + public function createMembership(string $teamId, string $email, array $roles, string $url, string $name = ''):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); + $params = []; + + $params['email'] = $email; + $params['name'] = $name; + $params['roles'] = $roles; + $params['url'] = $url; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if he didn't accept it. + * + * @param string $teamId + * @param string $inviteId + * @throws Exception + * @return array + */ + public function deleteMembership(string $teamId, string $inviteId):array + { + $path = str_replace(['{teamId}', '{inviteId}'], [$teamId, $inviteId], '/teams/{teamId}/memberships/{inviteId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-php/src/Appwrite/Services/Users.php b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Users.php new file mode 100644 index 0000000000..b2b4f576cc --- /dev/null +++ b/app/sdks/0.6.2/server-php/src/Appwrite/Services/Users.php @@ -0,0 +1,230 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create User + * + * Create a new user. + * + * @param string $email + * @param string $password + * @param string $name + * @throws Exception + * @return array + */ + public function create(string $email, string $password, string $name = ''):array + { + $path = str_replace([], [], '/users'); + $params = []; + + $params['email'] = $email; + $params['password'] = $password; + $params['name'] = $name; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User + * + * Get user by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function get(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function getLogs(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/logs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function getPrefs(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param string $userId + * @param array $prefs + * @throws Exception + * @return array + */ + public function updatePrefs(string $userId, array $prefs):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); + $params = []; + + $params['prefs'] = $prefs; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function getSessions(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function deleteSessions(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param string $userId + * @param string $sessionId + * @throws Exception + * @return array + */ + public function deleteSession(string $userId, string $sessionId):array + { + $path = str_replace(['{userId}', '{sessionId}'], [$userId, $sessionId], '/users/{userId}/sessions/{sessionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param string $userId + * @param string $status + * @throws Exception + * @return array + */ + public function updateStatus(string $userId, string $status):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/status'); + $params = []; + + $params['status'] = $status; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/CHANGELOG.md b/app/sdks/0.6.2/server-python/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/server-python/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/LICENSE b/app/sdks/0.6.2/server-python/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/server-python/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/README.md b/app/sdks/0.6.2/server-python/README.md new file mode 100644 index 0000000000..04421ff241 --- /dev/null +++ b/app/sdks/0.6.2/server-python/README.md @@ -0,0 +1,30 @@ +# Appwrite Python SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.6.2. 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 Python 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [PyPI](https://pypi.org/): + +```bash +pip install appwrite +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. diff --git a/app/sdks/0.6.2/server-python/appwrite/__init__.py b/app/sdks/0.6.2/server-python/appwrite/__init__.py new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/appwrite/client.py b/app/sdks/0.6.2/server-python/appwrite/client.py new file mode 100644 index 0000000000..8989fccb9c --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/client.py @@ -0,0 +1,106 @@ +import io +import requests + +class Client: + def __init__(self): + self._self_signed = False + self._endpoint = 'https://appwrite.io/v1' + self._global_headers = { + 'content-type': '', + 'x-sdk-version': 'appwrite:python:0.0.6', + } + + def set_self_signed(self, status=True): + self._self_signed = status + return self + + def set_endpoint(self, endpoint): + self._endpoint = endpoint + return self + + def add_header(self, key, value): + self._global_headers[key.lower()] = value.lower() + return self + + def set_project(self, value): + """Your project ID""" + + self._global_headers['x-appwrite-project'] = value.lower() + return self + + def set_key(self, value): + """Your secret API key""" + + self._global_headers['x-appwrite-key'] = value.lower() + return self + + def set_locale(self, value): + self._global_headers['x-appwrite-locale'] = value.lower() + return self + + def call(self, method, path='', headers=None, params=None): + if headers is None: + headers = {} + + if params is None: + params = {} + + data = {} + json = {} + files = {} + + headers = {**self._global_headers, **headers} + + if method != 'get': + data = params + params = {} + + if headers['content-type'].startswith('application/json'): + json = data + data = {} + + if headers['content-type'].startswith('multipart/form-data'): + del headers['content-type'] + + for key in data.copy(): + if isinstance(data[key], io.BufferedIOBase): + files[key] = data[key] + del data[key] + + response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554 + method=method, + url=self._endpoint + path, + params=self.flatten(params), + data=self.flatten(data), + json=json, + files=files, + headers=headers, + verify=self._self_signed, + ) + + response.raise_for_status() + + content_type = response.headers['Content-Type'] + + if content_type.startswith('application/json'): + return response.json() + + return response._content + + def flatten(self, data, prefix=''): + output = {} + i = 0 + + for key in data: + value = data[key] if isinstance(data, dict) else key + finalKey = prefix + '[' + key +']' if prefix else key + finalKey = prefix + '[' + str(i) +']' if isinstance(data, list) else finalKey + i += 1 + + if isinstance(value, list) or isinstance(value, dict): + output = {**output, **self.flatten(value, finalKey)} + else: + output[finalKey] = value + + return output + diff --git a/app/sdks/0.6.2/server-python/appwrite/service.py b/app/sdks/0.6.2/server-python/appwrite/service.py new file mode 100644 index 0000000000..b5b60e6c22 --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/service.py @@ -0,0 +1,6 @@ +from .client import Client + + +class Service: + def __init__(self, client: Client): + self.client = client diff --git a/app/sdks/0.6.2/server-python/appwrite/services/__init__.py b/app/sdks/0.6.2/server-python/appwrite/services/__init__.py new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/appwrite/services/avatars.py b/app/sdks/0.6.2/server-python/appwrite/services/avatars.py new file mode 100644 index 0000000000..12341106d0 --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/avatars.py @@ -0,0 +1,102 @@ +from ..service import Service + + +class Avatars(Service): + + def __init__(self, client): + super(Avatars, self).__init__(client) + + def get_browser(self, code, width=100, height=100, quality=100): + """Get Browser Icon""" + + params = {} + path = '/avatars/browsers/{code}' + path = path.replace('{code}', code) + params['width'] = width + params['height'] = height + params['quality'] = quality + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_credit_card(self, code, width=100, height=100, quality=100): + """Get Credit Card Icon""" + + params = {} + path = '/avatars/credit-cards/{code}' + path = path.replace('{code}', code) + params['width'] = width + params['height'] = height + params['quality'] = quality + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_favicon(self, url): + """Get Favicon""" + + params = {} + path = '/avatars/favicon' + params['url'] = url + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_flag(self, code, width=100, height=100, quality=100): + """Get Country Flag""" + + params = {} + path = '/avatars/flags/{code}' + path = path.replace('{code}', code) + params['width'] = width + params['height'] = height + params['quality'] = quality + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_image(self, url, width=400, height=400): + """Get Image from URL""" + + params = {} + path = '/avatars/image' + params['url'] = url + params['width'] = width + params['height'] = height + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_initials(self, name='', width=500, height=500, color='', background=''): + """Get User Initials""" + + params = {} + path = '/avatars/initials' + params['name'] = name + params['width'] = width + params['height'] = height + params['color'] = color + params['background'] = background + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_q_r(self, text, size=400, margin=1, download=False): + """Get QR Code""" + + params = {} + path = '/avatars/qr' + params['text'] = text + params['size'] = size + params['margin'] = margin + params['download'] = download + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/appwrite/services/database.py b/app/sdks/0.6.2/server-python/appwrite/services/database.py new file mode 100644 index 0000000000..7611cf25ba --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/database.py @@ -0,0 +1,146 @@ +from ..service import Service + + +class Database(Service): + + def __init__(self, client): + super(Database, self).__init__(client) + + def list_collections(self, search='', limit=25, offset=0, order_type='ASC'): + """List Collections""" + + params = {} + path = '/database/collections' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_collection(self, name, read, write, rules): + """Create Collection""" + + params = {} + path = '/database/collections' + params['name'] = name + params['read'] = read + params['write'] = write + params['rules'] = rules + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get_collection(self, collection_id): + """Get Collection""" + + params = {} + path = '/database/collections/{collectionId}' + path = path.replace('{collectionId}', collection_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_collection(self, collection_id, name, read, write, rules=[]): + """Update Collection""" + + params = {} + path = '/database/collections/{collectionId}' + path = path.replace('{collectionId}', collection_id) + params['name'] = name + params['read'] = read + params['write'] = write + params['rules'] = rules + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete_collection(self, collection_id): + """Delete Collection""" + + params = {} + path = '/database/collections/{collectionId}' + path = path.replace('{collectionId}', collection_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def list_documents(self, collection_id, filters=[], offset=0, limit=50, order_field='$id', order_type='ASC', order_cast='string', search=''): + """List Documents""" + + params = {} + path = '/database/collections/{collectionId}/documents' + path = path.replace('{collectionId}', collection_id) + params['filters'] = filters + params['offset'] = offset + params['limit'] = limit + params['orderField'] = order_field + params['orderType'] = order_type + params['orderCast'] = order_cast + params['search'] = search + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_document(self, collection_id, data, read, write, parent_document='', parent_property='', parent_property_type='assign'): + """Create Document""" + + params = {} + path = '/database/collections/{collectionId}/documents' + path = path.replace('{collectionId}', collection_id) + params['data'] = data + params['read'] = read + params['write'] = write + params['parentDocument'] = parent_document + params['parentProperty'] = parent_property + params['parentPropertyType'] = parent_property_type + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get_document(self, collection_id, document_id): + """Get Document""" + + params = {} + path = '/database/collections/{collectionId}/documents/{documentId}' + path = path.replace('{collectionId}', collection_id) + path = path.replace('{documentId}', document_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_document(self, collection_id, document_id, data, read, write): + """Update Document""" + + params = {} + path = '/database/collections/{collectionId}/documents/{documentId}' + path = path.replace('{collectionId}', collection_id) + path = path.replace('{documentId}', document_id) + params['data'] = data + params['read'] = read + params['write'] = write + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) + + def delete_document(self, collection_id, document_id): + """Delete Document""" + + params = {} + path = '/database/collections/{collectionId}/documents/{documentId}' + path = path.replace('{collectionId}', collection_id) + path = path.replace('{documentId}', document_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/appwrite/services/health.py b/app/sdks/0.6.2/server-python/appwrite/services/health.py new file mode 100644 index 0000000000..5e08ebe6e8 --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/health.py @@ -0,0 +1,127 @@ +from ..service import Service + + +class Health(Service): + + def __init__(self, client): + super(Health, self).__init__(client) + + def get(self): + """Get HTTP""" + + params = {} + path = '/health' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_anti_virus(self): + """Get Anti virus""" + + params = {} + path = '/health/anti-virus' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_cache(self): + """Get Cache""" + + params = {} + path = '/health/cache' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_d_b(self): + """Get DB""" + + params = {} + path = '/health/db' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_certificates(self): + """Get Certificate Queue""" + + params = {} + path = '/health/queue/certificates' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_functions(self): + """Get Functions Queue""" + + params = {} + path = '/health/queue/functions' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_logs(self): + """Get Logs Queue""" + + params = {} + path = '/health/queue/logs' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_tasks(self): + """Get Tasks Queue""" + + params = {} + path = '/health/queue/tasks' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_usage(self): + """Get Usage Queue""" + + params = {} + path = '/health/queue/usage' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_webhooks(self): + """Get Webhooks Queue""" + + params = {} + path = '/health/queue/webhooks' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_storage_local(self): + """Get Local Storage""" + + params = {} + path = '/health/storage/local' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_time(self): + """Get Time""" + + params = {} + path = '/health/time' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/appwrite/services/locale.py b/app/sdks/0.6.2/server-python/appwrite/services/locale.py new file mode 100644 index 0000000000..fe3ad5e988 --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/locale.py @@ -0,0 +1,77 @@ +from ..service import Service + + +class Locale(Service): + + def __init__(self, client): + super(Locale, self).__init__(client) + + def get(self): + """Get User Locale""" + + params = {} + path = '/locale' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_continents(self): + """List Continents""" + + params = {} + path = '/locale/continents' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_countries(self): + """List Countries""" + + params = {} + path = '/locale/countries' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_countries_e_u(self): + """List EU Countries""" + + params = {} + path = '/locale/countries/eu' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_countries_phones(self): + """List Countries Phone Codes""" + + params = {} + path = '/locale/countries/phones' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_currencies(self): + """List Currencies""" + + params = {} + path = '/locale/currencies' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_languages(self): + """List Languages""" + + params = {} + path = '/locale/languages' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/appwrite/services/storage.py b/app/sdks/0.6.2/server-python/appwrite/services/storage.py new file mode 100644 index 0000000000..7e2a986f6e --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/storage.py @@ -0,0 +1,108 @@ +from ..service import Service + + +class Storage(Service): + + def __init__(self, client): + super(Storage, self).__init__(client) + + def list_files(self, search='', limit=25, offset=0, order_type='ASC'): + """List Files""" + + params = {} + path = '/storage/files' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_file(self, file, read, write): + """Create File""" + + params = {} + path = '/storage/files' + params['file'] = file + params['read'] = read + params['write'] = write + + return self.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, params) + + def get_file(self, file_id): + """Get File""" + + params = {} + path = '/storage/files/{fileId}' + path = path.replace('{fileId}', file_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_file(self, file_id, read, write): + """Update File""" + + params = {} + path = '/storage/files/{fileId}' + path = path.replace('{fileId}', file_id) + params['read'] = read + params['write'] = write + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete_file(self, file_id): + """Delete File""" + + params = {} + path = '/storage/files/{fileId}' + path = path.replace('{fileId}', file_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def get_file_download(self, file_id): + """Get File for Download""" + + params = {} + path = '/storage/files/{fileId}/download' + path = path.replace('{fileId}', file_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_file_preview(self, file_id, width=0, height=0, quality=100, background='', output=''): + """Get File Preview""" + + params = {} + path = '/storage/files/{fileId}/preview' + path = path.replace('{fileId}', file_id) + params['width'] = width + params['height'] = height + params['quality'] = quality + params['background'] = background + params['output'] = output + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_file_view(self, file_id, xas=''): + """Get File for View""" + + params = {} + path = '/storage/files/{fileId}/view' + path = path.replace('{fileId}', file_id) + params['as'] = xas + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/appwrite/services/teams.py b/app/sdks/0.6.2/server-python/appwrite/services/teams.py new file mode 100644 index 0000000000..72c6a6e9d3 --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/teams.py @@ -0,0 +1,109 @@ +from ..service import Service + + +class Teams(Service): + + def __init__(self, client): + super(Teams, self).__init__(client) + + def list(self, search='', limit=25, offset=0, order_type='ASC'): + """List Teams""" + + params = {} + path = '/teams' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create(self, name, roles=[]): + """Create Team""" + + params = {} + path = '/teams' + params['name'] = name + params['roles'] = roles + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get(self, team_id): + """Get Team""" + + params = {} + path = '/teams/{teamId}' + path = path.replace('{teamId}', team_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update(self, team_id, name): + """Update Team""" + + params = {} + path = '/teams/{teamId}' + path = path.replace('{teamId}', team_id) + params['name'] = name + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete(self, team_id): + """Delete Team""" + + params = {} + path = '/teams/{teamId}' + path = path.replace('{teamId}', team_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def get_memberships(self, team_id, search='', limit=25, offset=0, order_type='ASC'): + """Get Team Memberships""" + + params = {} + path = '/teams/{teamId}/memberships' + path = path.replace('{teamId}', team_id) + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_membership(self, team_id, email, roles, url, name=''): + """Create Team Membership""" + + params = {} + path = '/teams/{teamId}/memberships' + path = path.replace('{teamId}', team_id) + params['email'] = email + params['name'] = name + params['roles'] = roles + params['url'] = url + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def delete_membership(self, team_id, invite_id): + """Delete Team Membership""" + + params = {} + path = '/teams/{teamId}/memberships/{inviteId}' + path = path.replace('{teamId}', team_id) + path = path.replace('{inviteId}', invite_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/appwrite/services/users.py b/app/sdks/0.6.2/server-python/appwrite/services/users.py new file mode 100644 index 0000000000..2608f07a50 --- /dev/null +++ b/app/sdks/0.6.2/server-python/appwrite/services/users.py @@ -0,0 +1,125 @@ +from ..service import Service + + +class Users(Service): + + def __init__(self, client): + super(Users, self).__init__(client) + + def list(self, search='', limit=25, offset=0, order_type='ASC'): + """List Users""" + + params = {} + path = '/users' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create(self, email, password, name=''): + """Create User""" + + params = {} + path = '/users' + params['email'] = email + params['password'] = password + params['name'] = name + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get(self, user_id): + """Get User""" + + params = {} + path = '/users/{userId}' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_logs(self, user_id): + """Get User Logs""" + + params = {} + path = '/users/{userId}/logs' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_prefs(self, user_id): + """Get User Preferences""" + + params = {} + path = '/users/{userId}/prefs' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_prefs(self, user_id, prefs): + """Update User Preferences""" + + params = {} + path = '/users/{userId}/prefs' + path = path.replace('{userId}', user_id) + params['prefs'] = prefs + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) + + def get_sessions(self, user_id): + """Get User Sessions""" + + params = {} + path = '/users/{userId}/sessions' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def delete_sessions(self, user_id): + """Delete User Sessions""" + + params = {} + path = '/users/{userId}/sessions' + path = path.replace('{userId}', user_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def delete_session(self, user_id, session_id): + """Delete User Session""" + + params = {} + path = '/users/{userId}/sessions/{sessionId}' + path = path.replace('{userId}', user_id) + path = path.replace('{sessionId}', session_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def update_status(self, user_id, status): + """Update User Status""" + + params = {} + path = '/users/{userId}/status' + path = path.replace('{userId}', user_id) + params['status'] = status + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..138c0d1b3e --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-browser.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_browser('aa') diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..83f76aca42 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_credit_card('amex') diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..6946080bee --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-favicon.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_favicon('https://example.com') diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..188d6d35bd --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-flag.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_flag('af') diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..29a6430eab --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_image('https://example.com') diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..0c300af5da --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-initials.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_initials() diff --git a/app/sdks/0.6.2/server-python/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..19551e99d7 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/avatars/get-q-r.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_q_r('[TEXT]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/create-collection.md b/app/sdks/0.6.2/server-python/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..eb704a80a1 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/create-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.create_collection('[NAME]', [], [], []) diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/create-document.md b/app/sdks/0.6.2/server-python/docs/examples/database/create-document.md new file mode 100644 index 0000000000..919d5ebbf4 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/create-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.create_document('[COLLECTION_ID]', {}, [], []) diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/delete-collection.md b/app/sdks/0.6.2/server-python/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..0e188ade41 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/delete-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.delete_collection('[COLLECTION_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/delete-document.md b/app/sdks/0.6.2/server-python/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..c085547c16 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/delete-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.delete_document('[COLLECTION_ID]', '[DOCUMENT_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/get-collection.md b/app/sdks/0.6.2/server-python/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..f90f51f48b --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/get-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.get_collection('[COLLECTION_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/get-document.md b/app/sdks/0.6.2/server-python/docs/examples/database/get-document.md new file mode 100644 index 0000000000..79891709d1 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/get-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.get_document('[COLLECTION_ID]', '[DOCUMENT_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/list-collections.md b/app/sdks/0.6.2/server-python/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..f60d4b90e5 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/list-collections.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.list_collections() diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/list-documents.md b/app/sdks/0.6.2/server-python/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..cecb57d2fa --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/list-documents.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.list_documents('[COLLECTION_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/update-collection.md b/app/sdks/0.6.2/server-python/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..7dacd558ba --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/update-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.update_collection('[COLLECTION_ID]', '[NAME]', [], []) diff --git a/app/sdks/0.6.2/server-python/docs/examples/database/update-document.md b/app/sdks/0.6.2/server-python/docs/examples/database/update-document.md new file mode 100644 index 0000000000..6296809dc5 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/database/update-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.update_document('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []) diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-anti-virus.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..c7628d90ea --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-anti-virus.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_anti_virus() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-cache.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..57c7939b7f --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-cache.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_cache() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-d-b.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..db8eec5ce6 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-d-b.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_d_b() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-certificates.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..1f87c2758a --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_certificates() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-functions.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..3e0b0c01e0 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-functions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_functions() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-logs.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..fdf80c6d82 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_logs() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-tasks.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..17b17a081f --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_tasks() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-usage.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..aeb8e83130 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-usage.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_usage() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..90c4238987 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_webhooks() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-storage-local.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..b06dcef245 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-storage-local.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_storage_local() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get-time.md b/app/sdks/0.6.2/server-python/docs/examples/health/get-time.md new file mode 100644 index 0000000000..df68c1a0f9 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get-time.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_time() diff --git a/app/sdks/0.6.2/server-python/docs/examples/health/get.md b/app/sdks/0.6.2/server-python/docs/examples/health/get.md new file mode 100644 index 0000000000..f3416aef75 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/health/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..393326ddab --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get-continents.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_continents() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..653fdd5abf --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_countries_e_u() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..8c7693a35c --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_countries_phones() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..8a6c7cb1c3 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get-countries.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_countries() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..17586de230 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get-currencies.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_currencies() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..292a401f75 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get-languages.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_languages() diff --git a/app/sdks/0.6.2/server-python/docs/examples/locale/get.md b/app/sdks/0.6.2/server-python/docs/examples/locale/get.md new file mode 100644 index 0000000000..752df0123d --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/locale/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get() diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/create-file.md b/app/sdks/0.6.2/server-python/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..52bf8b8575 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/create-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.create_file(open('/path/to/file.png', 'rb'), [], []) diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/server-python/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..9379cb8820 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.delete_file('[FILE_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..bc815cebbe --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file_download('[FILE_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..2d14539513 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-preview.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file_preview('[FILE_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..7d0b30b376 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file_view('[FILE_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/get-file.md b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..e8d1202e27 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/get-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file('[FILE_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/list-files.md b/app/sdks/0.6.2/server-python/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..0e72773fcb --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/list-files.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.list_files() diff --git a/app/sdks/0.6.2/server-python/docs/examples/storage/update-file.md b/app/sdks/0.6.2/server-python/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..7e1c5f61cd --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/storage/update-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.update_file('[FILE_ID]', [], []) diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/server-python/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..9e2c832b3c --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/create-membership.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.create_membership('[TEAM_ID]', 'email@example.com', [], 'https://example.com') diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/create.md b/app/sdks/0.6.2/server-python/docs/examples/teams/create.md new file mode 100644 index 0000000000..1debdc6109 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/create.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.create('[NAME]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/server-python/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..af30bc1cf3 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.delete_membership('[TEAM_ID]', '[INVITE_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/delete.md b/app/sdks/0.6.2/server-python/docs/examples/teams/delete.md new file mode 100644 index 0000000000..8fb037cd4a --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/delete.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.delete('[TEAM_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/server-python/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..6c6482418b --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/get-memberships.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.get_memberships('[TEAM_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/get.md b/app/sdks/0.6.2/server-python/docs/examples/teams/get.md new file mode 100644 index 0000000000..6c2b404517 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.get('[TEAM_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/list.md b/app/sdks/0.6.2/server-python/docs/examples/teams/list.md new file mode 100644 index 0000000000..c538aea340 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.list() diff --git a/app/sdks/0.6.2/server-python/docs/examples/teams/update.md b/app/sdks/0.6.2/server-python/docs/examples/teams/update.md new file mode 100644 index 0000000000..2b9c222be0 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/teams/update.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.update('[TEAM_ID]', '[NAME]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/create.md b/app/sdks/0.6.2/server-python/docs/examples/users/create.md new file mode 100644 index 0000000000..2cfe228ee0 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/create.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.create('email@example.com', 'password') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/delete-session.md b/app/sdks/0.6.2/server-python/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..d25cfb3abc --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/delete-session.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.delete_session('[USER_ID]', '[SESSION_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/delete-sessions.md b/app/sdks/0.6.2/server-python/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..9b24db1b5c --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/delete-sessions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.delete_sessions('[USER_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/get-logs.md b/app/sdks/0.6.2/server-python/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..c93ae244c8 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/get-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get_logs('[USER_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/get-prefs.md b/app/sdks/0.6.2/server-python/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..9ef100f9e6 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/get-prefs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get_prefs('[USER_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/get-sessions.md b/app/sdks/0.6.2/server-python/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..4de3120dfb --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/get-sessions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get_sessions('[USER_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/get.md b/app/sdks/0.6.2/server-python/docs/examples/users/get.md new file mode 100644 index 0000000000..c11f96e64b --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get('[USER_ID]') diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/list.md b/app/sdks/0.6.2/server-python/docs/examples/users/list.md new file mode 100644 index 0000000000..c4a66e42d2 --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.list() diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/update-prefs.md b/app/sdks/0.6.2/server-python/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..7e0fe7c35a --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/update-prefs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.update_prefs('[USER_ID]', {}) diff --git a/app/sdks/0.6.2/server-python/docs/examples/users/update-status.md b/app/sdks/0.6.2/server-python/docs/examples/users/update-status.md new file mode 100644 index 0000000000..28fd587deb --- /dev/null +++ b/app/sdks/0.6.2/server-python/docs/examples/users/update-status.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.update_status('[USER_ID]', '1') diff --git a/app/sdks/0.6.2/server-python/requirements.txt b/app/sdks/0.6.2/server-python/requirements.txt new file mode 100644 index 0000000000..e20605c43d --- /dev/null +++ b/app/sdks/0.6.2/server-python/requirements.txt @@ -0,0 +1 @@ +requests==2.22.0 \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/setup.cfg b/app/sdks/0.6.2/server-python/setup.cfg new file mode 100644 index 0000000000..224a77957f --- /dev/null +++ b/app/sdks/0.6.2/server-python/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md \ No newline at end of file diff --git a/app/sdks/0.6.2/server-python/setup.py b/app/sdks/0.6.2/server-python/setup.py new file mode 100644 index 0000000000..503ff387ea --- /dev/null +++ b/app/sdks/0.6.2/server-python/setup.py @@ -0,0 +1,31 @@ +import setuptools + +setuptools.setup( + name = 'appwrite', + packages = ['appwrite', 'appwrite/services'], + version = '0.0.6', + license='BSD-3-Clause', + 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', + author = 'Appwrite Team', + author_email = 'team@localhost.test', + maintainer = 'Appwrite Team', + maintainer_email = 'team@localhost.test', + url = 'https://appwrite.io/support', + download_url='https://github.com/appwrite/sdk-for-python/archive/0.0.6.tar.gz', + # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], + install_requires=[ + 'requests', + ], + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Environment :: Web Environment', + 'Topic :: Software Development', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + ], +) diff --git a/app/sdks/0.6.2/server-ruby/CHANGELOG.md b/app/sdks/0.6.2/server-ruby/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/Gemfile b/app/sdks/0.6.2/server-ruby/Gemfile new file mode 100644 index 0000000000..cd8aa9e04c --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gemspec \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/LICENSE b/app/sdks/0.6.2/server-ruby/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/README.md b/app/sdks/0.6.2/server-ruby/README.md new file mode 100644 index 0000000000..39c5ff1490 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/README.md @@ -0,0 +1,30 @@ +# Appwrite Ruby SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.6.2-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.6.2. 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 Ruby 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [Gem](https://rubygems.org/): + +```bash +gem install appwrite --save +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/appwrite.gemspec b/app/sdks/0.6.2/server-ruby/appwrite.gemspec new file mode 100644 index 0000000000..f550cecf9f --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/appwrite.gemspec @@ -0,0 +1,13 @@ +Gem::Specification.new do |s| + + s.name = 'appwrite' + s.version = '1.0.11' + s.summary = "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 Ruby 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)" + s.author = 'Appwrite Team' + s.homepage = 'https://appwrite.io/support' + s.email = 'team@localhost.test' + s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) + +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-browser.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..fc0cfc913f --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-browser.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_browser(code: 'aa'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-credit-card.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..b3763f0846 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_credit_card(code: 'amex'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-favicon.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..2ee4e75789 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-favicon.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_favicon(url: 'https://example.com'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-flag.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..2e2f01f0f9 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-flag.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_flag(code: 'af'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-image.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..682d6bf9df --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-image.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_image(url: 'https://example.com'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-initials.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..11878a6da7 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-initials.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_initials(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-q-r.md b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..f145425ca2 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/avatars/get-q-r.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_q_r(text: '[TEXT]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/create-collection.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..0317ed9f05 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/create-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.create_collection(name: '[NAME]', read: [], write: [], rules: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/create-document.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/create-document.md new file mode 100644 index 0000000000..0101c746b4 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/create-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.create_document(collection_id: '[COLLECTION_ID]', data: {}, read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/delete-collection.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..b91c369da7 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/delete-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.delete_collection(collection_id: '[COLLECTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/delete-document.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..6548ec2946 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/delete-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.delete_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/get-collection.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..1e54e94c10 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/get-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.get_collection(collection_id: '[COLLECTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/get-document.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/get-document.md new file mode 100644 index 0000000000..3040b82c03 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/get-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.get_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/list-collections.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..ec15fe3b08 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/list-collections.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.list_collections(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/list-documents.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..fa33f10ccf --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/list-documents.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.list_documents(collection_id: '[COLLECTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/update-collection.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..3ecfbdb4ab --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/update-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.update_collection(collection_id: '[COLLECTION_ID]', name: '[NAME]', read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/database/update-document.md b/app/sdks/0.6.2/server-ruby/docs/examples/database/update-document.md new file mode 100644 index 0000000000..492d4f3edc --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/database/update-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.update_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {}, read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-anti-virus.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..0c83a06cf8 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-anti-virus.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_anti_virus(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-cache.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..6f51fb6e00 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-cache.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_cache(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-d-b.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..4bb00577a7 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-d-b.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_d_b(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-certificates.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..f758b7c3a4 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_certificates(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-functions.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..653607f79d --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_functions(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-logs.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..c6751f7f91 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_logs(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-tasks.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..c6da38832e --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_tasks(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-usage.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..ed81452d86 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_usage(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..9e55ab1d87 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_webhooks(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-storage-local.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..09c47ae437 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-storage-local.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_storage_local(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get-time.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-time.md new file mode 100644 index 0000000000..3d72794e93 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get-time.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_time(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/health/get.md b/app/sdks/0.6.2/server-ruby/docs/examples/health/get.md new file mode 100644 index 0000000000..9496c31b36 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/health/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-continents.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..92f38922e1 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-continents.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_continents(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..b83125d4a6 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_countries_e_u(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries-phones.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..728a1b3cdc --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_countries_phones(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..54975db928 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-countries.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_countries(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-currencies.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..4e39b435e1 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-currencies.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_currencies(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-languages.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..64e74eece0 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get-languages.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_languages(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/locale/get.md b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get.md new file mode 100644 index 0000000000..b390d505c4 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/locale/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/create-file.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..b044e35b86 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/create-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.create_file(file: File.new(), read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/delete-file.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..1aa67b3537 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.delete_file(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-download.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..777c565d06 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-download.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file_download(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-preview.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..48be3a044e --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-preview.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file_preview(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-view.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..a3dc012098 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file-view.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file_view(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..203a4dff7c --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/get-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/list-files.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..a148da78f9 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/list-files.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.list_files(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/storage/update-file.md b/app/sdks/0.6.2/server-ruby/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..36d5049816 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/storage/update-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.update_file(file_id: '[FILE_ID]', read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/create-membership.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..fc0a249361 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/create-membership.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.create_membership(team_id: '[TEAM_ID]', email: 'email@example.com', roles: [], url: 'https://example.com'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/create.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/create.md new file mode 100644 index 0000000000..d7f9c2f8c0 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/create.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.create(name: '[NAME]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/delete-membership.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..545cacc51f --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.delete_membership(team_id: '[TEAM_ID]', invite_id: '[INVITE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/delete.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/delete.md new file mode 100644 index 0000000000..d28907f741 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/delete.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.delete(team_id: '[TEAM_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/get-memberships.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..013d952afc --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/get-memberships.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.get_memberships(team_id: '[TEAM_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/get.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/get.md new file mode 100644 index 0000000000..1dd4918a12 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.get(team_id: '[TEAM_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/list.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/list.md new file mode 100644 index 0000000000..c0cd72a362 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.list(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/teams/update.md b/app/sdks/0.6.2/server-ruby/docs/examples/teams/update.md new file mode 100644 index 0000000000..b7e87a8e09 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/teams/update.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.update(team_id: '[TEAM_ID]', name: '[NAME]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/create.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/create.md new file mode 100644 index 0000000000..0a152ac366 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/create.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.create(email: 'email@example.com', password: 'password'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/delete-session.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..149c7d9293 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/delete-session.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.delete_session(user_id: '[USER_ID]', session_id: '[SESSION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/delete-sessions.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..3f02e08dd1 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.delete_sessions(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/get-logs.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..695a77ad27 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/get-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get_logs(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/get-prefs.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..4a0761e283 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get_prefs(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/get-sessions.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..52f37a4609 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/get-sessions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get_sessions(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/get.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/get.md new file mode 100644 index 0000000000..562ac958c3 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/list.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/list.md new file mode 100644 index 0000000000..096ce859e3 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.list(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/update-prefs.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..2bb2d42e16 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.update_prefs(user_id: '[USER_ID]', prefs: {}); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/docs/examples/users/update-status.md b/app/sdks/0.6.2/server-ruby/docs/examples/users/update-status.md new file mode 100644 index 0000000000..088ee380d8 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/docs/examples/users/update-status.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.update_status(user_id: '[USER_ID]', status: '1'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite.rb new file mode 100644 index 0000000000..8e88842789 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite.rb @@ -0,0 +1,12 @@ +require 'net/http' +require 'uri' +require 'json' +require_relative 'appwrite/client' +require_relative 'appwrite/service' +require_relative 'appwrite/services/avatars' +require_relative 'appwrite/services/database' +require_relative 'appwrite/services/health' +require_relative 'appwrite/services/locale' +require_relative 'appwrite/services/storage' +require_relative 'appwrite/services/teams' +require_relative 'appwrite/services/users' diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/client.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/client.rb new file mode 100644 index 0000000000..2cd09d52fe --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/client.rb @@ -0,0 +1,116 @@ +require 'net/http' +require 'uri' +require 'json' +require 'cgi' + +module Appwrite + class Client + + METHOD_GET = 'get' + METHOD_POST = 'post' + METHOD_PUT = 'put' + METHOD_PATCH = 'patch' + METHOD_DELETE = 'delete' + METHOD_HEAD = 'head' + METHOD_OPTIONS = 'options' + METHOD_CONNECT = 'connect' + METHOD_TRACE = 'trace' + + def initialize() + @headers = { + 'content-type' => '', + 'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION, + 'x-sdk-version' => 'appwrite:ruby:1.0.11' + } + @endpoint = 'https://appwrite.io/v1'; + end + + def set_project(value) + add_header('x-appwrite-project', value) + + return self + end + + def set_key(value) + add_header('x-appwrite-key', value) + + return self + end + + def set_locale(value) + add_header('x-appwrite-locale', value) + + return self + end + + def set_endpoint(endpoint) + @endpoint = endpoint + + return self + end + + def add_header(key, value) + @headers[key.downcase] = value.downcase + + return self + end + + def call(method, path = '', headers = {}, params = {}) + uri = URI.parse(@endpoint + path + ((method == METHOD_GET && params.length) ? '?' + encode(params) : '')) + return fetch(method, uri, headers, params) + end + + protected + + private + + def fetch(method, uri, headers, params, limit = 5) + raise ArgumentError, 'Too Many HTTP Redirects' if limit == 0 + + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = (uri.scheme == 'https') + payload = '' + + headers = @headers.merge(headers) + + if (method != METHOD_GET) + case headers['content-type'][0, headers['content-type'].index(';') || headers['content-type'].length] + when 'application/json' + payload = params.to_json + else + payload = encode(params) + end + end + + begin + response = http.send_request(method.upcase, uri.request_uri, payload, headers) + rescue => error + raise 'Request Failed: ' + error.message + end + + # Handle Redirects + if (response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently) + location = response['location'] + uri = URI.parse(uri.scheme + "://" + uri.host + "" + location) + + return fetch(method, uri, headers, {}, limit - 1) + end + + return JSON.parse(response.body); + end + + def encode(value, key = nil) + case value + when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&') + when Array then value.map { |v| encode(v, "#{key}[]") }.join('&') + when nil then '' + else + "#{key}=#{CGI.escape(value.to_s)}" + end + end + + def append_key(root_key, key) + root_key.nil? ? key : "#{root_key}[#{key.to_s}]" + end + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/service.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/service.rb new file mode 100644 index 0000000000..0d954c6d17 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/service.rb @@ -0,0 +1,12 @@ +module Appwrite + class Service + + def initialize(client) + @client = client + end + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/avatars.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/avatars.rb new file mode 100644 index 0000000000..afc94c20c3 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/avatars.rb @@ -0,0 +1,111 @@ +module Appwrite + class Avatars < Service + + def get_browser(code:, width: 100, height: 100, quality: 100) + path = '/avatars/browsers/{code}' + .gsub('{code}', code) + + params = { + 'width': width, + 'height': height, + 'quality': quality + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_credit_card(code:, width: 100, height: 100, quality: 100) + path = '/avatars/credit-cards/{code}' + .gsub('{code}', code) + + params = { + 'width': width, + 'height': height, + 'quality': quality + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_favicon(url:) + path = '/avatars/favicon' + + params = { + 'url': url + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_flag(code:, width: 100, height: 100, quality: 100) + path = '/avatars/flags/{code}' + .gsub('{code}', code) + + params = { + 'width': width, + 'height': height, + 'quality': quality + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_image(url:, width: 400, height: 400) + path = '/avatars/image' + + params = { + 'url': url, + 'width': width, + 'height': height + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_initials(name: '', width: 500, height: 500, color: '', background: '') + path = '/avatars/initials' + + params = { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_q_r(text:, size: 400, margin: 1, download: false) + path = '/avatars/qr' + + params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/database.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/database.rb new file mode 100644 index 0000000000..cf8e048953 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/database.rb @@ -0,0 +1,158 @@ +module Appwrite + class Database < Service + + def list_collections(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/database/collections' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_collection(name:, read:, write:, rules:) + path = '/database/collections' + + params = { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_collection(collection_id:) + path = '/database/collections/{collectionId}' + .gsub('{collectionId}', collection_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_collection(collection_id:, name:, read:, write:, rules: []) + path = '/database/collections/{collectionId}' + .gsub('{collectionId}', collection_id) + + params = { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_collection(collection_id:) + path = '/database/collections/{collectionId}' + .gsub('{collectionId}', collection_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def list_documents(collection_id:, filters: [], offset: 0, limit: 50, order_field: '$id', order_type: 'ASC', order_cast: 'string', search: '') + path = '/database/collections/{collectionId}/documents' + .gsub('{collectionId}', collection_id) + + params = { + 'filters': filters, + 'offset': offset, + 'limit': limit, + 'orderField': order_field, + 'orderType': order_type, + 'orderCast': order_cast, + 'search': search + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_document(collection_id:, data:, read:, write:, parent_document: '', parent_property: '', parent_property_type: 'assign') + path = '/database/collections/{collectionId}/documents' + .gsub('{collectionId}', collection_id) + + params = { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parent_document, + 'parentProperty': parent_property, + 'parentPropertyType': parent_property_type + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_document(collection_id:, document_id:) + path = '/database/collections/{collectionId}/documents/{documentId}' + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_document(collection_id:, document_id:, data:, read:, write:) + path = '/database/collections/{collectionId}/documents/{documentId}' + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + params = { + 'data': data, + 'read': read, + 'write': write + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_document(collection_id:, document_id:) + path = '/database/collections/{collectionId}/documents/{documentId}' + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/health.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/health.rb new file mode 100644 index 0000000000..d2c6bc7b60 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/health.rb @@ -0,0 +1,141 @@ +module Appwrite + class Health < Service + + def get() + path = '/health' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_anti_virus() + path = '/health/anti-virus' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_cache() + path = '/health/cache' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_d_b() + path = '/health/db' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_certificates() + path = '/health/queue/certificates' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_functions() + path = '/health/queue/functions' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_logs() + path = '/health/queue/logs' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_tasks() + path = '/health/queue/tasks' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_usage() + path = '/health/queue/usage' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_webhooks() + path = '/health/queue/webhooks' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_storage_local() + path = '/health/storage/local' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_time() + path = '/health/time' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/locale.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/locale.rb new file mode 100644 index 0000000000..e71756b2a7 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/locale.rb @@ -0,0 +1,86 @@ +module Appwrite + class Locale < Service + + def get() + path = '/locale' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_continents() + path = '/locale/continents' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_countries() + path = '/locale/countries' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_countries_e_u() + path = '/locale/countries/eu' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_countries_phones() + path = '/locale/countries/phones' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_currencies() + path = '/locale/currencies' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_languages() + path = '/locale/languages' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/storage.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/storage.rb new file mode 100644 index 0000000000..0e99a2b0d5 --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/storage.rb @@ -0,0 +1,118 @@ +module Appwrite + class Storage < Service + + def list_files(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/storage/files' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_file(file:, read:, write:) + path = '/storage/files' + + params = { + 'file': file, + 'read': read, + 'write': write + } + + return @client.call('post', path, { + 'content-type' => 'multipart/form-data', + }, params); + end + + def get_file(file_id:) + path = '/storage/files/{fileId}' + .gsub('{fileId}', file_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_file(file_id:, read:, write:) + path = '/storage/files/{fileId}' + .gsub('{fileId}', file_id) + + params = { + 'read': read, + 'write': write + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_file(file_id:) + path = '/storage/files/{fileId}' + .gsub('{fileId}', file_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_file_download(file_id:) + path = '/storage/files/{fileId}/download' + .gsub('{fileId}', file_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') + path = '/storage/files/{fileId}/preview' + .gsub('{fileId}', file_id) + + params = { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_file_view(file_id:, as: '') + path = '/storage/files/{fileId}/view' + .gsub('{fileId}', file_id) + + params = { + 'as': as + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/teams.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/teams.rb new file mode 100644 index 0000000000..0480a4507e --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/teams.rb @@ -0,0 +1,119 @@ +module Appwrite + class Teams < Service + + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/teams' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create(name:, roles: ["owner"]) + path = '/teams' + + params = { + 'name': name, + 'roles': roles + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get(team_id:) + path = '/teams/{teamId}' + .gsub('{teamId}', team_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update(team_id:, name:) + path = '/teams/{teamId}' + .gsub('{teamId}', team_id) + + params = { + 'name': name + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete(team_id:) + path = '/teams/{teamId}' + .gsub('{teamId}', team_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_memberships(team_id:, search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/teams/{teamId}/memberships' + .gsub('{teamId}', team_id) + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_membership(team_id:, email:, roles:, url:, name: '') + path = '/teams/{teamId}/memberships' + .gsub('{teamId}', team_id) + + params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_membership(team_id:, invite_id:) + path = '/teams/{teamId}/memberships/{inviteId}' + .gsub('{teamId}', team_id) + .gsub('{inviteId}', invite_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.6.2/server-ruby/lib/appwrite/services/users.rb b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/users.rb new file mode 100644 index 0000000000..f75434bd1a --- /dev/null +++ b/app/sdks/0.6.2/server-ruby/lib/appwrite/services/users.rb @@ -0,0 +1,137 @@ +module Appwrite + class Users < Service + + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/users' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create(email:, password:, name: '') + path = '/users' + + params = { + 'email': email, + 'password': password, + 'name': name + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get(user_id:) + path = '/users/{userId}' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_logs(user_id:) + path = '/users/{userId}/logs' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_prefs(user_id:) + path = '/users/{userId}/prefs' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_prefs(user_id:, prefs:) + path = '/users/{userId}/prefs' + .gsub('{userId}', user_id) + + params = { + 'prefs': prefs + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_sessions(user_id:) + path = '/users/{userId}/sessions' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_sessions(user_id:) + path = '/users/{userId}/sessions' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_session(user_id:, session_id:) + path = '/users/{userId}/sessions/{sessionId}' + .gsub('{userId}', user_id) + .gsub('{sessionId}', session_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_status(user_id:, status:) + path = '/users/{userId}/status' + .gsub('{userId}', user_id) + + params = { + 'status': status + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/CHANGELOG.md b/app/sdks/0.7.0/client-flutter-dev/CHANGELOG.md new file mode 100644 index 0000000000..2e9b0e0a91 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/CHANGELOG.md @@ -0,0 +1,64 @@ +## 0.3.2 + +- Fixed package namespaces + +## 0.3.1 + +- Downgraded meta package version to 1.1.8 + +## 0.3.0 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + +## 0.2.3 + +- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie + +## 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 + +## 0.1.0 + +- Added examples file +- Some minor style fixes + +## 0.0.14 + +- Using MultipartFile for file uploads + +## 0.0.13 + +- Fix for file upload method + +## 0.0.12 + +- Added file upload support for storage service + +## 0.0.11 + +- Added integration with web auth plugin to support Appwrite OAuth API + +## 0.0.9 + +- Updated deafult params + +## 0.0.8 + +- Fixed compilation error in Client class +- Shorter description for package \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/LICENSE b/app/sdks/0.7.0/client-flutter-dev/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/README.md b/app/sdks/0.7.0/client-flutter-dev/README.md new file mode 100644 index 0000000000..9b04096f80 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/README.md @@ -0,0 +1,38 @@ +# Appwrite Flutter (Dev Channel) SDK + +[![pub package](https://img.shields.io/pub/v/appwrite.svg)](https://pub.dartlang.org/packages/appwrite) +![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter-dev.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.7.0. 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 Flutter (Dev Channel) 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +Add this to your package's `pubspec.yaml` file: + +```yml +dependencies: + appwrite_dev: ^0.3.2 +``` + +You can install packages from the command line: + +```bash +pub get appwrite_dev +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-o-auth2session.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..b3cb8831ee --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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: 'amazon', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-recovery.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..32fe469cff --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-recovery.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/create-session.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-session.md new file mode 100644 index 0000000000..a5930877f4 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-session.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/create-verification.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..738f22df42 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create-verification.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/create.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create.md new file mode 100644 index 0000000000..1f92976c39 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/create.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/delete-session.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..95b3641387 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/delete-session.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/delete-sessions.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..8aaef86816 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/delete-sessions.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/delete.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/delete.md new file mode 100644 index 0000000000..e6e29f53aa --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/delete.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/get-logs.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..92d9e47916 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get-logs.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/get-prefs.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..02874f2251 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get-prefs.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/get-sessions.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..ace4b1b6c1 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get-sessions.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/get.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get.md new file mode 100644 index 0000000000..4651559afb --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/get.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/update-email.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-email.md new file mode 100644 index 0000000000..9fc86a7aae --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-email.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/update-name.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-name.md new file mode 100644 index 0000000000..e5e218a515 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-name.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/update-password.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-password.md new file mode 100644 index 0000000000..869b4d9a30 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-password.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/update-prefs.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..0d50469742 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-prefs.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/update-recovery.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..e028e60a7d --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-recovery.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/account/update-verification.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..48d669efcc --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/account/update-verification.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..dec7863b1f --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-browser.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..e2746c4999 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..1c56335b9f --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-favicon.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..8a91f608ce --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-flag.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..a2cbea98e3 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-image.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..5f9353feae --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +import 'package:appwrite_dev/appwrite_dev.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.getInitials( + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..2737297082 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/avatars/get-q-r.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/database/create-document.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/create-document.md new file mode 100644 index 0000000000..6fc27bdfbb --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/create-document.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/database/delete-document.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..74bcd69d9a --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/delete-document.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/database/get-document.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/get-document.md new file mode 100644 index 0000000000..639209ed3c --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/get-document.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/database/list-documents.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..41eac5dd9a --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/list-documents.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/database/update-document.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/update-document.md new file mode 100644 index 0000000000..0b153b1595 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/database/update-document.md @@ -0,0 +1,26 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..cae4365382 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-continents.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..c326461bef --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..afd3f5d5be --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..e4fc236949 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-countries.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..d3eb30533e --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-currencies.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..32b2a700c0 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get-languages.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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.getLanguages(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get.md new file mode 100644 index 0000000000..b0cca45924 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/locale/get.md @@ -0,0 +1,20 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/create-file.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..d824bd5831 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/create-file.md @@ -0,0 +1,25 @@ +import 'dart:io'; +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..88e7b8815c --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/delete-file.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..483340e24a --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file-download.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..dd8d924fe7 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file-preview.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..8ed6a946e0 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file-view.md @@ -0,0 +1,17 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/get-file.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..4e398f88fd --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/get-file.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/list-files.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..d72ba29e03 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/list-files.md @@ -0,0 +1,21 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/storage/update-file.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..95e213ddc2 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/storage/update-file.md @@ -0,0 +1,24 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..31bf7ec1af --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/create-membership.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/create.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/create.md new file mode 100644 index 0000000000..e50279de01 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/create.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..015507d3a2 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/delete-membership.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/delete.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/delete.md new file mode 100644 index 0000000000..6cc1367f9b --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/delete.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..d427c9ac47 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/get-memberships.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/get.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/get.md new file mode 100644 index 0000000000..1bca70a23f --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/get.md @@ -0,0 +1,22 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/list.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/list.md new file mode 100644 index 0000000000..c56e7a5dd5 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/list.md @@ -0,0 +1,21 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/update-membership-status.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..6098b38ed9 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/update-membership-status.md @@ -0,0 +1,25 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/docs/examples/teams/update.md b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/update.md new file mode 100644 index 0000000000..2494f408d9 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/docs/examples/teams/update.md @@ -0,0 +1,23 @@ +import 'package:appwrite_dev/appwrite_dev.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/0.7.0/client-flutter-dev/example/README.md b/app/sdks/0.7.0/client-flutter-dev/example/README.md new file mode 100644 index 0000000000..f6768a5f85 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/example/README.md @@ -0,0 +1,55 @@ +# Examples + +Init your Appwrite client: + +```dart + Client client = Client(); + + client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production + ; + +``` + +Create a new user and session: + +```dart +Account account = Account(client); + +Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name'); + +Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); + +``` + +Fetch user profile: + +```dart +Account account = Account(client); + +Response profile = await account.get(); +``` + +Upload File: + +```dart +Storage storage = Storage(client); + +MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg'); + +storage.createFile( + file: file, + read: ['*'], + write: [] +) +.then((response) { + print(response); // File uploaded! +}) +.catchError((error) { + print(error.response); +}); +``` + +All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/appwrite_dev.dart b/app/sdks/0.7.0/client-flutter-dev/lib/appwrite_dev.dart new file mode 100644 index 0000000000..95d0b72cfe --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/appwrite_dev.dart @@ -0,0 +1,10 @@ +export 'package:dio/dio.dart' show Response; + +export 'client.dart'; +export 'enums.dart'; +export 'services/account.dart'; +export 'services/avatars.dart'; +export 'services/database.dart'; +export 'services/locale.dart'; +export 'services/storage.dart'; +export 'services/teams.dart'; diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/client.dart b/app/sdks/0.7.0/client-flutter-dev/lib/client.dart new file mode 100644 index 0000000000..b874b7e9e5 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/client.dart @@ -0,0 +1,144 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; +import 'package:dio/adapter.dart'; +import 'package:dio_cookie_manager/dio_cookie_manager.dart'; +import 'package:cookie_jar/cookie_jar.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:package_info/package_info.dart'; + +import 'enums.dart'; + +class Client { + String endPoint; + String type = 'unknown'; + Map headers; + Map config; + bool selfSigned; + bool initialized = false; + Dio http; + PersistCookieJar cookieJar; + + Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() { + // Platform is not supported in web so if web, set type to web automatically and skip Platform check + if(kIsWeb) { + type = 'web'; + }else{ + type = (Platform.isIOS) ? 'ios' : type; + type = (Platform.isMacOS) ? 'macos' : type; + type = (Platform.isAndroid) ? 'android' : type; + type = (Platform.isLinux) ? 'linux' : type; + type = (Platform.isWindows) ? 'windows' : type; + type = (Platform.isFuchsia) ? 'fuchsia' : type; + } + + this.headers = { + 'content-type': 'application/json', + 'x-sdk-version': 'appwrite:flutter:0.3.2', + }; + + this.config = {}; + + assert(endPoint.startsWith(RegExp("http://|https://")), "endPoint $endPoint must start with 'http'"); + } + + Future _getCookiePath() async { + final directory = await getApplicationDocumentsDirectory(); + final path = directory.path; + final Directory dir = new Directory('$path/cookies'); + await dir.create(); + return dir; + } + + /// Your project ID + Client setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + + Client setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + + Client setSelfSigned({bool status = true}) { + selfSigned = status; + return this; + } + + Client setEndpoint(String endPoint) { + this.endPoint = endPoint; + this.http.options.baseUrl = this.endPoint; + return this; + } + + Client addHeader(String key, String value) { + headers[key] = value; + + return this; + } + + Future init() async { + if(!initialized) { + // if web skip cookie implementation and origin header as those are automatically handled by browsers + if(!kIsWeb) { + final Directory cookieDir = await _getCookiePath(); + cookieJar = new PersistCookieJar(dir:cookieDir.path); + this.http.interceptors.add(CookieManager(cookieJar)); + if(Platform.isAndroid || Platform.isIOS) { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); + } else if(Platform.isLinux) { + addHeader('Origin', 'appwrite-linux://'); + } else if(Platform.isMacOS) { + addHeader('Origin', 'appwrite-macos://'); + } else if(Platform.isWindows) { + addHeader('Origin', 'appwrite-windows://'); + } else if(Platform.isFuchsia) { + addHeader('Origin', 'appwrite-fuchsia://'); + } + }else{ + // if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work + this.http.options.extra['withCredentials'] = true; + } + + this.http.options.baseUrl = this.endPoint; + this.http.options.validateStatus = (status) => status < 400; + } + } + + Future call(HttpMethod method, {String path = '', Map headers = const {}, Map params = const {}}) async { + if(selfSigned && !kIsWeb) { + // Allow self signed requests + (http.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (HttpClient client) { + client.badCertificateCallback = (X509Certificate cert, String host, int port) => true; + return client; + }; + } + + await this.init(); + + // Origin is hardcoded for testing + Options options = Options( + headers: {...this.headers, ...headers}, + method: method.name(), + ); + + if(headers['content-type'] == 'multipart/form-data') { + return http.request(path, data: FormData.fromMap(params), options: options); + } + + if (method == HttpMethod.get) { + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + return http.get(path, queryParameters: params, options: options); + } else { + return http.request(path, data: params, options: options); + } + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/enums.dart b/app/sdks/0.7.0/client-flutter-dev/lib/enums.dart new file mode 100644 index 0000000000..2757f6073e --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/enums.dart @@ -0,0 +1,15 @@ +enum HttpMethod { get, post, put, delete, patch } + +extension HttpMethodString on HttpMethod { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} + +enum OrderType { asc, desc } + +extension OrderTypeString on OrderType { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/service.dart b/app/sdks/0.7.0/client-flutter-dev/lib/service.dart new file mode 100644 index 0000000000..1ae319b705 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/service.dart @@ -0,0 +1,7 @@ +import 'client.dart'; + +class Service { + final Client client; + + const Service(this.client); +} diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/services/account.dart b/app/sdks/0.7.0/client-flutter-dev/lib/services/account.dart new file mode 100644 index 0000000000..48a3dc0309 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/services/account.dart @@ -0,0 +1,435 @@ + +import 'dart:io'; +import 'package:universal_html/html.dart' as html; + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_web_auth/flutter_web_auth.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Account extends Service { + Account(Client client): super(client); + + /// Get Account + /// + /// Get currently logged in user data as JSON object. + /// + Future get() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account + /// + /// Use this endpoint to allow a new user to register a new account in your + /// project. After the user registration completes successfully, you can use + /// the [/account/verfication](/docs/client/account#createVerification) route + /// to start verifying the user email address. To allow the new user to login + /// to their new account, you need to create a new [account + /// session](/docs/client/account#createSession). + /// + Future create({@required String email, @required String password, String name = ''}) { + final String path = '/account'; + + final Map params = { + 'email': email, + 'password': password, + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Account + /// + /// Delete a currently logged in user account. Behind the scene, the user + /// record is not deleted but permanently blocked from any access. This is done + /// to avoid deleted accounts being overtaken by new users with the same email + /// address. Any user-related resources like documents or storage files should + /// be deleted separately. + /// + Future delete() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Account Email + /// + /// Update currently logged in user account email address. After changing user + /// address, user confirmation status is being reset and a new confirmation + /// mail is sent. For security measures, user password is required to complete + /// this request. + /// + Future updateEmail({@required String email, @required String password}) { + final String path = '/account/email'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Logs + /// + /// Get currently logged in user list of latest security activity logs. Each + /// log returns user IP address, location and date and time of log. + /// + Future getLogs() { + final String path = '/account/logs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Name + /// + /// Update currently logged in user account name. + /// + Future updateName({@required String name}) { + final String path = '/account/name'; + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Update Account Password + /// + /// Update currently logged in user password. For validation, user is required + /// to pass the password twice. + /// + Future updatePassword({@required String password, @required String oldPassword}) { + final String path = '/account/password'; + + final Map params = { + 'password': password, + 'oldPassword': oldPassword, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Preferences + /// + /// Get currently logged in user preferences as a key-value object. + /// + Future getPrefs() { + final String path = '/account/prefs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Preferences + /// + /// Update currently logged in user account preferences. You can pass only the + /// specific settings you wish to update. + /// + Future updatePrefs({@required dynamic prefs}) { + final String path = '/account/prefs'; + + final Map params = { + 'prefs': prefs, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Create Password Recovery + /// + /// Sends the user an email with a temporary secret key for password reset. + /// When the user clicks the confirmation link he is redirected back to your + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + /// endpoint to complete the process. + /// + Future createRecovery({@required String email, @required String url}) { + final String path = '/account/recovery'; + + final Map params = { + 'email': email, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Password Recovery + /// + /// Use this endpoint to complete the user account password reset. Both the + /// **userId** and **secret** arguments will be passed as query parameters to + /// the redirect URL you have provided when sending your request to the [POST + /// /account/recovery](/docs/client/account#createRecovery) endpoint. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + Future updateRecovery({@required String userId, @required String secret, @required String password, @required String passwordAgain}) { + final String path = '/account/recovery'; + + final Map params = { + 'userId': userId, + 'secret': secret, + 'password': password, + 'passwordAgain': passwordAgain, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Get Account Sessions + /// + /// Get currently logged in user list of active sessions across different + /// devices. + /// + Future getSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account Session + /// + /// Allow the user to login into their account by providing a valid email and + /// password combination. This route will create a new session for the user. + /// + Future createSession({@required String email, @required String password}) { + final String path = '/account/sessions'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete All Account Sessions + /// + /// Delete all sessions from the user account and remove any sessions cookies + /// from the end client. + /// + Future deleteSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Account Session with OAuth2 + /// + /// Allow the user to login to their account using the OAuth2 provider of their + /// choice. Each OAuth2 provider should be enabled from the Appwrite console + /// 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://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure', List scopes = const []}) { + final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider); + + final Map params = { + 'success': success, + 'failure': failure, + 'scopes': scopes, + 'project': client.config['project'], + }; + + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } + else { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + query: query.join('&') + ); + + if(kIsWeb) { + html.window.location.href = url.toString(); + return null; + }else{ + + return FlutterWebAuth.authenticate( + url: url.toString(), + callbackUrlScheme: "appwrite-callback-" + client.config['project'] + ).then((value) async { + Uri url = Uri.parse(value); + Cookie cookie = new Cookie(url.queryParameters['key'], url.queryParameters['secret']); + cookie.domain = Uri.parse(client.endPoint).host; + cookie.httpOnly = true; + cookie.path = '/'; + List cookies = [cookie]; + await client.init(); + client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies); + }); + } + + } + + /// Delete Account Session + /// + /// Use this endpoint to log out the currently logged in user from all their + /// account sessions across all of their different devices. When using the + /// option id argument, only the session unique ID provider will be deleted. + /// + Future deleteSession({@required String sessionId}) { + final String path = '/account/sessions/{sessionId}'.replaceAll(RegExp('{sessionId}'), sessionId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Email Verification + /// + /// Use this endpoint to send a verification message to your user email address + /// to confirm they are the valid owners of that address. Both the **userId** + /// and **secret** arguments will be passed as query parameters to the URL you + /// have provided to be attached to the verification email. The provided URL + /// should redirect the user back to your app and allow you to complete the + /// verification process by verifying both the **userId** and **secret** + /// parameters. Learn more about how to [complete the verification + /// process](/docs/client/account#updateVerification). + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + /// + Future createVerification({@required String url}) { + final String path = '/account/verification'; + + final Map params = { + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Email Verification + /// + /// Use this endpoint to complete the user email verification process. Use both + /// the **userId** and **secret** parameters that were attached to your app URL + /// to verify the user email ownership. If confirmed this route will return a + /// 200 status code. + /// + Future updateVerification({@required String userId, @required String secret}) { + final String path = '/account/verification'; + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/services/avatars.dart b/app/sdks/0.7.0/client-flutter-dev/lib/services/avatars.dart new file mode 100644 index 0000000000..89caef576c --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/services/avatars.dart @@ -0,0 +1,239 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Avatars extends Service { + Avatars(Client client): super(client); + + /// Get Browser Icon + /// + /// You can use this endpoint to show different browser icons to your users. + /// The code argument receives the browser code as it appears in your user + /// /account/sessions endpoint. Use width, height and quality arguments to + /// change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Credit Card Icon + /// + /// Need to display your users with your billing method or their payment + /// methods? The credit card endpoint will return you the icon of the credit + /// card provider you need. Use width, height and quality arguments to change + /// the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Favicon + /// + /// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + /// website URL. + /// + /// + String getFavicon({@required String url}) { + final String path = '/avatars/favicon'; + + final Map params = { + 'url': url, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Country Flag + /// + /// You can use this endpoint to show different country flags icons to your + /// users. The code argument receives the 2 letter country code. Use width, + /// height and quality arguments to change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Image from URL + /// + /// Use this endpoint to fetch a remote image URL and crop it to any image size + /// you want. This endpoint is very useful if you need to crop and display + /// remote images in your app or in case you want to make sure a 3rd party + /// image is properly served using a TLS protocol. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get User Initials + /// + /// Use this endpoint to show your user initials avatar icon on your website or + /// app. By default, this route will try to print your logged-in user name or + /// email initials. You can also overwrite the user name if you pass the 'name' + /// parameter. If no name is given and no user is logged, an empty avatar will + /// be returned. + /// + /// You can use the color and background params to change the avatar colors. By + /// default, a random theme will be selected. The random theme will persist for + /// the user's initials when reloading the same theme will always return for + /// the same initials. + /// + String getInitials({String name = '', int width = 500, int height = 500, String color = '', String background = ''}) { + final String path = '/avatars/initials'; + + final Map params = { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get QR Code + /// + /// 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. + /// + String getQR({@required String text, int size = 400, int margin = 1, bool download = false}) { + final String path = '/avatars/qr'; + + final Map params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/services/database.dart b/app/sdks/0.7.0/client-flutter-dev/lib/services/database.dart new file mode 100644 index 0000000000..c45afe661f --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/services/database.dart @@ -0,0 +1,119 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Database extends Service { + Database(Client client): super(client); + + /// List Documents + /// + /// Get a list of all the user documents. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project documents. [Learn more about different API + /// modes](/docs/admin). + /// + Future listDocuments({@required String collectionId, List filters = const [], int limit = 25, int offset = 0, String orderField = '', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = ''}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'filters': filters, + 'limit': limit, + 'offset': offset, + 'orderField': orderField, + 'orderType': orderType.name(), + 'orderCast': orderCast, + 'search': search, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Document + /// + /// Create a new Document. Before using this route, you should create a new + /// collection resource using either a [server + /// integration](/docs/server/database?sdk=nodejs#createCollection) API or + /// directly from your database console. + /// + Future createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Document + /// + /// Get document by its unique ID. This endpoint response returns a JSON object + /// with the document data. + /// + Future getDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Document + Future updateDocument({@required String collectionId, @required String documentId, @required dynamic data, @required List read, @required List write}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Delete Document + /// + /// Delete document by its unique ID. This endpoint deletes only the parent + /// documents, its attributes and relations to other documents. Child documents + /// **will not** be deleted. + /// + Future deleteDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/services/locale.dart b/app/sdks/0.7.0/client-flutter-dev/lib/services/locale.dart new file mode 100644 index 0000000000..095af4792c --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/services/locale.dart @@ -0,0 +1,143 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Locale extends Service { + Locale(Client client): super(client); + + /// Get User Locale + /// + /// Get the current user location based on IP. Returns an object with user + /// country code, country name, continent name, continent code, ip address and + /// suggested currency. You can use the locale header to get the data in a + /// supported language. + /// + /// ([IP Geolocation by DB-IP](https://db-ip.com)) + /// + Future get() { + final String path = '/locale'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Continents + /// + /// List of all continents. You can use the locale header to get the data in a + /// supported language. + /// + Future getContinents() { + final String path = '/locale/continents'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries + /// + /// List of all countries. You can use the locale header to get the data in a + /// supported language. + /// + Future getCountries() { + final String path = '/locale/countries'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List EU Countries + /// + /// List of all countries that are currently members of the EU. You can use the + /// locale header to get the data in a supported language. + /// + Future getCountriesEU() { + final String path = '/locale/countries/eu'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries Phone Codes + /// + /// List of all countries phone codes. You can use the locale header to get the + /// data in a supported language. + /// + Future getCountriesPhones() { + final String path = '/locale/countries/phones'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Currencies + /// + /// List of all currencies, including currency symbol, name, plural, and + /// decimal digits for all major and minor currencies. You can use the locale + /// header to get the data in a supported language. + /// + Future getCurrencies() { + final String path = '/locale/currencies'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Languages + /// + /// List of all languages classified by ISO 639-1 including 2-letter code, name + /// in English, and name in the respective language. + /// + Future getLanguages() { + final String path = '/locale/languages'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/services/storage.dart b/app/sdks/0.7.0/client-flutter-dev/lib/services/storage.dart new file mode 100644 index 0000000000..51f9345050 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/services/storage.dart @@ -0,0 +1,203 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Storage extends Service { + Storage(Client client): super(client); + + /// List Files + /// + /// Get a list of all the user files. You can use the query params to filter + /// your results. On admin mode, this endpoint will return a list of all of the + /// project files. [Learn more about different API modes](/docs/admin). + /// + Future listFiles({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/storage/files'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create File + /// + /// Create a new file. The user who creates the file will automatically be + /// assigned to read and write access unless he has passed custom values for + /// read and write arguments. + /// + Future createFile({@required MultipartFile file, @required List read, @required List write}) { + final String path = '/storage/files'; + + final Map params = { + 'file': file, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'multipart/form-data', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get File + /// + /// Get file by its unique ID. This endpoint response returns a JSON object + /// with the file metadata. + /// + Future getFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update File + /// + /// Update file by its unique ID. Only users with write permissions have access + /// to update this resource. + /// + Future updateFile({@required String fileId, @required List read, @required List write}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete File + /// + /// Delete a file by its unique ID. Only users with write permissions have + /// access to delete this resource. + /// + Future deleteFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get File for Download + /// + /// Get file content by its unique ID. The endpoint response return with a + /// 'Content-Disposition: attachment' header that tells the browser to start + /// downloading the file to user downloads directory. + /// + String getFileDownload({@required String fileId}) { + final String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File Preview + /// + /// Get a file preview image. Currently, this method supports preview for image + /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + /// and spreadsheets, will return the file icon image. You can also pass query + /// string arguments for cutting and resizing your preview image. + /// + String getFilePreview({@required String fileId, int width = 0, int height = 0, int quality = 100, String background = '', String output = ''}) { + final String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File for View + /// + /// Get file content by its unique ID. This endpoint is similar to the download + /// method but returns with no 'Content-Disposition: attachment' header. + /// + String getFileView({@required String fileId, String as = ''}) { + final String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'as': as, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/lib/services/teams.dart b/app/sdks/0.7.0/client-flutter-dev/lib/services/teams.dart new file mode 100644 index 0000000000..050aeaf06d --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/lib/services/teams.dart @@ -0,0 +1,207 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Teams extends Service { + Teams(Client client): super(client); + + /// List Teams + /// + /// Get a list of all the current user teams. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project teams. [Learn more about different API modes](/docs/admin). + /// + Future list({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team + /// + /// Create a new team. The user who creates the team will automatically be + /// assigned as the owner of the team. The team owner can invite new members, + /// who will be able add new owners and update or delete the team from your + /// project. + /// + Future create({@required String name, List roles = const ["owner"]}) { + final String path = '/teams'; + + final Map params = { + 'name': name, + 'roles': roles, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Team + /// + /// Get team by its unique ID. All team members have read access for this + /// resource. + /// + Future get({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Team + /// + /// Update team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future update({@required String teamId, @required String name}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete Team + /// + /// Delete team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future delete({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get Team Memberships + /// + /// Get team members by the team unique ID. All team members have read access + /// for this list of resources. + /// + Future getMemberships({@required String teamId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team Membership + /// + /// Use this endpoint to invite a new member to join your team. An email with a + /// link to join the team will be sent to the new member email address if the + /// member doesn't exist in the project it will be created automatically. + /// + /// Use the 'URL' parameter to redirect the user from the invitation email back + /// to your app. When the user is redirected, use the [Update Team Membership + /// Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + /// user to accept the invitation to the team. + /// + /// Please note that in order to avoid a [Redirect + /// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URL's are the once from domains you have set when + /// added your platforms in the console interface. + /// + Future createMembership({@required String teamId, @required String email, @required List roles, @required String url, String name = ''}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Team Membership + /// + /// This endpoint allows a user to leave a team or for a team owner to delete + /// the membership of any other team member. You can also use this endpoint to + /// delete a user membership even if it is not accepted. + /// + Future deleteMembership({@required String teamId, @required String inviteId}) { + final String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Team Membership Status + /// + /// Use this endpoint to allow a user to accept an invitation to join a team + /// after being redirected back to your app from the invitation email recieved + /// by the user. + /// + Future updateMembershipStatus({@required String teamId, @required String inviteId, @required String userId, @required String secret}) { + final String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter-dev/pubspec.yaml b/app/sdks/0.7.0/client-flutter-dev/pubspec.yaml new file mode 100644 index 0000000000..2b2da51d3b --- /dev/null +++ b/app/sdks/0.7.0/client-flutter-dev/pubspec.yaml @@ -0,0 +1,24 @@ +name: appwrite_dev +version: 0.3.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-flutter-dev +issue_tracker: https://github.com/appwrite/sdk-generator/issues +documentation: https://appwrite.io/support +environment: + sdk: '>=2.6.0 <3.0.0' +dependencies: + meta: ^1.1.8 + path_provider: ^1.6.14 + package_info: ^0.4.3 + dio: ^3.0.10 + cookie_jar: ^1.0.1 + dio_cookie_manager: ^1.0.0 + flutter_web_auth: ^0.2.4 + universal_html: ^1.2.3 + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/CHANGELOG.md b/app/sdks/0.7.0/client-flutter/CHANGELOG.md new file mode 100644 index 0000000000..a584ad8b9a --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/CHANGELOG.md @@ -0,0 +1,60 @@ +## 0.3.0-dev.2 + +- Fix for an error when using a self-signed certificate for Web + +## 0.3.0-dev.1 + +- Updated package dependencies (@lohanidamodar) +- Added Flutter for Web compatibility (@lohanidamodar) + +## 0.2.3 + +- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie + +## 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 + +## 0.1.0 + +- Added examples file +- Some minor style fixes + +## 0.0.14 + +- Using MultipartFile for file uploads + +## 0.0.13 + +- Fix for file upload method + +## 0.0.12 + +- Added file upload support for storage service + +## 0.0.11 + +- Added integration with web auth plugin to support Appwrite OAuth API + +## 0.0.9 + +- Updated deafult params + +## 0.0.8 + +- Fixed compilation error in Client class +- Shorter description for package \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/LICENSE b/app/sdks/0.7.0/client-flutter/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/README.md b/app/sdks/0.7.0/client-flutter/README.md new file mode 100644 index 0000000000..6477acebf6 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/README.md @@ -0,0 +1,38 @@ +# Appwrite Flutter SDK + +[![pub package](https://img.shields.io/pub/v/appwrite.svg)](https://pub.dartlang.org/packages/appwrite) +![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.7.0. 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 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +Add this to your package's `pubspec.yaml` file: + +```yml +dependencies: + appwrite: ^0.3.0-dev.2 +``` + +You can install packages from the command line: + +```bash +pub get appwrite +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/docs/examples/account/create-o-auth2session.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..0e26dd27af --- /dev/null +++ b/app/sdks/0.7.0/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: 'amazon', + ); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/docs/examples/account/create-recovery.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..50db45b15d --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/create-session.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/create-session.md new file mode 100644 index 0000000000..ef824b4eca --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/create-verification.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..6b9b1ace40 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/create.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/create.md new file mode 100644 index 0000000000..384258ae68 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/delete-session.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..80a3f505d0 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/delete-sessions.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..74e494db25 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/delete.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/delete.md new file mode 100644 index 0000000000..2d9d302af0 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/get-logs.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..4240e55eec --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/get-prefs.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..d98dcd7290 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/get-sessions.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..b5ecd34e45 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/get.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/get.md new file mode 100644 index 0000000000..a77fbf3ad5 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/update-email.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/update-email.md new file mode 100644 index 0000000000..4a1a002db4 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/update-name.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/update-name.md new file mode 100644 index 0000000000..fa432bb34a --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/update-password.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/update-password.md new file mode 100644 index 0000000000..9bd8ad9b77 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/update-prefs.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..443252f89a --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/update-recovery.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..5140235d49 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/account/update-verification.md b/app/sdks/0.7.0/client-flutter/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..b795cde92d --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..464767c4c0 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..482c642402 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..60397b0af2 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..a9f7a711d9 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..7cead1cb2f --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..b2e70788d6 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +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.getInitials( + ); + + print(result); // Resource URL string +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/client-flutter/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..a5bcfd2c05 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/database/create-document.md b/app/sdks/0.7.0/client-flutter/docs/examples/database/create-document.md new file mode 100644 index 0000000000..b7d540bc2d --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/database/delete-document.md b/app/sdks/0.7.0/client-flutter/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..40c1cbdfe2 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/database/get-document.md b/app/sdks/0.7.0/client-flutter/docs/examples/database/get-document.md new file mode 100644 index 0000000000..0c98142315 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/database/list-documents.md b/app/sdks/0.7.0/client-flutter/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..0685e7f1aa --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/database/update-document.md b/app/sdks/0.7.0/client-flutter/docs/examples/database/update-document.md new file mode 100644 index 0000000000..2f37cd767a --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..60d4f32c4f --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..766006fecc --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..786eeb0b70 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..0570421ef9 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..7846c3c710 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..4f526383fa --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get-languages.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.getLanguages(); + + result + .then((response) { + print(response); + }).catchError((error) { + print(error.response); + }); +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/docs/examples/locale/get.md b/app/sdks/0.7.0/client-flutter/docs/examples/locale/get.md new file mode 100644 index 0000000000..2dbdd47f63 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/create-file.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..9f61be12f4 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..271ed7b2dd --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..be3385a61b --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..8bd1a47457 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..5803fd409f --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/get-file.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..feca667fa9 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/list-files.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..1963ec694d --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/storage/update-file.md b/app/sdks/0.7.0/client-flutter/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..a5ecbfe987 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..e5e82de7b4 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/create.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/create.md new file mode 100644 index 0000000000..d11958ae6d --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..3f57b840fe --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/delete.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/delete.md new file mode 100644 index 0000000000..9fb488afec --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..4edadfa2b4 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/get.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/get.md new file mode 100644 index 0000000000..083565f7a6 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/list.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/list.md new file mode 100644 index 0000000000..665020e928 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/update-membership-status.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..616f64e148 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/docs/examples/teams/update.md b/app/sdks/0.7.0/client-flutter/docs/examples/teams/update.md new file mode 100644 index 0000000000..915fb57d38 --- /dev/null +++ b/app/sdks/0.7.0/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/0.7.0/client-flutter/example/README.md b/app/sdks/0.7.0/client-flutter/example/README.md new file mode 100644 index 0000000000..f6768a5f85 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/example/README.md @@ -0,0 +1,55 @@ +# Examples + +Init your Appwrite client: + +```dart + Client client = Client(); + + client + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production + ; + +``` + +Create a new user and session: + +```dart +Account account = Account(client); + +Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name'); + +Response session = await account.createSession(email: 'me@appwrite.io', password: 'password'); + +``` + +Fetch user profile: + +```dart +Account account = Account(client); + +Response profile = await account.get(); +``` + +Upload File: + +```dart +Storage storage = Storage(client); + +MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg'); + +storage.createFile( + file: file, + read: ['*'], + write: [] +) +.then((response) { + print(response); // File uploaded! +}) +.catchError((error) { + print(error.response); +}); +``` + +All examples and API features are available at the [official Appwrite docs](https://appwrite.io/docs) \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/appwrite.dart b/app/sdks/0.7.0/client-flutter/lib/appwrite.dart new file mode 100644 index 0000000000..95d0b72cfe --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/appwrite.dart @@ -0,0 +1,10 @@ +export 'package:dio/dio.dart' show Response; + +export 'client.dart'; +export 'enums.dart'; +export 'services/account.dart'; +export 'services/avatars.dart'; +export 'services/database.dart'; +export 'services/locale.dart'; +export 'services/storage.dart'; +export 'services/teams.dart'; diff --git a/app/sdks/0.7.0/client-flutter/lib/client.dart b/app/sdks/0.7.0/client-flutter/lib/client.dart new file mode 100644 index 0000000000..96fbf60780 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/client.dart @@ -0,0 +1,144 @@ +import 'dart:io'; + +import 'package:dio/dio.dart'; +import 'package:flutter/foundation.dart'; +import 'package:dio/adapter.dart'; +import 'package:dio_cookie_manager/dio_cookie_manager.dart'; +import 'package:cookie_jar/cookie_jar.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:package_info/package_info.dart'; + +import 'enums.dart'; + +class Client { + String endPoint; + String type = 'unknown'; + Map headers; + Map config; + bool selfSigned; + bool initialized = false; + Dio http; + PersistCookieJar cookieJar; + + Client({this.endPoint = 'https://appwrite.io/v1', this.selfSigned = false, Dio http}) : this.http = http ?? Dio() { + // Platform is not supported in web so if web, set type to web automatically and skip Platform check + if(kIsWeb) { + type = 'web'; + }else{ + type = (Platform.isIOS) ? 'ios' : type; + type = (Platform.isMacOS) ? 'macos' : type; + type = (Platform.isAndroid) ? 'android' : type; + type = (Platform.isLinux) ? 'linux' : type; + type = (Platform.isWindows) ? 'windows' : type; + type = (Platform.isFuchsia) ? 'fuchsia' : type; + } + + this.headers = { + 'content-type': 'application/json', + 'x-sdk-version': 'appwrite:flutter:0.3.0-dev.2', + }; + + this.config = {}; + + assert(endPoint.startsWith(RegExp("http://|https://")), "endPoint $endPoint must start with 'http'"); + } + + Future _getCookiePath() async { + final directory = await getApplicationDocumentsDirectory(); + final path = directory.path; + final Directory dir = new Directory('$path/cookies'); + await dir.create(); + return dir; + } + + /// Your project ID + Client setProject(value) { + config['project'] = value; + addHeader('X-Appwrite-Project', value); + return this; + } + + Client setLocale(value) { + config['locale'] = value; + addHeader('X-Appwrite-Locale', value); + return this; + } + + Client setSelfSigned({bool status = true}) { + selfSigned = status; + return this; + } + + Client setEndpoint(String endPoint) { + this.endPoint = endPoint; + this.http.options.baseUrl = this.endPoint; + return this; + } + + Client addHeader(String key, String value) { + headers[key] = value; + + return this; + } + + Future init() async { + if(!initialized) { + // if web skip cookie implementation and origin header as those are automatically handled by browsers + if(!kIsWeb) { + final Directory cookieDir = await _getCookiePath(); + cookieJar = new PersistCookieJar(dir:cookieDir.path); + this.http.interceptors.add(CookieManager(cookieJar)); + if(Platform.isAndroid || Platform.isIOS) { + PackageInfo packageInfo = await PackageInfo.fromPlatform(); + addHeader('Origin', 'appwrite-' + type + '://' + packageInfo.packageName); + } else if(Platform.isLinux) { + addHeader('Origin', 'appwrite-linux://'); + } else if(Platform.isMacOS) { + addHeader('Origin', 'appwrite-macos://'); + } else if(Platform.isWindows) { + addHeader('Origin', 'appwrite-windows://'); + } else if(Platform.isFuchsia) { + addHeader('Origin', 'appwrite-fuchsia://'); + } + }else{ + // if web set httpClientAdapter as BrowserHttpClientAdapter with withCredentials true to make cookies work + this.http.options.extra['withCredentials'] = true; + } + + this.http.options.baseUrl = this.endPoint; + this.http.options.validateStatus = (status) => status < 400; + } + } + + Future call(HttpMethod method, {String path = '', Map headers = const {}, Map params = const {}}) async { + if(selfSigned && !kIsWeb) { + // Allow self signed requests + (http.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (HttpClient client) { + client.badCertificateCallback = (X509Certificate cert, String host, int port) => true; + return client; + }; + } + + await this.init(); + + // Origin is hardcoded for testing + Options options = Options( + headers: {...this.headers, ...headers}, + method: method.name(), + ); + + if(headers['content-type'] == 'multipart/form-data') { + return http.request(path, data: FormData.fromMap(params), options: options); + } + + if (method == HttpMethod.get) { + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + return http.get(path, queryParameters: params, options: options); + } else { + return http.request(path, data: params, options: options); + } + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/enums.dart b/app/sdks/0.7.0/client-flutter/lib/enums.dart new file mode 100644 index 0000000000..2757f6073e --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/enums.dart @@ -0,0 +1,15 @@ +enum HttpMethod { get, post, put, delete, patch } + +extension HttpMethodString on HttpMethod { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} + +enum OrderType { asc, desc } + +extension OrderTypeString on OrderType { + String name() { + return this.toString().split('.').last.toUpperCase(); + } +} diff --git a/app/sdks/0.7.0/client-flutter/lib/service.dart b/app/sdks/0.7.0/client-flutter/lib/service.dart new file mode 100644 index 0000000000..1ae319b705 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/service.dart @@ -0,0 +1,7 @@ +import 'client.dart'; + +class Service { + final Client client; + + const Service(this.client); +} diff --git a/app/sdks/0.7.0/client-flutter/lib/services/account.dart b/app/sdks/0.7.0/client-flutter/lib/services/account.dart new file mode 100644 index 0000000000..48a3dc0309 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/services/account.dart @@ -0,0 +1,435 @@ + +import 'dart:io'; +import 'package:universal_html/html.dart' as html; + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter_web_auth/flutter_web_auth.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Account extends Service { + Account(Client client): super(client); + + /// Get Account + /// + /// Get currently logged in user data as JSON object. + /// + Future get() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account + /// + /// Use this endpoint to allow a new user to register a new account in your + /// project. After the user registration completes successfully, you can use + /// the [/account/verfication](/docs/client/account#createVerification) route + /// to start verifying the user email address. To allow the new user to login + /// to their new account, you need to create a new [account + /// session](/docs/client/account#createSession). + /// + Future create({@required String email, @required String password, String name = ''}) { + final String path = '/account'; + + final Map params = { + 'email': email, + 'password': password, + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Account + /// + /// Delete a currently logged in user account. Behind the scene, the user + /// record is not deleted but permanently blocked from any access. This is done + /// to avoid deleted accounts being overtaken by new users with the same email + /// address. Any user-related resources like documents or storage files should + /// be deleted separately. + /// + Future delete() { + final String path = '/account'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Account Email + /// + /// Update currently logged in user account email address. After changing user + /// address, user confirmation status is being reset and a new confirmation + /// mail is sent. For security measures, user password is required to complete + /// this request. + /// + Future updateEmail({@required String email, @required String password}) { + final String path = '/account/email'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Logs + /// + /// Get currently logged in user list of latest security activity logs. Each + /// log returns user IP address, location and date and time of log. + /// + Future getLogs() { + final String path = '/account/logs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Name + /// + /// Update currently logged in user account name. + /// + Future updateName({@required String name}) { + final String path = '/account/name'; + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Update Account Password + /// + /// Update currently logged in user password. For validation, user is required + /// to pass the password twice. + /// + Future updatePassword({@required String password, @required String oldPassword}) { + final String path = '/account/password'; + + final Map params = { + 'password': password, + 'oldPassword': oldPassword, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Get Account Preferences + /// + /// Get currently logged in user preferences as a key-value object. + /// + Future getPrefs() { + final String path = '/account/prefs'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Account Preferences + /// + /// Update currently logged in user account preferences. You can pass only the + /// specific settings you wish to update. + /// + Future updatePrefs({@required dynamic prefs}) { + final String path = '/account/prefs'; + + final Map params = { + 'prefs': prefs, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Create Password Recovery + /// + /// Sends the user an email with a temporary secret key for password reset. + /// When the user clicks the confirmation link he is redirected back to your + /// app password reset URL with the secret key and email address values + /// attached to the URL query string. Use the query string params to submit a + /// request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + /// endpoint to complete the process. + /// + Future createRecovery({@required String email, @required String url}) { + final String path = '/account/recovery'; + + final Map params = { + 'email': email, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Password Recovery + /// + /// Use this endpoint to complete the user account password reset. Both the + /// **userId** and **secret** arguments will be passed as query parameters to + /// the redirect URL you have provided when sending your request to the [POST + /// /account/recovery](/docs/client/account#createRecovery) endpoint. + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + Future updateRecovery({@required String userId, @required String secret, @required String password, @required String passwordAgain}) { + final String path = '/account/recovery'; + + final Map params = { + 'userId': userId, + 'secret': secret, + 'password': password, + 'passwordAgain': passwordAgain, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Get Account Sessions + /// + /// Get currently logged in user list of active sessions across different + /// devices. + /// + Future getSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Account Session + /// + /// Allow the user to login into their account by providing a valid email and + /// password combination. This route will create a new session for the user. + /// + Future createSession({@required String email, @required String password}) { + final String path = '/account/sessions'; + + final Map params = { + 'email': email, + 'password': password, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete All Account Sessions + /// + /// Delete all sessions from the user account and remove any sessions cookies + /// from the end client. + /// + Future deleteSessions() { + final String path = '/account/sessions'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Account Session with OAuth2 + /// + /// Allow the user to login to their account using the OAuth2 provider of their + /// choice. Each OAuth2 provider should be enabled from the Appwrite console + /// 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://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure', List scopes = const []}) { + final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider); + + final Map params = { + 'success': success, + 'failure': failure, + 'scopes': scopes, + 'project': client.config['project'], + }; + + + final List query = []; + + params.forEach((key, value) { + if (value is List) { + for (var item in value) { + query.add(Uri.encodeComponent(key + '[]') + '=' + Uri.encodeComponent(item)); + } + } + else { + query.add(Uri.encodeComponent(key) + '=' + Uri.encodeComponent(value)); + } + }); + + Uri endpoint = Uri.parse(client.endPoint); + Uri url = new Uri(scheme: endpoint.scheme, + host: endpoint.host, + port: endpoint.port, + path: endpoint.path + path, + query: query.join('&') + ); + + if(kIsWeb) { + html.window.location.href = url.toString(); + return null; + }else{ + + return FlutterWebAuth.authenticate( + url: url.toString(), + callbackUrlScheme: "appwrite-callback-" + client.config['project'] + ).then((value) async { + Uri url = Uri.parse(value); + Cookie cookie = new Cookie(url.queryParameters['key'], url.queryParameters['secret']); + cookie.domain = Uri.parse(client.endPoint).host; + cookie.httpOnly = true; + cookie.path = '/'; + List cookies = [cookie]; + await client.init(); + client.cookieJar.saveFromResponse(Uri.parse(client.endPoint), cookies); + }); + } + + } + + /// Delete Account Session + /// + /// Use this endpoint to log out the currently logged in user from all their + /// account sessions across all of their different devices. When using the + /// option id argument, only the session unique ID provider will be deleted. + /// + Future deleteSession({@required String sessionId}) { + final String path = '/account/sessions/{sessionId}'.replaceAll(RegExp('{sessionId}'), sessionId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Create Email Verification + /// + /// Use this endpoint to send a verification message to your user email address + /// to confirm they are the valid owners of that address. Both the **userId** + /// and **secret** arguments will be passed as query parameters to the URL you + /// have provided to be attached to the verification email. The provided URL + /// should redirect the user back to your app and allow you to complete the + /// verification process by verifying both the **userId** and **secret** + /// parameters. Learn more about how to [complete the verification + /// process](/docs/client/account#updateVerification). + /// + /// Please note that in order to avoid a [Redirect + /// Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + /// the only valid redirect URLs are the ones from domains you have set when + /// adding your platforms in the console interface. + /// + /// + Future createVerification({@required String url}) { + final String path = '/account/verification'; + + final Map params = { + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Complete Email Verification + /// + /// Use this endpoint to complete the user email verification process. Use both + /// the **userId** and **secret** parameters that were attached to your app URL + /// to verify the user email ownership. If confirmed this route will return a + /// 200 status code. + /// + Future updateVerification({@required String userId, @required String secret}) { + final String path = '/account/verification'; + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/services/avatars.dart b/app/sdks/0.7.0/client-flutter/lib/services/avatars.dart new file mode 100644 index 0000000000..89caef576c --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/services/avatars.dart @@ -0,0 +1,239 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Avatars extends Service { + Avatars(Client client): super(client); + + /// Get Browser Icon + /// + /// You can use this endpoint to show different browser icons to your users. + /// The code argument receives the browser code as it appears in your user + /// /account/sessions endpoint. Use width, height and quality arguments to + /// change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Credit Card Icon + /// + /// Need to display your users with your billing method or their payment + /// methods? The credit card endpoint will return you the icon of the credit + /// card provider you need. Use width, height and quality arguments to change + /// the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Favicon + /// + /// Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + /// website URL. + /// + /// + String getFavicon({@required String url}) { + final String path = '/avatars/favicon'; + + final Map params = { + 'url': url, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Country Flag + /// + /// You can use this endpoint to show different country flags icons to your + /// users. The code argument receives the 2 letter country code. Use width, + /// height and quality arguments to change the output settings. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get Image from URL + /// + /// Use this endpoint to fetch a remote image URL and crop it to any image size + /// you want. This endpoint is very useful if you need to crop and display + /// remote images in your app or in case you want to make sure a 3rd party + /// image is properly served using a TLS protocol. + /// + 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'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get User Initials + /// + /// Use this endpoint to show your user initials avatar icon on your website or + /// app. By default, this route will try to print your logged-in user name or + /// email initials. You can also overwrite the user name if you pass the 'name' + /// parameter. If no name is given and no user is logged, an empty avatar will + /// be returned. + /// + /// You can use the color and background params to change the avatar colors. By + /// default, a random theme will be selected. The random theme will persist for + /// the user's initials when reloading the same theme will always return for + /// the same initials. + /// + String getInitials({String name = '', int width = 500, int height = 500, String color = '', String background = ''}) { + final String path = '/avatars/initials'; + + final Map params = { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get QR Code + /// + /// 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. + /// + String getQR({@required String text, int size = 400, int margin = 1, bool download = false}) { + final String path = '/avatars/qr'; + + final Map params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/services/database.dart b/app/sdks/0.7.0/client-flutter/lib/services/database.dart new file mode 100644 index 0000000000..c45afe661f --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/services/database.dart @@ -0,0 +1,119 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Database extends Service { + Database(Client client): super(client); + + /// List Documents + /// + /// Get a list of all the user documents. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project documents. [Learn more about different API + /// modes](/docs/admin). + /// + Future listDocuments({@required String collectionId, List filters = const [], int limit = 25, int offset = 0, String orderField = '', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = ''}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'filters': filters, + 'limit': limit, + 'offset': offset, + 'orderField': orderField, + 'orderType': orderType.name(), + 'orderCast': orderCast, + 'search': search, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Document + /// + /// Create a new Document. Before using this route, you should create a new + /// collection resource using either a [server + /// integration](/docs/server/database?sdk=nodejs#createCollection) API or + /// directly from your database console. + /// + Future createDocument({@required String collectionId, @required dynamic data, @required List read, @required List write, String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) { + final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Document + /// + /// Get document by its unique ID. This endpoint response returns a JSON object + /// with the document data. + /// + Future getDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Document + Future updateDocument({@required String collectionId, @required String documentId, @required dynamic data, @required List read, @required List write}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + 'data': data, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } + + /// Delete Document + /// + /// Delete document by its unique ID. This endpoint deletes only the parent + /// documents, its attributes and relations to other documents. Child documents + /// **will not** be deleted. + /// + Future deleteDocument({@required String collectionId, @required String documentId}) { + final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/services/locale.dart b/app/sdks/0.7.0/client-flutter/lib/services/locale.dart new file mode 100644 index 0000000000..095af4792c --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/services/locale.dart @@ -0,0 +1,143 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Locale extends Service { + Locale(Client client): super(client); + + /// Get User Locale + /// + /// Get the current user location based on IP. Returns an object with user + /// country code, country name, continent name, continent code, ip address and + /// suggested currency. You can use the locale header to get the data in a + /// supported language. + /// + /// ([IP Geolocation by DB-IP](https://db-ip.com)) + /// + Future get() { + final String path = '/locale'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Continents + /// + /// List of all continents. You can use the locale header to get the data in a + /// supported language. + /// + Future getContinents() { + final String path = '/locale/continents'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries + /// + /// List of all countries. You can use the locale header to get the data in a + /// supported language. + /// + Future getCountries() { + final String path = '/locale/countries'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List EU Countries + /// + /// List of all countries that are currently members of the EU. You can use the + /// locale header to get the data in a supported language. + /// + Future getCountriesEU() { + final String path = '/locale/countries/eu'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Countries Phone Codes + /// + /// List of all countries phone codes. You can use the locale header to get the + /// data in a supported language. + /// + Future getCountriesPhones() { + final String path = '/locale/countries/phones'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Currencies + /// + /// List of all currencies, including currency symbol, name, plural, and + /// decimal digits for all major and minor currencies. You can use the locale + /// header to get the data in a supported language. + /// + Future getCurrencies() { + final String path = '/locale/currencies'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// List Languages + /// + /// List of all languages classified by ISO 639-1 including 2-letter code, name + /// in English, and name in the respective language. + /// + Future getLanguages() { + final String path = '/locale/languages'; + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/services/storage.dart b/app/sdks/0.7.0/client-flutter/lib/services/storage.dart new file mode 100644 index 0000000000..51f9345050 --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/services/storage.dart @@ -0,0 +1,203 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Storage extends Service { + Storage(Client client): super(client); + + /// List Files + /// + /// Get a list of all the user files. You can use the query params to filter + /// your results. On admin mode, this endpoint will return a list of all of the + /// project files. [Learn more about different API modes](/docs/admin). + /// + Future listFiles({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/storage/files'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create File + /// + /// Create a new file. The user who creates the file will automatically be + /// assigned to read and write access unless he has passed custom values for + /// read and write arguments. + /// + Future createFile({@required MultipartFile file, @required List read, @required List write}) { + final String path = '/storage/files'; + + final Map params = { + 'file': file, + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'multipart/form-data', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get File + /// + /// Get file by its unique ID. This endpoint response returns a JSON object + /// with the file metadata. + /// + Future getFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update File + /// + /// Update file by its unique ID. Only users with write permissions have access + /// to update this resource. + /// + Future updateFile({@required String fileId, @required List read, @required List write}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'read': read, + 'write': write, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete File + /// + /// Delete a file by its unique ID. Only users with write permissions have + /// access to delete this resource. + /// + Future deleteFile({@required String fileId}) { + final String path = '/storage/files/{fileId}'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get File for Download + /// + /// Get file content by its unique ID. The endpoint response return with a + /// 'Content-Disposition: attachment' header that tells the browser to start + /// downloading the file to user downloads directory. + /// + String getFileDownload({@required String fileId}) { + final String path = '/storage/files/{fileId}/download'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File Preview + /// + /// Get a file preview image. Currently, this method supports preview for image + /// files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + /// and spreadsheets, will return the file icon image. You can also pass query + /// string arguments for cutting and resizing your preview image. + /// + String getFilePreview({@required String fileId, int width = 0, int height = 0, int quality = 100, String background = '', String output = ''}) { + final String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } + + /// Get File for View + /// + /// Get file content by its unique ID. This endpoint is similar to the download + /// method but returns with no 'Content-Disposition: attachment' header. + /// + String getFileView({@required String fileId, String as = ''}) { + final String path = '/storage/files/{fileId}/view'.replaceAll(RegExp('{fileId}'), fileId); + + final Map params = { + 'as': as, + 'project': client.config['project'], + }; + + params.keys.forEach((key) {if (params[key] is int || params[key] is double) { + params[key] = params[key].toString(); + }}); + + 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 location.toString(); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/lib/services/teams.dart b/app/sdks/0.7.0/client-flutter/lib/services/teams.dart new file mode 100644 index 0000000000..050aeaf06d --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/lib/services/teams.dart @@ -0,0 +1,207 @@ + + +import 'package:dio/dio.dart'; +import 'package:meta/meta.dart'; + +import "../client.dart"; +import '../enums.dart'; +import "../service.dart"; + +class Teams extends Service { + Teams(Client client): super(client); + + /// List Teams + /// + /// Get a list of all the current user teams. You can use the query params to + /// filter your results. On admin mode, this endpoint will return a list of all + /// of the project teams. [Learn more about different API modes](/docs/admin). + /// + Future list({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams'; + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team + /// + /// Create a new team. The user who creates the team will automatically be + /// assigned as the owner of the team. The team owner can invite new members, + /// who will be able add new owners and update or delete the team from your + /// project. + /// + Future create({@required String name, List roles = const ["owner"]}) { + final String path = '/teams'; + + final Map params = { + 'name': name, + 'roles': roles, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Get Team + /// + /// Get team by its unique ID. All team members have read access for this + /// resource. + /// + Future get({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Update Team + /// + /// Update team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future update({@required String teamId, @required String name}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'name': name, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.put, path: path, params: params, headers: headers); + } + + /// Delete Team + /// + /// Delete team by its unique ID. Only team owners have write access for this + /// resource. + /// + Future delete({@required String teamId}) { + final String path = '/teams/{teamId}'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Get Team Memberships + /// + /// Get team members by the team unique ID. All team members have read access + /// for this list of resources. + /// + Future getMemberships({@required String teamId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType.name(), + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.get, path: path, params: params, headers: headers); + } + + /// Create Team Membership + /// + /// Use this endpoint to invite a new member to join your team. An email with a + /// link to join the team will be sent to the new member email address if the + /// member doesn't exist in the project it will be created automatically. + /// + /// Use the 'URL' parameter to redirect the user from the invitation email back + /// to your app. When the user is redirected, use the [Update Team Membership + /// Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + /// user to accept the invitation to the team. + /// + /// Please note that in order to avoid a [Redirect + /// Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + /// the only valid redirect URL's are the once from domains you have set when + /// added your platforms in the console interface. + /// + Future createMembership({@required String teamId, @required String email, @required List roles, @required String url, String name = ''}) { + final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId); + + final Map params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.post, path: path, params: params, headers: headers); + } + + /// Delete Team Membership + /// + /// This endpoint allows a user to leave a team or for a team owner to delete + /// the membership of any other team member. You can also use this endpoint to + /// delete a user membership even if it is not accepted. + /// + Future deleteMembership({@required String teamId, @required String inviteId}) { + final String path = '/teams/{teamId}/memberships/{inviteId}'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.delete, path: path, params: params, headers: headers); + } + + /// Update Team Membership Status + /// + /// Use this endpoint to allow a user to accept an invitation to join a team + /// after being redirected back to your app from the invitation email recieved + /// by the user. + /// + Future updateMembershipStatus({@required String teamId, @required String inviteId, @required String userId, @required String secret}) { + final String path = '/teams/{teamId}/memberships/{inviteId}/status'.replaceAll(RegExp('{teamId}'), teamId).replaceAll(RegExp('{inviteId}'), inviteId); + + final Map params = { + 'userId': userId, + 'secret': secret, + }; + + final Map headers = { + 'content-type': 'application/json', + }; + + return client.call(HttpMethod.patch, path: path, params: params, headers: headers); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-flutter/pubspec.yaml b/app/sdks/0.7.0/client-flutter/pubspec.yaml new file mode 100644 index 0000000000..cabc271c5e --- /dev/null +++ b/app/sdks/0.7.0/client-flutter/pubspec.yaml @@ -0,0 +1,24 @@ +name: appwrite +version: 0.3.0-dev.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-flutter +issue_tracker: https://github.com/appwrite/sdk-generator/issues +documentation: https://appwrite.io/support +environment: + sdk: '>=2.6.0 <3.0.0' +dependencies: + meta: ^1.1.8 + path_provider: ^1.6.14 + package_info: ^0.4.3 + dio: ^3.0.10 + cookie_jar: ^1.0.1 + dio_cookie_manager: ^1.0.0 + flutter_web_auth: ^0.2.4 + universal_html: ^1.2.3 + flutter: + sdk: flutter + +dev_dependencies: + flutter_test: + sdk: flutter \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/CHANGELOG.md b/app/sdks/0.7.0/client-web/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/client-web/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/LICENSE b/app/sdks/0.7.0/client-web/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/client-web/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/README.md b/app/sdks/0.7.0/client-web/README.md new file mode 100644 index 0000000000..ff92e79c17 --- /dev/null +++ b/app/sdks/0.7.0/client-web/README.md @@ -0,0 +1,59 @@ +# Appwrite Web SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-js.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. + Use the Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. + For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +### NPM + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install appwrite --save +``` + +If you're using a bundler (like [Browserify](http://browserify.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it: + +```js +import * as Appwrite from "appwrite"; +``` + +### CDN + +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 Web SDK +var appwrite = new Appwrite(); + +appwrite + .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution + .setProject('455x34dfkj') // Your Appwrite Project UID +; + +``` + + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/create-o-auth2session.md b/app/sdks/0.7.0/client-web/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..25b02e632e --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,10 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +// Go to OAuth provider login page +sdk.account.createOAuth2Session('amazon'); + diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/create-recovery.md b/app/sdks/0.7.0/client-web/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..72130f4de4 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/create-recovery.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.createRecovery('email@example.com', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/create-session.md b/app/sdks/0.7.0/client-web/docs/examples/account/create-session.md new file mode 100644 index 0000000000..4a7682c13d --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/create-session.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.createSession('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/create-verification.md b/app/sdks/0.7.0/client-web/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..7903384a9f --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/create-verification.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.createVerification('https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/create.md b/app/sdks/0.7.0/client-web/docs/examples/account/create.md new file mode 100644 index 0000000000..c9ce798b6a --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/create.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/delete-session.md b/app/sdks/0.7.0/client-web/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..581e5d132d --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/delete-session.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.deleteSession('[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/delete-sessions.md b/app/sdks/0.7.0/client-web/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..d037673eb3 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/delete-sessions.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.deleteSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/delete.md b/app/sdks/0.7.0/client-web/docs/examples/account/delete.md new file mode 100644 index 0000000000..d952d77d7a --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/delete.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.delete(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/get-logs.md b/app/sdks/0.7.0/client-web/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..c53e0446e9 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/get-logs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.getLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/get-prefs.md b/app/sdks/0.7.0/client-web/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..75835e37fb --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/get-prefs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.getPrefs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/get-sessions.md b/app/sdks/0.7.0/client-web/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..b4434de336 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/get-sessions.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.getSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/get.md b/app/sdks/0.7.0/client-web/docs/examples/account/get.md new file mode 100644 index 0000000000..f0184a8513 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/update-email.md b/app/sdks/0.7.0/client-web/docs/examples/account/update-email.md new file mode 100644 index 0000000000..f48fed78bc --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/update-email.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateEmail('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/update-name.md b/app/sdks/0.7.0/client-web/docs/examples/account/update-name.md new file mode 100644 index 0000000000..e03e72c4b2 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/update-name.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateName('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/update-password.md b/app/sdks/0.7.0/client-web/docs/examples/account/update-password.md new file mode 100644 index 0000000000..22539f3f64 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/update-password.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updatePassword('password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/update-prefs.md b/app/sdks/0.7.0/client-web/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..b2d4ff175e --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/update-prefs.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updatePrefs({}); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/update-recovery.md b/app/sdks/0.7.0/client-web/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..33cf1b63c9 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/update-recovery.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/account/update-verification.md b/app/sdks/0.7.0/client-web/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..a80e125e30 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/account/update-verification.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.account.updateVerification('[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..0855209f58 --- /dev/null +++ b/app/sdks/0.7.0/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 \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..1aa595bd65 --- /dev/null +++ b/app/sdks/0.7.0/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 \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..a945e50bb2 --- /dev/null +++ b/app/sdks/0.7.0/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 \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..222b388afc --- /dev/null +++ b/app/sdks/0.7.0/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 \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..3f15981c71 --- /dev/null +++ b/app/sdks/0.7.0/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 \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..ef04988e2d --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-initials.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.getInitials(); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/client-web/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..9d9ee3fea2 --- /dev/null +++ b/app/sdks/0.7.0/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 \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/database/create-document.md b/app/sdks/0.7.0/client-web/docs/examples/database/create-document.md new file mode 100644 index 0000000000..e04f73f73e --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/database/create-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/database/delete-document.md b/app/sdks/0.7.0/client-web/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..79799b6907 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/database/delete-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/database/get-document.md b/app/sdks/0.7.0/client-web/docs/examples/database/get-document.md new file mode 100644 index 0000000000..b9605dccc6 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/database/get-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/database/list-documents.md b/app/sdks/0.7.0/client-web/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..14f8a423a1 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/database/list-documents.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/database/update-document.md b/app/sdks/0.7.0/client-web/docs/examples/database/update-document.md new file mode 100644 index 0000000000..9104b77a71 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/database/update-document.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..1dfdf8013b --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get-continents.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getContinents(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..6b3f210a1e --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..f35e2152e4 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..53b96375a1 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get-countries.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCountries(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..57db66401f --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get-currencies.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..04e3063ee7 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get-languages.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.getLanguages(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/locale/get.md b/app/sdks/0.7.0/client-web/docs/examples/locale/get.md new file mode 100644 index 0000000000..469a046dbc --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/locale/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.locale.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/create-file.md b/app/sdks/0.7.0/client-web/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..b23c47027a --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/create-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/client-web/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..c38ab4ba9c --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..1323b8b8df --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-download.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.storage.getFileDownload('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..5ede9fdb93 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-preview.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.storage.getFilePreview('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..53877ae352 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file-view.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.storage.getFileView('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/get-file.md b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..a1f94c08a6 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/get-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/list-files.md b/app/sdks/0.7.0/client-web/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..c489a0b46d --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/list-files.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.listFiles(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/storage/update-file.md b/app/sdks/0.7.0/client-web/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..2a2f579b3b --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/storage/update-file.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/client-web/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..78b2d7fa77 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/create-membership.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/create.md b/app/sdks/0.7.0/client-web/docs/examples/teams/create.md new file mode 100644 index 0000000000..43205ba888 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/create.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/client-web/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..1b85ef08da --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/delete.md b/app/sdks/0.7.0/client-web/docs/examples/teams/delete.md new file mode 100644 index 0000000000..4665ad5773 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/delete.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/client-web/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..6235ce33f4 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/get-memberships.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/get.md b/app/sdks/0.7.0/client-web/docs/examples/teams/get.md new file mode 100644 index 0000000000..f4b0f040b1 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/get.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/list.md b/app/sdks/0.7.0/client-web/docs/examples/teams/list.md new file mode 100644 index 0000000000..c4229e2400 --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/list.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/update-membership-status.md b/app/sdks/0.7.0/client-web/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..e8b3de0a0b --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/update-membership-status.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.updateMembershipStatus('[TEAM_ID]', '[INVITE_ID]', '[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/docs/examples/teams/update.md b/app/sdks/0.7.0/client-web/docs/examples/teams/update.md new file mode 100644 index 0000000000..bbab80937d --- /dev/null +++ b/app/sdks/0.7.0/client-web/docs/examples/teams/update.md @@ -0,0 +1,14 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID +; + +let promise = sdk.teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/package.json b/app/sdks/0.7.0/client-web/package.json new file mode 100644 index 0000000000..26dd06fb94 --- /dev/null +++ b/app/sdks/0.7.0/client-web/package.json @@ -0,0 +1,17 @@ +{ + "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.1.0", + "license": "BSD-3-Clause", + "main": "src/sdk.js", + "types": "types/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-js" + }, + "devDependencies": { + "typescript": "^3.6.4" + }, + "dependencies": {} +} \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/src/sdk.js b/app/sdks/0.7.0/client-web/src/sdk.js new file mode 100644 index 0000000000..906aa60a91 --- /dev/null +++ b/app/sdks/0.7.0/client-web/src/sdk.js @@ -0,0 +1,2387 @@ +(function (window) { + + 'use strict'; + + window.Appwrite = function () { + + let config = { + endpoint: 'https://appwrite.io/v1', + project: '', + locale: '', + }; + + /** + * @param {string} endpoint + * @returns {this} + */ + let setEndpoint = function(endpoint) { + config.endpoint = endpoint; + + return this; + }; + + /** + * Set Project + * + * Your project ID + * + * @param value string + * + * @return this + */ + let setProject = function (value) + { + http.addGlobalHeader('X-Appwrite-Project', value); + + config.project = value; + + return this; + }; + + /** + * Set Locale + * + * @param value string + * + * @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; + }; + + /** + * @param {Object} params + * @returns {string} + */ + let buildQuery = function(params) { + let str = []; + + for (let p in params) { + if(Array.isArray(params[p])) { + for (let index = 0; index < params[p].length; index++) { + let param = params[p][index]; + str.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(params[p])); + } + } + + return str.join("&"); + }; + + let addGlobalHeader = function(key, value) { + globalHeaders[key] = {key: key.toLowerCase(), value: value.toLowerCase()}; + }; + + let addGlobalParam = function(key, value) { + globalParams.push({key: key, value: value}); + }; + + addGlobalHeader('x-sdk-version', 'appwrite:web:1.1.0'); + addGlobalHeader('content-type', ''); + + /** + * @param {string} method + * @param {string} path string + * @param {Object} headers + * @param {Object} params + * @param {function} progress + * @returns {Promise} + */ + let call = function (method, path, headers = {}, params = {}, progress = null) { + let i; + + path = config.endpoint + path; + + if (-1 === ['GET', 'POST', 'PUT', 'DELETE', 'TRACE', 'HEAD', 'OPTIONS', 'CONNECT', 'PATCH'].indexOf(method)) { + throw new Error('var method must contain a valid HTTP method name'); + } + + if (typeof path !== 'string') { + throw new Error('var path must be of type string'); + } + + if (typeof headers !== 'object') { + throw new Error('var headers must be of type object'); + } + + for (i = 0; i < globalParams.length; i++) { // Add global params to URL + path = addParam(path, globalParams[i].key, globalParams[i].value); + } + + if(window.localStorage && window.localStorage.getItem('cookieFallback')) { + headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback'); + } + + for (let key in globalHeaders) { // Add Global Headers + if (globalHeaders.hasOwnProperty(key)) { + if (!headers[globalHeaders[key].key]) { + headers[globalHeaders[key].key] = globalHeaders[key].value; + } + } + } + + if(method === 'GET') { + for (let param in params) { + if (param.hasOwnProperty(key)) { + path = addParam(path, key + (Array.isArray(param) ? '[]' : ''), params[key]); + } + } + } + + switch (headers['content-type']) { // Parse request by content type + case 'application/json': + params = JSON.stringify(params); + break; + + case 'multipart/form-data': + let formData = new FormData(); + + Object.keys(params).forEach(function(key) { + let param = params[key]; + formData.append(key + (Array.isArray(param) ? '[]' : ''), param); + }); + + params = formData; + break; + } + + return new Promise(function (resolve, reject) { + + let request = new XMLHttpRequest(), key; + + request.withCredentials = true; + request.open(method, path, true); + + for (key in headers) { // Set Headers + if (headers.hasOwnProperty(key)) { + if (key === 'content-type' && headers[key] === 'multipart/form-data') { // Skip to avoid missing boundary + continue; + } + + request.setRequestHeader(key, headers[key]); + } + } + + request.onload = function () { + let data = request.response; + let contentType = this.getResponseHeader('content-type') || ''; + contentType = contentType.substring(0, contentType.indexOf(';')); + + switch (contentType) { + case 'application/json': + data = JSON.parse(data); + break; + } + + let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || ''; + + if(window.localStorage && cookieFallback) { + window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); + window.localStorage.setItem('cookieFallback', cookieFallback); + } + + if (4 === request.readyState && 399 >= request.status) { + resolve(data); + } else { + reject(data); + } + }; + + if (progress) { + request.addEventListener('progress', progress); + request.upload.addEventListener('progress', progress, false); + } + + // Handle network errors + request.onerror = function () { + reject(new Error("Network Error")); + }; + + request.send(params); + }) + }; + + return { + 'get': function(path, headers = {}, params = {}) { + return call('GET', path + ((Object.keys(params).length > 0) ? '?' + buildQuery(params) : ''), headers, {}); + }, + 'post': function(path, headers = {}, params = {}, progress = null) { + return call('POST', path, headers, params, progress); + }, + 'put': function(path, headers = {}, params = {}, progress = null) { + return call('PUT', path, headers, params, progress); + }, + 'patch': function(path, headers = {}, params = {}, progress = null) { + return call('PATCH', path, headers, params, progress); + }, + 'delete': function(path, headers = {}, params = {}, progress = null) { + return call('DELETE', path, headers, params, progress); + }, + 'addGlobalParam': addGlobalParam, + 'addGlobalHeader': addGlobalHeader + } + }(window.document); + + let account = { + + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/account'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow the new user to login + * to their new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete: function() { + let path = '/account'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/email'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs: function() { + let path = '/account/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName: function(name) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/account/name'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword: function(password, oldPassword) { + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(oldPassword === undefined) { + throw new Error('Missing required parameter: "oldPassword"'); + } + + let path = '/account/password'; + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + if(oldPassword) { + payload['oldPassword'] = oldPassword; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs: function() { + let path = '/account/prefs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(prefs) { + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/account/prefs'; + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery: function(email, url) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery: function(userId, secret, password, passwordAgain) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(passwordAgain === undefined) { + throw new Error('Missing required parameter: "passwordAgain"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + if(password) { + payload['password'] = password; + } + + if(passwordAgain) { + payload['passwordAgain'] = passwordAgain; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session + * + * Allow the user to login into their account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/sessions'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to their account using the OAuth2 provider of their + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) { + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}', 'g'), provider); + + let payload = {}; + + if(success) { + payload['success'] = success; + } + + if(failure) { + payload['failure'] = failure; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + window.location = config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all their + * account sessions across all of their different devices. When using the + * option id argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(sessionId) { + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}', 'g'), sessionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification: function(userId, secret) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let avatars = { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/avatars/favicon'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials: function(name = '', width = 500, height = 500, color = '', background = '') { + let path = '/avatars/initials'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(color) { + payload['color'] = color; + } + + if(background) { + payload['background'] = background; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR: function(text, size = 400, margin = 1, download = false) { + 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; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let database = { + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} limit + * @param {number} offset + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments: function(collectionId, filters = [], limit = 25, offset = 0, orderField = '', orderType = 'ASC', orderCast = 'string', search = '') { + 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(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderField) { + payload['orderField'] = orderField; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + if(orderCast) { + payload['orderCast'] = orderCast; + } + + if(search) { + payload['search'] = search; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument: function(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(parentDocument) { + payload['parentDocument'] = parentDocument; + } + + if(parentProperty) { + payload['parentProperty'] = parentProperty; + } + + if(parentPropertyType) { + payload['parentPropertyType'] = parentPropertyType; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument: function(collectionId, documentId, data, read, write) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let locale = { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/locale'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents: function() { + let path = '/locale/continents'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries: function() { + let path = '/locale/countries'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU: function() { + let path = '/locale/countries/eu'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones: function() { + let path = '/locale/countries/phones'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies: function() { + let path = '/locale/currencies'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages: function() { + let path = '/locale/languages'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let storage = { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile: function(file, read, write) { + if(file === undefined) { + throw new Error('Missing required parameter: "file"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files'; + + let payload = {}; + + if(file) { + payload['file'] = file; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + }, + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile: function(fileId, read, write) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + if(background) { + payload['background'] = background; + } + + if(output) { + payload['output'] = output; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView: function(fileId, as = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(as) { + payload['as'] = as; + } + + payload['project'] = config.project; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let teams = { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create: function(name, roles = ["owner"]) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update: function(teamId, name) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships: function(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership: function(teamId, email, roles, url, name = '') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(roles === undefined) { + throw new Error('Missing required parameter: "roles"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership: function(teamId, inviteId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after being redirected back to your app from the invitation email recieved + * by the user. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus: function(teamId, inviteId, userId, secret) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + return { + setEndpoint: setEndpoint, + setProject: setProject, + setLocale: setLocale, + account: account, + avatars: avatars, + database: database, + locale: locale, + storage: storage, + teams: teams + }; + }; + + if(typeof module !== "undefined") { + module.exports = window.Appwrite; + } + +})((typeof window !== "undefined") ? window : {}); \ No newline at end of file diff --git a/app/sdks/0.7.0/client-web/src/sdk.min.js b/app/sdks/0.7.0/client-web/src/sdk.min.js new file mode 100644 index 0000000000..477a40cb1a --- /dev/null +++ b/app/sdks/0.7.0/client-web/src/sdk.min.js @@ -0,0 +1,187 @@ +(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;index=request.status){resolve(data)}else{reject(data)}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)} +request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +if(name){payload.name=name} +return http.post(path,{'content-type':'application/json',},payload)},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/email';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.patch(path,{'content-type':'application/json',},payload)},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"')} +let path='/account/name';let payload={};if(name){payload.name=name} +return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} +let path='/account/password';let payload={};if(password){payload.password=password} +if(oldPassword){payload.oldPassword=oldPassword} +return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} +let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} +return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(url===undefined){throw new Error('Missing required parameter: "url"')} +let path='/account/recovery';let payload={};if(email){payload.email=email} +if(url){payload.url=url} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +if(secret===undefined){throw new Error('Missing required parameter: "secret"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')} +let path='/account/recovery';let payload={};if(userId){payload.userId=userId} +if(secret){payload.secret=secret} +if(password){payload.password=password} +if(passwordAgain){payload.passwordAgain=passwordAgain} +return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/sessions';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} +if(failure){payload.failure=failure} +if(scopes){payload.scopes=scopes} +payload.project=config.project;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index; + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow the new user to login + * to their new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create(email: string, password: string, name?: string): Promise; + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete(): Promise; + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail(email: string, password: string): Promise; + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs(): Promise; + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName(name: string): Promise; + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword(password: string, oldPassword: string): Promise; + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs(): Promise; + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs(prefs: object): Promise; + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery(email: string, url: string): Promise; + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise; + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions(): Promise; + + /** + * Create Account Session + * + * Allow the user to login into their account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession(email: string, password: string): Promise; + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions(): Promise; + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to their account using the OAuth2 provider of their + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): Promise; + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all their + * account sessions across all of their different devices. When using the + * option id argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession(sessionId: string): Promise; + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification(url: string): Promise; + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification(userId: string, secret: string): Promise; + + } + + export interface Avatars { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getCreditCard(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon(url: string): string; + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getFlag(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + getImage(url: string, width?: number, height?: number): string; + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials(name?: string, width?: number, height?: number, color?: string, background?: string): string; + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR(text: string, size?: number, margin?: number, download?: boolean): string; + + } + + export interface Database { + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} limit + * @param {number} offset + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments(collectionId: string, filters?: string[], limit?: number, offset?: number, orderField?: string, orderType?: string, orderCast?: string, search?: string): Promise; + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument(collectionId: string, data: object, read: string[], write: string[], parentDocument?: string, parentProperty?: string, parentPropertyType?: string): Promise; + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument(collectionId: string, documentId: string): Promise; + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument(collectionId: string, documentId: string, data: object, read: string[], write: string[]): Promise; + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument(collectionId: string, documentId: string): Promise; + + } + + export interface Locale { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents(): Promise; + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries(): Promise; + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU(): Promise; + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones(): Promise; + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies(): Promise; + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages(): Promise; + + } + + export interface Storage { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile(file: File, read: string[], write: string[]): Promise; + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile(fileId: string): Promise; + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile(fileId: string, read: string[], write: string[]): Promise; + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile(fileId: string): Promise; + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload(fileId: string): string; + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview(fileId: string, width?: number, height?: number, quality?: number, background?: string, output?: string): string; + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView(fileId: string, as?: string): string; + + } + + export interface Teams { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create(name: string, roles?: string[]): Promise; + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get(teamId: string): Promise; + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update(teamId: string, name: string): Promise; + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete(teamId: string): Promise; + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships(teamId: string, search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership(teamId: string, email: string, roles: string[], url: string, name?: string): Promise; + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership(teamId: string, inviteId: string): Promise; + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after being redirected back to your app from the invitation email recieved + * by the user. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus(teamId: string, inviteId: string, userId: string, secret: string): Promise; + + } + + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/CHANGELOG.md b/app/sdks/0.7.0/console-web/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/console-web/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/LICENSE b/app/sdks/0.7.0/console-web/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/console-web/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/README.md b/app/sdks/0.7.0/console-web/README.md new file mode 100644 index 0000000000..2c32f3c57a --- /dev/null +++ b/app/sdks/0.7.0/console-web/README.md @@ -0,0 +1,59 @@ +# Appwrite Console SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-console.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +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 Console 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) + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +### NPM + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install appwrite --save +``` + +If you're using a bundler (like [Browserify](http://browserify.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it: + +```js +import * as Appwrite from "appwrite"; +``` + +### CDN + +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 Web SDK +var appwrite = new Appwrite(); + +appwrite + .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution + .setProject('455x34dfkj') // Your Appwrite Project UID +; + +``` + + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/create-o-auth2session.md b/app/sdks/0.7.0/console-web/docs/examples/account/create-o-auth2session.md new file mode 100644 index 0000000000..3a2dcba651 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/create-o-auth2session.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +// Go to OAuth provider login page +sdk.account.createOAuth2Session('amazon'); + diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/create-recovery.md b/app/sdks/0.7.0/console-web/docs/examples/account/create-recovery.md new file mode 100644 index 0000000000..d69269b351 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/create-recovery.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.createRecovery('email@example.com', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/create-session.md b/app/sdks/0.7.0/console-web/docs/examples/account/create-session.md new file mode 100644 index 0000000000..0734a84aaa --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/create-session.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.createSession('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/create-verification.md b/app/sdks/0.7.0/console-web/docs/examples/account/create-verification.md new file mode 100644 index 0000000000..1211b5c642 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/create-verification.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.createVerification('https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/create.md b/app/sdks/0.7.0/console-web/docs/examples/account/create.md new file mode 100644 index 0000000000..e61b1fbac4 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/delete-session.md b/app/sdks/0.7.0/console-web/docs/examples/account/delete-session.md new file mode 100644 index 0000000000..84505281f0 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/delete-session.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.deleteSession('[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/delete-sessions.md b/app/sdks/0.7.0/console-web/docs/examples/account/delete-sessions.md new file mode 100644 index 0000000000..61bec86399 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/delete-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.deleteSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/delete.md b/app/sdks/0.7.0/console-web/docs/examples/account/delete.md new file mode 100644 index 0000000000..dbb8dbf250 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.delete(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/get-logs.md b/app/sdks/0.7.0/console-web/docs/examples/account/get-logs.md new file mode 100644 index 0000000000..12e6656c96 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/get-logs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.getLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/get-prefs.md b/app/sdks/0.7.0/console-web/docs/examples/account/get-prefs.md new file mode 100644 index 0000000000..e328baba32 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/get-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.getPrefs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/get-sessions.md b/app/sdks/0.7.0/console-web/docs/examples/account/get-sessions.md new file mode 100644 index 0000000000..cb281dd4db --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/get-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.getSessions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/get.md b/app/sdks/0.7.0/console-web/docs/examples/account/get.md new file mode 100644 index 0000000000..82c96fb9db --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/update-email.md b/app/sdks/0.7.0/console-web/docs/examples/account/update-email.md new file mode 100644 index 0000000000..c2caaf060e --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/update-email.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateEmail('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/update-name.md b/app/sdks/0.7.0/console-web/docs/examples/account/update-name.md new file mode 100644 index 0000000000..047eba688b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/update-name.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateName('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/update-password.md b/app/sdks/0.7.0/console-web/docs/examples/account/update-password.md new file mode 100644 index 0000000000..d305031fa0 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/update-password.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updatePassword('password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/update-prefs.md b/app/sdks/0.7.0/console-web/docs/examples/account/update-prefs.md new file mode 100644 index 0000000000..8c4e402ae1 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/update-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updatePrefs({}); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/update-recovery.md b/app/sdks/0.7.0/console-web/docs/examples/account/update-recovery.md new file mode 100644 index 0000000000..235a4db481 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/update-recovery.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/account/update-verification.md b/app/sdks/0.7.0/console-web/docs/examples/account/update-verification.md new file mode 100644 index 0000000000..ef2c384853 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/account/update-verification.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.account.updateVerification('[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..bbbdb9738f --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-browser.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getBrowser('aa'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..e1fab01cf2 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getCreditCard('amex'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..397986b11a --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-favicon.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getFavicon('https://example.com'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..6e90b72feb --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-flag.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getFlag('af'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..afd1a17cb5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-image.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getImage('https://example.com'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..dab6417ca5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-initials.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getInitials(); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..31f490cedd --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/avatars/get-q-r.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.avatars.getQR('[TEXT]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/create-collection.md b/app/sdks/0.7.0/console-web/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..a7a4b90197 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/create-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.createCollection('[NAME]', [], [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/create-document.md b/app/sdks/0.7.0/console-web/docs/examples/database/create-document.md new file mode 100644 index 0000000000..64809c6156 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/create-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/delete-collection.md b/app/sdks/0.7.0/console-web/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..bfb0706bf5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/delete-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.deleteCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/delete-document.md b/app/sdks/0.7.0/console-web/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..356a71a437 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/delete-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/get-collection.md b/app/sdks/0.7.0/console-web/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..d74d4b3225 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/get-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.getCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/get-document.md b/app/sdks/0.7.0/console-web/docs/examples/database/get-document.md new file mode 100644 index 0000000000..51638880c5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/get-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/list-collections.md b/app/sdks/0.7.0/console-web/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..8a18249748 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/list-collections.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.listCollections(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/list-documents.md b/app/sdks/0.7.0/console-web/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..1d895a566a --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/list-documents.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/update-collection.md b/app/sdks/0.7.0/console-web/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..f00a6c6f8c --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/update-collection.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/database/update-document.md b/app/sdks/0.7.0/console-web/docs/examples/database/update-document.md new file mode 100644 index 0000000000..52c172ab6a --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/database/update-document.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/create-execution.md b/app/sdks/0.7.0/console-web/docs/examples/functions/create-execution.md new file mode 100644 index 0000000000..e70d7f931a --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/create-execution.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.createExecution('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/create-tag.md b/app/sdks/0.7.0/console-web/docs/examples/functions/create-tag.md new file mode 100644 index 0000000000..743517ff1a --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/create-tag.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.createTag('[FUNCTION_ID]', '[COMMAND]', document.getElementById('uploader').files[0]); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/create.md b/app/sdks/0.7.0/console-web/docs/examples/functions/create.md new file mode 100644 index 0000000000..6fb506816f --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.create('[NAME]', 'node-14'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/delete-tag.md b/app/sdks/0.7.0/console-web/docs/examples/functions/delete-tag.md new file mode 100644 index 0000000000..9c1b5cdda3 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/delete-tag.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.deleteTag('[FUNCTION_ID]', '[TAG_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/delete.md b/app/sdks/0.7.0/console-web/docs/examples/functions/delete.md new file mode 100644 index 0000000000..f76f809c2b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.delete('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/get-execution.md b/app/sdks/0.7.0/console-web/docs/examples/functions/get-execution.md new file mode 100644 index 0000000000..8287c4709e --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/get-execution.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/get-tag.md b/app/sdks/0.7.0/console-web/docs/examples/functions/get-tag.md new file mode 100644 index 0000000000..c6021ccdac --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/get-tag.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.getTag('[FUNCTION_ID]', '[TAG_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/get-usage.md b/app/sdks/0.7.0/console-web/docs/examples/functions/get-usage.md new file mode 100644 index 0000000000..7515c0fe5c --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/get-usage.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.getUsage('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/get.md b/app/sdks/0.7.0/console-web/docs/examples/functions/get.md new file mode 100644 index 0000000000..dc068ffa09 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.get('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/list-executions.md b/app/sdks/0.7.0/console-web/docs/examples/functions/list-executions.md new file mode 100644 index 0000000000..9367a9eb52 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/list-executions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.listExecutions('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/list-tags.md b/app/sdks/0.7.0/console-web/docs/examples/functions/list-tags.md new file mode 100644 index 0000000000..4542bae44b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/list-tags.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.listTags('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/list.md b/app/sdks/0.7.0/console-web/docs/examples/functions/list.md new file mode 100644 index 0000000000..e2ce2511e0 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/update-tag.md b/app/sdks/0.7.0/console-web/docs/examples/functions/update-tag.md new file mode 100644 index 0000000000..7ea2ba1808 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/update-tag.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.updateTag('[FUNCTION_ID]', '[TAG]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/functions/update.md b/app/sdks/0.7.0/console-web/docs/examples/functions/update.md new file mode 100644 index 0000000000..c6a34cff5c --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/functions/update.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.functions.update('[FUNCTION_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-anti-virus.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..95b671992b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-anti-virus.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getAntiVirus(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-cache.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..5c41d81868 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-cache.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getCache(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-d-b.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..407f87e2a1 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-d-b.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getDB(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-certificates.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..a115c869ba --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-functions.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..3c0dc33acf --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueFunctions(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-logs.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..b3d41b49c6 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-tasks.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..4f34f670a6 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-usage.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..3d234be2de --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..c5825dcf6c --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-storage-local.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..7287745704 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-storage-local.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get-time.md b/app/sdks/0.7.0/console-web/docs/examples/health/get-time.md new file mode 100644 index 0000000000..b6087b73d5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get-time.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.getTime(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/health/get.md b/app/sdks/0.7.0/console-web/docs/examples/health/get.md new file mode 100644 index 0000000000..1e7d6fe4e8 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/health/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.health.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..93144335ea --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get-continents.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getContinents(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..fffc8696e8 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..751f4f6cc4 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..30b1dd95c7 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get-countries.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCountries(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..4c92714062 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get-currencies.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..2d1f713eeb --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get-languages.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.getLanguages(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/locale/get.md b/app/sdks/0.7.0/console-web/docs/examples/locale/get.md new file mode 100644 index 0000000000..1fba9877b5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/locale/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.locale.get(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/create-domain.md b/app/sdks/0.7.0/console-web/docs/examples/projects/create-domain.md new file mode 100644 index 0000000000..756b869a85 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/create-domain.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createDomain('[PROJECT_ID]', ''); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/create-key.md b/app/sdks/0.7.0/console-web/docs/examples/projects/create-key.md new file mode 100644 index 0000000000..9556f5b7f7 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/create-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createKey('[PROJECT_ID]', '[NAME]', []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/create-platform.md b/app/sdks/0.7.0/console-web/docs/examples/projects/create-platform.md new file mode 100644 index 0000000000..f4476fe599 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/create-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createPlatform('[PROJECT_ID]', 'web', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/create-task.md b/app/sdks/0.7.0/console-web/docs/examples/projects/create-task.md new file mode 100644 index 0000000000..9b0f3c1e03 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/create-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', false, 'GET', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/create-webhook.md b/app/sdks/0.7.0/console-web/docs/examples/projects/create-webhook.md new file mode 100644 index 0000000000..be722f3dbe --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/create-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.createWebhook('[PROJECT_ID]', '[NAME]', [], 'https://example.com', false); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/create.md b/app/sdks/0.7.0/console-web/docs/examples/projects/create.md new file mode 100644 index 0000000000..8041ed154e --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.create('[NAME]', '[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/delete-domain.md b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-domain.md new file mode 100644 index 0000000000..1b3df9363b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-domain.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteDomain('[PROJECT_ID]', '[DOMAIN_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/delete-key.md b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-key.md new file mode 100644 index 0000000000..dc855bcc30 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteKey('[PROJECT_ID]', '[KEY_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/delete-platform.md b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-platform.md new file mode 100644 index 0000000000..2a180c47e4 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deletePlatform('[PROJECT_ID]', '[PLATFORM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/delete-task.md b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-task.md new file mode 100644 index 0000000000..b7f9ad3e47 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteTask('[PROJECT_ID]', '[TASK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/delete-webhook.md b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-webhook.md new file mode 100644 index 0000000000..c5e0588ad1 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/delete-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.deleteWebhook('[PROJECT_ID]', '[WEBHOOK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/delete.md b/app/sdks/0.7.0/console-web/docs/examples/projects/delete.md new file mode 100644 index 0000000000..20b67370f0 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.delete('[PROJECT_ID]', '[PASSWORD]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get-domain.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get-domain.md new file mode 100644 index 0000000000..1622546719 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get-domain.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getDomain('[PROJECT_ID]', '[DOMAIN_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get-key.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get-key.md new file mode 100644 index 0000000000..8bb458c335 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getKey('[PROJECT_ID]', '[KEY_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get-platform.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get-platform.md new file mode 100644 index 0000000000..bfeb49393b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getPlatform('[PROJECT_ID]', '[PLATFORM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get-task.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get-task.md new file mode 100644 index 0000000000..c405299d74 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getTask('[PROJECT_ID]', '[TASK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get-usage.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get-usage.md new file mode 100644 index 0000000000..e024a2966c --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get-usage.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getUsage('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get-webhook.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get-webhook.md new file mode 100644 index 0000000000..2629d4424d --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.getWebhook('[PROJECT_ID]', '[WEBHOOK_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/get.md b/app/sdks/0.7.0/console-web/docs/examples/projects/get.md new file mode 100644 index 0000000000..bcfb35186b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.get('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/list-domains.md b/app/sdks/0.7.0/console-web/docs/examples/projects/list-domains.md new file mode 100644 index 0000000000..5ddfec49b5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/list-domains.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listDomains('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/list-keys.md b/app/sdks/0.7.0/console-web/docs/examples/projects/list-keys.md new file mode 100644 index 0000000000..497ddf9bac --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/list-keys.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listKeys('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/list-platforms.md b/app/sdks/0.7.0/console-web/docs/examples/projects/list-platforms.md new file mode 100644 index 0000000000..4fd2d311f3 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/list-platforms.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listPlatforms('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/list-tasks.md b/app/sdks/0.7.0/console-web/docs/examples/projects/list-tasks.md new file mode 100644 index 0000000000..d42efc2b80 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/list-tasks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listTasks('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/list-webhooks.md b/app/sdks/0.7.0/console-web/docs/examples/projects/list-webhooks.md new file mode 100644 index 0000000000..6c45849399 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/list-webhooks.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.listWebhooks('[PROJECT_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/list.md b/app/sdks/0.7.0/console-web/docs/examples/projects/list.md new file mode 100644 index 0000000000..428fc4545f --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update-domain-verification.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update-domain-verification.md new file mode 100644 index 0000000000..ea53295bcf --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update-domain-verification.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateDomainVerification('[PROJECT_ID]', '[DOMAIN_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update-key.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update-key.md new file mode 100644 index 0000000000..f19b593c9f --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update-key.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateKey('[PROJECT_ID]', '[KEY_ID]', '[NAME]', []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update-o-auth2.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update-o-auth2.md new file mode 100644 index 0000000000..479c5e9d30 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update-o-auth2.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateOAuth2('[PROJECT_ID]', 'amazon'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update-platform.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update-platform.md new file mode 100644 index 0000000000..0e22080ed0 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update-platform.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updatePlatform('[PROJECT_ID]', '[PLATFORM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update-task.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update-task.md new file mode 100644 index 0000000000..38744a36bd --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update-task.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', false, 'GET', 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update-webhook.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update-webhook.md new file mode 100644 index 0000000000..cdef2ec479 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update-webhook.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.updateWebhook('[PROJECT_ID]', '[WEBHOOK_ID]', '[NAME]', [], 'https://example.com', false); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/projects/update.md b/app/sdks/0.7.0/console-web/docs/examples/projects/update.md new file mode 100644 index 0000000000..9d06850534 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/projects/update.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.projects.update('[PROJECT_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/create-file.md b/app/sdks/0.7.0/console-web/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..673777e380 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/create-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.createFile(document.getElementById('uploader').files[0], [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/console-web/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..7278b682ae --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..0a4677fe80 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-download.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.storage.getFileDownload('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..a44cb6479c --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-preview.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.storage.getFilePreview('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..adfb6320c3 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file-view.md @@ -0,0 +1,11 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let result = sdk.storage.getFileView('[FILE_ID]'); + +console.log(result); // Resource URL \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/get-file.md b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..9691be3056 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/get-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/list-files.md b/app/sdks/0.7.0/console-web/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..5c2560d06d --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/list-files.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.listFiles(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/storage/update-file.md b/app/sdks/0.7.0/console-web/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..c053d60470 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/storage/update-file.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/console-web/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..534577ead3 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/create-membership.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/create.md b/app/sdks/0.7.0/console-web/docs/examples/teams/create.md new file mode 100644 index 0000000000..6f7232b9c5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/console-web/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..fa1efe401b --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/delete.md b/app/sdks/0.7.0/console-web/docs/examples/teams/delete.md new file mode 100644 index 0000000000..cacad26c02 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/delete.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/console-web/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..e1b959d1eb --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/get-memberships.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/get.md b/app/sdks/0.7.0/console-web/docs/examples/teams/get.md new file mode 100644 index 0000000000..a8496ad76d --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/list.md b/app/sdks/0.7.0/console-web/docs/examples/teams/list.md new file mode 100644 index 0000000000..b94d6c32ff --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/update-membership-status.md b/app/sdks/0.7.0/console-web/docs/examples/teams/update-membership-status.md new file mode 100644 index 0000000000..4931f02689 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/update-membership-status.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.updateMembershipStatus('[TEAM_ID]', '[INVITE_ID]', '[USER_ID]', '[SECRET]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/teams/update.md b/app/sdks/0.7.0/console-web/docs/examples/teams/update.md new file mode 100644 index 0000000000..5b73121518 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/teams/update.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/create.md b/app/sdks/0.7.0/console-web/docs/examples/users/create.md new file mode 100644 index 0000000000..9adc060ff5 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/create.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/delete-session.md b/app/sdks/0.7.0/console-web/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..96a9b5c94f --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/delete-session.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/delete-sessions.md b/app/sdks/0.7.0/console-web/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..56092ab5fc --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/delete-user.md b/app/sdks/0.7.0/console-web/docs/examples/users/delete-user.md new file mode 100644 index 0000000000..40f33e34c2 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/delete-user.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.deleteUser('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/get-logs.md b/app/sdks/0.7.0/console-web/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..c349383ec1 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/get-logs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.getLogs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/get-prefs.md b/app/sdks/0.7.0/console-web/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..7d8a3cd33f --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.getPrefs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/get-sessions.md b/app/sdks/0.7.0/console-web/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..1b7535855e --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/get-sessions.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.getSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/get.md b/app/sdks/0.7.0/console-web/docs/examples/users/get.md new file mode 100644 index 0000000000..751798de39 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/get.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/list.md b/app/sdks/0.7.0/console-web/docs/examples/users/list.md new file mode 100644 index 0000000000..bbc4895412 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/list.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.list(); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/update-prefs.md b/app/sdks/0.7.0/console-web/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..877aa309a1 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.updatePrefs('[USER_ID]', {}); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/docs/examples/users/update-status.md b/app/sdks/0.7.0/console-web/docs/examples/users/update-status.md new file mode 100644 index 0000000000..6c432ff4c6 --- /dev/null +++ b/app/sdks/0.7.0/console-web/docs/examples/users/update-status.md @@ -0,0 +1,15 @@ +let sdk = new Appwrite(); + +sdk + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = sdk.users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); // Success +}, function (error) { + console.log(error); // Failure +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/package.json b/app/sdks/0.7.0/console-web/package.json new file mode 100644 index 0000000000..6c53a70307 --- /dev/null +++ b/app/sdks/0.7.0/console-web/package.json @@ -0,0 +1,17 @@ +{ + "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.0", + "license": "BSD-3-Clause", + "main": "src/sdk.js", + "types": "types/index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-console" + }, + "devDependencies": { + "typescript": "^3.6.4" + }, + "dependencies": {} +} \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/src/sdk.js b/app/sdks/0.7.0/console-web/src/sdk.js new file mode 100644 index 0000000000..c497dd6c95 --- /dev/null +++ b/app/sdks/0.7.0/console-web/src/sdk.js @@ -0,0 +1,5017 @@ +(function (window) { + + 'use strict'; + + window.Appwrite = function () { + + let config = { + endpoint: 'https://appwrite.io/v1', + project: '', + key: '', + locale: '', + mode: '', + }; + + /** + * @param {string} endpoint + * @returns {this} + */ + let setEndpoint = function(endpoint) { + config.endpoint = endpoint; + + return this; + }; + + /** + * Set Project + * + * Your project ID + * + * @param value string + * + * @return this + */ + let setProject = function (value) + { + http.addGlobalHeader('X-Appwrite-Project', value); + + config.project = value; + + return this; + }; + + /** + * Set Key + * + * Your secret API key + * + * @param value string + * + * @return this + */ + let setKey = function (value) + { + http.addGlobalHeader('X-Appwrite-Key', value); + + config.key = value; + + return this; + }; + + /** + * Set Locale + * + * @param value string + * + * @return this + */ + let setLocale = function (value) + { + http.addGlobalHeader('X-Appwrite-Locale', value); + + config.locale = value; + + return this; + }; + + /** + * Set Mode + * + * @param value string + * + * @return this + */ + let setMode = function (value) + { + http.addGlobalHeader('X-Appwrite-Mode', value); + + config.mode = 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; + }; + + /** + * @param {Object} params + * @returns {string} + */ + let buildQuery = function(params) { + let str = []; + + for (let p in params) { + if(Array.isArray(params[p])) { + for (let index = 0; index < params[p].length; index++) { + let param = params[p][index]; + str.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + str.push(encodeURIComponent(p) + "=" + encodeURIComponent(params[p])); + } + } + + return str.join("&"); + }; + + let addGlobalHeader = function(key, value) { + globalHeaders[key] = {key: key.toLowerCase(), value: value.toLowerCase()}; + }; + + let addGlobalParam = function(key, value) { + globalParams.push({key: key, value: value}); + }; + + addGlobalHeader('x-sdk-version', 'appwrite:web:1.0.0'); + addGlobalHeader('content-type', ''); + + /** + * @param {string} method + * @param {string} path string + * @param {Object} headers + * @param {Object} params + * @param {function} progress + * @returns {Promise} + */ + let call = function (method, path, headers = {}, params = {}, progress = null) { + let i; + + path = config.endpoint + path; + + if (-1 === ['GET', 'POST', 'PUT', 'DELETE', 'TRACE', 'HEAD', 'OPTIONS', 'CONNECT', 'PATCH'].indexOf(method)) { + throw new Error('var method must contain a valid HTTP method name'); + } + + if (typeof path !== 'string') { + throw new Error('var path must be of type string'); + } + + if (typeof headers !== 'object') { + throw new Error('var headers must be of type object'); + } + + for (i = 0; i < globalParams.length; i++) { // Add global params to URL + path = addParam(path, globalParams[i].key, globalParams[i].value); + } + + if(window.localStorage && window.localStorage.getItem('cookieFallback')) { + headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback'); + } + + for (let key in globalHeaders) { // Add Global Headers + if (globalHeaders.hasOwnProperty(key)) { + if (!headers[globalHeaders[key].key]) { + headers[globalHeaders[key].key] = globalHeaders[key].value; + } + } + } + + if(method === 'GET') { + for (let param in params) { + if (param.hasOwnProperty(key)) { + path = addParam(path, key + (Array.isArray(param) ? '[]' : ''), params[key]); + } + } + } + + switch (headers['content-type']) { // Parse request by content type + case 'application/json': + params = JSON.stringify(params); + break; + + case 'multipart/form-data': + let formData = new FormData(); + + Object.keys(params).forEach(function(key) { + let param = params[key]; + formData.append(key + (Array.isArray(param) ? '[]' : ''), param); + }); + + params = formData; + break; + } + + return new Promise(function (resolve, reject) { + + let request = new XMLHttpRequest(), key; + + request.withCredentials = true; + request.open(method, path, true); + + for (key in headers) { // Set Headers + if (headers.hasOwnProperty(key)) { + if (key === 'content-type' && headers[key] === 'multipart/form-data') { // Skip to avoid missing boundary + continue; + } + + request.setRequestHeader(key, headers[key]); + } + } + + request.onload = function () { + let data = request.response; + let contentType = this.getResponseHeader('content-type') || ''; + contentType = contentType.substring(0, contentType.indexOf(';')); + + switch (contentType) { + case 'application/json': + data = JSON.parse(data); + break; + } + + let cookieFallback = this.getResponseHeader('X-Fallback-Cookies') || ''; + + if(window.localStorage && cookieFallback) { + window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.'); + window.localStorage.setItem('cookieFallback', cookieFallback); + } + + if (4 === request.readyState && 399 >= request.status) { + resolve(data); + } else { + reject(data); + } + }; + + if (progress) { + request.addEventListener('progress', progress); + request.upload.addEventListener('progress', progress, false); + } + + // Handle network errors + request.onerror = function () { + reject(new Error("Network Error")); + }; + + request.send(params); + }) + }; + + return { + 'get': function(path, headers = {}, params = {}) { + return call('GET', path + ((Object.keys(params).length > 0) ? '?' + buildQuery(params) : ''), headers, {}); + }, + 'post': function(path, headers = {}, params = {}, progress = null) { + return call('POST', path, headers, params, progress); + }, + 'put': function(path, headers = {}, params = {}, progress = null) { + return call('PUT', path, headers, params, progress); + }, + 'patch': function(path, headers = {}, params = {}, progress = null) { + return call('PATCH', path, headers, params, progress); + }, + 'delete': function(path, headers = {}, params = {}, progress = null) { + return call('DELETE', path, headers, params, progress); + }, + 'addGlobalParam': addGlobalParam, + 'addGlobalHeader': addGlobalHeader + } + }(window.document); + + let account = { + + /** + * Get Account + * + * Get currently logged in user data as JSON object. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/account'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow the new user to login + * to their new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete: function() { + let path = '/account'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/email'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs: function() { + let path = '/account/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName: function(name) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/account/name'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword: function(password, oldPassword) { + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(oldPassword === undefined) { + throw new Error('Missing required parameter: "oldPassword"'); + } + + let path = '/account/password'; + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + if(oldPassword) { + payload['oldPassword'] = oldPassword; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs: function() { + let path = '/account/prefs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(prefs) { + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/account/prefs'; + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery: function(email, url) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery: function(userId, secret, password, passwordAgain) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + if(passwordAgain === undefined) { + throw new Error('Missing required parameter: "passwordAgain"'); + } + + let path = '/account/recovery'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + if(password) { + payload['password'] = password; + } + + if(passwordAgain) { + payload['passwordAgain'] = passwordAgain; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session + * + * Allow the user to login into their account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession: function(email, password) { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/account/sessions'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function() { + let path = '/account/sessions'; + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to their account using the OAuth2 provider of their + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session: function(provider, success = 'https://appwrite.io/auth/oauth2/success', failure = 'https://appwrite.io/auth/oauth2/failure', scopes = []) { + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}', 'g'), provider); + + let payload = {}; + + if(success) { + payload['success'] = success; + } + + if(failure) { + payload['failure'] = failure; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + window.location = config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all their + * account sessions across all of their different devices. When using the + * option id argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(sessionId) { + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/account/sessions/{sessionId}'.replace(new RegExp('{sessionId}', 'g'), sessionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification: function(userId, secret) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/account/verification'; + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let avatars = { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser: function(code, width = 100, height = 100, quality = 100) { + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon: function(url) { + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/avatars/favicon'; + + let payload = {}; + + if(url) { + payload['url'] = url; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials: function(name = '', width = 500, height = 500, color = '', background = '') { + let path = '/avatars/initials'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(color) { + payload['color'] = color; + } + + if(background) { + payload['background'] = background; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR: function(text, size = 400, margin = 1, download = false) { + 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; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let database = { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listCollections: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/database/collections'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Collection + * + * Create a new Collection. + * + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + createCollection: function(name, read, write, rules) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + if(rules === undefined) { + throw new Error('Missing required parameter: "rules"'); + } + + let path = '/database/collections'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(rules) { + payload['rules'] = rules; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollection: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param {string} collectionId + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + updateCollection: function(collectionId, name, read, write, rules = []) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(rules) { + payload['rules'] = rules; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + deleteCollection: function(collectionId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} limit + * @param {number} offset + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments: function(collectionId, filters = [], limit = 25, offset = 0, orderField = '', orderType = 'ASC', orderCast = 'string', search = '') { + 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(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderField) { + payload['orderField'] = orderField; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + if(orderCast) { + payload['orderCast'] = orderCast; + } + + if(search) { + payload['search'] = search; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument: function(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + if(parentDocument) { + payload['parentDocument'] = parentDocument; + } + + if(parentProperty) { + payload['parentProperty'] = parentProperty; + } + + if(parentPropertyType) { + payload['parentPropertyType'] = parentPropertyType; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument: function(collectionId, documentId, data, read, write) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + if(data === undefined) { + throw new Error('Missing required parameter: "data"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + if(data) { + payload['data'] = data; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument: function(collectionId, documentId) { + if(collectionId === undefined) { + throw new Error('Missing required parameter: "collectionId"'); + } + + if(documentId === undefined) { + throw new Error('Missing required parameter: "documentId"'); + } + + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let functions = { + + /** + * List Functions + * + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/functions'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Function + * + * + * @param {string} name + * @param {string} env + * @param {object} vars + * @param {string[]} events + * @param {string} schedule + * @param {number} timeout + * @throws {Error} + * @return {Promise} + */ + create: function(name, env, vars = [], events = [], schedule = '', timeout = 15) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(env === undefined) { + throw new Error('Missing required parameter: "env"'); + } + + let path = '/functions'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(env) { + payload['env'] = env; + } + + if(vars) { + payload['vars'] = vars; + } + + if(events) { + payload['events'] = events; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(timeout) { + payload['timeout'] = timeout; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Function + * + * + * @param {string} functionId + * @throws {Error} + * @return {Promise} + */ + get: function(functionId) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Function + * + * + * @param {string} functionId + * @param {string} name + * @param {object} vars + * @param {string[]} events + * @param {string} schedule + * @param {number} timeout + * @throws {Error} + * @return {Promise} + */ + update: function(functionId, name, vars = [], events = [], schedule = '', timeout = 15) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(vars) { + payload['vars'] = vars; + } + + if(events) { + payload['events'] = events; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(timeout) { + payload['timeout'] = timeout; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Function + * + * + * @param {string} functionId + * @throws {Error} + * @return {Promise} + */ + delete: function(functionId) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Executions + * + * + * @param {string} functionId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listExecutions: function(functionId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Execution + * + * + * @param {string} functionId + * @throws {Error} + * @return {Promise} + */ + createExecution: function(functionId) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Execution + * + * + * @param {string} functionId + * @param {string} executionId + * @throws {Error} + * @return {Promise} + */ + getExecution: function(functionId, executionId) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + if(executionId === undefined) { + throw new Error('Missing required parameter: "executionId"'); + } + + let path = '/functions/{functionId}/executions/{executionId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{executionId}', 'g'), executionId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Function Tag + * + * + * @param {string} functionId + * @param {string} tag + * @throws {Error} + * @return {Promise} + */ + updateTag: function(functionId, tag) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + if(tag === undefined) { + throw new Error('Missing required parameter: "tag"'); + } + + let path = '/functions/{functionId}/tag'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + if(tag) { + payload['tag'] = tag; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Tags + * + * + * @param {string} functionId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listTags: function(functionId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Tag + * + * + * @param {string} functionId + * @param {string} command + * @param {File} code + * @throws {Error} + * @return {Promise} + */ + createTag: function(functionId, command, code) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + if(command === undefined) { + throw new Error('Missing required parameter: "command"'); + } + + if(code === undefined) { + throw new Error('Missing required parameter: "code"'); + } + + let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + if(command) { + payload['command'] = command; + } + + if(code) { + payload['code'] = code; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + }, + + /** + * Get Tag + * + * + * @param {string} functionId + * @param {string} tagId + * @throws {Error} + * @return {Promise} + */ + getTag: function(functionId, tagId) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + if(tagId === undefined) { + throw new Error('Missing required parameter: "tagId"'); + } + + let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Tag + * + * + * @param {string} functionId + * @param {string} tagId + * @throws {Error} + * @return {Promise} + */ + deleteTag: function(functionId, tagId) { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + if(tagId === undefined) { + throw new Error('Missing required parameter: "tagId"'); + } + + let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Function Usage + * + * + * @param {string} functionId + * @param {string} range + * @throws {Error} + * @return {Promise} + */ + getUsage: function(functionId, range = '30d') { + if(functionId === undefined) { + throw new Error('Missing required parameter: "functionId"'); + } + + let path = '/functions/{functionId}/usage'.replace(new RegExp('{functionId}', 'g'), functionId); + + let payload = {}; + + if(range) { + payload['range'] = range; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let health = { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/health'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getAntiVirus: function() { + let path = '/health/anti-virus'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {Error} + * @return {Promise} + */ + getCache: function() { + let path = '/health/cache'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getDB: function() { + let path = '/health/db'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueCertificates: function() { + let path = '/health/queue/certificates'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Functions Queue + * + * + * @throws {Error} + * @return {Promise} + */ + getQueueFunctions: function() { + let path = '/health/queue/functions'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueLogs: function() { + let path = '/health/queue/logs'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueTasks: function() { + let path = '/health/queue/tasks'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueUsage: function() { + let path = '/health/queue/usage'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueWebhooks: function() { + let path = '/health/queue/webhooks'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageLocal: function() { + let path = '/health/storage/local'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws {Error} + * @return {Promise} + */ + getTime: function() { + let path = '/health/time'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let locale = { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get: function() { + let path = '/locale'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents: function() { + let path = '/locale/continents'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries: function() { + let path = '/locale/countries'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU: function() { + let path = '/locale/countries/eu'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones: function() { + let path = '/locale/countries/phones'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies: function() { + let path = '/locale/currencies'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages: function() { + let path = '/locale/languages'; + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let projects = { + + /** + * List Projects + * + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/projects'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Project + * + * + * @param {string} name + * @param {string} teamId + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + create: function(name, teamId, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/projects'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(teamId) { + payload['teamId'] = teamId; + } + + if(description) { + payload['description'] = description; + } + + if(logo) { + payload['logo'] = logo; + } + + if(url) { + payload['url'] = url; + } + + if(legalName) { + payload['legalName'] = legalName; + } + + if(legalCountry) { + payload['legalCountry'] = legalCountry; + } + + if(legalState) { + payload['legalState'] = legalState; + } + + if(legalCity) { + payload['legalCity'] = legalCity; + } + + if(legalAddress) { + payload['legalAddress'] = legalAddress; + } + + if(legalTaxId) { + payload['legalTaxId'] = legalTaxId; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + get: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Project + * + * + * @param {string} projectId + * @param {string} name + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + update: function(projectId, name, description = '', logo = '', url = '', legalName = '', legalCountry = '', legalState = '', legalCity = '', legalAddress = '', legalTaxId = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(description) { + payload['description'] = description; + } + + if(logo) { + payload['logo'] = logo; + } + + if(url) { + payload['url'] = url; + } + + if(legalName) { + payload['legalName'] = legalName; + } + + if(legalCountry) { + payload['legalCountry'] = legalCountry; + } + + if(legalState) { + payload['legalState'] = legalState; + } + + if(legalCity) { + payload['legalCity'] = legalCity; + } + + if(legalAddress) { + payload['legalAddress'] = legalAddress; + } + + if(legalTaxId) { + payload['legalTaxId'] = legalTaxId; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Project + * + * + * @param {string} projectId + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + delete: function(projectId, password) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/projects/{projectId}'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(password) { + payload['password'] = password; + } + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Domains + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listDomains: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/domains'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Domain + * + * + * @param {string} projectId + * @param {string} domain + * @throws {Error} + * @return {Promise} + */ + createDomain: function(projectId, domain) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domain === undefined) { + throw new Error('Missing required parameter: "domain"'); + } + + let path = '/projects/{projectId}/domains'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(domain) { + payload['domain'] = domain; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + getDomain: function(projectId, domainId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domainId === undefined) { + throw new Error('Missing required parameter: "domainId"'); + } + + let path = '/projects/{projectId}/domains/{domainId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{domainId}', 'g'), domainId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + deleteDomain: function(projectId, domainId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domainId === undefined) { + throw new Error('Missing required parameter: "domainId"'); + } + + let path = '/projects/{projectId}/domains/{domainId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{domainId}', 'g'), domainId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Domain Verification Status + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + updateDomainVerification: function(projectId, domainId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(domainId === undefined) { + throw new Error('Missing required parameter: "domainId"'); + } + + let path = '/projects/{projectId}/domains/{domainId}/verification'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{domainId}', 'g'), domainId); + + let payload = {}; + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Keys + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listKeys: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Key + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createKey: function(projectId, name, scopes) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(scopes === undefined) { + throw new Error('Missing required parameter: "scopes"'); + } + + let path = '/projects/{projectId}/keys'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + getKey: function(projectId, keyId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Key + * + * + * @param {string} projectId + * @param {string} keyId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + updateKey: function(projectId, keyId, name, scopes) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(scopes === undefined) { + throw new Error('Missing required parameter: "scopes"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(scopes) { + payload['scopes'] = scopes; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + deleteKey: function(projectId, keyId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(keyId === undefined) { + throw new Error('Missing required parameter: "keyId"'); + } + + let path = '/projects/{projectId}/keys/{keyId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{keyId}', 'g'), keyId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Project OAuth2 + * + * + * @param {string} projectId + * @param {string} provider + * @param {string} appId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateOAuth2: function(projectId, provider, appId = '', secret = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(provider === undefined) { + throw new Error('Missing required parameter: "provider"'); + } + + let path = '/projects/{projectId}/oauth2'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(provider) { + payload['provider'] = provider; + } + + if(appId) { + payload['appId'] = appId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Platforms + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listPlatforms: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Platform + * + * + * @param {string} projectId + * @param {string} type + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + createPlatform: function(projectId, type, name, key = '', store = '', hostname = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(type === undefined) { + throw new Error('Missing required parameter: "type"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}/platforms'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(type) { + payload['type'] = type; + } + + if(name) { + payload['name'] = name; + } + + if(key) { + payload['key'] = key; + } + + if(store) { + payload['store'] = store; + } + + if(hostname) { + payload['hostname'] = hostname; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + getPlatform: function(projectId, platformId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + updatePlatform: function(projectId, platformId, name, key = '', store = '', hostname = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(key) { + payload['key'] = key; + } + + if(store) { + payload['store'] = store; + } + + if(hostname) { + payload['hostname'] = hostname; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + deletePlatform: function(projectId, platformId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(platformId === undefined) { + throw new Error('Missing required parameter: "platformId"'); + } + + let path = '/projects/{projectId}/platforms/{platformId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{platformId}', 'g'), platformId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Tasks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listTasks: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Task + * + * + * @param {string} projectId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createTask: function(projectId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + if(schedule === undefined) { + throw new Error('Missing required parameter: "schedule"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + if(httpMethod === undefined) { + throw new Error('Missing required parameter: "httpMethod"'); + } + + if(httpUrl === undefined) { + throw new Error('Missing required parameter: "httpUrl"'); + } + + let path = '/projects/{projectId}/tasks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(status) { + payload['status'] = status; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(security) { + payload['security'] = security; + } + + if(httpMethod) { + payload['httpMethod'] = httpMethod; + } + + if(httpUrl) { + payload['httpUrl'] = httpUrl; + } + + if(httpHeaders) { + payload['httpHeaders'] = httpHeaders; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + getTask: function(projectId, taskId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Task + * + * + * @param {string} projectId + * @param {string} taskId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateTask: function(projectId, taskId, name, status, schedule, security, httpMethod, httpUrl, httpHeaders = [], httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + if(schedule === undefined) { + throw new Error('Missing required parameter: "schedule"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + if(httpMethod === undefined) { + throw new Error('Missing required parameter: "httpMethod"'); + } + + if(httpUrl === undefined) { + throw new Error('Missing required parameter: "httpUrl"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(status) { + payload['status'] = status; + } + + if(schedule) { + payload['schedule'] = schedule; + } + + if(security) { + payload['security'] = security; + } + + if(httpMethod) { + payload['httpMethod'] = httpMethod; + } + + if(httpUrl) { + payload['httpUrl'] = httpUrl; + } + + if(httpHeaders) { + payload['httpHeaders'] = httpHeaders; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + deleteTask: function(projectId, taskId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(taskId === undefined) { + throw new Error('Missing required parameter: "taskId"'); + } + + let path = '/projects/{projectId}/tasks/{taskId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{taskId}', 'g'), taskId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Project + * + * + * @param {string} projectId + * @param {string} range + * @throws {Error} + * @return {Promise} + */ + getUsage: function(projectId, range = '30d') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/usage'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(range) { + payload['range'] = range; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * List Webhooks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listWebhooks: function(projectId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Webhook + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createWebhook: function(projectId, name, events, url, security, httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(events === undefined) { + throw new Error('Missing required parameter: "events"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + let path = '/projects/{projectId}/webhooks'.replace(new RegExp('{projectId}', 'g'), projectId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(events) { + payload['events'] = events; + } + + if(url) { + payload['url'] = url; + } + + if(security) { + payload['security'] = security; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + getWebhook: function(projectId, webhookId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateWebhook: function(projectId, webhookId, name, events, url, security, httpUser = '', httpPass = '') { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + if(events === undefined) { + throw new Error('Missing required parameter: "events"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + if(security === undefined) { + throw new Error('Missing required parameter: "security"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(events) { + payload['events'] = events; + } + + if(url) { + payload['url'] = url; + } + + if(security) { + payload['security'] = security; + } + + if(httpUser) { + payload['httpUser'] = httpUser; + } + + if(httpPass) { + payload['httpPass'] = httpPass; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + deleteWebhook: function(projectId, webhookId) { + if(projectId === undefined) { + throw new Error('Missing required parameter: "projectId"'); + } + + if(webhookId === undefined) { + throw new Error('Missing required parameter: "webhookId"'); + } + + let path = '/projects/{projectId}/webhooks/{webhookId}'.replace(new RegExp('{projectId}', 'g'), projectId).replace(new RegExp('{webhookId}', 'g'), webhookId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let storage = { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile: function(file, read, write) { + if(file === undefined) { + throw new Error('Missing required parameter: "file"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files'; + + let payload = {}; + + if(file) { + payload['file'] = file; + } + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .post(path, { + 'content-type': 'multipart/form-data', + }, payload); + }, + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile: function(fileId, read, write) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + if(read === undefined) { + throw new Error('Missing required parameter: "read"'); + } + + if(write === undefined) { + throw new Error('Missing required parameter: "write"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(read) { + payload['read'] = read; + } + + if(write) { + payload['write'] = write; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload: function(fileId) { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview: function(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(width) { + payload['width'] = width; + } + + if(height) { + payload['height'] = height; + } + + if(quality) { + payload['quality'] = quality; + } + + if(background) { + payload['background'] = background; + } + + if(output) { + payload['output'] = output; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + }, + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView: function(fileId, as = '') { + if(fileId === undefined) { + throw new Error('Missing required parameter: "fileId"'); + } + + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + let payload = {}; + + if(as) { + payload['as'] = as; + } + + payload['project'] = config.project; + + payload['key'] = config.key; + + + let query = []; + + for (let p in payload) { + if(Array.isArray(payload[p])) { + for (let index = 0; index < payload[p].length; index++) { + let param = payload[p][index]; + query.push(encodeURIComponent(p + '[]') + "=" + encodeURIComponent(param)); + } + } + else { + query.push(encodeURIComponent(p) + "=" + encodeURIComponent(payload[p])); + } + } + + query = query.join("&"); + + return config.endpoint + path + ((query) ? '?' + query : ''); + } + }; + + let teams = { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create: function(name, roles = ["owner"]) { + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams'; + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update: function(teamId, name) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(name === undefined) { + throw new Error('Missing required parameter: "name"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(name) { + payload['name'] = name; + } + + return http + .put(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete: function(teamId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships: function(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership: function(teamId, email, roles, url, name = '') { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(roles === undefined) { + throw new Error('Missing required parameter: "roles"'); + } + + if(url === undefined) { + throw new Error('Missing required parameter: "url"'); + } + + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(name) { + payload['name'] = name; + } + + if(roles) { + payload['roles'] = roles; + } + + if(url) { + payload['url'] = url; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership: function(teamId, inviteId) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after being redirected back to your app from the invitation email recieved + * by the user. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus: function(teamId, inviteId, userId, secret) { + if(teamId === undefined) { + throw new Error('Missing required parameter: "teamId"'); + } + + if(inviteId === undefined) { + throw new Error('Missing required parameter: "inviteId"'); + } + + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(secret === undefined) { + throw new Error('Missing required parameter: "secret"'); + } + + let path = '/teams/{teamId}/memberships/{inviteId}/status'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + let payload = {}; + + if(userId) { + payload['userId'] = userId; + } + + if(secret) { + payload['secret'] = secret; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + let users = { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list: function(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/users'; + + let payload = {}; + + if(search) { + payload['search'] = search; + } + + if(limit) { + payload['limit'] = limit; + } + + if(offset) { + payload['offset'] = offset; + } + + if(orderType) { + payload['orderType'] = orderType; + } + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Create User + * + * Create a new user. + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create: function(email, password, name = '') { + if(email === undefined) { + throw new Error('Missing required parameter: "email"'); + } + + if(password === undefined) { + throw new Error('Missing required parameter: "password"'); + } + + let path = '/users'; + + let payload = {}; + + if(email) { + payload['email'] = email; + } + + if(password) { + payload['password'] = password; + } + + if(name) { + payload['name'] = name; + } + + return http + .post(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User + * + * Get user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + get: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User + * + * Delete a user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteUser: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getLogs: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getPrefs: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param {string} userId + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs: function(userId, prefs) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(prefs === undefined) { + throw new Error('Missing required parameter: "prefs"'); + } + + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(prefs) { + payload['prefs'] = prefs; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getSessions: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .get(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteSessions: function(userId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param {string} userId + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession: function(userId, sessionId) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(sessionId === undefined) { + throw new Error('Missing required parameter: "sessionId"'); + } + + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); + + let payload = {}; + + return http + .delete(path, { + 'content-type': 'application/json', + }, payload); + }, + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param {string} userId + * @param {string} status + * @throws {Error} + * @return {Promise} + */ + updateStatus: function(userId, status) { + if(userId === undefined) { + throw new Error('Missing required parameter: "userId"'); + } + + if(status === undefined) { + throw new Error('Missing required parameter: "status"'); + } + + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + let payload = {}; + + if(status) { + payload['status'] = status; + } + + return http + .patch(path, { + 'content-type': 'application/json', + }, payload); + } + }; + + return { + setEndpoint: setEndpoint, + setProject: setProject, + setKey: setKey, + setLocale: setLocale, + setMode: setMode, + account: account, + avatars: avatars, + database: database, + functions: functions, + health: health, + locale: locale, + projects: projects, + storage: storage, + teams: teams, + users: users + }; + }; + + if(typeof module !== "undefined") { + module.exports = window.Appwrite; + } + +})((typeof window !== "undefined") ? window : {}); \ No newline at end of file diff --git a/app/sdks/0.7.0/console-web/src/sdk.min.js b/app/sdks/0.7.0/console-web/src/sdk.min.js new file mode 100644 index 0000000000..29411571f6 --- /dev/null +++ b/app/sdks/0.7.0/console-web/src/sdk.min.js @@ -0,0 +1,432 @@ +(function(window){'use strict';window.Appwrite=function(){let config={endpoint:'https://appwrite.io/v1',project:'',key:'',locale:'',mode:'',};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 setKey=function(value){http.addGlobalHeader('X-Appwrite-Key',value);config.key=value;return this};let setLocale=function(value){http.addGlobalHeader('X-Appwrite-Locale',value);config.locale=value;return this};let setMode=function(value){http.addGlobalHeader('X-Appwrite-Mode',value);config.mode=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;index=request.status){resolve(data)}else{reject(data)}};if(progress){request.addEventListener('progress',progress);request.upload.addEventListener('progress',progress,!1)} +request.onerror=function(){reject(new Error("Network Error"))};request.send(params)})};return{'get':function(path,headers={},params={}){return call('GET',path+((Object.keys(params).length>0)?'?'+buildQuery(params):''),headers,{})},'post':function(path,headers={},params={},progress=null){return call('POST',path,headers,params,progress)},'put':function(path,headers={},params={},progress=null){return call('PUT',path,headers,params,progress)},'patch':function(path,headers={},params={},progress=null){return call('PATCH',path,headers,params,progress)},'delete':function(path,headers={},params={},progress=null){return call('DELETE',path,headers,params,progress)},'addGlobalParam':addGlobalParam,'addGlobalHeader':addGlobalHeader}}(window.document);let account={get:function(){let path='/account';let payload={};return http.get(path,{'content-type':'application/json',},payload)},create:function(email,password,name=''){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +if(name){payload.name=name} +return http.post(path,{'content-type':'application/json',},payload)},delete:function(){let path='/account';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},updateEmail:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/email';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.patch(path,{'content-type':'application/json',},payload)},getLogs:function(){let path='/account/logs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updateName:function(name){if(name===undefined){throw new Error('Missing required parameter: "name"')} +let path='/account/name';let payload={};if(name){payload.name=name} +return http.patch(path,{'content-type':'application/json',},payload)},updatePassword:function(password,oldPassword){if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(oldPassword===undefined){throw new Error('Missing required parameter: "oldPassword"')} +let path='/account/password';let payload={};if(password){payload.password=password} +if(oldPassword){payload.oldPassword=oldPassword} +return http.patch(path,{'content-type':'application/json',},payload)},getPrefs:function(){let path='/account/prefs';let payload={};return http.get(path,{'content-type':'application/json',},payload)},updatePrefs:function(prefs){if(prefs===undefined){throw new Error('Missing required parameter: "prefs"')} +let path='/account/prefs';let payload={};if(prefs){payload.prefs=prefs} +return http.patch(path,{'content-type':'application/json',},payload)},createRecovery:function(email,url){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(url===undefined){throw new Error('Missing required parameter: "url"')} +let path='/account/recovery';let payload={};if(email){payload.email=email} +if(url){payload.url=url} +return http.post(path,{'content-type':'application/json',},payload)},updateRecovery:function(userId,secret,password,passwordAgain){if(userId===undefined){throw new Error('Missing required parameter: "userId"')} +if(secret===undefined){throw new Error('Missing required parameter: "secret"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +if(passwordAgain===undefined){throw new Error('Missing required parameter: "passwordAgain"')} +let path='/account/recovery';let payload={};if(userId){payload.userId=userId} +if(secret){payload.secret=secret} +if(password){payload.password=password} +if(passwordAgain){payload.passwordAgain=passwordAgain} +return http.put(path,{'content-type':'application/json',},payload)},getSessions:function(){let path='/account/sessions';let payload={};return http.get(path,{'content-type':'application/json',},payload)},createSession:function(email,password){if(email===undefined){throw new Error('Missing required parameter: "email"')} +if(password===undefined){throw new Error('Missing required parameter: "password"')} +let path='/account/sessions';let payload={};if(email){payload.email=email} +if(password){payload.password=password} +return http.post(path,{'content-type':'application/json',},payload)},deleteSessions:function(){let path='/account/sessions';let payload={};return http.delete(path,{'content-type':'application/json',},payload)},createOAuth2Session:function(provider,success='https://appwrite.io/auth/oauth2/success',failure='https://appwrite.io/auth/oauth2/failure',scopes=[]){if(provider===undefined){throw new Error('Missing required parameter: "provider"')} +let path='/account/sessions/oauth2/{provider}'.replace(new RegExp('{provider}','g'),provider);let payload={};if(success){payload.success=success} +if(failure){payload.failure=failure} +if(scopes){payload.scopes=scopes} +payload.project=config.project;payload.key=config.key;let query=[];for(let p in payload){if(Array.isArray(payload[p])){for(let index=0;index; + + /** + * Create Account + * + * Use this endpoint to allow a new user to register a new account in your + * project. After the user registration completes successfully, you can use + * the [/account/verfication](/docs/client/account#createVerification) route + * to start verifying the user email address. To allow the new user to login + * to their new account, you need to create a new [account + * session](/docs/client/account#createSession). + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create(email: string, password: string, name?: string): Promise; + + /** + * Delete Account + * + * Delete a currently logged in user account. Behind the scene, the user + * record is not deleted but permanently blocked from any access. This is done + * to avoid deleted accounts being overtaken by new users with the same email + * address. Any user-related resources like documents or storage files should + * be deleted separately. + * + * @throws {Error} + * @return {Promise} + */ + delete(): Promise; + + /** + * Update Account Email + * + * Update currently logged in user account email address. After changing user + * address, user confirmation status is being reset and a new confirmation + * mail is sent. For security measures, user password is required to complete + * this request. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + updateEmail(email: string, password: string): Promise; + + /** + * Get Account Logs + * + * Get currently logged in user list of latest security activity logs. Each + * log returns user IP address, location and date and time of log. + * + * @throws {Error} + * @return {Promise} + */ + getLogs(): Promise; + + /** + * Update Account Name + * + * Update currently logged in user account name. + * + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + updateName(name: string): Promise; + + /** + * Update Account Password + * + * Update currently logged in user password. For validation, user is required + * to pass the password twice. + * + * @param {string} password + * @param {string} oldPassword + * @throws {Error} + * @return {Promise} + */ + updatePassword(password: string, oldPassword: string): Promise; + + /** + * Get Account Preferences + * + * Get currently logged in user preferences as a key-value object. + * + * @throws {Error} + * @return {Promise} + */ + getPrefs(): Promise; + + /** + * Update Account Preferences + * + * Update currently logged in user account preferences. You can pass only the + * specific settings you wish to update. + * + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs(prefs: object): Promise; + + /** + * Create Password Recovery + * + * Sends the user an email with a temporary secret key for password reset. + * When the user clicks the confirmation link he is redirected back to your + * app password reset URL with the secret key and email address values + * attached to the URL query string. Use the query string params to submit a + * request to the [PUT /account/recovery](/docs/client/account#updateRecovery) + * endpoint to complete the process. + * + * @param {string} email + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createRecovery(email: string, url: string): Promise; + + /** + * Complete Password Recovery + * + * Use this endpoint to complete the user account password reset. Both the + * **userId** and **secret** arguments will be passed as query parameters to + * the redirect URL you have provided when sending your request to the [POST + * /account/recovery](/docs/client/account#createRecovery) endpoint. + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * @param {string} userId + * @param {string} secret + * @param {string} password + * @param {string} passwordAgain + * @throws {Error} + * @return {Promise} + */ + updateRecovery(userId: string, secret: string, password: string, passwordAgain: string): Promise; + + /** + * Get Account Sessions + * + * Get currently logged in user list of active sessions across different + * devices. + * + * @throws {Error} + * @return {Promise} + */ + getSessions(): Promise; + + /** + * Create Account Session + * + * Allow the user to login into their account by providing a valid email and + * password combination. This route will create a new session for the user. + * + * @param {string} email + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + createSession(email: string, password: string): Promise; + + /** + * Delete All Account Sessions + * + * Delete all sessions from the user account and remove any sessions cookies + * from the end client. + * + * @throws {Error} + * @return {Promise} + */ + deleteSessions(): Promise; + + /** + * Create Account Session with OAuth2 + * + * Allow the user to login to their account using the OAuth2 provider of their + * choice. Each OAuth2 provider should be enabled from the Appwrite console + * first. Use the success and failure arguments to provide a redirect URL's + * back to your app when login is completed. + * + * @param {string} provider + * @param {string} success + * @param {string} failure + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createOAuth2Session(provider: string, success?: string, failure?: string, scopes?: string[]): Promise; + + /** + * Delete Account Session + * + * Use this endpoint to log out the currently logged in user from all their + * account sessions across all of their different devices. When using the + * option id argument, only the session unique ID provider will be deleted. + * + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession(sessionId: string): Promise; + + /** + * Create Email Verification + * + * Use this endpoint to send a verification message to your user email address + * to confirm they are the valid owners of that address. Both the **userId** + * and **secret** arguments will be passed as query parameters to the URL you + * have provided to be attached to the verification email. The provided URL + * should redirect the user back to your app and allow you to complete the + * verification process by verifying both the **userId** and **secret** + * parameters. Learn more about how to [complete the verification + * process](/docs/client/account#updateVerification). + * + * Please note that in order to avoid a [Redirect + * Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), + * the only valid redirect URLs are the ones from domains you have set when + * adding your platforms in the console interface. + * + * + * @param {string} url + * @throws {Error} + * @return {Promise} + */ + createVerification(url: string): Promise; + + /** + * Complete Email Verification + * + * Use this endpoint to complete the user email verification process. Use both + * the **userId** and **secret** parameters that were attached to your app URL + * to verify the user email ownership. If confirmed this route will return a + * 200 status code. + * + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateVerification(userId: string, secret: string): Promise; + + } + + export interface Avatars { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getBrowser(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getCreditCard(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param {string} url + * @throws {Error} + * @return {string} + */ + getFavicon(url: string): string; + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param {string} code + * @param {number} width + * @param {number} height + * @param {number} quality + * @throws {Error} + * @return {string} + */ + getFlag(code: string, width?: number, height?: number, quality?: number): string; + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param {string} url + * @param {number} width + * @param {number} height + * @throws {Error} + * @return {string} + */ + getImage(url: string, width?: number, height?: number): string; + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param {string} name + * @param {number} width + * @param {number} height + * @param {string} color + * @param {string} background + * @throws {Error} + * @return {string} + */ + getInitials(name?: string, width?: number, height?: number, color?: string, background?: string): string; + + /** + * Get QR Code + * + * 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. + * + * @param {string} text + * @param {number} size + * @param {number} margin + * @param {boolean} download + * @throws {Error} + * @return {string} + */ + getQR(text: string, size?: number, margin?: number, download?: boolean): string; + + } + + export interface Database { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listCollections(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Collection + * + * Create a new Collection. + * + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + createCollection(name: string, read: string[], write: string[], rules: string[]): Promise; + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + getCollection(collectionId: string): Promise; + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param {string} collectionId + * @param {string} name + * @param {string[]} read + * @param {string[]} write + * @param {string[]} rules + * @throws {Error} + * @return {Promise} + */ + updateCollection(collectionId: string, name: string, read: string[], write: string[], rules?: string[]): Promise; + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param {string} collectionId + * @throws {Error} + * @return {Promise} + */ + deleteCollection(collectionId: string): Promise; + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param {string} collectionId + * @param {string[]} filters + * @param {number} limit + * @param {number} offset + * @param {string} orderField + * @param {string} orderType + * @param {string} orderCast + * @param {string} search + * @throws {Error} + * @return {Promise} + */ + listDocuments(collectionId: string, filters?: string[], limit?: number, offset?: number, orderField?: string, orderType?: string, orderCast?: string, search?: string): Promise; + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param {string} collectionId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @param {string} parentDocument + * @param {string} parentProperty + * @param {string} parentPropertyType + * @throws {Error} + * @return {Promise} + */ + createDocument(collectionId: string, data: object, read: string[], write: string[], parentDocument?: string, parentProperty?: string, parentPropertyType?: string): Promise; + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + getDocument(collectionId: string, documentId: string): Promise; + + /** + * Update Document + * + * + * @param {string} collectionId + * @param {string} documentId + * @param {object} data + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateDocument(collectionId: string, documentId: string, data: object, read: string[], write: string[]): Promise; + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param {string} collectionId + * @param {string} documentId + * @throws {Error} + * @return {Promise} + */ + deleteDocument(collectionId: string, documentId: string): Promise; + + } + + export interface Functions { + + /** + * List Functions + * + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Function + * + * + * @param {string} name + * @param {string} env + * @param {object} vars + * @param {string[]} events + * @param {string} schedule + * @param {number} timeout + * @throws {Error} + * @return {Promise} + */ + create(name: string, env: string, vars?: object, events?: string[], schedule?: string, timeout?: number): Promise; + + /** + * Get Function + * + * + * @param {string} functionId + * @throws {Error} + * @return {Promise} + */ + get(functionId: string): Promise; + + /** + * Update Function + * + * + * @param {string} functionId + * @param {string} name + * @param {object} vars + * @param {string[]} events + * @param {string} schedule + * @param {number} timeout + * @throws {Error} + * @return {Promise} + */ + update(functionId: string, name: string, vars?: object, events?: string[], schedule?: string, timeout?: number): Promise; + + /** + * Delete Function + * + * + * @param {string} functionId + * @throws {Error} + * @return {Promise} + */ + delete(functionId: string): Promise; + + /** + * List Executions + * + * + * @param {string} functionId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listExecutions(functionId: string, search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Execution + * + * + * @param {string} functionId + * @throws {Error} + * @return {Promise} + */ + createExecution(functionId: string): Promise; + + /** + * Get Execution + * + * + * @param {string} functionId + * @param {string} executionId + * @throws {Error} + * @return {Promise} + */ + getExecution(functionId: string, executionId: string): Promise; + + /** + * Update Function Tag + * + * + * @param {string} functionId + * @param {string} tag + * @throws {Error} + * @return {Promise} + */ + updateTag(functionId: string, tag: string): Promise; + + /** + * List Tags + * + * + * @param {string} functionId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listTags(functionId: string, search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Tag + * + * + * @param {string} functionId + * @param {string} command + * @param {File} code + * @throws {Error} + * @return {Promise} + */ + createTag(functionId: string, command: string, code: File): Promise; + + /** + * Get Tag + * + * + * @param {string} functionId + * @param {string} tagId + * @throws {Error} + * @return {Promise} + */ + getTag(functionId: string, tagId: string): Promise; + + /** + * Delete Tag + * + * + * @param {string} functionId + * @param {string} tagId + * @throws {Error} + * @return {Promise} + */ + deleteTag(functionId: string, tagId: string): Promise; + + /** + * Get Function Usage + * + * + * @param {string} functionId + * @param {string} range + * @throws {Error} + * @return {Promise} + */ + getUsage(functionId: string, range?: string): Promise; + + } + + export interface Health { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getAntiVirus(): Promise; + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws {Error} + * @return {Promise} + */ + getCache(): Promise; + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getDB(): Promise; + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueCertificates(): Promise; + + /** + * Get Functions Queue + * + * + * @throws {Error} + * @return {Promise} + */ + getQueueFunctions(): Promise; + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueLogs(): Promise; + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueTasks(): Promise; + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueUsage(): Promise; + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws {Error} + * @return {Promise} + */ + getQueueWebhooks(): Promise; + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws {Error} + * @return {Promise} + */ + getStorageLocal(): Promise; + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws {Error} + * @return {Promise} + */ + getTime(): Promise; + + } + + export interface Locale { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws {Error} + * @return {Promise} + */ + get(): Promise; + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getContinents(): Promise; + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountries(): Promise; + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesEU(): Promise; + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCountriesPhones(): Promise; + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws {Error} + * @return {Promise} + */ + getCurrencies(): Promise; + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws {Error} + * @return {Promise} + */ + getLanguages(): Promise; + + } + + export interface Projects { + + /** + * List Projects + * + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Project + * + * + * @param {string} name + * @param {string} teamId + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + create(name: string, teamId: string, description?: string, logo?: string, url?: string, legalName?: string, legalCountry?: string, legalState?: string, legalCity?: string, legalAddress?: string, legalTaxId?: string): Promise; + + /** + * Get Project + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + get(projectId: string): Promise; + + /** + * Update Project + * + * + * @param {string} projectId + * @param {string} name + * @param {string} description + * @param {string} logo + * @param {string} url + * @param {string} legalName + * @param {string} legalCountry + * @param {string} legalState + * @param {string} legalCity + * @param {string} legalAddress + * @param {string} legalTaxId + * @throws {Error} + * @return {Promise} + */ + update(projectId: string, name: string, description?: string, logo?: string, url?: string, legalName?: string, legalCountry?: string, legalState?: string, legalCity?: string, legalAddress?: string, legalTaxId?: string): Promise; + + /** + * Delete Project + * + * + * @param {string} projectId + * @param {string} password + * @throws {Error} + * @return {Promise} + */ + delete(projectId: string, password: string): Promise; + + /** + * List Domains + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listDomains(projectId: string): Promise; + + /** + * Create Domain + * + * + * @param {string} projectId + * @param {string} domain + * @throws {Error} + * @return {Promise} + */ + createDomain(projectId: string, domain: string): Promise; + + /** + * Get Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + getDomain(projectId: string, domainId: string): Promise; + + /** + * Delete Domain + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + deleteDomain(projectId: string, domainId: string): Promise; + + /** + * Update Domain Verification Status + * + * + * @param {string} projectId + * @param {string} domainId + * @throws {Error} + * @return {Promise} + */ + updateDomainVerification(projectId: string, domainId: string): Promise; + + /** + * List Keys + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listKeys(projectId: string): Promise; + + /** + * Create Key + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + createKey(projectId: string, name: string, scopes: string[]): Promise; + + /** + * Get Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + getKey(projectId: string, keyId: string): Promise; + + /** + * Update Key + * + * + * @param {string} projectId + * @param {string} keyId + * @param {string} name + * @param {string[]} scopes + * @throws {Error} + * @return {Promise} + */ + updateKey(projectId: string, keyId: string, name: string, scopes: string[]): Promise; + + /** + * Delete Key + * + * + * @param {string} projectId + * @param {string} keyId + * @throws {Error} + * @return {Promise} + */ + deleteKey(projectId: string, keyId: string): Promise; + + /** + * Update Project OAuth2 + * + * + * @param {string} projectId + * @param {string} provider + * @param {string} appId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateOAuth2(projectId: string, provider: string, appId?: string, secret?: string): Promise; + + /** + * List Platforms + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listPlatforms(projectId: string): Promise; + + /** + * Create Platform + * + * + * @param {string} projectId + * @param {string} type + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + createPlatform(projectId: string, type: string, name: string, key?: string, store?: string, hostname?: string): Promise; + + /** + * Get Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + getPlatform(projectId: string, platformId: string): Promise; + + /** + * Update Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @param {string} name + * @param {string} key + * @param {string} store + * @param {string} hostname + * @throws {Error} + * @return {Promise} + */ + updatePlatform(projectId: string, platformId: string, name: string, key?: string, store?: string, hostname?: string): Promise; + + /** + * Delete Platform + * + * + * @param {string} projectId + * @param {string} platformId + * @throws {Error} + * @return {Promise} + */ + deletePlatform(projectId: string, platformId: string): Promise; + + /** + * List Tasks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listTasks(projectId: string): Promise; + + /** + * Create Task + * + * + * @param {string} projectId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createTask(projectId: string, name: string, status: string, schedule: string, security: boolean, httpMethod: string, httpUrl: string, httpHeaders?: string[], httpUser?: string, httpPass?: string): Promise; + + /** + * Get Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + getTask(projectId: string, taskId: string): Promise; + + /** + * Update Task + * + * + * @param {string} projectId + * @param {string} taskId + * @param {string} name + * @param {string} status + * @param {string} schedule + * @param {boolean} security + * @param {string} httpMethod + * @param {string} httpUrl + * @param {string[]} httpHeaders + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateTask(projectId: string, taskId: string, name: string, status: string, schedule: string, security: boolean, httpMethod: string, httpUrl: string, httpHeaders?: string[], httpUser?: string, httpPass?: string): Promise; + + /** + * Delete Task + * + * + * @param {string} projectId + * @param {string} taskId + * @throws {Error} + * @return {Promise} + */ + deleteTask(projectId: string, taskId: string): Promise; + + /** + * Get Project + * + * + * @param {string} projectId + * @param {string} range + * @throws {Error} + * @return {Promise} + */ + getUsage(projectId: string, range?: string): Promise; + + /** + * List Webhooks + * + * + * @param {string} projectId + * @throws {Error} + * @return {Promise} + */ + listWebhooks(projectId: string): Promise; + + /** + * Create Webhook + * + * + * @param {string} projectId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + createWebhook(projectId: string, name: string, events: string[], url: string, security: boolean, httpUser?: string, httpPass?: string): Promise; + + /** + * Get Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + getWebhook(projectId: string, webhookId: string): Promise; + + /** + * Update Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @param {string} name + * @param {string[]} events + * @param {string} url + * @param {boolean} security + * @param {string} httpUser + * @param {string} httpPass + * @throws {Error} + * @return {Promise} + */ + updateWebhook(projectId: string, webhookId: string, name: string, events: string[], url: string, security: boolean, httpUser?: string, httpPass?: string): Promise; + + /** + * Delete Webhook + * + * + * @param {string} projectId + * @param {string} webhookId + * @throws {Error} + * @return {Promise} + */ + deleteWebhook(projectId: string, webhookId: string): Promise; + + } + + export interface Storage { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + listFiles(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param {File} file + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + createFile(file: File, read: string[], write: string[]): Promise; + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + getFile(fileId: string): Promise; + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param {string} fileId + * @param {string[]} read + * @param {string[]} write + * @throws {Error} + * @return {Promise} + */ + updateFile(fileId: string, read: string[], write: string[]): Promise; + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param {string} fileId + * @throws {Error} + * @return {Promise} + */ + deleteFile(fileId: string): Promise; + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param {string} fileId + * @throws {Error} + * @return {string} + */ + getFileDownload(fileId: string): string; + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param {string} fileId + * @param {number} width + * @param {number} height + * @param {number} quality + * @param {string} background + * @param {string} output + * @throws {Error} + * @return {string} + */ + getFilePreview(fileId: string, width?: number, height?: number, quality?: number, background?: string, output?: string): string; + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param {string} fileId + * @param {string} as + * @throws {Error} + * @return {string} + */ + getFileView(fileId: string, as?: string): string; + + } + + export interface Teams { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param {string} name + * @param {string[]} roles + * @throws {Error} + * @return {Promise} + */ + create(name: string, roles?: string[]): Promise; + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + get(teamId: string): Promise; + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + update(teamId: string, name: string): Promise; + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param {string} teamId + * @throws {Error} + * @return {Promise} + */ + delete(teamId: string): Promise; + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param {string} teamId + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + getMemberships(teamId: string, search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param {string} teamId + * @param {string} email + * @param {string[]} roles + * @param {string} url + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + createMembership(teamId: string, email: string, roles: string[], url: string, name?: string): Promise; + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param {string} teamId + * @param {string} inviteId + * @throws {Error} + * @return {Promise} + */ + deleteMembership(teamId: string, inviteId: string): Promise; + + /** + * Update Team Membership Status + * + * Use this endpoint to allow a user to accept an invitation to join a team + * after being redirected back to your app from the invitation email recieved + * by the user. + * + * @param {string} teamId + * @param {string} inviteId + * @param {string} userId + * @param {string} secret + * @throws {Error} + * @return {Promise} + */ + updateMembershipStatus(teamId: string, inviteId: string, userId: string, secret: string): Promise; + + } + + export interface Users { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param {string} search + * @param {number} limit + * @param {number} offset + * @param {string} orderType + * @throws {Error} + * @return {Promise} + */ + list(search?: string, limit?: number, offset?: number, orderType?: string): Promise; + + /** + * Create User + * + * Create a new user. + * + * @param {string} email + * @param {string} password + * @param {string} name + * @throws {Error} + * @return {Promise} + */ + create(email: string, password: string, name?: string): Promise; + + /** + * Get User + * + * Get user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + get(userId: string): Promise; + + /** + * Delete User + * + * Delete a user by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteUser(userId: string): Promise; + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getLogs(userId: string): Promise; + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getPrefs(userId: string): Promise; + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param {string} userId + * @param {object} prefs + * @throws {Error} + * @return {Promise} + */ + updatePrefs(userId: string, prefs: object): Promise; + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + getSessions(userId: string): Promise; + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param {string} userId + * @throws {Error} + * @return {Promise} + */ + deleteSessions(userId: string): Promise; + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param {string} userId + * @param {string} sessionId + * @throws {Error} + * @return {Promise} + */ + deleteSession(userId: string, sessionId: string): Promise; + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param {string} userId + * @param {string} status + * @throws {Error} + * @return {Promise} + */ + updateStatus(userId: string, status: string): Promise; + + } + + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/CHANGELOG.md b/app/sdks/0.7.0/server-deno/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/LICENSE b/app/sdks/0.7.0/server-deno/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/README.md b/app/sdks/0.7.0/server-deno/README.md new file mode 100644 index 0000000000..d857e22f24 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/README.md @@ -0,0 +1,28 @@ +# Appwrite Deno SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.7.0. 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 Deno 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +```javascript +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..27c0336054 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-browser.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getBrowser('aa'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..998356a106 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getCreditCard('amex'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..43afe096c4 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-favicon.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getFavicon('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..6b28e5db2f --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-flag.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getFlag('af'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..0a2693c768 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-image.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getImage('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..af35445bb3 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-initials.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getInitials(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..6d8446b105 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/avatars/get-q-r.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = avatars.getQR('[TEXT]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/create-collection.md b/app/sdks/0.7.0/server-deno/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..316ae6b222 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/create-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.createCollection('[NAME]', [], [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/create-document.md b/app/sdks/0.7.0/server-deno/docs/examples/database/create-document.md new file mode 100644 index 0000000000..ef78a839a4 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/create-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/delete-collection.md b/app/sdks/0.7.0/server-deno/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..e9b5d6392b --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/delete-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.deleteCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/delete-document.md b/app/sdks/0.7.0/server-deno/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..b7d3f52c71 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/delete-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/get-collection.md b/app/sdks/0.7.0/server-deno/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..323bc7ec74 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/get-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.getCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/get-document.md b/app/sdks/0.7.0/server-deno/docs/examples/database/get-document.md new file mode 100644 index 0000000000..7a0332251a --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/get-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/list-collections.md b/app/sdks/0.7.0/server-deno/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..292e46f860 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/list-collections.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.listCollections(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/list-documents.md b/app/sdks/0.7.0/server-deno/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..bb22a3956a --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/list-documents.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/update-collection.md b/app/sdks/0.7.0/server-deno/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..8239e45f28 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/update-collection.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/database/update-document.md b/app/sdks/0.7.0/server-deno/docs/examples/database/update-document.md new file mode 100644 index 0000000000..cd079c8f2d --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/database/update-document.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/create-execution.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/create-execution.md new file mode 100644 index 0000000000..8ba9844d64 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/create-execution.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.createExecution('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/create-tag.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/create-tag.md new file mode 100644 index 0000000000..7fcaaa8725 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/create-tag.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.createTag('[FUNCTION_ID]', '[COMMAND]', new File([fileBlob], 'file.png')); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/create.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/create.md new file mode 100644 index 0000000000..95a0760ec0 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/create.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.create('[NAME]', 'node-14'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/delete-tag.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/delete-tag.md new file mode 100644 index 0000000000..da50cdd77f --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/delete-tag.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.deleteTag('[FUNCTION_ID]', '[TAG_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/delete.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/delete.md new file mode 100644 index 0000000000..f987765b93 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/delete.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.delete('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/get-execution.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/get-execution.md new file mode 100644 index 0000000000..49ed2abe8d --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/get-execution.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/get-tag.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/get-tag.md new file mode 100644 index 0000000000..8d267eabf2 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/get-tag.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.getTag('[FUNCTION_ID]', '[TAG_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/get.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/get.md new file mode 100644 index 0000000000..0be5a98de8 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.get('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/list-executions.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/list-executions.md new file mode 100644 index 0000000000..862e81f01e --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/list-executions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.listExecutions('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/list-tags.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/list-tags.md new file mode 100644 index 0000000000..5ca2da7b61 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/list-tags.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.listTags('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/list.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/list.md new file mode 100644 index 0000000000..43e0201e82 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/list.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/update-tag.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/update-tag.md new file mode 100644 index 0000000000..cfa961cb25 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/update-tag.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.updateTag('[FUNCTION_ID]', '[TAG]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/functions/update.md b/app/sdks/0.7.0/server-deno/docs/examples/functions/update.md new file mode 100644 index 0000000000..579b6b7d21 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/functions/update.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = functions.update('[FUNCTION_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-anti-virus.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..e06fbf86de --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-anti-virus.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getAntiVirus(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-cache.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..b58ca1bc15 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-cache.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getCache(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-d-b.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..946cfb03a8 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-d-b.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getDB(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-certificates.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..a86358bb22 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-functions.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..033248b118 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-functions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueFunctions(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-logs.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..d4c3300a35 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-logs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-tasks.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..01e3094ffc --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-usage.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..d0d8faf7b6 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-usage.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..268c521373 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-storage-local.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..77bb658f9a --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-storage-local.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get-time.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get-time.md new file mode 100644 index 0000000000..0e5205b075 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get-time.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.getTime(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/health/get.md b/app/sdks/0.7.0/server-deno/docs/examples/health/get.md new file mode 100644 index 0000000000..c2e6ecdf65 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/health/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = health.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..18221d44b4 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-continents.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getContinents(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..4a3e49f755 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..61a1790806 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..20f544e617 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-countries.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCountries(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..13b975291d --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-currencies.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..95c5c6b355 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get-languages.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.getLanguages(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/locale/get.md b/app/sdks/0.7.0/server-deno/docs/examples/locale/get.md new file mode 100644 index 0000000000..2336c3289d --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/locale/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = locale.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/create-file.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..5b446e1a38 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/create-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.createFile(new File([fileBlob], 'file.png'), [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..6469308c74 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/delete-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..4510257bad --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-download.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFileDownload('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..282fb30324 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-preview.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFilePreview('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..8af5391017 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file-view.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFileView('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..393ce229cb --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/get-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/list-files.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..0e57cd01de --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/list-files.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.listFiles(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/storage/update-file.md b/app/sdks/0.7.0/server-deno/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..33b2263540 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/storage/update-file.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..b277899c91 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/create.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/create.md new file mode 100644 index 0000000000..1ef3e01b81 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/create.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..911fa30075 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/delete-membership.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/delete.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/delete.md new file mode 100644 index 0000000000..61ac03483f --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/delete.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..b652f8e4e5 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/get-memberships.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/get.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/get.md new file mode 100644 index 0000000000..69496e3eef --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/list.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/list.md new file mode 100644 index 0000000000..70851dda51 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/list.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/teams/update.md b/app/sdks/0.7.0/server-deno/docs/examples/teams/update.md new file mode 100644 index 0000000000..7b815b4050 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/teams/update.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/create.md b/app/sdks/0.7.0/server-deno/docs/examples/users/create.md new file mode 100644 index 0000000000..593eee6e9f --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/create.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/delete-session.md b/app/sdks/0.7.0/server-deno/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..e4940773e4 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/delete-session.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/delete-sessions.md b/app/sdks/0.7.0/server-deno/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..e772c00a5f --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/delete-sessions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/delete-user.md b/app/sdks/0.7.0/server-deno/docs/examples/users/delete-user.md new file mode 100644 index 0000000000..657cf61bcb --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/delete-user.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.deleteUser('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/get-logs.md b/app/sdks/0.7.0/server-deno/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..58cc4fc529 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/get-logs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.getLogs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/get-prefs.md b/app/sdks/0.7.0/server-deno/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..4cda0bb73e --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/get-prefs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.getPrefs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/get-sessions.md b/app/sdks/0.7.0/server-deno/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..6686e21564 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/get-sessions.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.getSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/get.md b/app/sdks/0.7.0/server-deno/docs/examples/users/get.md new file mode 100644 index 0000000000..dce73d62c5 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/get.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/list.md b/app/sdks/0.7.0/server-deno/docs/examples/users/list.md new file mode 100644 index 0000000000..b089c3e7e9 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/list.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/update-prefs.md b/app/sdks/0.7.0/server-deno/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..b06185ee91 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/update-prefs.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.updatePrefs('[USER_ID]', {}); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/docs/examples/users/update-status.md b/app/sdks/0.7.0/server-deno/docs/examples/users/update-status.md new file mode 100644 index 0000000000..a0f028bde5 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/docs/examples/users/update-status.md @@ -0,0 +1,20 @@ +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + + +let promise = users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/mod.ts b/app/sdks/0.7.0/server-deno/mod.ts new file mode 100644 index 0000000000..3484edd93f --- /dev/null +++ b/app/sdks/0.7.0/server-deno/mod.ts @@ -0,0 +1,21 @@ +import { Client } from "./src/client.ts"; +import { Avatars } from "./src/services/avatars.ts"; +import { Database } from "./src/services/database.ts"; +import { Functions } from "./src/services/functions.ts"; +import { Health } from "./src/services/health.ts"; +import { Locale } from "./src/services/locale.ts"; +import { Storage } from "./src/services/storage.ts"; +import { Teams } from "./src/services/teams.ts"; +import { Users } from "./src/services/users.ts"; + +export { + Client, + Avatars, + Database, + Functions, + Health, + Locale, + Storage, + Teams, + Users, +}; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/client.ts b/app/sdks/0.7.0/server-deno/src/client.ts new file mode 100644 index 0000000000..3bf22034b8 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/client.ts @@ -0,0 +1,138 @@ +export interface DocumentData { + [key: string]: any; +} + +export class Client { + + endpoint: string = 'https://appwrite.io/v1'; + headers: DocumentData = { + 'content-type': '', + 'x-sdk-version': 'appwrite:deno:0.0.2', + }; + + /** + * Set Project + * + * Your project ID + * + * @param string value + * + * @return self + */ + setProject(value: string): this { + this.addHeader('X-Appwrite-Project', value); + + return this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string value + * + * @return self + */ + setKey(value: string): this { + this.addHeader('X-Appwrite-Key', value); + + return this; + } + + /** + * Set Locale + * + * @param string value + * + * @return self + */ + setLocale(value: string): this { + this.addHeader('X-Appwrite-Locale', value); + + return this; + } + + + /*** + * @param endpoint + * @return this + */ + setEndpoint(endpoint: string): this { + this.endpoint = endpoint; + + return this; + } + + /** + * @param key string + * @param value string + */ + addHeader(key: string, value: string): this { + this.headers[key.toLowerCase()] = value.toLowerCase(); + + return this; + } + + withoutHeader(key: string, headers: DocumentData): DocumentData { + return Object.keys(headers).reduce((acc: DocumentData, cv) => { + if (cv == 'content-type') return acc + acc[cv] = headers[cv] + return acc + }, {}) + } + + async call(method: string, path: string = '', headers: DocumentData = {}, params: DocumentData = {}) { + headers = Object.assign(this.headers, headers); + + let body; + const url = new URL(this.endpoint + path) + if (method.toUpperCase() === 'GET') { + url.search = new URLSearchParams(this.flatten(params)).toString() + body = null + } else if (headers['content-type'].toLowerCase().startsWith('multipart/form-data')) { + headers = this.withoutHeader('content-type', headers) + const formData = new FormData() + const flatParams = this.flatten(params) + for (const key in flatParams) { + formData.append(key, flatParams[key]); + } + body = formData + } else { + body = JSON.stringify(params) + } + + const options = { + method: method.toUpperCase(), + headers: headers, + body: body, + }; + + let response = await fetch(url.toString(), options); + const contentType = response.headers.get('content-type'); + + if (contentType && contentType.includes('application/json')) { + return response.json() + } + + return response; + } + + flatten(data: DocumentData, prefix = '') { + let output: DocumentData = {}; + + for (const key in data) { + let value = data[key]; + let finalKey = prefix ? prefix + '[' + key +']' : key; + + if (Array.isArray(value)) { + output = Object.assign(output, this.flatten(value, finalKey)); // @todo: handle name collision here if needed + } + else { + output[finalKey] = value; + } + } + + return output; + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/service.ts b/app/sdks/0.7.0/server-deno/src/service.ts new file mode 100644 index 0000000000..ceedf1a0c3 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/service.ts @@ -0,0 +1,13 @@ +import { Client } from "./client.ts"; + +export abstract class Service { + + client: Client; + + /** + * @param client + */ + constructor(client: Client) { + this.client = client; + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/avatars.ts b/app/sdks/0.7.0/server-deno/src/services/avatars.ts new file mode 100644 index 0000000000..fc08624829 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/avatars.ts @@ -0,0 +1,201 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Avatars extends Service { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return Promise + */ + async getBrowser(code: string, width: number = 100, height: number = 100, quality: number = 100): Promise { + let path = '/avatars/browsers/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return Promise + */ + async getCreditCard(code: string, width: number = 100, height: number = 100, quality: number = 100): Promise { + let path = '/avatars/credit-cards/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param string url + * @throws Exception + * @return Promise + */ + async getFavicon(url: string): Promise { + let path = '/avatars/favicon'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url + }); + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return Promise + */ + async getFlag(code: string, width: number = 100, height: number = 100, quality: number = 100): Promise { + let path = '/avatars/flags/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param string url + * @param number width + * @param number height + * @throws Exception + * @return Promise + */ + async getImage(url: string, width: number = 400, height: number = 400): Promise { + let path = '/avatars/image'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url, + 'width': width, + 'height': height + }); + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param string name + * @param number width + * @param number height + * @param string color + * @param string background + * @throws Exception + * @return Promise + */ + async getInitials(name: string = '', width: number = 500, height: number = 500, color: string = '', background: string = ''): Promise { + let path = '/avatars/initials'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background + }); + } + + /** + * Get QR Code + * + * 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. + * + * @param string text + * @param number size + * @param number margin + * @param boolean download + * @throws Exception + * @return Promise + */ + async getQR(text: string, size: number = 400, margin: number = 1, download: boolean = false): Promise { + let path = '/avatars/qr'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/database.ts b/app/sdks/0.7.0/server-deno/src/services/database.ts new file mode 100644 index 0000000000..31b331b301 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/database.ts @@ -0,0 +1,264 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Database extends Service { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async listCollections(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/database/collections'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Collection + * + * Create a new Collection. + * + * @param string name + * @param Array read + * @param Array write + * @param Array rules + * @throws Exception + * @return Promise + */ + async createCollection(name: string, read: Array, write: Array, rules: Array): Promise { + let path = '/database/collections'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string collectionId + * @throws Exception + * @return Promise + */ + async getCollection(collectionId: string): Promise { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param string collectionId + * @param string name + * @param Array read + * @param Array write + * @param Array rules + * @throws Exception + * @return Promise + */ + async updateCollection(collectionId: string, name: string, read: Array, write: Array, rules: Array = []): Promise { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string collectionId + * @throws Exception + * @return Promise + */ + async deleteCollection(collectionId: string): Promise { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param string collectionId + * @param Array filters + * @param number limit + * @param number offset + * @param string orderField + * @param string orderType + * @param string orderCast + * @param string search + * @throws Exception + * @return Promise + */ + async listDocuments(collectionId: string, filters: Array = [], limit: number = 25, offset: number = 0, orderField: string = '', orderType: string = 'ASC', orderCast: string = 'string', search: string = ''): Promise { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'filters': filters, + 'limit': limit, + 'offset': offset, + 'orderField': orderField, + 'orderType': orderType, + 'orderCast': orderCast, + 'search': search + }); + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param string collectionId + * @param DocumentData data + * @param Array read + * @param Array write + * @param string parentDocument + * @param string parentProperty + * @param string parentPropertyType + * @throws Exception + * @return Promise + */ + async createDocument(collectionId: string, data: DocumentData, read: Array, write: Array, parentDocument: string = '', parentProperty: string = '', parentPropertyType: string = 'assign'): Promise { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType + }); + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return Promise + */ + async getDocument(collectionId: string, documentId: string): Promise { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Document + * + * @param string collectionId + * @param string documentId + * @param DocumentData data + * @param Array read + * @param Array write + * @throws Exception + * @return Promise + */ + async updateDocument(collectionId: string, documentId: string, data: DocumentData, read: Array, write: Array): Promise { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write + }); + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return Promise + */ + async deleteDocument(collectionId: string, documentId: string): Promise { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/functions.ts b/app/sdks/0.7.0/server-deno/src/services/functions.ts new file mode 100644 index 0000000000..265cbfab98 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/functions.ts @@ -0,0 +1,279 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Functions extends Service { + + /** + * List Functions + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async list(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/functions'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Function + * + * @param string name + * @param string env + * @param DocumentData vars + * @param Array events + * @param string schedule + * @param number timeout + * @throws Exception + * @return Promise + */ + async create(name: string, env: string, vars: DocumentData = [], events: Array = [], schedule: string = '', timeout: number = 15): Promise { + let path = '/functions'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'env': env, + 'vars': vars, + 'events': events, + 'schedule': schedule, + 'timeout': timeout + }); + } + + /** + * Get Function + * + * @param string functionId + * @throws Exception + * @return Promise + */ + async get(functionId: string): Promise { + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Function + * + * @param string functionId + * @param string name + * @param DocumentData vars + * @param Array events + * @param string schedule + * @param number timeout + * @throws Exception + * @return Promise + */ + async update(functionId: string, name: string, vars: DocumentData = [], events: Array = [], schedule: string = '', timeout: number = 15): Promise { + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'vars': vars, + 'events': events, + 'schedule': schedule, + 'timeout': timeout + }); + } + + /** + * Delete Function + * + * @param string functionId + * @throws Exception + * @return Promise + */ + async delete(functionId: string): Promise { + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Executions + * + * @param string functionId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async listExecutions(functionId: string, search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Execution + * + * @param string functionId + * @throws Exception + * @return Promise + */ + async createExecution(functionId: string): Promise { + let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Execution + * + * @param string functionId + * @param string executionId + * @throws Exception + * @return Promise + */ + async getExecution(functionId: string, executionId: string): Promise { + let path = '/functions/{functionId}/executions/{executionId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{executionId}', 'g'), executionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Function Tag + * + * @param string functionId + * @param string tag + * @throws Exception + * @return Promise + */ + async updateTag(functionId: string, tag: string): Promise { + let path = '/functions/{functionId}/tag'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'tag': tag + }); + } + + /** + * List Tags + * + * @param string functionId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async listTags(functionId: string, search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Tag + * + * @param string functionId + * @param string command + * @param File | Blob code + * @throws Exception + * @return Promise + */ + async createTag(functionId: string, command: string, code: File | Blob): Promise { + let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, + { + 'command': command, + 'code': code + }); + } + + /** + * Get Tag + * + * @param string functionId + * @param string tagId + * @throws Exception + * @return Promise + */ + async getTag(functionId: string, tagId: string): Promise { + let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete Tag + * + * @param string functionId + * @param string tagId + * @throws Exception + * @return Promise + */ + async deleteTag(functionId: string, tagId: string): Promise { + let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/health.ts b/app/sdks/0.7.0/server-deno/src/services/health.ts new file mode 100644 index 0000000000..df5c18a2cb --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/health.ts @@ -0,0 +1,232 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Health extends Service { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws Exception + * @return Promise + */ + async get(): Promise { + let path = '/health'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return Promise + */ + async getAntiVirus(): Promise { + let path = '/health/anti-virus'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return Promise + */ + async getCache(): Promise { + let path = '/health/cache'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return Promise + */ + async getDB(): Promise { + let path = '/health/db'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return Promise + */ + async getQueueCertificates(): Promise { + let path = '/health/queue/certificates'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Functions Queue + * + * @throws Exception + * @return Promise + */ + async getQueueFunctions(): Promise { + let path = '/health/queue/functions'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueLogs(): Promise { + let path = '/health/queue/logs'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueTasks(): Promise { + let path = '/health/queue/tasks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueUsage(): Promise { + let path = '/health/queue/usage'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return Promise + */ + async getQueueWebhooks(): Promise { + let path = '/health/queue/webhooks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return Promise + */ + async getStorageLocal(): Promise { + let path = '/health/storage/local'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return Promise + */ + async getTime(): Promise { + let path = '/health/time'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/locale.ts b/app/sdks/0.7.0/server-deno/src/services/locale.ts new file mode 100644 index 0000000000..9d8e066c70 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/locale.ts @@ -0,0 +1,143 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Locale extends Service { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws Exception + * @return Promise + */ + async get(): Promise { + let path = '/locale'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return Promise + */ + async getContinents(): Promise { + let path = '/locale/continents'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return Promise + */ + async getCountries(): Promise { + let path = '/locale/countries'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return Promise + */ + async getCountriesEU(): Promise { + let path = '/locale/countries/eu'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return Promise + */ + async getCountriesPhones(): Promise { + let path = '/locale/countries/phones'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return Promise + */ + async getCurrencies(): Promise { + let path = '/locale/currencies'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return Promise + */ + async getLanguages(): Promise { + let path = '/locale/languages'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/storage.ts b/app/sdks/0.7.0/server-deno/src/services/storage.ts new file mode 100644 index 0000000000..b663739e05 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/storage.ts @@ -0,0 +1,198 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Storage extends Service { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async listFiles(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/storage/files'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param File | Blob file + * @param Array read + * @param Array write + * @throws Exception + * @return Promise + */ + async createFile(file: File | Blob, read: Array, write: Array): Promise { + let path = '/storage/files'; + + return await this.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, + { + 'file': file, + 'read': read, + 'write': write + }); + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string fileId + * @throws Exception + * @return Promise + */ + async getFile(fileId: string): Promise { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param string fileId + * @param Array read + * @param Array write + * @throws Exception + * @return Promise + */ + async updateFile(fileId: string, read: Array, write: Array): Promise { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'read': read, + 'write': write + }); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string fileId + * @throws Exception + * @return Promise + */ + async deleteFile(fileId: string): Promise { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string fileId + * @throws Exception + * @return Promise + */ + async getFileDownload(fileId: string): Promise { + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param string fileId + * @param number width + * @param number height + * @param number quality + * @param string background + * @param string output + * @throws Exception + * @return Promise + */ + async getFilePreview(fileId: string, width: number = 0, height: number = 0, quality: number = 100, background: string = '', output: string = ''): Promise { + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output + }); + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param string fileId + * @param string as + * @throws Exception + * @return Promise + */ + async getFileView(fileId: string, as: string = ''): Promise { + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'as': as + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/teams.ts b/app/sdks/0.7.0/server-deno/src/services/teams.ts new file mode 100644 index 0000000000..864e6f6ed4 --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/teams.ts @@ -0,0 +1,209 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Teams extends Service { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async list(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/teams'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param string name + * @param Array roles + * @throws Exception + * @return Promise + */ + async create(name: string, roles: Array = ["owner"]): Promise { + let path = '/teams'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'roles': roles + }); + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return Promise + */ + async get(teamId: string): Promise { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @param string name + * @throws Exception + * @return Promise + */ + async update(teamId: string, name: string): Promise { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name + }); + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return Promise + */ + async delete(teamId: string): Promise { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param string teamId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async getMemberships(teamId: string, search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param string teamId + * @param string email + * @param Array roles + * @param string url + * @param string name + * @throws Exception + * @return Promise + */ + async createMembership(teamId: string, email: string, roles: Array, url: string, name: string = ''): Promise { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url + }); + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param string teamId + * @param string inviteId + * @throws Exception + * @return Promise + */ + async deleteMembership(teamId: string, inviteId: string): Promise { + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-deno/src/services/users.ts b/app/sdks/0.7.0/server-deno/src/services/users.ts new file mode 100644 index 0000000000..0db02d83cd --- /dev/null +++ b/app/sdks/0.7.0/server-deno/src/services/users.ts @@ -0,0 +1,233 @@ +import { Service } from "../service.ts"; +import { DocumentData } from '../client.ts' + +export class Users extends Service { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return Promise + */ + async list(search: string = '', limit: number = 25, offset: number = 0, orderType: string = 'ASC'): Promise { + let path = '/users'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create User + * + * Create a new user. + * + * @param string email + * @param string password + * @param string name + * @throws Exception + * @return Promise + */ + async create(email: string, password: string, name: string = ''): Promise { + let path = '/users'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'password': password, + 'name': name + }); + } + + /** + * Get User + * + * Get user by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async get(userId: string): Promise { + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User + * + * Delete a user by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async deleteUser(userId: string): Promise { + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async getLogs(userId: string): Promise { + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async getPrefs(userId: string): Promise { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param string userId + * @param DocumentData prefs + * @throws Exception + * @return Promise + */ + async updatePrefs(userId: string, prefs: DocumentData): Promise { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'prefs': prefs + }); + } + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async getSessions(userId: string): Promise { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param string userId + * @throws Exception + * @return Promise + */ + async deleteSessions(userId: string): Promise { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param string userId + * @param string sessionId + * @throws Exception + * @return Promise + */ + async deleteSession(userId: string, sessionId: string): Promise { + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param string userId + * @param string status + * @throws Exception + * @return Promise + */ + async updateStatus(userId: string, status: string): Promise { + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'status': status + }); + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/CHANGELOG.md b/app/sdks/0.7.0/server-nodejs/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/LICENSE b/app/sdks/0.7.0/server-nodejs/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/README.md b/app/sdks/0.7.0/server-nodejs/README.md new file mode 100644 index 0000000000..130f0362d3 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/README.md @@ -0,0 +1,28 @@ +# Appwrite Node.js SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-node.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +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 Node.js 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [NPM](https://www.npmjs.com/): + +```bash +npm install node-appwrite --save +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..2a670ce08b --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-browser.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getBrowser('aa'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..afd38f5a97 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getCreditCard('amex'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..bb347371d4 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-favicon.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getFavicon('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..db677bc4f8 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-flag.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getFlag('af'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..efa871ea63 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-image.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getImage('https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..d6175bff13 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-initials.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getInitials(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..e79b3235af --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/avatars/get-q-r.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let avatars = new sdk.Avatars(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = avatars.getQR('[TEXT]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/create-collection.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..c0207f30f0 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/create-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.createCollection('[NAME]', [], [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/create-document.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/create-document.md new file mode 100644 index 0000000000..8676dfb84d --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/create-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.createDocument('[COLLECTION_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/delete-collection.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..503da98a73 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/delete-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.deleteCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/delete-document.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..f14c985e83 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/delete-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/get-collection.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..a14ce0d49a --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/get-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.getCollection('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/get-document.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/get-document.md new file mode 100644 index 0000000000..55cce32b9b --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/get-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/list-collections.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..bacfdb062c --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/list-collections.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.listCollections(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/list-documents.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..ad02d05e2a --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/list-documents.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.listDocuments('[COLLECTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/update-collection.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..eb9326565a --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/update-collection.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.updateCollection('[COLLECTION_ID]', '[NAME]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/database/update-document.md b/app/sdks/0.7.0/server-nodejs/docs/examples/database/update-document.md new file mode 100644 index 0000000000..131722cd26 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/database/update-document.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let database = new sdk.Database(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = database.updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create-execution.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create-execution.md new file mode 100644 index 0000000000..895b70cd1b --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create-execution.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.createExecution('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create-tag.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create-tag.md new file mode 100644 index 0000000000..7949790f16 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create-tag.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); +const fs = require('fs'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.createTag('[FUNCTION_ID]', '[COMMAND]', fs.createReadStream(__dirname + '/file.png'))); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create.md new file mode 100644 index 0000000000..1e1a255bc2 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/create.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.create('[NAME]', 'node-14'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/delete-tag.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/delete-tag.md new file mode 100644 index 0000000000..938bb5cc19 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/delete-tag.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.deleteTag('[FUNCTION_ID]', '[TAG_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/delete.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/delete.md new file mode 100644 index 0000000000..6f079cb7f7 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/delete.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.delete('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get-execution.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get-execution.md new file mode 100644 index 0000000000..1e2f5ea88a --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get-execution.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get-tag.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get-tag.md new file mode 100644 index 0000000000..a016699a11 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get-tag.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.getTag('[FUNCTION_ID]', '[TAG_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get.md new file mode 100644 index 0000000000..620deec88c --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.get('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list-executions.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list-executions.md new file mode 100644 index 0000000000..40c44b12e5 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list-executions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.listExecutions('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list-tags.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list-tags.md new file mode 100644 index 0000000000..c9c043a8b4 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list-tags.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.listTags('[FUNCTION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list.md new file mode 100644 index 0000000000..9ecd37237d --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/list.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/update-tag.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/update-tag.md new file mode 100644 index 0000000000..0ea180e1d9 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/update-tag.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.updateTag('[FUNCTION_ID]', '[TAG]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/functions/update.md b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/update.md new file mode 100644 index 0000000000..209346ef89 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/functions/update.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let functions = new sdk.Functions(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = functions.update('[FUNCTION_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-anti-virus.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..c08e612bcf --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-anti-virus.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getAntiVirus(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-cache.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..d19cc8abd5 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-cache.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getCache(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-d-b.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..08505367d4 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-d-b.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getDB(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-certificates.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..2eb69e0126 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueCertificates(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-functions.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..9470e11646 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-functions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueFunctions(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-logs.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..10f1cb24e3 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-logs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueLogs(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-tasks.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..c159f4e6ee --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueTasks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-usage.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..6286c741ee --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-usage.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueUsage(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..3a788eb895 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getQueueWebhooks(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-storage-local.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..84b8fb47a6 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-storage-local.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getStorageLocal(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-time.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-time.md new file mode 100644 index 0000000000..563bf2fb52 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get-time.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.getTime(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/health/get.md b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get.md new file mode 100644 index 0000000000..20c3d40801 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/health/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let health = new sdk.Health(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = health.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..323237b4ab --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-continents.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getContinents(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..fc9170dba4 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCountriesEU(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..42be901677 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCountriesPhones(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..437c9bb502 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-countries.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCountries(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..1b7d605760 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-currencies.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getCurrencies(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..b6f45311b3 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get-languages.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.getLanguages(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get.md b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get.md new file mode 100644 index 0000000000..2f2eb95d90 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/locale/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let locale = new sdk.Locale(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = locale.get(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/create-file.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..1eda9fd868 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/create-file.md @@ -0,0 +1,21 @@ +const sdk = require('node-appwrite'); +const fs = require('fs'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.createFile(fs.createReadStream(__dirname + '/file.png')), [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..9ce0ff7f2e --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/delete-file.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.deleteFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..1683ed87e0 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-download.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFileDownload('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..771dcd35f0 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-preview.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFilePreview('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..83029ecdee --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file-view.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFileView('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..2a76fdf189 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/get-file.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.getFile('[FILE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/list-files.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..e11fd95300 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/list-files.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.listFiles(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/storage/update-file.md b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..4726169146 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/storage/update-file.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let storage = new sdk.Storage(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = storage.updateFile('[FILE_ID]', [], []); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..cd17042e58 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/create-membership.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/create.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/create.md new file mode 100644 index 0000000000..c0d0611a49 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/create.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.create('[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..f9a76f3ec0 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/delete-membership.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.deleteMembership('[TEAM_ID]', '[INVITE_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/delete.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/delete.md new file mode 100644 index 0000000000..e833fdfb9b --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/delete.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.delete('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..75cdf38e5c --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/get-memberships.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.getMemberships('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/get.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/get.md new file mode 100644 index 0000000000..a51322df27 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.get('[TEAM_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/list.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/list.md new file mode 100644 index 0000000000..259bbd22b2 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/list.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/teams/update.md b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/update.md new file mode 100644 index 0000000000..2118e8a90f --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/teams/update.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let teams = new sdk.Teams(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = teams.update('[TEAM_ID]', '[NAME]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/create.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/create.md new file mode 100644 index 0000000000..83704cbd9d --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/create.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-session.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..22308d4fa6 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-session.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.deleteSession('[USER_ID]', '[SESSION_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-sessions.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..75f8f96bda --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-sessions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.deleteSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-user.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-user.md new file mode 100644 index 0000000000..e72e600015 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/delete-user.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.deleteUser('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-logs.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..1287b5ef5f --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-logs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.getLogs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-prefs.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..088e6b0811 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-prefs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.getPrefs('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-sessions.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..f5ad029ebe --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get-sessions.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.getSessions('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/get.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get.md new file mode 100644 index 0000000000..5b91577284 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/get.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.get('[USER_ID]'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/list.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/list.md new file mode 100644 index 0000000000..0bc83b06bf --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/list.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.list(); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/update-prefs.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..7d1011d6be --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/update-prefs.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.updatePrefs('[USER_ID]', {}); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/docs/examples/users/update-status.md b/app/sdks/0.7.0/server-nodejs/docs/examples/users/update-status.md new file mode 100644 index 0000000000..86f54381da --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/docs/examples/users/update-status.md @@ -0,0 +1,20 @@ +const sdk = require('node-appwrite'); + +// Init SDK +let client = new sdk.Client(); + +let users = new sdk.Users(client); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let promise = users.updateStatus('[USER_ID]', '1'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/index.js b/app/sdks/0.7.0/server-nodejs/index.js new file mode 100644 index 0000000000..deb571190d --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/index.js @@ -0,0 +1,21 @@ +const Client = require('./lib/client.js'); +const Avatars = require('./lib/services/avatars.js'); +const Database = require('./lib/services/database.js'); +const Functions = require('./lib/services/functions.js'); +const Health = require('./lib/services/health.js'); +const Locale = require('./lib/services/locale.js'); +const Storage = require('./lib/services/storage.js'); +const Teams = require('./lib/services/teams.js'); +const Users = require('./lib/services/users.js'); + +module.exports = { + Client, + Avatars, + Database, + Functions, + Health, + Locale, + Storage, + Teams, + Users, +}; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/client.js b/app/sdks/0.7.0/server-nodejs/lib/client.js new file mode 100644 index 0000000000..821ef5f424 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/client.js @@ -0,0 +1,152 @@ +const URL = require('url').URL; +const axios = require('axios'); +const FormData = require('form-data'); + +class Client { + + constructor() { + this.endpoint = 'https://appwrite.io/v1'; + this.headers = { + 'content-type': '', + 'x-sdk-version': 'appwrite:nodejs:1.1.0', + }; + this.selfSigned = false; + } + + /** + * Set Project + * + * Your project ID + * + * @param string value + * + * @return self + */ + setProject(value) { + this.addHeader('X-Appwrite-Project', value); + + return this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string value + * + * @return self + */ + setKey(value) { + this.addHeader('X-Appwrite-Key', value); + + return this; + } + + /** + * Set Locale + * + * @param string value + * + * @return self + */ + setLocale(value) { + this.addHeader('X-Appwrite-Locale', value); + + return this; + } + + /*** + * @param bool status + * @return this + */ + setSelfSigned(status = true) { + this.selfSigned = status; + + return this; + } + + /*** + * @param endpoint + * @return this + */ + setEndpoint(endpoint) + { + this.endpoint = endpoint; + + return this; + } + + /** + * @param key string + * @param value string + */ + addHeader(key, value) { + this.headers[key.toLowerCase()] = value.toLowerCase(); + + return this; + } + + async call(method, path = '', headers = {}, params = {}) { + if(this.selfSigned) { // Allow self signed requests + process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0; + } + + headers = Object.assign(this.headers, headers); + + let contentType = headers['content-type'].toLowerCase(); + + let formData = null; + + // Compute FormData for axios and appwrite. + if (contentType.startsWith('multipart/form-data')) { + const form = new FormData(); + + let flatParams = this.flatten(params); + + for (const key in flatParams) { + form.append(key, flatParams[key]) + } + + headers = { + ...headers, + ...form.getHeaders() + }; + + formData = form; + } + + let options = { + method: method.toUpperCase(), + url: this.endpoint + path, + params: (method.toUpperCase() === 'GET') ? params : {}, + headers: headers, + data: (method.toUpperCase() === 'GET' || contentType.startsWith('multipart/form-data')) ? formData : params, + json: (contentType.startsWith('application/json')) + }; + + let response = await axios(options); + + return response.data; + } + + flatten(data, prefix = '') { + let output = {}; + + for (const key in data) { + let value = data[key]; + let finalKey = prefix ? prefix + '[' + key +']' : key; + + if (Array.isArray(value)) { + output = Object.assign(output, this.flatten(value, finalKey)); // @todo: handle name collision here if needed + } + else { + output[finalKey] = value; + } + } + + return output; + } +} + +module.exports = Client; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/service.js b/app/sdks/0.7.0/server-nodejs/lib/service.js new file mode 100644 index 0000000000..e799c064be --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/service.js @@ -0,0 +1,10 @@ +class Service { + /** + * @param client + */ + constructor(client) { + this.client = client; + } +} + +module.exports = Service; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/avatars.js b/app/sdks/0.7.0/server-nodejs/lib/services/avatars.js new file mode 100644 index 0000000000..0227b2ac7f --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/avatars.js @@ -0,0 +1,202 @@ +const Service = require('../service.js'); + +class Avatars extends Service { + + /** + * Get Browser Icon + * + * You can use this endpoint to show different browser icons to your users. + * The code argument receives the browser code as it appears in your user + * /account/sessions endpoint. Use width, height and quality arguments to + * change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return {} + */ + async getBrowser(code, width = 100, height = 100, quality = 100) { + let path = '/avatars/browsers/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return {} + */ + async getCreditCard(code, width = 100, height = 100, quality = 100) { + let path = '/avatars/credit-cards/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param string url + * @throws Exception + * @return {} + */ + async getFavicon(url) { + let path = '/avatars/favicon'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url + }); + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param string code + * @param number width + * @param number height + * @param number quality + * @throws Exception + * @return {} + */ + async getFlag(code, width = 100, height = 100, quality = 100) { + let path = '/avatars/flags/{code}'.replace(new RegExp('{code}', 'g'), code); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality + }); + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param string url + * @param number width + * @param number height + * @throws Exception + * @return {} + */ + async getImage(url, width = 400, height = 400) { + let path = '/avatars/image'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'url': url, + 'width': width, + 'height': height + }); + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param string name + * @param number width + * @param number height + * @param string color + * @param string background + * @throws Exception + * @return {} + */ + async getInitials(name = '', width = 500, height = 500, color = '', background = '') { + let path = '/avatars/initials'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background + }); + } + + /** + * Get QR Code + * + * 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. + * + * @param string text + * @param number size + * @param number margin + * @param boolean download + * @throws Exception + * @return {} + */ + async getQR(text, size = 400, margin = 1, download = false) { + let path = '/avatars/qr'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download + }); + } +} + +module.exports = Avatars; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/database.js b/app/sdks/0.7.0/server-nodejs/lib/services/database.js new file mode 100644 index 0000000000..ee5f3de22e --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/database.js @@ -0,0 +1,265 @@ +const Service = require('../service.js'); + +class Database extends Service { + + /** + * List Collections + * + * Get a list of all the user collections. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project collections. [Learn more about different API + * modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async listCollections(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/database/collections'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Collection + * + * Create a new Collection. + * + * @param string name + * @param string[] read + * @param string[] write + * @param string[] rules + * @throws Exception + * @return {} + */ + async createCollection(name, read, write, rules) { + let path = '/database/collections'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string collectionId + * @throws Exception + * @return {} + */ + async getCollection(collectionId) { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param string collectionId + * @param string name + * @param string[] read + * @param string[] write + * @param string[] rules + * @throws Exception + * @return {} + */ + async updateCollection(collectionId, name, read, write, rules = []) { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + }); + } + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string collectionId + * @throws Exception + * @return {} + */ + async deleteCollection(collectionId) { + let path = '/database/collections/{collectionId}'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param string collectionId + * @param string[] filters + * @param number limit + * @param number offset + * @param string orderField + * @param string orderType + * @param string orderCast + * @param string search + * @throws Exception + * @return {} + */ + async listDocuments(collectionId, filters = [], limit = 25, offset = 0, orderField = '', orderType = 'ASC', orderCast = 'string', search = '') { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'filters': filters, + 'limit': limit, + 'offset': offset, + 'orderField': orderField, + 'orderType': orderType, + 'orderCast': orderCast, + 'search': search + }); + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param string collectionId + * @param object data + * @param string[] read + * @param string[] write + * @param string parentDocument + * @param string parentProperty + * @param string parentPropertyType + * @throws Exception + * @return {} + */ + async createDocument(collectionId, data, read, write, parentDocument = '', parentProperty = '', parentPropertyType = 'assign') { + let path = '/database/collections/{collectionId}/documents'.replace(new RegExp('{collectionId}', 'g'), collectionId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parentDocument, + 'parentProperty': parentProperty, + 'parentPropertyType': parentPropertyType + }); + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return {} + */ + async getDocument(collectionId, documentId) { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Document + * + * @param string collectionId + * @param string documentId + * @param object data + * @param string[] read + * @param string[] write + * @throws Exception + * @return {} + */ + async updateDocument(collectionId, documentId, data, read, write) { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'data': data, + 'read': read, + 'write': write + }); + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param string collectionId + * @param string documentId + * @throws Exception + * @return {} + */ + async deleteDocument(collectionId, documentId) { + let path = '/database/collections/{collectionId}/documents/{documentId}'.replace(new RegExp('{collectionId}', 'g'), collectionId).replace(new RegExp('{documentId}', 'g'), documentId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Database; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/functions.js b/app/sdks/0.7.0/server-nodejs/lib/services/functions.js new file mode 100644 index 0000000000..95e4626b33 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/functions.js @@ -0,0 +1,280 @@ +const Service = require('../service.js'); + +class Functions extends Service { + + /** + * List Functions + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/functions'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Function + * + * @param string name + * @param string env + * @param object vars + * @param string[] events + * @param string schedule + * @param number timeout + * @throws Exception + * @return {} + */ + async create(name, env, vars = [], events = [], schedule = '', timeout = 15) { + let path = '/functions'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'env': env, + 'vars': vars, + 'events': events, + 'schedule': schedule, + 'timeout': timeout + }); + } + + /** + * Get Function + * + * @param string functionId + * @throws Exception + * @return {} + */ + async get(functionId) { + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Function + * + * @param string functionId + * @param string name + * @param object vars + * @param string[] events + * @param string schedule + * @param number timeout + * @throws Exception + * @return {} + */ + async update(functionId, name, vars = [], events = [], schedule = '', timeout = 15) { + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'vars': vars, + 'events': events, + 'schedule': schedule, + 'timeout': timeout + }); + } + + /** + * Delete Function + * + * @param string functionId + * @throws Exception + * @return {} + */ + async delete(functionId) { + let path = '/functions/{functionId}'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Executions + * + * @param string functionId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async listExecutions(functionId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Execution + * + * @param string functionId + * @throws Exception + * @return {} + */ + async createExecution(functionId) { + let path = '/functions/{functionId}/executions'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Execution + * + * @param string functionId + * @param string executionId + * @throws Exception + * @return {} + */ + async getExecution(functionId, executionId) { + let path = '/functions/{functionId}/executions/{executionId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{executionId}', 'g'), executionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Function Tag + * + * @param string functionId + * @param string tag + * @throws Exception + * @return {} + */ + async updateTag(functionId, tag) { + let path = '/functions/{functionId}/tag'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'tag': tag + }); + } + + /** + * List Tags + * + * @param string functionId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async listTags(functionId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Tag + * + * @param string functionId + * @param string command + * @param File code + * @throws Exception + * @return {} + */ + async createTag(functionId, command, code) { + let path = '/functions/{functionId}/tags'.replace(new RegExp('{functionId}', 'g'), functionId); + + return await this.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, + { + 'command': command, + 'code': code + }); + } + + /** + * Get Tag + * + * @param string functionId + * @param string tagId + * @throws Exception + * @return {} + */ + async getTag(functionId, tagId) { + let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete Tag + * + * @param string functionId + * @param string tagId + * @throws Exception + * @return {} + */ + async deleteTag(functionId, tagId) { + let path = '/functions/{functionId}/tags/{tagId}'.replace(new RegExp('{functionId}', 'g'), functionId).replace(new RegExp('{tagId}', 'g'), tagId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Functions; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/health.js b/app/sdks/0.7.0/server-nodejs/lib/services/health.js new file mode 100644 index 0000000000..a0aed052ce --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/health.js @@ -0,0 +1,233 @@ +const Service = require('../service.js'); + +class Health extends Service { + + /** + * Get HTTP + * + * Check the Appwrite HTTP server is up and responsive. + * + * @throws Exception + * @return {} + */ + async get() { + let path = '/health'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getAntiVirus() { + let path = '/health/anti-virus'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return {} + */ + async getCache() { + let path = '/health/cache'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getDB() { + let path = '/health/db'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return {} + */ + async getQueueCertificates() { + let path = '/health/queue/certificates'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Functions Queue + * + * @throws Exception + * @return {} + */ + async getQueueFunctions() { + let path = '/health/queue/functions'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueLogs() { + let path = '/health/queue/logs'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueTasks() { + let path = '/health/queue/tasks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueUsage() { + let path = '/health/queue/usage'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return {} + */ + async getQueueWebhooks() { + let path = '/health/queue/webhooks'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return {} + */ + async getStorageLocal() { + let path = '/health/storage/local'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return {} + */ + async getTime() { + let path = '/health/time'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Health; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/locale.js b/app/sdks/0.7.0/server-nodejs/lib/services/locale.js new file mode 100644 index 0000000000..8bb45bf45e --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/locale.js @@ -0,0 +1,144 @@ +const Service = require('../service.js'); + +class Locale extends Service { + + /** + * Get User Locale + * + * Get the current user location based on IP. Returns an object with user + * country code, country name, continent name, continent code, ip address and + * suggested currency. You can use the locale header to get the data in a + * supported language. + * + * ([IP Geolocation by DB-IP](https://db-ip.com)) + * + * @throws Exception + * @return {} + */ + async get() { + let path = '/locale'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return {} + */ + async getContinents() { + let path = '/locale/continents'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return {} + */ + async getCountries() { + let path = '/locale/countries'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return {} + */ + async getCountriesEU() { + let path = '/locale/countries/eu'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return {} + */ + async getCountriesPhones() { + let path = '/locale/countries/phones'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return {} + */ + async getCurrencies() { + let path = '/locale/currencies'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return {} + */ + async getLanguages() { + let path = '/locale/languages'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Locale; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/storage.js b/app/sdks/0.7.0/server-nodejs/lib/services/storage.js new file mode 100644 index 0000000000..2b670db31a --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/storage.js @@ -0,0 +1,199 @@ +const Service = require('../service.js'); + +class Storage extends Service { + + /** + * List Files + * + * Get a list of all the user files. You can use the query params to filter + * your results. On admin mode, this endpoint will return a list of all of the + * project files. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async listFiles(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/storage/files'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param File file + * @param string[] read + * @param string[] write + * @throws Exception + * @return {} + */ + async createFile(file, read, write) { + let path = '/storage/files'; + + return await this.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, + { + 'file': file, + 'read': read, + 'write': write + }); + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string fileId + * @throws Exception + * @return {} + */ + async getFile(fileId) { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param string fileId + * @param string[] read + * @param string[] write + * @throws Exception + * @return {} + */ + async updateFile(fileId, read, write) { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'read': read, + 'write': write + }); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string fileId + * @throws Exception + * @return {} + */ + async deleteFile(fileId) { + let path = '/storage/files/{fileId}'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string fileId + * @throws Exception + * @return {} + */ + async getFileDownload(fileId) { + let path = '/storage/files/{fileId}/download'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param string fileId + * @param number width + * @param number height + * @param number quality + * @param string background + * @param string output + * @throws Exception + * @return {} + */ + async getFilePreview(fileId, width = 0, height = 0, quality = 100, background = '', output = '') { + let path = '/storage/files/{fileId}/preview'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output + }); + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param string fileId + * @param string as + * @throws Exception + * @return {} + */ + async getFileView(fileId, as = '') { + let path = '/storage/files/{fileId}/view'.replace(new RegExp('{fileId}', 'g'), fileId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'as': as + }); + } +} + +module.exports = Storage; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/teams.js b/app/sdks/0.7.0/server-nodejs/lib/services/teams.js new file mode 100644 index 0000000000..30025efef4 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/teams.js @@ -0,0 +1,210 @@ +const Service = require('../service.js'); + +class Teams extends Service { + + /** + * List Teams + * + * Get a list of all the current user teams. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project teams. [Learn more about different API modes](/docs/admin). + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param string name + * @param string[] roles + * @throws Exception + * @return {} + */ + async create(name, roles = ["owner"]) { + let path = '/teams'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'name': name, + 'roles': roles + }); + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return {} + */ + async get(teamId) { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @param string name + * @throws Exception + * @return {} + */ + async update(teamId, name) { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('put', path, { + 'content-type': 'application/json', + }, + { + 'name': name + }); + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string teamId + * @throws Exception + * @return {} + */ + async delete(teamId) { + let path = '/teams/{teamId}'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param string teamId + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async getMemberships(teamId, search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param string teamId + * @param string email + * @param string[] roles + * @param string url + * @param string name + * @throws Exception + * @return {} + */ + async createMembership(teamId, email, roles, url, name = '') { + let path = '/teams/{teamId}/memberships'.replace(new RegExp('{teamId}', 'g'), teamId); + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url + }); + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param string teamId + * @param string inviteId + * @throws Exception + * @return {} + */ + async deleteMembership(teamId, inviteId) { + let path = '/teams/{teamId}/memberships/{inviteId}'.replace(new RegExp('{teamId}', 'g'), teamId).replace(new RegExp('{inviteId}', 'g'), inviteId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } +} + +module.exports = Teams; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/lib/services/users.js b/app/sdks/0.7.0/server-nodejs/lib/services/users.js new file mode 100644 index 0000000000..7beea9d4f5 --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/lib/services/users.js @@ -0,0 +1,234 @@ +const Service = require('../service.js'); + +class Users extends Service { + + /** + * List Users + * + * Get a list of all the project users. You can use the query params to filter + * your results. + * + * @param string search + * @param number limit + * @param number offset + * @param string orderType + * @throws Exception + * @return {} + */ + async list(search = '', limit = 25, offset = 0, orderType = 'ASC') { + let path = '/users'; + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': orderType + }); + } + + /** + * Create User + * + * Create a new user. + * + * @param string email + * @param string password + * @param string name + * @throws Exception + * @return {} + */ + async create(email, password, name = '') { + let path = '/users'; + + return await this.client.call('post', path, { + 'content-type': 'application/json', + }, + { + 'email': email, + 'password': password, + 'name': name + }); + } + + /** + * Get User + * + * Get user by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async get(userId) { + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User + * + * Delete a user by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async deleteUser(userId) { + let path = '/users/{userId}'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async getLogs(userId) { + let path = '/users/{userId}/logs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async getPrefs(userId) { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param string userId + * @param object prefs + * @throws Exception + * @return {} + */ + async updatePrefs(userId, prefs) { + let path = '/users/{userId}/prefs'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'prefs': prefs + }); + } + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async getSessions(userId) { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('get', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param string userId + * @throws Exception + * @return {} + */ + async deleteSessions(userId) { + let path = '/users/{userId}/sessions'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param string userId + * @param string sessionId + * @throws Exception + * @return {} + */ + async deleteSession(userId, sessionId) { + let path = '/users/{userId}/sessions/{sessionId}'.replace(new RegExp('{userId}', 'g'), userId).replace(new RegExp('{sessionId}', 'g'), sessionId); + + return await this.client.call('delete', path, { + 'content-type': 'application/json', + }, + { + }); + } + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param string userId + * @param string status + * @throws Exception + * @return {} + */ + async updateStatus(userId, status) { + let path = '/users/{userId}/status'.replace(new RegExp('{userId}', 'g'), userId); + + return await this.client.call('patch', path, { + 'content-type': 'application/json', + }, + { + 'status': status + }); + } +} + +module.exports = Users; \ No newline at end of file diff --git a/app/sdks/0.7.0/server-nodejs/package.json b/app/sdks/0.7.0/server-nodejs/package.json new file mode 100644 index 0000000000..c38677a33b --- /dev/null +++ b/app/sdks/0.7.0/server-nodejs/package.json @@ -0,0 +1,17 @@ +{ + "name": "node-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.1.0", + "license": "BSD-3-Clause", + "main": "index.js", + "repository": { + "type": "git", + "url": "https://github.com/appwrite/sdk-for-node" + }, + "devDependencies": {}, + "dependencies": { + "axios": "^0.20.0", + "form-data": "^3.0.0" + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/CHANGELOG.md b/app/sdks/0.7.0/server-php/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/server-php/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/LICENSE b/app/sdks/0.7.0/server-php/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/server-php/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/README.md b/app/sdks/0.7.0/server-php/README.md new file mode 100644 index 0000000000..518f26e933 --- /dev/null +++ b/app/sdks/0.7.0/server-php/README.md @@ -0,0 +1,28 @@ +# Appwrite PHP SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-php.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +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 PHP 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [Composer](http://getcomposer.org/): + +```bash +composer require appwrite/appwrite +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/composer.json b/app/sdks/0.7.0/server-php/composer.json new file mode 100644 index 0000000000..fc13cb3bed --- /dev/null +++ b/app/sdks/0.7.0/server-php/composer.json @@ -0,0 +1,26 @@ +{ + "name": "appwrite/appwrite", + "description": "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 PHP 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)", + "type": "library", + "license": "BSD-3-Clause", + "support": { + "url": "https://appwrite.io/support", + "email": "team@appwrite.io" + }, + "autoload": { + "psr-4": { + "Appwrite\\": "src/Appwrite" + } + }, + "require": { + "php": ">=7.1.0", + "ext-curl": "*", + "ext-json": "*" + }, + "require-dev": { + "phpunit/phpunit": "3.7.35" + }, + "minimum-stability": "dev" +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/avatars.md b/app/sdks/0.7.0/server-php/docs/avatars.md new file mode 100644 index 0000000000..b143d0bb07 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/avatars.md @@ -0,0 +1,121 @@ +# Avatars Service + +## Get Browser Icon + +```http request +GET https://appwrite.io/v1/avatars/browsers/{code} +``` + +** You can use this endpoint to show different browser icons to your users. The code argument receives the browser code as it appears in your user /account/sessions endpoint. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Browser Code. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Credit Card Icon + +```http request +GET https://appwrite.io/v1/avatars/credit-cards/{code} +``` + +** Need to display your users with your billing method or their payment methods? The credit card endpoint will return you the icon of the credit card provider you need. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Credit Card Code. Possible values: amex, argencard, cabal, censosud, diners, discover, elo, hipercard, jcb, mastercard, naranja, targeta-shopping, union-china-pay, visa, mir, maestro. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Favicon + +```http request +GET https://appwrite.io/v1/avatars/favicon +``` + +** Use this endpoint to fetch the favorite icon (AKA favicon) of any remote website URL. + ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | **Required** Website URL which you want to fetch the favicon from. | | + +## Get Country Flag + +```http request +GET https://appwrite.io/v1/avatars/flags/{code} +``` + +** You can use this endpoint to show different country flags icons to your users. The code argument receives the 2 letter country code. Use width, height and quality arguments to change the output settings. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| code | string | **Required** Country Code. ISO Alpha-2 country code format. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 100 | +| quality | integer | Image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | + +## Get Image from URL + +```http request +GET https://appwrite.io/v1/avatars/image +``` + +** Use this endpoint to fetch a remote image URL and crop it to any image size you want. This endpoint is very useful if you need to crop and display remote images in your app or in case you want to make sure a 3rd party image is properly served using a TLS protocol. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| url | string | **Required** Image URL which you want to crop. | | +| width | integer | Resize preview image width, Pass an integer between 0 to 2000. | 400 | +| height | integer | Resize preview image height, Pass an integer between 0 to 2000. | 400 | + +## Get User Initials + +```http request +GET https://appwrite.io/v1/avatars/initials +``` + +** Use this endpoint to show your user initials avatar icon on your website or app. By default, this route will try to print your logged-in user name or email initials. You can also overwrite the user name if you pass the 'name' parameter. If no name is given and no user is logged, an empty avatar will be returned. + +You can use the color and background params to change the avatar colors. By default, a random theme will be selected. The random theme will persist for the user's initials when reloading the same theme will always return for the same initials. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Full Name. When empty, current user name or email will be used. Max length: 128 chars. | | +| width | integer | Image width. Pass an integer between 0 to 2000. Defaults to 100. | 500 | +| height | integer | Image height. Pass an integer between 0 to 2000. Defaults to 100. | 500 | +| color | string | Changes text color. By default a random color will be picked and stay will persistent to the given name. | | +| background | string | Changes background color. By default a random color will be picked and stay will persistent to the given name. | | + +## Get QR Code + +```http request +GET https://appwrite.io/v1/avatars/qr +``` + +** 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. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| text | string | **Required** Plain text to be converted to QR code image. | | +| size | integer | QR code size. Pass an integer between 0 to 1000. Defaults to 400. | 400 | +| margin | integer | Margin from edge. Pass an integer between 0 to 10. Defaults to 1. | 1 | +| download | boolean | Return resulting image with 'Content-Disposition: attachment ' headers for the browser to start downloading it. Pass 0 for no header, or 1 for otherwise. Default value is set to 0. | | + diff --git a/app/sdks/0.7.0/server-php/docs/database.md b/app/sdks/0.7.0/server-php/docs/database.md new file mode 100644 index 0000000000..6c9110a89a --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/database.md @@ -0,0 +1,169 @@ +# Database Service + +## List Collections + +```http request +GET https://appwrite.io/v1/database/collections +``` + +** Get a list of all the user collections. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project collections. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Collection + +```http request +POST https://appwrite.io/v1/database/collections +``` + +** Create a new Collection. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Collection name. Max length: 128 chars. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation. | | + +## Get Collection + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId} +``` + +** Get collection by its unique ID. This endpoint response returns a JSON object with the collection metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | + +## Update Collection + +```http request +PUT https://appwrite.io/v1/database/collections/{collectionId} +``` + +** Update collection by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | +| name | string | Collection name. Max length: 128 chars. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions(/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| rules | array | Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation. | [] | + +## Delete Collection + +```http request +DELETE https://appwrite.io/v1/database/collections/{collectionId} +``` + +** Delete a collection by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. | | + +## List Documents + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/documents +``` + +** Get a list of all the user documents. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project documents. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| filters | array | Array of filter strings. Each filter is constructed from a key name, comparison operator (=, !=, >, <, <=, >=) and a value. You can also use a dot (.) separator in attribute names to filter by child document attributes. Examples: 'name=John Doe' or 'category.$id>=5bed2d152c362'. | [] | +| limit | integer | Maximum number of documents to return in response. Use this value to manage pagination. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Offset value. The default value is 0. Use this param to manage pagination. | 0 | +| orderField | string | Document field that results will be sorted by. | | +| orderType | string | Order direction. Possible values are DESC for descending order, or ASC for ascending order. | ASC | +| orderCast | string | Order field type casting. Possible values are int, string, date, time or datetime. The database will attempt to cast the order field to the value you pass here. The default value is a string. | string | +| search | string | Search query. Enter any free text search. The database will try to find a match against all document attributes and children. Max length: 256 chars. | | + +## Create Document + +```http request +POST https://appwrite.io/v1/database/collections/{collectionId}/documents +``` + +** Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](/docs/server/database?sdk=nodejs#createCollection) API or directly from your database console. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| data | object | Document data as JSON object. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| parentDocument | string | Parent document unique ID. Use when you want your new document to be a child of a parent document. | | +| parentProperty | string | Parent document property name. Use when you want your new document to be a child of a parent document. | | +| parentPropertyType | string | Parent document property connection type. You can set this value to **assign**, **append** or **prepend**, default value is assign. Use when you want your new document to be a child of a parent document. | assign | + +## Get Document + +```http request +GET https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +** Get document by its unique ID. This endpoint response returns a JSON object with the document data. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | + +## Update Document + +```http request +PATCH https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | +| data | object | Document data as JSON object. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Delete Document + +```http request +DELETE https://appwrite.io/v1/database/collections/{collectionId}/documents/{documentId} +``` + +** Delete document by its unique ID. This endpoint deletes only the parent documents, its attributes and relations to other documents. Child documents **will not** be deleted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| collectionId | string | **Required** Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection). | | +| documentId | string | **Required** Document unique ID. | | + diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..795d79157e --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-browser.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getBrowser('aa'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..33879d0179 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getCreditCard('amex'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..dee19dbf04 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-favicon.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getFavicon('https://example.com'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..d70d7e43ec --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-flag.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getFlag('af'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..a46b9fbe37 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-image.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getImage('https://example.com'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..f5e549ace6 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-initials.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getInitials(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..95b5a6d7b3 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/avatars/get-q-r.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$avatars = new Avatars($client); + +$result = $avatars->getQR('[TEXT]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/create-collection.md b/app/sdks/0.7.0/server-php/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..276d5049fe --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/create-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->createCollection('[NAME]', [], [], []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/create-document.md b/app/sdks/0.7.0/server-php/docs/examples/database/create-document.md new file mode 100644 index 0000000000..6c32cdf950 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/create-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->createDocument('[COLLECTION_ID]', [], [], []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/delete-collection.md b/app/sdks/0.7.0/server-php/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..4018420188 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/delete-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->deleteCollection('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/delete-document.md b/app/sdks/0.7.0/server-php/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..3ed45d6ee1 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/delete-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->deleteDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/get-collection.md b/app/sdks/0.7.0/server-php/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..a088b24bb6 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/get-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->getCollection('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/get-document.md b/app/sdks/0.7.0/server-php/docs/examples/database/get-document.md new file mode 100644 index 0000000000..d506bd8414 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/get-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->getDocument('[COLLECTION_ID]', '[DOCUMENT_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/list-collections.md b/app/sdks/0.7.0/server-php/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..4f4aa1b775 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/list-collections.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->listCollections(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/list-documents.md b/app/sdks/0.7.0/server-php/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..359da4ce33 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/list-documents.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->listDocuments('[COLLECTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/update-collection.md b/app/sdks/0.7.0/server-php/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..70d596066a --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/update-collection.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->updateCollection('[COLLECTION_ID]', '[NAME]', [], []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/database/update-document.md b/app/sdks/0.7.0/server-php/docs/examples/database/update-document.md new file mode 100644 index 0000000000..4389034640 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/database/update-document.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$database = new Database($client); + +$result = $database->updateDocument('[COLLECTION_ID]', '[DOCUMENT_ID]', [], [], []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/create-execution.md b/app/sdks/0.7.0/server-php/docs/examples/functions/create-execution.md new file mode 100644 index 0000000000..422331a0df --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/create-execution.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->createExecution('[FUNCTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/create-tag.md b/app/sdks/0.7.0/server-php/docs/examples/functions/create-tag.md new file mode 100644 index 0000000000..72007a7d4f --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/create-tag.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->createTag('[FUNCTION_ID]', '[COMMAND]', new \CURLFile('/path/to/file.png', 'image/png', 'file.png')); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/create.md b/app/sdks/0.7.0/server-php/docs/examples/functions/create.md new file mode 100644 index 0000000000..2e7b8ea044 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/create.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->create('[NAME]', 'node-14'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/delete-tag.md b/app/sdks/0.7.0/server-php/docs/examples/functions/delete-tag.md new file mode 100644 index 0000000000..0a47accec9 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/delete-tag.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->deleteTag('[FUNCTION_ID]', '[TAG_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/delete.md b/app/sdks/0.7.0/server-php/docs/examples/functions/delete.md new file mode 100644 index 0000000000..319856522e --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/delete.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->delete('[FUNCTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/get-execution.md b/app/sdks/0.7.0/server-php/docs/examples/functions/get-execution.md new file mode 100644 index 0000000000..b02cfa08f7 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/get-execution.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->getExecution('[FUNCTION_ID]', '[EXECUTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/get-tag.md b/app/sdks/0.7.0/server-php/docs/examples/functions/get-tag.md new file mode 100644 index 0000000000..5cee355f7e --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/get-tag.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->getTag('[FUNCTION_ID]', '[TAG_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/get.md b/app/sdks/0.7.0/server-php/docs/examples/functions/get.md new file mode 100644 index 0000000000..06ddece1ca --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->get('[FUNCTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/list-executions.md b/app/sdks/0.7.0/server-php/docs/examples/functions/list-executions.md new file mode 100644 index 0000000000..4417fc8860 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/list-executions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->listExecutions('[FUNCTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/list-tags.md b/app/sdks/0.7.0/server-php/docs/examples/functions/list-tags.md new file mode 100644 index 0000000000..ac652d5647 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/list-tags.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->listTags('[FUNCTION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/list.md b/app/sdks/0.7.0/server-php/docs/examples/functions/list.md new file mode 100644 index 0000000000..3eaa8c567e --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/list.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->list(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/update-tag.md b/app/sdks/0.7.0/server-php/docs/examples/functions/update-tag.md new file mode 100644 index 0000000000..42c74d4f95 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/update-tag.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->updateTag('[FUNCTION_ID]', '[TAG]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/functions/update.md b/app/sdks/0.7.0/server-php/docs/examples/functions/update.md new file mode 100644 index 0000000000..c9ca3f5071 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/functions/update.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$functions = new Functions($client); + +$result = $functions->update('[FUNCTION_ID]', '[NAME]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-anti-virus.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..89a5fb2a7a --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-anti-virus.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getAntiVirus(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-cache.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..e654c26f51 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-cache.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getCache(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-d-b.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..2d37991a3d --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-d-b.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getDB(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-certificates.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..57f2c5793e --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueCertificates(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-functions.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..8ff6510e1c --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-functions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueFunctions(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-logs.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..fa723d7391 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-logs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueLogs(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-tasks.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..b8f1794a1a --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueTasks(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-usage.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..371d02f5b4 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-usage.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueUsage(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..af48a72d06 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getQueueWebhooks(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-storage-local.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..eba15a1652 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-storage-local.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getStorageLocal(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get-time.md b/app/sdks/0.7.0/server-php/docs/examples/health/get-time.md new file mode 100644 index 0000000000..849f499460 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get-time.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->getTime(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/health/get.md b/app/sdks/0.7.0/server-php/docs/examples/health/get.md new file mode 100644 index 0000000000..9f1ec8970c --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/health/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$health = new Health($client); + +$result = $health->get(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..bb099d31f5 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get-continents.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getContinents(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..87287a5cea --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCountriesEU(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..71a39303da --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCountriesPhones(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..1c8f863a76 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get-countries.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCountries(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..b799bf6b80 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get-currencies.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getCurrencies(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..47fdc6eb34 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get-languages.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->getLanguages(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/locale/get.md b/app/sdks/0.7.0/server-php/docs/examples/locale/get.md new file mode 100644 index 0000000000..8e11f17689 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/locale/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$locale = new Locale($client); + +$result = $locale->get(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/create-file.md b/app/sdks/0.7.0/server-php/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..ba533dd2e7 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/create-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->createFile(new \CURLFile('/path/to/file.png', 'image/png', 'file.png'), [], []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/server-php/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..23d4013d22 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/delete-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->deleteFile('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..3064481141 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-download.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFileDownload('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..00cb63696b --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-preview.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFilePreview('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..07b7ab32ba --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file-view.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFileView('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/get-file.md b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..c8b6495f18 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/get-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->getFile('[FILE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/list-files.md b/app/sdks/0.7.0/server-php/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..787c38e320 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/list-files.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->listFiles(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/storage/update-file.md b/app/sdks/0.7.0/server-php/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..7515217b97 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/storage/update-file.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$storage = new Storage($client); + +$result = $storage->updateFile('[FILE_ID]', [], []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/server-php/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..9c88b1bba5 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/create-membership.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->createMembership('[TEAM_ID]', 'email@example.com', [], 'https://example.com'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/create.md b/app/sdks/0.7.0/server-php/docs/examples/teams/create.md new file mode 100644 index 0000000000..7b0946bc83 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/create.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->create('[NAME]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/server-php/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..ca9d3d57c0 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/delete-membership.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->deleteMembership('[TEAM_ID]', '[INVITE_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/delete.md b/app/sdks/0.7.0/server-php/docs/examples/teams/delete.md new file mode 100644 index 0000000000..394a1940fc --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/delete.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->delete('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/server-php/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..56f6d59063 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/get-memberships.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->getMemberships('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/get.md b/app/sdks/0.7.0/server-php/docs/examples/teams/get.md new file mode 100644 index 0000000000..6f0b705707 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->get('[TEAM_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/list.md b/app/sdks/0.7.0/server-php/docs/examples/teams/list.md new file mode 100644 index 0000000000..d17bb7689b --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/list.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->list(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/teams/update.md b/app/sdks/0.7.0/server-php/docs/examples/teams/update.md new file mode 100644 index 0000000000..945001dc36 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/teams/update.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$teams = new Teams($client); + +$result = $teams->update('[TEAM_ID]', '[NAME]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/create.md b/app/sdks/0.7.0/server-php/docs/examples/users/create.md new file mode 100644 index 0000000000..53497b4277 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/create.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->create('email@example.com', 'password'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/delete-session.md b/app/sdks/0.7.0/server-php/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..ead6de7549 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/delete-session.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->deleteSession('[USER_ID]', '[SESSION_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/delete-sessions.md b/app/sdks/0.7.0/server-php/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..968d788ea7 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/delete-sessions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->deleteSessions('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/delete-user.md b/app/sdks/0.7.0/server-php/docs/examples/users/delete-user.md new file mode 100644 index 0000000000..1e9f0cb227 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/delete-user.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->deleteUser('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/get-logs.md b/app/sdks/0.7.0/server-php/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..5602536920 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/get-logs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->getLogs('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/get-prefs.md b/app/sdks/0.7.0/server-php/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..1c9978a0fb --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/get-prefs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->getPrefs('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/get-sessions.md b/app/sdks/0.7.0/server-php/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..fef9f1db74 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/get-sessions.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->getSessions('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/get.md b/app/sdks/0.7.0/server-php/docs/examples/users/get.md new file mode 100644 index 0000000000..16c29f9a5a --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/get.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->get('[USER_ID]'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/list.md b/app/sdks/0.7.0/server-php/docs/examples/users/list.md new file mode 100644 index 0000000000..efce771ea1 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/list.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->list(); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/update-prefs.md b/app/sdks/0.7.0/server-php/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..9e9141f8a7 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/update-prefs.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->updatePrefs('[USER_ID]', []); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/examples/users/update-status.md b/app/sdks/0.7.0/server-php/docs/examples/users/update-status.md new file mode 100644 index 0000000000..87f9bceb46 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/examples/users/update-status.md @@ -0,0 +1,16 @@ +setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +$users = new Users($client); + +$result = $users->updateStatus('[USER_ID]', '1'); \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/docs/functions.md b/app/sdks/0.7.0/server-php/docs/functions.md new file mode 100644 index 0000000000..4ee1455e0b --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/functions.md @@ -0,0 +1,185 @@ +# Functions Service + +## List Functions + +```http request +GET https://appwrite.io/v1/functions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Function + +```http request +POST https://appwrite.io/v1/functions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Function name. Max length: 128 chars. | | +| env | string | Execution enviornment. | | +| vars | object | Key-value JSON object. | [] | +| events | array | Events list. | [] | +| schedule | string | Schedule CRON syntax. | | +| timeout | integer | Function maximum execution time in seconds. | 15 | + +## Get Function + +```http request +GET https://appwrite.io/v1/functions/{functionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | + +## Update Function + +```http request +PUT https://appwrite.io/v1/functions/{functionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| name | string | Function name. Max length: 128 chars. | | +| vars | object | Key-value JSON object. | [] | +| events | array | Events list. | [] | +| schedule | string | Schedule CRON syntax. | | +| timeout | integer | Function maximum execution time in seconds. | 15 | + +## Delete Function + +```http request +DELETE https://appwrite.io/v1/functions/{functionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | + +## List Executions + +```http request +GET https://appwrite.io/v1/functions/{functionId}/executions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Execution + +```http request +POST https://appwrite.io/v1/functions/{functionId}/executions +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | + +## Get Execution + +```http request +GET https://appwrite.io/v1/functions/{functionId}/executions/{executionId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| executionId | string | **Required** Execution unique ID. | | + +## Update Function Tag + +```http request +PATCH https://appwrite.io/v1/functions/{functionId}/tag +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| tag | string | Tag unique ID. | | + +## List Tags + +```http request +GET https://appwrite.io/v1/functions/{functionId}/tags +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Tag + +```http request +POST https://appwrite.io/v1/functions/{functionId}/tags +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| command | string | Code execution command. | | +| code | file | Gzip file containing your code. | | + +## Get Tag + +```http request +GET https://appwrite.io/v1/functions/{functionId}/tags/{tagId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| tagId | string | **Required** Tag unique ID. | | + +## Delete Tag + +```http request +DELETE https://appwrite.io/v1/functions/{functionId}/tags/{tagId} +``` + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| functionId | string | **Required** Function unique ID. | | +| tagId | string | **Required** Tag unique ID. | | + diff --git a/app/sdks/0.7.0/server-php/docs/health.md b/app/sdks/0.7.0/server-php/docs/health.md new file mode 100644 index 0000000000..38b814b633 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/health.md @@ -0,0 +1,96 @@ +# Health Service + +## Get HTTP + +```http request +GET https://appwrite.io/v1/health +``` + +** Check the Appwrite HTTP server is up and responsive. ** + +## Get Anti virus + +```http request +GET https://appwrite.io/v1/health/anti-virus +``` + +** Check the Appwrite Anti Virus server is up and connection is successful. ** + +## Get Cache + +```http request +GET https://appwrite.io/v1/health/cache +``` + +** Check the Appwrite in-memory cache server is up and connection is successful. ** + +## Get DB + +```http request +GET https://appwrite.io/v1/health/db +``` + +** Check the Appwrite database server is up and connection is successful. ** + +## Get Certificate Queue + +```http request +GET https://appwrite.io/v1/health/queue/certificates +``` + +** Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server. ** + +## Get Functions Queue + +```http request +GET https://appwrite.io/v1/health/queue/functions +``` + +## Get Logs Queue + +```http request +GET https://appwrite.io/v1/health/queue/logs +``` + +** Get the number of logs that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Tasks Queue + +```http request +GET https://appwrite.io/v1/health/queue/tasks +``` + +** Get the number of tasks that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Usage Queue + +```http request +GET https://appwrite.io/v1/health/queue/usage +``` + +** Get the number of usage stats that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Webhooks Queue + +```http request +GET https://appwrite.io/v1/health/queue/webhooks +``` + +** Get the number of webhooks that are waiting to be processed in the Appwrite internal queue server. ** + +## Get Local Storage + +```http request +GET https://appwrite.io/v1/health/storage/local +``` + +** Check the Appwrite local storage device is up and connection is successful. ** + +## Get Time + +```http request +GET https://appwrite.io/v1/health/time +``` + +** Check the Appwrite server time is synced with Google remote NTP server. We use this technology to smoothly handle leap seconds with no disruptive events. The [Network Time Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is used by hundreds of millions of computers and devices to synchronize their clocks over the Internet. If your computer sets its own clock, it likely uses NTP. ** + diff --git a/app/sdks/0.7.0/server-php/docs/locale.md b/app/sdks/0.7.0/server-php/docs/locale.md new file mode 100644 index 0000000000..1591f4a1a8 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/locale.md @@ -0,0 +1,60 @@ +# Locale Service + +## Get User Locale + +```http request +GET https://appwrite.io/v1/locale +``` + +** Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language. + +([IP Geolocation by DB-IP](https://db-ip.com)) ** + +## List Continents + +```http request +GET https://appwrite.io/v1/locale/continents +``` + +** List of all continents. You can use the locale header to get the data in a supported language. ** + +## List Countries + +```http request +GET https://appwrite.io/v1/locale/countries +``` + +** List of all countries. You can use the locale header to get the data in a supported language. ** + +## List EU Countries + +```http request +GET https://appwrite.io/v1/locale/countries/eu +``` + +** List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language. ** + +## List Countries Phone Codes + +```http request +GET https://appwrite.io/v1/locale/countries/phones +``` + +** List of all countries phone codes. You can use the locale header to get the data in a supported language. ** + +## List Currencies + +```http request +GET https://appwrite.io/v1/locale/currencies +``` + +** List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language. ** + +## List Languages + +```http request +GET https://appwrite.io/v1/locale/languages +``` + +** List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language. ** + diff --git a/app/sdks/0.7.0/server-php/docs/storage.md b/app/sdks/0.7.0/server-php/docs/storage.md new file mode 100644 index 0000000000..d23f986a0c --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/storage.md @@ -0,0 +1,127 @@ +# Storage Service + +## List Files + +```http request +GET https://appwrite.io/v1/storage/files +``` + +** Get a list of all the user files. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project files. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create File + +```http request +POST https://appwrite.io/v1/storage/files +``` + +** Create a new file. The user who creates the file will automatically be assigned to read and write access unless he has passed custom values for read and write arguments. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| file | file | Binary file. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Get File + +```http request +GET https://appwrite.io/v1/storage/files/{fileId} +``` + +** Get file by its unique ID. This endpoint response returns a JSON object with the file metadata. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Update File + +```http request +PUT https://appwrite.io/v1/storage/files/{fileId} +``` + +** Update file by its unique ID. Only users with write permissions have access to update this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | +| read | array | An array of strings with read permissions. By default no user is granted with any read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | +| write | array | An array of strings with write permissions. By default no user is granted with any write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions. | | + +## Delete File + +```http request +DELETE https://appwrite.io/v1/storage/files/{fileId} +``` + +** Delete a file by its unique ID. Only users with write permissions have access to delete this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Get File for Download + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/download +``` + +** Get file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | + +## Get File Preview + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/preview +``` + +** Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID | | +| width | integer | Resize preview image width, Pass an integer between 0 to 4000. | 0 | +| height | integer | Resize preview image height, Pass an integer between 0 to 4000. | 0 | +| quality | integer | Preview image quality. Pass an integer between 0 to 100. Defaults to 100. | 100 | +| background | string | Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix. | | +| output | string | Output format type (jpeg, jpg, png, gif and webp). | | + +## Get File for View + +```http request +GET https://appwrite.io/v1/storage/files/{fileId}/view +``` + +** Get file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| fileId | string | **Required** File unique ID. | | +| as | string | Choose a file format to convert your file to. Currently you can only convert word and pdf files to pdf or txt. This option is currently experimental only, use at your own risk. | | + diff --git a/app/sdks/0.7.0/server-php/docs/teams.md b/app/sdks/0.7.0/server-php/docs/teams.md new file mode 100644 index 0000000000..6ee37b7949 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/teams.md @@ -0,0 +1,132 @@ +# Teams Service + +## List Teams + +```http request +GET https://appwrite.io/v1/teams +``` + +** Get a list of all the current user teams. You can use the query params to filter your results. On admin mode, this endpoint will return a list of all of the project teams. [Learn more about different API modes](/docs/admin). ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Team + +```http request +POST https://appwrite.io/v1/teams +``` + +** Create a new team. The user who creates the team will automatically be assigned as the owner of the team. The team owner can invite new members, who will be able add new owners and update or delete the team from your project. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| name | string | Team name. Max length: 128 chars. | | +| roles | array | Array of strings. Use this param to set the roles in the team for the user who created it. The default role is **owner**. A role can be any string. Learn more about [roles and permissions](/docs/permissions). Max length for each role is 32 chars. | ["owner"] | + +## Get Team + +```http request +GET https://appwrite.io/v1/teams/{teamId} +``` + +** Get team by its unique ID. All team members have read access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | + +## Update Team + +```http request +PUT https://appwrite.io/v1/teams/{teamId} +``` + +** Update team by its unique ID. Only team owners have write access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| name | string | Team name. Max length: 128 chars. | | + +## Delete Team + +```http request +DELETE https://appwrite.io/v1/teams/{teamId} +``` + +** Delete team by its unique ID. Only team owners have write access for this resource. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | + +## Get Team Memberships + +```http request +GET https://appwrite.io/v1/teams/{teamId}/memberships +``` + +** Get team members by the team unique ID. All team members have read access for this list of resources. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create Team Membership + +```http request +POST https://appwrite.io/v1/teams/{teamId}/memberships +``` + +** Use this endpoint to invite a new member to join your team. An email with a link to join the team will be sent to the new member email address if the member doesn't exist in the project it will be created automatically. + +Use the 'URL' parameter to redirect the user from the invitation email back to your app. When the user is redirected, use the [Update Team Membership Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the user to accept the invitation to the team. + +Please note that in order to avoid a [Redirect Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URL's are the once from domains you have set when added your platforms in the console interface. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| email | string | New team member email. | | +| name | string | New team member name. Max length: 128 chars. | | +| roles | array | 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). Max length for each role is 32 chars. | | +| url | string | 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. | | + +## Delete Team Membership + +```http request +DELETE https://appwrite.io/v1/teams/{teamId}/memberships/{inviteId} +``` + +** This endpoint allows a user to leave a team or for a team owner to delete the membership of any other team member. You can also use this endpoint to delete a user membership even if it is not accepted. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| teamId | string | **Required** Team unique ID. | | +| inviteId | string | **Required** Invite unique ID. | | + diff --git a/app/sdks/0.7.0/server-php/docs/users.md b/app/sdks/0.7.0/server-php/docs/users.md new file mode 100644 index 0000000000..f01db86da9 --- /dev/null +++ b/app/sdks/0.7.0/server-php/docs/users.md @@ -0,0 +1,164 @@ +# Users Service + +## List Users + +```http request +GET https://appwrite.io/v1/users +``` + +** Get a list of all the project users. You can use the query params to filter your results. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| search | string | Search term to filter your list results. Max length: 256 chars. | | +| limit | integer | Results limit value. By default will return maximum 25 results. Maximum of 100 results allowed per request. | 25 | +| offset | integer | Results offset. The default value is 0. Use this param to manage pagination. | 0 | +| orderType | string | Order result by ASC or DESC order. | ASC | + +## Create User + +```http request +POST https://appwrite.io/v1/users +``` + +** Create a new user. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| email | string | User email. | | +| password | string | User password. Must be between 6 to 32 chars. | | +| name | string | User name. Max length: 128 chars. | | + +## Get User + +```http request +GET https://appwrite.io/v1/users/{userId} +``` + +** Get user by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Delete User + +```http request +DELETE https://appwrite.io/v1/users/{userId} +``` + +** Delete a user by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Get User Logs + +```http request +GET https://appwrite.io/v1/users/{userId}/logs +``` + +** Get user activity logs list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Get User Preferences + +```http request +GET https://appwrite.io/v1/users/{userId}/prefs +``` + +** Get user preferences by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Update User Preferences + +```http request +PATCH https://appwrite.io/v1/users/{userId}/prefs +``` + +** Update user preferences by its unique ID. You can pass only the specific settings you wish to update. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | +| prefs | object | Prefs key-value JSON object. | | + +## Get User Sessions + +```http request +GET https://appwrite.io/v1/users/{userId}/sessions +``` + +** Get user sessions list by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Delete User Sessions + +```http request +DELETE https://appwrite.io/v1/users/{userId}/sessions +``` + +** Delete all user sessions by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | + +## Delete User Session + +```http request +DELETE https://appwrite.io/v1/users/{userId}/sessions/{sessionId} +``` + +** Delete user sessions by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | +| sessionId | string | **Required** User unique session ID. | | + +## Update User Status + +```http request +PATCH https://appwrite.io/v1/users/{userId}/status +``` + +** Update user status by its unique ID. ** + +### Parameters + +| Field Name | Type | Description | Default | +| --- | --- | --- | --- | +| userId | string | **Required** User unique ID. | | +| status | string | User Status code. To activate the user pass 1, to block the user pass 2 and for disabling the user pass 0 | | + diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Client.php b/app/sdks/0.7.0/server-php/src/Appwrite/Client.php new file mode 100644 index 0000000000..b87c929b9b --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Client.php @@ -0,0 +1,240 @@ + '', + 'x-sdk-version' => 'appwrite:php:1.1.0', + ]; + + /** + * SDK constructor. + */ + public function __construct() + { + } + + /** + * Set Project + * + * Your project ID + * + * @param string $value + * + * @return Client + */ + public function setProject($value) + { + $this->addHeader('X-Appwrite-Project', $value); + + return $this; + } + + /** + * Set Key + * + * Your secret API key + * + * @param string $value + * + * @return Client + */ + public function setKey($value) + { + $this->addHeader('X-Appwrite-Key', $value); + + return $this; + } + + /** + * Set Locale + * + * @param string $value + * + * @return Client + */ + public function setLocale($value) + { + $this->addHeader('X-Appwrite-Locale', $value); + + return $this; + } + + + /*** + * @param bool $status + * @return $this + */ + public function setSelfSigned($status = true) + { + $this->selfSigned = $status; + + return $this; + } + + /*** + * @param $endpoint + * @return $this + */ + public function setEndpoint($endpoint) + { + $this->endpoint = $endpoint; + + return $this; + } + + /** + * @param $key + * @param $value + */ + public function addHeader($key, $value) + { + $this->headers[strtolower($key)] = strtolower($value); + + return $this; + } + + /** + * Call + * + * Make an API call + * + * @param string $method + * @param string $path + * @param array $params + * @param array $headers + * @return array|string + * @throws Exception + */ + public function call($method, $path = '', $headers = array(), array $params = array()) + { + $headers = array_merge($this->headers, $headers); + $ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); + $responseHeaders = []; + $responseStatus = -1; + $responseType = ''; + $responseBody = ''; + + switch ($headers['content-type']) { + case 'application/json': + $query = json_encode($params); + break; + + case 'multipart/form-data': + $query = $this->flatten($params); + break; + + default: + $query = http_build_query($params); + break; + } + + foreach ($headers as $i => $header) { + $headers[] = $i . ':' . $header; + unset($headers[$i]); + } + + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_USERAGENT, php_uname('s') . '-' . php_uname('r') . ':php-' . phpversion()); + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { + $len = strlen($header); + $header = explode(':', strtolower($header), 2); + + if (count($header) < 2) { // ignore invalid headers + return $len; + } + + $responseHeaders[strtolower(trim($header[0]))] = trim($header[1]); + + return $len; + }); + + if($method != self::METHOD_GET) { + curl_setopt($ch, CURLOPT_POSTFIELDS, $query); + } + + // Allow self signed certificates + if($this->selfSigned) { + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + } + + $responseBody = curl_exec($ch); + $responseType = $responseHeaders['content-type'] ?? ''; + $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); + + switch(substr($responseType, 0, strpos($responseType, ';'))) { + case 'application/json': + $responseBody = json_decode($responseBody, true); + break; + } + + if ((curl_errno($ch)/* || 200 != $responseStatus*/)) { + throw new Exception(curl_error($ch) . ' with status code ' . $responseStatus, $responseStatus); + } + + curl_close($ch); + + return $responseBody; + } + + /** + * Flatten params array to PHP multiple format + * + * @param array $data + * @param string $prefix + * @return array + */ + protected function flatten(array $data, $prefix = '') { + $output = []; + + foreach($data as $key => $value) { + $finalKey = $prefix ? "{$prefix}[{$key}]" : $key; + + if (is_array($value)) { + $output += $this->flatten($value, $finalKey); // @todo: handle name collision here if needed + } + else { + $output[$finalKey] = $value; + } + } + + return $output; + } +} diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Service.php b/app/sdks/0.7.0/server-php/src/Appwrite/Service.php new file mode 100644 index 0000000000..ea3ad92e2d --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Service.php @@ -0,0 +1,19 @@ +client = $client; + } +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Avatars.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Avatars.php new file mode 100644 index 0000000000..2c9a0d4877 --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Avatars.php @@ -0,0 +1,214 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Credit Card Icon + * + * Need to display your users with your billing method or their payment + * methods? The credit card endpoint will return you the icon of the credit + * card provider you need. Use width, height and quality arguments to change + * the output settings. + * + * @param string $code + * @param int $width + * @param int $height + * @param int $quality + * @throws Exception + * @return array + */ + public function getCreditCard(string $code, int $width = 100, int $height = 100, int $quality = 100):array + { + $path = str_replace(['{code}'], [$code], '/avatars/credit-cards/{code}'); + $params = []; + + $params['width'] = $width; + $params['height'] = $height; + $params['quality'] = $quality; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Favicon + * + * Use this endpoint to fetch the favorite icon (AKA favicon) of any remote + * website URL. + * + * + * @param string $url + * @throws Exception + * @return array + */ + public function getFavicon(string $url):array + { + $path = str_replace([], [], '/avatars/favicon'); + $params = []; + + $params['url'] = $url; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Country Flag + * + * You can use this endpoint to show different country flags icons to your + * users. The code argument receives the 2 letter country code. Use width, + * height and quality arguments to change the output settings. + * + * @param string $code + * @param int $width + * @param int $height + * @param int $quality + * @throws Exception + * @return array + */ + public function getFlag(string $code, int $width = 100, int $height = 100, int $quality = 100):array + { + $path = str_replace(['{code}'], [$code], '/avatars/flags/{code}'); + $params = []; + + $params['width'] = $width; + $params['height'] = $height; + $params['quality'] = $quality; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Image from URL + * + * Use this endpoint to fetch a remote image URL and crop it to any image size + * you want. This endpoint is very useful if you need to crop and display + * remote images in your app or in case you want to make sure a 3rd party + * image is properly served using a TLS protocol. + * + * @param string $url + * @param int $width + * @param int $height + * @throws Exception + * @return array + */ + public function getImage(string $url, int $width = 400, int $height = 400):array + { + $path = str_replace([], [], '/avatars/image'); + $params = []; + + $params['url'] = $url; + $params['width'] = $width; + $params['height'] = $height; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Initials + * + * Use this endpoint to show your user initials avatar icon on your website or + * app. By default, this route will try to print your logged-in user name or + * email initials. You can also overwrite the user name if you pass the 'name' + * parameter. If no name is given and no user is logged, an empty avatar will + * be returned. + * + * You can use the color and background params to change the avatar colors. By + * default, a random theme will be selected. The random theme will persist for + * the user's initials when reloading the same theme will always return for + * the same initials. + * + * @param string $name + * @param int $width + * @param int $height + * @param string $color + * @param string $background + * @throws Exception + * @return array + */ + public function getInitials(string $name = '', int $width = 500, int $height = 500, string $color = '', string $background = ''):array + { + $path = str_replace([], [], '/avatars/initials'); + $params = []; + + $params['name'] = $name; + $params['width'] = $width; + $params['height'] = $height; + $params['color'] = $color; + $params['background'] = $background; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get QR Code + * + * 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. + * + * @param string $text + * @param int $size + * @param int $margin + * @param boolean $download + * @throws Exception + * @return array + */ + public function getQR(string $text, int $size = 400, int $margin = 1, boolean $download = false):array + { + $path = str_replace([], [], '/avatars/qr'); + $params = []; + + $params['text'] = $text; + $params['size'] = $size; + $params['margin'] = $margin; + $params['download'] = $download; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Database.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Database.php new file mode 100644 index 0000000000..c57e29374a --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Database.php @@ -0,0 +1,280 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Collection + * + * Create a new Collection. + * + * @param string $name + * @param array $read + * @param array $write + * @param array $rules + * @throws Exception + * @return array + */ + public function createCollection(string $name, array $read, array $write, array $rules):array + { + $path = str_replace([], [], '/database/collections'); + $params = []; + + $params['name'] = $name; + $params['read'] = $read; + $params['write'] = $write; + $params['rules'] = $rules; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Collection + * + * Get collection by its unique ID. This endpoint response returns a JSON + * object with the collection metadata. + * + * @param string $collectionId + * @throws Exception + * @return array + */ + public function getCollection(string $collectionId):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Collection + * + * Update collection by its unique ID. + * + * @param string $collectionId + * @param string $name + * @param array $read + * @param array $write + * @param array $rules + * @throws Exception + * @return array + */ + public function updateCollection(string $collectionId, string $name, array $read, array $write, array $rules = []):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); + $params = []; + + $params['name'] = $name; + $params['read'] = $read; + $params['write'] = $write; + $params['rules'] = $rules; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Collection + * + * Delete a collection by its unique ID. Only users with write permissions + * have access to delete this resource. + * + * @param string $collectionId + * @throws Exception + * @return array + */ + public function deleteCollection(string $collectionId):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Documents + * + * Get a list of all the user documents. You can use the query params to + * filter your results. On admin mode, this endpoint will return a list of all + * of the project documents. [Learn more about different API + * modes](/docs/admin). + * + * @param string $collectionId + * @param array $filters + * @param int $limit + * @param int $offset + * @param string $orderField + * @param string $orderType + * @param string $orderCast + * @param string $search + * @throws Exception + * @return array + */ + public function listDocuments(string $collectionId, array $filters = [], int $limit = 25, int $offset = 0, string $orderField = '', string $orderType = 'ASC', string $orderCast = 'string', string $search = ''):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents'); + $params = []; + + $params['filters'] = $filters; + $params['limit'] = $limit; + $params['offset'] = $offset; + $params['orderField'] = $orderField; + $params['orderType'] = $orderType; + $params['orderCast'] = $orderCast; + $params['search'] = $search; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Document + * + * Create a new Document. Before using this route, you should create a new + * collection resource using either a [server + * integration](/docs/server/database?sdk=nodejs#createCollection) API or + * directly from your database console. + * + * @param string $collectionId + * @param array $data + * @param array $read + * @param array $write + * @param string $parentDocument + * @param string $parentProperty + * @param string $parentPropertyType + * @throws Exception + * @return array + */ + public function createDocument(string $collectionId, array $data, array $read, array $write, string $parentDocument = '', string $parentProperty = '', string $parentPropertyType = 'assign'):array + { + $path = str_replace(['{collectionId}'], [$collectionId], '/database/collections/{collectionId}/documents'); + $params = []; + + $params['data'] = $data; + $params['read'] = $read; + $params['write'] = $write; + $params['parentDocument'] = $parentDocument; + $params['parentProperty'] = $parentProperty; + $params['parentPropertyType'] = $parentPropertyType; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Document + * + * Get document by its unique ID. This endpoint response returns a JSON object + * with the document data. + * + * @param string $collectionId + * @param string $documentId + * @throws Exception + * @return array + */ + public function getDocument(string $collectionId, string $documentId):array + { + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Document + * + * @param string $collectionId + * @param string $documentId + * @param array $data + * @param array $read + * @param array $write + * @throws Exception + * @return array + */ + public function updateDocument(string $collectionId, string $documentId, array $data, array $read, array $write):array + { + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); + $params = []; + + $params['data'] = $data; + $params['read'] = $read; + $params['write'] = $write; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Document + * + * Delete document by its unique ID. This endpoint deletes only the parent + * documents, its attributes and relations to other documents. Child documents + * **will not** be deleted. + * + * @param string $collectionId + * @param string $documentId + * @throws Exception + * @return array + */ + public function deleteDocument(string $collectionId, string $documentId):array + { + $path = str_replace(['{collectionId}', '{documentId}'], [$collectionId, $documentId], '/database/collections/{collectionId}/documents/{documentId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Functions.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Functions.php new file mode 100644 index 0000000000..12c887a911 --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Functions.php @@ -0,0 +1,298 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Function + * + * @param string $name + * @param string $env + * @param array $vars + * @param array $events + * @param string $schedule + * @param int $timeout + * @throws Exception + * @return array + */ + public function create(string $name, string $env, array $vars = , array $events = [], string $schedule = '', int $timeout = 15):array + { + $path = str_replace([], [], '/functions'); + $params = []; + + $params['name'] = $name; + $params['env'] = $env; + $params['vars'] = $vars; + $params['events'] = $events; + $params['schedule'] = $schedule; + $params['timeout'] = $timeout; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Function + * + * @param string $functionId + * @throws Exception + * @return array + */ + public function get(string $functionId):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Function + * + * @param string $functionId + * @param string $name + * @param array $vars + * @param array $events + * @param string $schedule + * @param int $timeout + * @throws Exception + * @return array + */ + public function update(string $functionId, string $name, array $vars = , array $events = [], string $schedule = '', int $timeout = 15):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); + $params = []; + + $params['name'] = $name; + $params['vars'] = $vars; + $params['events'] = $events; + $params['schedule'] = $schedule; + $params['timeout'] = $timeout; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Function + * + * @param string $functionId + * @throws Exception + * @return array + */ + public function delete(string $functionId):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Executions + * + * @param string $functionId + * @param string $search + * @param int $limit + * @param int $offset + * @param string $orderType + * @throws Exception + * @return array + */ + public function listExecutions(string $functionId, string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/executions'); + $params = []; + + $params['search'] = $search; + $params['limit'] = $limit; + $params['offset'] = $offset; + $params['orderType'] = $orderType; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Execution + * + * @param string $functionId + * @throws Exception + * @return array + */ + public function createExecution(string $functionId):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/executions'); + $params = []; + + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Execution + * + * @param string $functionId + * @param string $executionId + * @throws Exception + * @return array + */ + public function getExecution(string $functionId, string $executionId):array + { + $path = str_replace(['{functionId}', '{executionId}'], [$functionId, $executionId], '/functions/{functionId}/executions/{executionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Function Tag + * + * @param string $functionId + * @param string $tag + * @throws Exception + * @return array + */ + public function updateTag(string $functionId, string $tag):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/tag'); + $params = []; + + $params['tag'] = $tag; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Tags + * + * @param string $functionId + * @param string $search + * @param int $limit + * @param int $offset + * @param string $orderType + * @throws Exception + * @return array + */ + public function listTags(string $functionId, string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/tags'); + $params = []; + + $params['search'] = $search; + $params['limit'] = $limit; + $params['offset'] = $offset; + $params['orderType'] = $orderType; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Tag + * + * @param string $functionId + * @param string $command + * @param \CurlFile $code + * @throws Exception + * @return array + */ + public function createTag(string $functionId, string $command, \CurlFile $code):array + { + $path = str_replace(['{functionId}'], [$functionId], '/functions/{functionId}/tags'); + $params = []; + + $params['command'] = $command; + $params['code'] = $code; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'multipart/form-data', + ], $params); + } + + /** + * Get Tag + * + * @param string $functionId + * @param string $tagId + * @throws Exception + * @return array + */ + public function getTag(string $functionId, string $tagId):array + { + $path = str_replace(['{functionId}', '{tagId}'], [$functionId, $tagId], '/functions/{functionId}/tags/{tagId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Tag + * + * @param string $functionId + * @param string $tagId + * @throws Exception + * @return array + */ + public function deleteTag(string $functionId, string $tagId):array + { + $path = str_replace(['{functionId}', '{tagId}'], [$functionId, $tagId], '/functions/{functionId}/tags/{tagId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Health.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Health.php new file mode 100644 index 0000000000..d39f1f406d --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Health.php @@ -0,0 +1,250 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Anti virus + * + * Check the Appwrite Anti Virus server is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getAntiVirus():array + { + $path = str_replace([], [], '/health/anti-virus'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Cache + * + * Check the Appwrite in-memory cache server is up and connection is + * successful. + * + * @throws Exception + * @return array + */ + public function getCache():array + { + $path = str_replace([], [], '/health/cache'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get DB + * + * Check the Appwrite database server is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getDB():array + { + $path = str_replace([], [], '/health/db'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Certificate Queue + * + * Get the number of certificates that are waiting to be issued against + * [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue + * server. + * + * @throws Exception + * @return array + */ + public function getQueueCertificates():array + { + $path = str_replace([], [], '/health/queue/certificates'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Functions Queue + * + * @throws Exception + * @return array + */ + public function getQueueFunctions():array + { + $path = str_replace([], [], '/health/queue/functions'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Logs Queue + * + * Get the number of logs that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueLogs():array + { + $path = str_replace([], [], '/health/queue/logs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Tasks Queue + * + * Get the number of tasks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueTasks():array + { + $path = str_replace([], [], '/health/queue/tasks'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Usage Queue + * + * Get the number of usage stats that are waiting to be processed in the + * Appwrite internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueUsage():array + { + $path = str_replace([], [], '/health/queue/usage'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Webhooks Queue + * + * Get the number of webhooks that are waiting to be processed in the Appwrite + * internal queue server. + * + * @throws Exception + * @return array + */ + public function getQueueWebhooks():array + { + $path = str_replace([], [], '/health/queue/webhooks'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Local Storage + * + * Check the Appwrite local storage device is up and connection is successful. + * + * @throws Exception + * @return array + */ + public function getStorageLocal():array + { + $path = str_replace([], [], '/health/storage/local'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Time + * + * Check the Appwrite server time is synced with Google remote NTP server. We + * use this technology to smoothly handle leap seconds with no disruptive + * events. The [Network Time + * Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) (NTP) is + * used by hundreds of millions of computers and devices to synchronize their + * clocks over the Internet. If your computer sets its own clock, it likely + * uses NTP. + * + * @throws Exception + * @return array + */ + public function getTime():array + { + $path = str_replace([], [], '/health/time'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Locale.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Locale.php new file mode 100644 index 0000000000..93318d57cb --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Locale.php @@ -0,0 +1,156 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Continents + * + * List of all continents. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + public function getContinents():array + { + $path = str_replace([], [], '/locale/continents'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Countries + * + * List of all countries. You can use the locale header to get the data in a + * supported language. + * + * @throws Exception + * @return array + */ + public function getCountries():array + { + $path = str_replace([], [], '/locale/countries'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List EU Countries + * + * List of all countries that are currently members of the EU. You can use the + * locale header to get the data in a supported language. + * + * @throws Exception + * @return array + */ + public function getCountriesEU():array + { + $path = str_replace([], [], '/locale/countries/eu'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Countries Phone Codes + * + * List of all countries phone codes. You can use the locale header to get the + * data in a supported language. + * + * @throws Exception + * @return array + */ + public function getCountriesPhones():array + { + $path = str_replace([], [], '/locale/countries/phones'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Currencies + * + * List of all currencies, including currency symbol, name, plural, and + * decimal digits for all major and minor currencies. You can use the locale + * header to get the data in a supported language. + * + * @throws Exception + * @return array + */ + public function getCurrencies():array + { + $path = str_replace([], [], '/locale/currencies'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * List Languages + * + * List of all languages classified by ISO 639-1 including 2-letter code, name + * in English, and name in the respective language. + * + * @throws Exception + * @return array + */ + public function getLanguages():array + { + $path = str_replace([], [], '/locale/languages'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Storage.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Storage.php new file mode 100644 index 0000000000..09b74fbf8f --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Storage.php @@ -0,0 +1,212 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create File + * + * Create a new file. The user who creates the file will automatically be + * assigned to read and write access unless he has passed custom values for + * read and write arguments. + * + * @param \CurlFile $file + * @param array $read + * @param array $write + * @throws Exception + * @return array + */ + public function createFile(\CurlFile $file, array $read, array $write):array + { + $path = str_replace([], [], '/storage/files'); + $params = []; + + $params['file'] = $file; + $params['read'] = $read; + $params['write'] = $write; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'multipart/form-data', + ], $params); + } + + /** + * Get File + * + * Get file by its unique ID. This endpoint response returns a JSON object + * with the file metadata. + * + * @param string $fileId + * @throws Exception + * @return array + */ + public function getFile(string $fileId):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update File + * + * Update file by its unique ID. Only users with write permissions have access + * to update this resource. + * + * @param string $fileId + * @param array $read + * @param array $write + * @throws Exception + * @return array + */ + public function updateFile(string $fileId, array $read, array $write):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); + $params = []; + + $params['read'] = $read; + $params['write'] = $write; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete File + * + * Delete a file by its unique ID. Only users with write permissions have + * access to delete this resource. + * + * @param string $fileId + * @throws Exception + * @return array + */ + public function deleteFile(string $fileId):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get File for Download + * + * Get file content by its unique ID. The endpoint response return with a + * 'Content-Disposition: attachment' header that tells the browser to start + * downloading the file to user downloads directory. + * + * @param string $fileId + * @throws Exception + * @return array + */ + public function getFileDownload(string $fileId):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/download'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get File Preview + * + * Get a file preview image. Currently, this method supports preview for image + * files (jpg, png, and gif), other supported formats, like pdf, docs, slides, + * and spreadsheets, will return the file icon image. You can also pass query + * string arguments for cutting and resizing your preview image. + * + * @param string $fileId + * @param int $width + * @param int $height + * @param int $quality + * @param string $background + * @param string $output + * @throws Exception + * @return array + */ + public function getFilePreview(string $fileId, int $width = 0, int $height = 0, int $quality = 100, string $background = '', string $output = ''):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/preview'); + $params = []; + + $params['width'] = $width; + $params['height'] = $height; + $params['quality'] = $quality; + $params['background'] = $background; + $params['output'] = $output; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get File for View + * + * Get file content by its unique ID. This endpoint is similar to the download + * method but returns with no 'Content-Disposition: attachment' header. + * + * @param string $fileId + * @param string $as + * @throws Exception + * @return array + */ + public function getFileView(string $fileId, string $as = ''):array + { + $path = str_replace(['{fileId}'], [$fileId], '/storage/files/{fileId}/view'); + $params = []; + + $params['as'] = $as; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Teams.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Teams.php new file mode 100644 index 0000000000..edb6445e57 --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Teams.php @@ -0,0 +1,223 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Team + * + * Create a new team. The user who creates the team will automatically be + * assigned as the owner of the team. The team owner can invite new members, + * who will be able add new owners and update or delete the team from your + * project. + * + * @param string $name + * @param array $roles + * @throws Exception + * @return array + */ + public function create(string $name, array $roles = ["owner"]):array + { + $path = str_replace([], [], '/teams'); + $params = []; + + $params['name'] = $name; + $params['roles'] = $roles; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Team + * + * Get team by its unique ID. All team members have read access for this + * resource. + * + * @param string $teamId + * @throws Exception + * @return array + */ + public function get(string $teamId):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update Team + * + * Update team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string $teamId + * @param string $name + * @throws Exception + * @return array + */ + public function update(string $teamId, string $name):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $params = []; + + $params['name'] = $name; + + return $this->client->call(Client::METHOD_PUT, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Team + * + * Delete team by its unique ID. Only team owners have write access for this + * resource. + * + * @param string $teamId + * @throws Exception + * @return array + */ + public function delete(string $teamId):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get Team Memberships + * + * Get team members by the team unique ID. All team members have read access + * for this list of resources. + * + * @param string $teamId + * @param string $search + * @param int $limit + * @param int $offset + * @param string $orderType + * @throws Exception + * @return array + */ + public function getMemberships(string $teamId, string $search = '', int $limit = 25, int $offset = 0, string $orderType = 'ASC'):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); + $params = []; + + $params['search'] = $search; + $params['limit'] = $limit; + $params['offset'] = $offset; + $params['orderType'] = $orderType; + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create Team Membership + * + * Use this endpoint to invite a new member to join your team. An email with a + * link to join the team will be sent to the new member email address if the + * member doesn't exist in the project it will be created automatically. + * + * Use the 'URL' parameter to redirect the user from the invitation email back + * to your app. When the user is redirected, use the [Update Team Membership + * Status](/docs/client/teams#updateMembershipStatus) endpoint to allow the + * user to accept the invitation to the team. + * + * Please note that in order to avoid a [Redirect + * Attacks](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) + * the only valid redirect URL's are the once from domains you have set when + * added your platforms in the console interface. + * + * @param string $teamId + * @param string $email + * @param array $roles + * @param string $url + * @param string $name + * @throws Exception + * @return array + */ + public function createMembership(string $teamId, string $email, array $roles, string $url, string $name = ''):array + { + $path = str_replace(['{teamId}'], [$teamId], '/teams/{teamId}/memberships'); + $params = []; + + $params['email'] = $email; + $params['name'] = $name; + $params['roles'] = $roles; + $params['url'] = $url; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete Team Membership + * + * This endpoint allows a user to leave a team or for a team owner to delete + * the membership of any other team member. You can also use this endpoint to + * delete a user membership even if it is not accepted. + * + * @param string $teamId + * @param string $inviteId + * @throws Exception + * @return array + */ + public function deleteMembership(string $teamId, string $inviteId):array + { + $path = str_replace(['{teamId}', '{inviteId}'], [$teamId, $inviteId], '/teams/{teamId}/memberships/{inviteId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-php/src/Appwrite/Services/Users.php b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Users.php new file mode 100644 index 0000000000..099f1bc31e --- /dev/null +++ b/app/sdks/0.7.0/server-php/src/Appwrite/Services/Users.php @@ -0,0 +1,250 @@ +client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Create User + * + * Create a new user. + * + * @param string $email + * @param string $password + * @param string $name + * @throws Exception + * @return array + */ + public function create(string $email, string $password, string $name = ''):array + { + $path = str_replace([], [], '/users'); + $params = []; + + $params['email'] = $email; + $params['password'] = $password; + $params['name'] = $name; + + return $this->client->call(Client::METHOD_POST, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User + * + * Get user by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function get(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete User + * + * Delete a user by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function deleteUser(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Logs + * + * Get user activity logs list by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function getLogs(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/logs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Preferences + * + * Get user preferences by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function getPrefs(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update User Preferences + * + * Update user preferences by its unique ID. You can pass only the specific + * settings you wish to update. + * + * @param string $userId + * @param array $prefs + * @throws Exception + * @return array + */ + public function updatePrefs(string $userId, array $prefs):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/prefs'); + $params = []; + + $params['prefs'] = $prefs; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Get User Sessions + * + * Get user sessions list by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function getSessions(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $params = []; + + + return $this->client->call(Client::METHOD_GET, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete User Sessions + * + * Delete all user sessions by its unique ID. + * + * @param string $userId + * @throws Exception + * @return array + */ + public function deleteSessions(string $userId):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/sessions'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Delete User Session + * + * Delete user sessions by its unique ID. + * + * @param string $userId + * @param string $sessionId + * @throws Exception + * @return array + */ + public function deleteSession(string $userId, string $sessionId):array + { + $path = str_replace(['{userId}', '{sessionId}'], [$userId, $sessionId], '/users/{userId}/sessions/{sessionId}'); + $params = []; + + + return $this->client->call(Client::METHOD_DELETE, $path, [ + 'content-type' => 'application/json', + ], $params); + } + + /** + * Update User Status + * + * Update user status by its unique ID. + * + * @param string $userId + * @param string $status + * @throws Exception + * @return array + */ + public function updateStatus(string $userId, string $status):array + { + $path = str_replace(['{userId}'], [$userId], '/users/{userId}/status'); + $params = []; + + $params['status'] = $status; + + return $this->client->call(Client::METHOD_PATCH, $path, [ + 'content-type' => 'application/json', + ], $params); + } + +} \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/CHANGELOG.md b/app/sdks/0.7.0/server-python/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/server-python/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/LICENSE b/app/sdks/0.7.0/server-python/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/server-python/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/README.md b/app/sdks/0.7.0/server-python/README.md new file mode 100644 index 0000000000..eb73775936 --- /dev/null +++ b/app/sdks/0.7.0/server-python/README.md @@ -0,0 +1,30 @@ +# Appwrite Python SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-python.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.7.0. 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 Python 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [PyPI](https://pypi.org/): + +```bash +pip install appwrite +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. diff --git a/app/sdks/0.7.0/server-python/appwrite/__init__.py b/app/sdks/0.7.0/server-python/appwrite/__init__.py new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/appwrite/client.py b/app/sdks/0.7.0/server-python/appwrite/client.py new file mode 100644 index 0000000000..8989fccb9c --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/client.py @@ -0,0 +1,106 @@ +import io +import requests + +class Client: + def __init__(self): + self._self_signed = False + self._endpoint = 'https://appwrite.io/v1' + self._global_headers = { + 'content-type': '', + 'x-sdk-version': 'appwrite:python:0.0.6', + } + + def set_self_signed(self, status=True): + self._self_signed = status + return self + + def set_endpoint(self, endpoint): + self._endpoint = endpoint + return self + + def add_header(self, key, value): + self._global_headers[key.lower()] = value.lower() + return self + + def set_project(self, value): + """Your project ID""" + + self._global_headers['x-appwrite-project'] = value.lower() + return self + + def set_key(self, value): + """Your secret API key""" + + self._global_headers['x-appwrite-key'] = value.lower() + return self + + def set_locale(self, value): + self._global_headers['x-appwrite-locale'] = value.lower() + return self + + def call(self, method, path='', headers=None, params=None): + if headers is None: + headers = {} + + if params is None: + params = {} + + data = {} + json = {} + files = {} + + headers = {**self._global_headers, **headers} + + if method != 'get': + data = params + params = {} + + if headers['content-type'].startswith('application/json'): + json = data + data = {} + + if headers['content-type'].startswith('multipart/form-data'): + del headers['content-type'] + + for key in data.copy(): + if isinstance(data[key], io.BufferedIOBase): + files[key] = data[key] + del data[key] + + response = requests.request( # call method dynamically https://stackoverflow.com/a/4246075/2299554 + method=method, + url=self._endpoint + path, + params=self.flatten(params), + data=self.flatten(data), + json=json, + files=files, + headers=headers, + verify=self._self_signed, + ) + + response.raise_for_status() + + content_type = response.headers['Content-Type'] + + if content_type.startswith('application/json'): + return response.json() + + return response._content + + def flatten(self, data, prefix=''): + output = {} + i = 0 + + for key in data: + value = data[key] if isinstance(data, dict) else key + finalKey = prefix + '[' + key +']' if prefix else key + finalKey = prefix + '[' + str(i) +']' if isinstance(data, list) else finalKey + i += 1 + + if isinstance(value, list) or isinstance(value, dict): + output = {**output, **self.flatten(value, finalKey)} + else: + output[finalKey] = value + + return output + diff --git a/app/sdks/0.7.0/server-python/appwrite/service.py b/app/sdks/0.7.0/server-python/appwrite/service.py new file mode 100644 index 0000000000..b5b60e6c22 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/service.py @@ -0,0 +1,6 @@ +from .client import Client + + +class Service: + def __init__(self, client: Client): + self.client = client diff --git a/app/sdks/0.7.0/server-python/appwrite/services/__init__.py b/app/sdks/0.7.0/server-python/appwrite/services/__init__.py new file mode 100644 index 0000000000..0519ecba6e --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/__init__.py @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/appwrite/services/avatars.py b/app/sdks/0.7.0/server-python/appwrite/services/avatars.py new file mode 100644 index 0000000000..12341106d0 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/avatars.py @@ -0,0 +1,102 @@ +from ..service import Service + + +class Avatars(Service): + + def __init__(self, client): + super(Avatars, self).__init__(client) + + def get_browser(self, code, width=100, height=100, quality=100): + """Get Browser Icon""" + + params = {} + path = '/avatars/browsers/{code}' + path = path.replace('{code}', code) + params['width'] = width + params['height'] = height + params['quality'] = quality + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_credit_card(self, code, width=100, height=100, quality=100): + """Get Credit Card Icon""" + + params = {} + path = '/avatars/credit-cards/{code}' + path = path.replace('{code}', code) + params['width'] = width + params['height'] = height + params['quality'] = quality + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_favicon(self, url): + """Get Favicon""" + + params = {} + path = '/avatars/favicon' + params['url'] = url + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_flag(self, code, width=100, height=100, quality=100): + """Get Country Flag""" + + params = {} + path = '/avatars/flags/{code}' + path = path.replace('{code}', code) + params['width'] = width + params['height'] = height + params['quality'] = quality + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_image(self, url, width=400, height=400): + """Get Image from URL""" + + params = {} + path = '/avatars/image' + params['url'] = url + params['width'] = width + params['height'] = height + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_initials(self, name='', width=500, height=500, color='', background=''): + """Get User Initials""" + + params = {} + path = '/avatars/initials' + params['name'] = name + params['width'] = width + params['height'] = height + params['color'] = color + params['background'] = background + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_q_r(self, text, size=400, margin=1, download=False): + """Get QR Code""" + + params = {} + path = '/avatars/qr' + params['text'] = text + params['size'] = size + params['margin'] = margin + params['download'] = download + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/database.py b/app/sdks/0.7.0/server-python/appwrite/services/database.py new file mode 100644 index 0000000000..4f20c5aba6 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/database.py @@ -0,0 +1,146 @@ +from ..service import Service + + +class Database(Service): + + def __init__(self, client): + super(Database, self).__init__(client) + + def list_collections(self, search='', limit=25, offset=0, order_type='ASC'): + """List Collections""" + + params = {} + path = '/database/collections' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_collection(self, name, read, write, rules): + """Create Collection""" + + params = {} + path = '/database/collections' + params['name'] = name + params['read'] = read + params['write'] = write + params['rules'] = rules + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get_collection(self, collection_id): + """Get Collection""" + + params = {} + path = '/database/collections/{collectionId}' + path = path.replace('{collectionId}', collection_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_collection(self, collection_id, name, read, write, rules=[]): + """Update Collection""" + + params = {} + path = '/database/collections/{collectionId}' + path = path.replace('{collectionId}', collection_id) + params['name'] = name + params['read'] = read + params['write'] = write + params['rules'] = rules + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete_collection(self, collection_id): + """Delete Collection""" + + params = {} + path = '/database/collections/{collectionId}' + path = path.replace('{collectionId}', collection_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def list_documents(self, collection_id, filters=[], limit=25, offset=0, order_field='', order_type='ASC', order_cast='string', search=''): + """List Documents""" + + params = {} + path = '/database/collections/{collectionId}/documents' + path = path.replace('{collectionId}', collection_id) + params['filters'] = filters + params['limit'] = limit + params['offset'] = offset + params['orderField'] = order_field + params['orderType'] = order_type + params['orderCast'] = order_cast + params['search'] = search + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_document(self, collection_id, data, read, write, parent_document='', parent_property='', parent_property_type='assign'): + """Create Document""" + + params = {} + path = '/database/collections/{collectionId}/documents' + path = path.replace('{collectionId}', collection_id) + params['data'] = data + params['read'] = read + params['write'] = write + params['parentDocument'] = parent_document + params['parentProperty'] = parent_property + params['parentPropertyType'] = parent_property_type + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get_document(self, collection_id, document_id): + """Get Document""" + + params = {} + path = '/database/collections/{collectionId}/documents/{documentId}' + path = path.replace('{collectionId}', collection_id) + path = path.replace('{documentId}', document_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_document(self, collection_id, document_id, data, read, write): + """Update Document""" + + params = {} + path = '/database/collections/{collectionId}/documents/{documentId}' + path = path.replace('{collectionId}', collection_id) + path = path.replace('{documentId}', document_id) + params['data'] = data + params['read'] = read + params['write'] = write + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) + + def delete_document(self, collection_id, document_id): + """Delete Document""" + + params = {} + path = '/database/collections/{collectionId}/documents/{documentId}' + path = path.replace('{collectionId}', collection_id) + path = path.replace('{documentId}', document_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/functions.py b/app/sdks/0.7.0/server-python/appwrite/services/functions.py new file mode 100644 index 0000000000..da0a759d7c --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/functions.py @@ -0,0 +1,177 @@ +from ..service import Service + + +class Functions(Service): + + def __init__(self, client): + super(Functions, self).__init__(client) + + def list(self, search='', limit=25, offset=0, order_type='ASC'): + """List Functions""" + + params = {} + path = '/functions' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create(self, name, env, vars={}, events=[], schedule='', timeout=15): + """Create Function""" + + params = {} + path = '/functions' + params['name'] = name + params['env'] = env + params['vars'] = vars + params['events'] = events + params['schedule'] = schedule + params['timeout'] = timeout + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get(self, function_id): + """Get Function""" + + params = {} + path = '/functions/{functionId}' + path = path.replace('{functionId}', function_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update(self, function_id, name, vars={}, events=[], schedule='', timeout=15): + """Update Function""" + + params = {} + path = '/functions/{functionId}' + path = path.replace('{functionId}', function_id) + params['name'] = name + params['vars'] = vars + params['events'] = events + params['schedule'] = schedule + params['timeout'] = timeout + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete(self, function_id): + """Delete Function""" + + params = {} + path = '/functions/{functionId}' + path = path.replace('{functionId}', function_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def list_executions(self, function_id, search='', limit=25, offset=0, order_type='ASC'): + """List Executions""" + + params = {} + path = '/functions/{functionId}/executions' + path = path.replace('{functionId}', function_id) + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_execution(self, function_id): + """Create Execution""" + + params = {} + path = '/functions/{functionId}/executions' + path = path.replace('{functionId}', function_id) + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get_execution(self, function_id, execution_id): + """Get Execution""" + + params = {} + path = '/functions/{functionId}/executions/{executionId}' + path = path.replace('{functionId}', function_id) + path = path.replace('{executionId}', execution_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_tag(self, function_id, tag): + """Update Function Tag""" + + params = {} + path = '/functions/{functionId}/tag' + path = path.replace('{functionId}', function_id) + params['tag'] = tag + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) + + def list_tags(self, function_id, search='', limit=25, offset=0, order_type='ASC'): + """List Tags""" + + params = {} + path = '/functions/{functionId}/tags' + path = path.replace('{functionId}', function_id) + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_tag(self, function_id, command, code): + """Create Tag""" + + params = {} + path = '/functions/{functionId}/tags' + path = path.replace('{functionId}', function_id) + params['command'] = command + params['code'] = code + + return self.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, params) + + def get_tag(self, function_id, tag_id): + """Get Tag""" + + params = {} + path = '/functions/{functionId}/tags/{tagId}' + path = path.replace('{functionId}', function_id) + path = path.replace('{tagId}', tag_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def delete_tag(self, function_id, tag_id): + """Delete Tag""" + + params = {} + path = '/functions/{functionId}/tags/{tagId}' + path = path.replace('{functionId}', function_id) + path = path.replace('{tagId}', tag_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/health.py b/app/sdks/0.7.0/server-python/appwrite/services/health.py new file mode 100644 index 0000000000..5e08ebe6e8 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/health.py @@ -0,0 +1,127 @@ +from ..service import Service + + +class Health(Service): + + def __init__(self, client): + super(Health, self).__init__(client) + + def get(self): + """Get HTTP""" + + params = {} + path = '/health' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_anti_virus(self): + """Get Anti virus""" + + params = {} + path = '/health/anti-virus' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_cache(self): + """Get Cache""" + + params = {} + path = '/health/cache' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_d_b(self): + """Get DB""" + + params = {} + path = '/health/db' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_certificates(self): + """Get Certificate Queue""" + + params = {} + path = '/health/queue/certificates' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_functions(self): + """Get Functions Queue""" + + params = {} + path = '/health/queue/functions' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_logs(self): + """Get Logs Queue""" + + params = {} + path = '/health/queue/logs' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_tasks(self): + """Get Tasks Queue""" + + params = {} + path = '/health/queue/tasks' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_usage(self): + """Get Usage Queue""" + + params = {} + path = '/health/queue/usage' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_queue_webhooks(self): + """Get Webhooks Queue""" + + params = {} + path = '/health/queue/webhooks' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_storage_local(self): + """Get Local Storage""" + + params = {} + path = '/health/storage/local' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_time(self): + """Get Time""" + + params = {} + path = '/health/time' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/locale.py b/app/sdks/0.7.0/server-python/appwrite/services/locale.py new file mode 100644 index 0000000000..fe3ad5e988 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/locale.py @@ -0,0 +1,77 @@ +from ..service import Service + + +class Locale(Service): + + def __init__(self, client): + super(Locale, self).__init__(client) + + def get(self): + """Get User Locale""" + + params = {} + path = '/locale' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_continents(self): + """List Continents""" + + params = {} + path = '/locale/continents' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_countries(self): + """List Countries""" + + params = {} + path = '/locale/countries' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_countries_e_u(self): + """List EU Countries""" + + params = {} + path = '/locale/countries/eu' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_countries_phones(self): + """List Countries Phone Codes""" + + params = {} + path = '/locale/countries/phones' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_currencies(self): + """List Currencies""" + + params = {} + path = '/locale/currencies' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_languages(self): + """List Languages""" + + params = {} + path = '/locale/languages' + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/storage.py b/app/sdks/0.7.0/server-python/appwrite/services/storage.py new file mode 100644 index 0000000000..7e2a986f6e --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/storage.py @@ -0,0 +1,108 @@ +from ..service import Service + + +class Storage(Service): + + def __init__(self, client): + super(Storage, self).__init__(client) + + def list_files(self, search='', limit=25, offset=0, order_type='ASC'): + """List Files""" + + params = {} + path = '/storage/files' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_file(self, file, read, write): + """Create File""" + + params = {} + path = '/storage/files' + params['file'] = file + params['read'] = read + params['write'] = write + + return self.client.call('post', path, { + 'content-type': 'multipart/form-data', + }, params) + + def get_file(self, file_id): + """Get File""" + + params = {} + path = '/storage/files/{fileId}' + path = path.replace('{fileId}', file_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_file(self, file_id, read, write): + """Update File""" + + params = {} + path = '/storage/files/{fileId}' + path = path.replace('{fileId}', file_id) + params['read'] = read + params['write'] = write + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete_file(self, file_id): + """Delete File""" + + params = {} + path = '/storage/files/{fileId}' + path = path.replace('{fileId}', file_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def get_file_download(self, file_id): + """Get File for Download""" + + params = {} + path = '/storage/files/{fileId}/download' + path = path.replace('{fileId}', file_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_file_preview(self, file_id, width=0, height=0, quality=100, background='', output=''): + """Get File Preview""" + + params = {} + path = '/storage/files/{fileId}/preview' + path = path.replace('{fileId}', file_id) + params['width'] = width + params['height'] = height + params['quality'] = quality + params['background'] = background + params['output'] = output + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_file_view(self, file_id, xas=''): + """Get File for View""" + + params = {} + path = '/storage/files/{fileId}/view' + path = path.replace('{fileId}', file_id) + params['as'] = xas + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/teams.py b/app/sdks/0.7.0/server-python/appwrite/services/teams.py new file mode 100644 index 0000000000..72c6a6e9d3 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/teams.py @@ -0,0 +1,109 @@ +from ..service import Service + + +class Teams(Service): + + def __init__(self, client): + super(Teams, self).__init__(client) + + def list(self, search='', limit=25, offset=0, order_type='ASC'): + """List Teams""" + + params = {} + path = '/teams' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create(self, name, roles=[]): + """Create Team""" + + params = {} + path = '/teams' + params['name'] = name + params['roles'] = roles + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get(self, team_id): + """Get Team""" + + params = {} + path = '/teams/{teamId}' + path = path.replace('{teamId}', team_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update(self, team_id, name): + """Update Team""" + + params = {} + path = '/teams/{teamId}' + path = path.replace('{teamId}', team_id) + params['name'] = name + + return self.client.call('put', path, { + 'content-type': 'application/json', + }, params) + + def delete(self, team_id): + """Delete Team""" + + params = {} + path = '/teams/{teamId}' + path = path.replace('{teamId}', team_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def get_memberships(self, team_id, search='', limit=25, offset=0, order_type='ASC'): + """Get Team Memberships""" + + params = {} + path = '/teams/{teamId}/memberships' + path = path.replace('{teamId}', team_id) + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create_membership(self, team_id, email, roles, url, name=''): + """Create Team Membership""" + + params = {} + path = '/teams/{teamId}/memberships' + path = path.replace('{teamId}', team_id) + params['email'] = email + params['name'] = name + params['roles'] = roles + params['url'] = url + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def delete_membership(self, team_id, invite_id): + """Delete Team Membership""" + + params = {} + path = '/teams/{teamId}/memberships/{inviteId}' + path = path.replace('{teamId}', team_id) + path = path.replace('{inviteId}', invite_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/appwrite/services/users.py b/app/sdks/0.7.0/server-python/appwrite/services/users.py new file mode 100644 index 0000000000..56a73883d0 --- /dev/null +++ b/app/sdks/0.7.0/server-python/appwrite/services/users.py @@ -0,0 +1,136 @@ +from ..service import Service + + +class Users(Service): + + def __init__(self, client): + super(Users, self).__init__(client) + + def list(self, search='', limit=25, offset=0, order_type='ASC'): + """List Users""" + + params = {} + path = '/users' + params['search'] = search + params['limit'] = limit + params['offset'] = offset + params['orderType'] = order_type + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def create(self, email, password, name=''): + """Create User""" + + params = {} + path = '/users' + params['email'] = email + params['password'] = password + params['name'] = name + + return self.client.call('post', path, { + 'content-type': 'application/json', + }, params) + + def get(self, user_id): + """Get User""" + + params = {} + path = '/users/{userId}' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def delete_user(self, user_id): + """Delete User""" + + params = {} + path = '/users/{userId}' + path = path.replace('{userId}', user_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def get_logs(self, user_id): + """Get User Logs""" + + params = {} + path = '/users/{userId}/logs' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def get_prefs(self, user_id): + """Get User Preferences""" + + params = {} + path = '/users/{userId}/prefs' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def update_prefs(self, user_id, prefs): + """Update User Preferences""" + + params = {} + path = '/users/{userId}/prefs' + path = path.replace('{userId}', user_id) + params['prefs'] = prefs + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) + + def get_sessions(self, user_id): + """Get User Sessions""" + + params = {} + path = '/users/{userId}/sessions' + path = path.replace('{userId}', user_id) + + return self.client.call('get', path, { + 'content-type': 'application/json', + }, params) + + def delete_sessions(self, user_id): + """Delete User Sessions""" + + params = {} + path = '/users/{userId}/sessions' + path = path.replace('{userId}', user_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def delete_session(self, user_id, session_id): + """Delete User Session""" + + params = {} + path = '/users/{userId}/sessions/{sessionId}' + path = path.replace('{userId}', user_id) + path = path.replace('{sessionId}', session_id) + + return self.client.call('delete', path, { + 'content-type': 'application/json', + }, params) + + def update_status(self, user_id, status): + """Update User Status""" + + params = {} + path = '/users/{userId}/status' + path = path.replace('{userId}', user_id) + params['status'] = status + + return self.client.call('patch', path, { + 'content-type': 'application/json', + }, params) diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..138c0d1b3e --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-browser.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_browser('aa') diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..83f76aca42 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_credit_card('amex') diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..6946080bee --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-favicon.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_favicon('https://example.com') diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..188d6d35bd --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-flag.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_flag('af') diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..29a6430eab --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-image.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_image('https://example.com') diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..0c300af5da --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-initials.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_initials() diff --git a/app/sdks/0.7.0/server-python/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..19551e99d7 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/avatars/get-q-r.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.avatars import Avatars + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +avatars = Avatars(client) + +result = avatars.get_q_r('[TEXT]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/create-collection.md b/app/sdks/0.7.0/server-python/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..eb704a80a1 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/create-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.create_collection('[NAME]', [], [], []) diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/create-document.md b/app/sdks/0.7.0/server-python/docs/examples/database/create-document.md new file mode 100644 index 0000000000..919d5ebbf4 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/create-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.create_document('[COLLECTION_ID]', {}, [], []) diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/delete-collection.md b/app/sdks/0.7.0/server-python/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..0e188ade41 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/delete-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.delete_collection('[COLLECTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/delete-document.md b/app/sdks/0.7.0/server-python/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..c085547c16 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/delete-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.delete_document('[COLLECTION_ID]', '[DOCUMENT_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/get-collection.md b/app/sdks/0.7.0/server-python/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..f90f51f48b --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/get-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.get_collection('[COLLECTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/get-document.md b/app/sdks/0.7.0/server-python/docs/examples/database/get-document.md new file mode 100644 index 0000000000..79891709d1 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/get-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.get_document('[COLLECTION_ID]', '[DOCUMENT_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/list-collections.md b/app/sdks/0.7.0/server-python/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..f60d4b90e5 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/list-collections.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.list_collections() diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/list-documents.md b/app/sdks/0.7.0/server-python/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..cecb57d2fa --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/list-documents.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.list_documents('[COLLECTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/update-collection.md b/app/sdks/0.7.0/server-python/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..7dacd558ba --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/update-collection.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.update_collection('[COLLECTION_ID]', '[NAME]', [], []) diff --git a/app/sdks/0.7.0/server-python/docs/examples/database/update-document.md b/app/sdks/0.7.0/server-python/docs/examples/database/update-document.md new file mode 100644 index 0000000000..6296809dc5 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/database/update-document.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.database import Database + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +database = Database(client) + +result = database.update_document('[COLLECTION_ID]', '[DOCUMENT_ID]', {}, [], []) diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/create-execution.md b/app/sdks/0.7.0/server-python/docs/examples/functions/create-execution.md new file mode 100644 index 0000000000..dc4442cd84 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/create-execution.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.create_execution('[FUNCTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/create-tag.md b/app/sdks/0.7.0/server-python/docs/examples/functions/create-tag.md new file mode 100644 index 0000000000..1995a64c33 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/create-tag.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.create_tag('[FUNCTION_ID]', '[COMMAND]', open('/path/to/file.png', 'rb')) diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/create.md b/app/sdks/0.7.0/server-python/docs/examples/functions/create.md new file mode 100644 index 0000000000..c6fd31bcb1 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/create.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.create('[NAME]', 'node-14') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/delete-tag.md b/app/sdks/0.7.0/server-python/docs/examples/functions/delete-tag.md new file mode 100644 index 0000000000..a4cb1b7a85 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/delete-tag.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.delete_tag('[FUNCTION_ID]', '[TAG_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/delete.md b/app/sdks/0.7.0/server-python/docs/examples/functions/delete.md new file mode 100644 index 0000000000..52658e8c30 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/delete.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.delete('[FUNCTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/get-execution.md b/app/sdks/0.7.0/server-python/docs/examples/functions/get-execution.md new file mode 100644 index 0000000000..1e101304d3 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/get-execution.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.get_execution('[FUNCTION_ID]', '[EXECUTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/get-tag.md b/app/sdks/0.7.0/server-python/docs/examples/functions/get-tag.md new file mode 100644 index 0000000000..4cded469dd --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/get-tag.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.get_tag('[FUNCTION_ID]', '[TAG_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/get.md b/app/sdks/0.7.0/server-python/docs/examples/functions/get.md new file mode 100644 index 0000000000..0007667da6 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.get('[FUNCTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/list-executions.md b/app/sdks/0.7.0/server-python/docs/examples/functions/list-executions.md new file mode 100644 index 0000000000..6d75e093f4 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/list-executions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.list_executions('[FUNCTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/list-tags.md b/app/sdks/0.7.0/server-python/docs/examples/functions/list-tags.md new file mode 100644 index 0000000000..67a81a9d89 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/list-tags.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.list_tags('[FUNCTION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/list.md b/app/sdks/0.7.0/server-python/docs/examples/functions/list.md new file mode 100644 index 0000000000..cc1f04d9c6 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.list() diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/update-tag.md b/app/sdks/0.7.0/server-python/docs/examples/functions/update-tag.md new file mode 100644 index 0000000000..7a9da50b2f --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/update-tag.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.update_tag('[FUNCTION_ID]', '[TAG]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/functions/update.md b/app/sdks/0.7.0/server-python/docs/examples/functions/update.md new file mode 100644 index 0000000000..f55767d0ae --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/functions/update.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.functions import Functions + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +functions = Functions(client) + +result = functions.update('[FUNCTION_ID]', '[NAME]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-anti-virus.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..c7628d90ea --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-anti-virus.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_anti_virus() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-cache.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..57c7939b7f --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-cache.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_cache() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-d-b.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..db8eec5ce6 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-d-b.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_d_b() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-certificates.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..1f87c2758a --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_certificates() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-functions.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..3e0b0c01e0 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-functions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_functions() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-logs.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..fdf80c6d82 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_logs() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-tasks.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..17b17a081f --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_tasks() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-usage.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..aeb8e83130 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-usage.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_usage() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..90c4238987 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_queue_webhooks() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-storage-local.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..b06dcef245 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-storage-local.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_storage_local() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get-time.md b/app/sdks/0.7.0/server-python/docs/examples/health/get-time.md new file mode 100644 index 0000000000..df68c1a0f9 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get-time.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get_time() diff --git a/app/sdks/0.7.0/server-python/docs/examples/health/get.md b/app/sdks/0.7.0/server-python/docs/examples/health/get.md new file mode 100644 index 0000000000..f3416aef75 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/health/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.health import Health + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +health = Health(client) + +result = health.get() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..393326ddab --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get-continents.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_continents() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..653fdd5abf --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_countries_e_u() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..8c7693a35c --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_countries_phones() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..8a6c7cb1c3 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get-countries.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_countries() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..17586de230 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get-currencies.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_currencies() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..292a401f75 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get-languages.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get_languages() diff --git a/app/sdks/0.7.0/server-python/docs/examples/locale/get.md b/app/sdks/0.7.0/server-python/docs/examples/locale/get.md new file mode 100644 index 0000000000..752df0123d --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/locale/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.locale import Locale + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +locale = Locale(client) + +result = locale.get() diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/create-file.md b/app/sdks/0.7.0/server-python/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..52bf8b8575 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/create-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.create_file(open('/path/to/file.png', 'rb'), [], []) diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/server-python/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..9379cb8820 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/delete-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.delete_file('[FILE_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..bc815cebbe --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-download.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file_download('[FILE_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..2d14539513 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-preview.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file_preview('[FILE_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..7d0b30b376 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file-view.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file_view('[FILE_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/get-file.md b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..e8d1202e27 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/get-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.get_file('[FILE_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/list-files.md b/app/sdks/0.7.0/server-python/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..0e72773fcb --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/list-files.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.list_files() diff --git a/app/sdks/0.7.0/server-python/docs/examples/storage/update-file.md b/app/sdks/0.7.0/server-python/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..7e1c5f61cd --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/storage/update-file.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.storage import Storage + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +storage = Storage(client) + +result = storage.update_file('[FILE_ID]', [], []) diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/server-python/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..9e2c832b3c --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/create-membership.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.create_membership('[TEAM_ID]', 'email@example.com', [], 'https://example.com') diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/create.md b/app/sdks/0.7.0/server-python/docs/examples/teams/create.md new file mode 100644 index 0000000000..1debdc6109 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/create.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.create('[NAME]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/server-python/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..af30bc1cf3 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/delete-membership.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.delete_membership('[TEAM_ID]', '[INVITE_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/delete.md b/app/sdks/0.7.0/server-python/docs/examples/teams/delete.md new file mode 100644 index 0000000000..8fb037cd4a --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/delete.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.delete('[TEAM_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/server-python/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..6c6482418b --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/get-memberships.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.get_memberships('[TEAM_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/get.md b/app/sdks/0.7.0/server-python/docs/examples/teams/get.md new file mode 100644 index 0000000000..6c2b404517 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.get('[TEAM_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/list.md b/app/sdks/0.7.0/server-python/docs/examples/teams/list.md new file mode 100644 index 0000000000..c538aea340 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.list() diff --git a/app/sdks/0.7.0/server-python/docs/examples/teams/update.md b/app/sdks/0.7.0/server-python/docs/examples/teams/update.md new file mode 100644 index 0000000000..2b9c222be0 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/teams/update.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.teams import Teams + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +teams = Teams(client) + +result = teams.update('[TEAM_ID]', '[NAME]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/create.md b/app/sdks/0.7.0/server-python/docs/examples/users/create.md new file mode 100644 index 0000000000..2cfe228ee0 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/create.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.create('email@example.com', 'password') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/delete-session.md b/app/sdks/0.7.0/server-python/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..d25cfb3abc --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/delete-session.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.delete_session('[USER_ID]', '[SESSION_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/delete-sessions.md b/app/sdks/0.7.0/server-python/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..9b24db1b5c --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/delete-sessions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.delete_sessions('[USER_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/delete-user.md b/app/sdks/0.7.0/server-python/docs/examples/users/delete-user.md new file mode 100644 index 0000000000..1520823a36 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/delete-user.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.delete_user('[USER_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/get-logs.md b/app/sdks/0.7.0/server-python/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..c93ae244c8 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/get-logs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get_logs('[USER_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/get-prefs.md b/app/sdks/0.7.0/server-python/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..9ef100f9e6 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/get-prefs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get_prefs('[USER_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/get-sessions.md b/app/sdks/0.7.0/server-python/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..4de3120dfb --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/get-sessions.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get_sessions('[USER_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/get.md b/app/sdks/0.7.0/server-python/docs/examples/users/get.md new file mode 100644 index 0000000000..c11f96e64b --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/get.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.get('[USER_ID]') diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/list.md b/app/sdks/0.7.0/server-python/docs/examples/users/list.md new file mode 100644 index 0000000000..c4a66e42d2 --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/list.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.list() diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/update-prefs.md b/app/sdks/0.7.0/server-python/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..7e0fe7c35a --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/update-prefs.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.update_prefs('[USER_ID]', {}) diff --git a/app/sdks/0.7.0/server-python/docs/examples/users/update-status.md b/app/sdks/0.7.0/server-python/docs/examples/users/update-status.md new file mode 100644 index 0000000000..28fd587deb --- /dev/null +++ b/app/sdks/0.7.0/server-python/docs/examples/users/update-status.md @@ -0,0 +1,14 @@ +from appwrite.client import Client +from appwrite.services.users import Users + +client = Client() + +(client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +) + +users = Users(client) + +result = users.update_status('[USER_ID]', '1') diff --git a/app/sdks/0.7.0/server-python/requirements.txt b/app/sdks/0.7.0/server-python/requirements.txt new file mode 100644 index 0000000000..e20605c43d --- /dev/null +++ b/app/sdks/0.7.0/server-python/requirements.txt @@ -0,0 +1 @@ +requests==2.22.0 \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/setup.cfg b/app/sdks/0.7.0/server-python/setup.cfg new file mode 100644 index 0000000000..224a77957f --- /dev/null +++ b/app/sdks/0.7.0/server-python/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.md \ No newline at end of file diff --git a/app/sdks/0.7.0/server-python/setup.py b/app/sdks/0.7.0/server-python/setup.py new file mode 100644 index 0000000000..ef51270c42 --- /dev/null +++ b/app/sdks/0.7.0/server-python/setup.py @@ -0,0 +1,31 @@ +import setuptools + +setuptools.setup( + name = 'appwrite', + packages = ['appwrite', 'appwrite/services'], + version = '0.0.6', + license='BSD-3-Clause', + 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', + author = 'Appwrite Team', + author_email = 'team@appwrite.io', + maintainer = 'Appwrite Team', + maintainer_email = 'team@appwrite.io', + url = 'https://appwrite.io/support', + download_url='https://github.com/appwrite/sdk-for-python/archive/0.0.6.tar.gz', + # keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], + install_requires=[ + 'requests', + ], + classifiers=[ + 'Development Status :: 5 - Production/Stable', + 'Intended Audience :: Developers', + 'Environment :: Web Environment', + 'Topic :: Software Development', + 'License :: OSI Approved :: BSD License', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + ], +) diff --git a/app/sdks/0.7.0/server-ruby/CHANGELOG.md b/app/sdks/0.7.0/server-ruby/CHANGELOG.md new file mode 100644 index 0000000000..fa4d35e687 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/Gemfile b/app/sdks/0.7.0/server-ruby/Gemfile new file mode 100644 index 0000000000..cd8aa9e04c --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gemspec \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/LICENSE b/app/sdks/0.7.0/server-ruby/LICENSE new file mode 100644 index 0000000000..fc7c051a91 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/LICENSE @@ -0,0 +1,12 @@ +Copyright (c) 2019 Appwrite (https://appwrite.io) and individual contributors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + + 3. Neither the name Appwrite nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/README.md b/app/sdks/0.7.0/server-ruby/README.md new file mode 100644 index 0000000000..d1c7112a98 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/README.md @@ -0,0 +1,30 @@ +# Appwrite Ruby SDK + +![License](https://img.shields.io/github/license/appwrite/sdk-for-ruby.svg?v=1) +![Version](https://img.shields.io/badge/api%20version-0.7.0-blue.svg?v=1) + +**This SDK is compatible with Appwrite server version 0.7.0. 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 Ruby 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) + + + +![Appwrite](https://appwrite.io/images/github.png) + +## Installation + +To install via [Gem](https://rubygems.org/): + +```bash +gem install appwrite --save +``` + +## Contribution + +This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. + +## License + +Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/appwrite.gemspec b/app/sdks/0.7.0/server-ruby/appwrite.gemspec new file mode 100644 index 0000000000..8f4c99be3f --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/appwrite.gemspec @@ -0,0 +1,13 @@ +Gem::Specification.new do |s| + + s.name = 'appwrite' + s.version = '1.0.11' + s.summary = "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 Ruby 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)" + s.author = 'Appwrite Team' + s.homepage = 'https://appwrite.io/support' + s.email = 'team@appwrite.io' + s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR) + +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-browser.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-browser.md new file mode 100644 index 0000000000..fc0cfc913f --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-browser.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_browser(code: 'aa'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-credit-card.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-credit-card.md new file mode 100644 index 0000000000..b3763f0846 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-credit-card.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_credit_card(code: 'amex'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-favicon.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-favicon.md new file mode 100644 index 0000000000..2ee4e75789 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-favicon.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_favicon(url: 'https://example.com'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-flag.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-flag.md new file mode 100644 index 0000000000..2e2f01f0f9 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-flag.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_flag(code: 'af'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-image.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-image.md new file mode 100644 index 0000000000..682d6bf9df --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-image.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_image(url: 'https://example.com'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-initials.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-initials.md new file mode 100644 index 0000000000..11878a6da7 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-initials.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_initials(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-q-r.md b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-q-r.md new file mode 100644 index 0000000000..f145425ca2 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/avatars/get-q-r.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +avatars = Appwrite::Avatars.new(client); + +response = avatars.get_q_r(text: '[TEXT]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/create-collection.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/create-collection.md new file mode 100644 index 0000000000..0317ed9f05 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/create-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.create_collection(name: '[NAME]', read: [], write: [], rules: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/create-document.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/create-document.md new file mode 100644 index 0000000000..0101c746b4 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/create-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.create_document(collection_id: '[COLLECTION_ID]', data: {}, read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/delete-collection.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/delete-collection.md new file mode 100644 index 0000000000..b91c369da7 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/delete-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.delete_collection(collection_id: '[COLLECTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/delete-document.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/delete-document.md new file mode 100644 index 0000000000..6548ec2946 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/delete-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.delete_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/get-collection.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/get-collection.md new file mode 100644 index 0000000000..1e54e94c10 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/get-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.get_collection(collection_id: '[COLLECTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/get-document.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/get-document.md new file mode 100644 index 0000000000..3040b82c03 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/get-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.get_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/list-collections.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/list-collections.md new file mode 100644 index 0000000000..ec15fe3b08 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/list-collections.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.list_collections(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/list-documents.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/list-documents.md new file mode 100644 index 0000000000..fa33f10ccf --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/list-documents.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.list_documents(collection_id: '[COLLECTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/update-collection.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/update-collection.md new file mode 100644 index 0000000000..3ecfbdb4ab --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/update-collection.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.update_collection(collection_id: '[COLLECTION_ID]', name: '[NAME]', read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/database/update-document.md b/app/sdks/0.7.0/server-ruby/docs/examples/database/update-document.md new file mode 100644 index 0000000000..492d4f3edc --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/database/update-document.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +database = Appwrite::Database.new(client); + +response = database.update_document(collection_id: '[COLLECTION_ID]', document_id: '[DOCUMENT_ID]', data: {}, read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/create-execution.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/create-execution.md new file mode 100644 index 0000000000..775b4d7a98 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/create-execution.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.create_execution(function_id: '[FUNCTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/create-tag.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/create-tag.md new file mode 100644 index 0000000000..3e05f11b94 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/create-tag.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.create_tag(function_id: '[FUNCTION_ID]', command: '[COMMAND]', code: File.new()); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/create.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/create.md new file mode 100644 index 0000000000..e790c1ae1a --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/create.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.create(name: '[NAME]', env: 'node-14'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/delete-tag.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/delete-tag.md new file mode 100644 index 0000000000..72e9b00164 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/delete-tag.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.delete_tag(function_id: '[FUNCTION_ID]', tag_id: '[TAG_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/delete.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/delete.md new file mode 100644 index 0000000000..41a02e994e --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/delete.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.delete(function_id: '[FUNCTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/get-execution.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/get-execution.md new file mode 100644 index 0000000000..73e2ddd5d6 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/get-execution.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.get_execution(function_id: '[FUNCTION_ID]', execution_id: '[EXECUTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/get-tag.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/get-tag.md new file mode 100644 index 0000000000..61c78a0d61 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/get-tag.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.get_tag(function_id: '[FUNCTION_ID]', tag_id: '[TAG_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/get.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/get.md new file mode 100644 index 0000000000..44d89f873b --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.get(function_id: '[FUNCTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/list-executions.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/list-executions.md new file mode 100644 index 0000000000..cd7eef772a --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/list-executions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.list_executions(function_id: '[FUNCTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/list-tags.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/list-tags.md new file mode 100644 index 0000000000..ea1a613570 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/list-tags.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.list_tags(function_id: '[FUNCTION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/list.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/list.md new file mode 100644 index 0000000000..6d5a151bba --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.list(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/update-tag.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/update-tag.md new file mode 100644 index 0000000000..e95c8fb945 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/update-tag.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.update_tag(function_id: '[FUNCTION_ID]', tag: '[TAG]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/functions/update.md b/app/sdks/0.7.0/server-ruby/docs/examples/functions/update.md new file mode 100644 index 0000000000..16133e9e59 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/functions/update.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +functions = Appwrite::Functions.new(client); + +response = functions.update(function_id: '[FUNCTION_ID]', name: '[NAME]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-anti-virus.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-anti-virus.md new file mode 100644 index 0000000000..0c83a06cf8 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-anti-virus.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_anti_virus(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-cache.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-cache.md new file mode 100644 index 0000000000..6f51fb6e00 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-cache.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_cache(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-d-b.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-d-b.md new file mode 100644 index 0000000000..4bb00577a7 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-d-b.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_d_b(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-certificates.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-certificates.md new file mode 100644 index 0000000000..f758b7c3a4 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-certificates.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_certificates(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-functions.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-functions.md new file mode 100644 index 0000000000..653607f79d --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-functions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_functions(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-logs.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-logs.md new file mode 100644 index 0000000000..c6751f7f91 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_logs(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-tasks.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-tasks.md new file mode 100644 index 0000000000..c6da38832e --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-tasks.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_tasks(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-usage.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-usage.md new file mode 100644 index 0000000000..ed81452d86 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-usage.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_usage(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-webhooks.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-webhooks.md new file mode 100644 index 0000000000..9e55ab1d87 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-queue-webhooks.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_queue_webhooks(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-storage-local.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-storage-local.md new file mode 100644 index 0000000000..09c47ae437 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-storage-local.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_storage_local(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get-time.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-time.md new file mode 100644 index 0000000000..3d72794e93 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get-time.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get_time(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/health/get.md b/app/sdks/0.7.0/server-ruby/docs/examples/health/get.md new file mode 100644 index 0000000000..9496c31b36 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/health/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +health = Appwrite::Health.new(client); + +response = health.get(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-continents.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-continents.md new file mode 100644 index 0000000000..92f38922e1 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-continents.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_continents(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries-e-u.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries-e-u.md new file mode 100644 index 0000000000..b83125d4a6 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries-e-u.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_countries_e_u(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries-phones.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries-phones.md new file mode 100644 index 0000000000..728a1b3cdc --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries-phones.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_countries_phones(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries.md new file mode 100644 index 0000000000..54975db928 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-countries.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_countries(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-currencies.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-currencies.md new file mode 100644 index 0000000000..4e39b435e1 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-currencies.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_currencies(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-languages.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-languages.md new file mode 100644 index 0000000000..64e74eece0 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get-languages.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get_languages(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/locale/get.md b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get.md new file mode 100644 index 0000000000..b390d505c4 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/locale/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +locale = Appwrite::Locale.new(client); + +response = locale.get(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/create-file.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/create-file.md new file mode 100644 index 0000000000..b044e35b86 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/create-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.create_file(file: File.new(), read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/delete-file.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/delete-file.md new file mode 100644 index 0000000000..1aa67b3537 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/delete-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.delete_file(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-download.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-download.md new file mode 100644 index 0000000000..777c565d06 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-download.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file_download(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-preview.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-preview.md new file mode 100644 index 0000000000..48be3a044e --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-preview.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file_preview(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-view.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-view.md new file mode 100644 index 0000000000..a3dc012098 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file-view.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file_view(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file.md new file mode 100644 index 0000000000..203a4dff7c --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/get-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.get_file(file_id: '[FILE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/list-files.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/list-files.md new file mode 100644 index 0000000000..a148da78f9 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/list-files.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.list_files(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/storage/update-file.md b/app/sdks/0.7.0/server-ruby/docs/examples/storage/update-file.md new file mode 100644 index 0000000000..36d5049816 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/storage/update-file.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +storage = Appwrite::Storage.new(client); + +response = storage.update_file(file_id: '[FILE_ID]', read: [], write: []); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/create-membership.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/create-membership.md new file mode 100644 index 0000000000..fc0a249361 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/create-membership.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.create_membership(team_id: '[TEAM_ID]', email: 'email@example.com', roles: [], url: 'https://example.com'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/create.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/create.md new file mode 100644 index 0000000000..d7f9c2f8c0 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/create.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.create(name: '[NAME]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/delete-membership.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/delete-membership.md new file mode 100644 index 0000000000..545cacc51f --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/delete-membership.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.delete_membership(team_id: '[TEAM_ID]', invite_id: '[INVITE_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/delete.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/delete.md new file mode 100644 index 0000000000..d28907f741 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/delete.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.delete(team_id: '[TEAM_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/get-memberships.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/get-memberships.md new file mode 100644 index 0000000000..013d952afc --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/get-memberships.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.get_memberships(team_id: '[TEAM_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/get.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/get.md new file mode 100644 index 0000000000..1dd4918a12 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.get(team_id: '[TEAM_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/list.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/list.md new file mode 100644 index 0000000000..c0cd72a362 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.list(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/teams/update.md b/app/sdks/0.7.0/server-ruby/docs/examples/teams/update.md new file mode 100644 index 0000000000..b7e87a8e09 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/teams/update.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +teams = Appwrite::Teams.new(client); + +response = teams.update(team_id: '[TEAM_ID]', name: '[NAME]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/create.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/create.md new file mode 100644 index 0000000000..0a152ac366 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/create.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.create(email: 'email@example.com', password: 'password'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-session.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-session.md new file mode 100644 index 0000000000..149c7d9293 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-session.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.delete_session(user_id: '[USER_ID]', session_id: '[SESSION_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-sessions.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-sessions.md new file mode 100644 index 0000000000..3f02e08dd1 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-sessions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.delete_sessions(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-user.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-user.md new file mode 100644 index 0000000000..3a0bcb0407 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/delete-user.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.delete_user(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/get-logs.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/get-logs.md new file mode 100644 index 0000000000..695a77ad27 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/get-logs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get_logs(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/get-prefs.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/get-prefs.md new file mode 100644 index 0000000000..4a0761e283 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/get-prefs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get_prefs(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/get-sessions.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/get-sessions.md new file mode 100644 index 0000000000..52f37a4609 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/get-sessions.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get_sessions(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/get.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/get.md new file mode 100644 index 0000000000..562ac958c3 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/get.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.get(user_id: '[USER_ID]'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/list.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/list.md new file mode 100644 index 0000000000..096ce859e3 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/list.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.list(); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/update-prefs.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/update-prefs.md new file mode 100644 index 0000000000..2bb2d42e16 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/update-prefs.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.update_prefs(user_id: '[USER_ID]', prefs: {}); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/docs/examples/users/update-status.md b/app/sdks/0.7.0/server-ruby/docs/examples/users/update-status.md new file mode 100644 index 0000000000..088ee380d8 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/docs/examples/users/update-status.md @@ -0,0 +1,15 @@ +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint('https://[HOSTNAME_OR_IP]/v1') # Your API Endpoint + .set_project('5df5acd0d48c2') # Your project ID + .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key +; + +users = Appwrite::Users.new(client); + +response = users.update_status(user_id: '[USER_ID]', status: '1'); + +puts response \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite.rb new file mode 100644 index 0000000000..1b4f38bea2 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite.rb @@ -0,0 +1,13 @@ +require 'net/http' +require 'uri' +require 'json' +require_relative 'appwrite/client' +require_relative 'appwrite/service' +require_relative 'appwrite/services/avatars' +require_relative 'appwrite/services/database' +require_relative 'appwrite/services/functions' +require_relative 'appwrite/services/health' +require_relative 'appwrite/services/locale' +require_relative 'appwrite/services/storage' +require_relative 'appwrite/services/teams' +require_relative 'appwrite/services/users' diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/client.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/client.rb new file mode 100644 index 0000000000..2cd09d52fe --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/client.rb @@ -0,0 +1,116 @@ +require 'net/http' +require 'uri' +require 'json' +require 'cgi' + +module Appwrite + class Client + + METHOD_GET = 'get' + METHOD_POST = 'post' + METHOD_PUT = 'put' + METHOD_PATCH = 'patch' + METHOD_DELETE = 'delete' + METHOD_HEAD = 'head' + METHOD_OPTIONS = 'options' + METHOD_CONNECT = 'connect' + METHOD_TRACE = 'trace' + + def initialize() + @headers = { + 'content-type' => '', + 'user-agent' => RUBY_PLATFORM + ':ruby-' + RUBY_VERSION, + 'x-sdk-version' => 'appwrite:ruby:1.0.11' + } + @endpoint = 'https://appwrite.io/v1'; + end + + def set_project(value) + add_header('x-appwrite-project', value) + + return self + end + + def set_key(value) + add_header('x-appwrite-key', value) + + return self + end + + def set_locale(value) + add_header('x-appwrite-locale', value) + + return self + end + + def set_endpoint(endpoint) + @endpoint = endpoint + + return self + end + + def add_header(key, value) + @headers[key.downcase] = value.downcase + + return self + end + + def call(method, path = '', headers = {}, params = {}) + uri = URI.parse(@endpoint + path + ((method == METHOD_GET && params.length) ? '?' + encode(params) : '')) + return fetch(method, uri, headers, params) + end + + protected + + private + + def fetch(method, uri, headers, params, limit = 5) + raise ArgumentError, 'Too Many HTTP Redirects' if limit == 0 + + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = (uri.scheme == 'https') + payload = '' + + headers = @headers.merge(headers) + + if (method != METHOD_GET) + case headers['content-type'][0, headers['content-type'].index(';') || headers['content-type'].length] + when 'application/json' + payload = params.to_json + else + payload = encode(params) + end + end + + begin + response = http.send_request(method.upcase, uri.request_uri, payload, headers) + rescue => error + raise 'Request Failed: ' + error.message + end + + # Handle Redirects + if (response.class == Net::HTTPRedirection || response.class == Net::HTTPMovedPermanently) + location = response['location'] + uri = URI.parse(uri.scheme + "://" + uri.host + "" + location) + + return fetch(method, uri, headers, {}, limit - 1) + end + + return JSON.parse(response.body); + end + + def encode(value, key = nil) + case value + when Hash then value.map { |k,v| encode(v, append_key(key,k)) }.join('&') + when Array then value.map { |v| encode(v, "#{key}[]") }.join('&') + when nil then '' + else + "#{key}=#{CGI.escape(value.to_s)}" + end + end + + def append_key(root_key, key) + root_key.nil? ? key : "#{root_key}[#{key.to_s}]" + end + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/service.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/service.rb new file mode 100644 index 0000000000..0d954c6d17 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/service.rb @@ -0,0 +1,12 @@ +module Appwrite + class Service + + def initialize(client) + @client = client + end + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/avatars.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/avatars.rb new file mode 100644 index 0000000000..afc94c20c3 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/avatars.rb @@ -0,0 +1,111 @@ +module Appwrite + class Avatars < Service + + def get_browser(code:, width: 100, height: 100, quality: 100) + path = '/avatars/browsers/{code}' + .gsub('{code}', code) + + params = { + 'width': width, + 'height': height, + 'quality': quality + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_credit_card(code:, width: 100, height: 100, quality: 100) + path = '/avatars/credit-cards/{code}' + .gsub('{code}', code) + + params = { + 'width': width, + 'height': height, + 'quality': quality + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_favicon(url:) + path = '/avatars/favicon' + + params = { + 'url': url + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_flag(code:, width: 100, height: 100, quality: 100) + path = '/avatars/flags/{code}' + .gsub('{code}', code) + + params = { + 'width': width, + 'height': height, + 'quality': quality + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_image(url:, width: 400, height: 400) + path = '/avatars/image' + + params = { + 'url': url, + 'width': width, + 'height': height + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_initials(name: '', width: 500, height: 500, color: '', background: '') + path = '/avatars/initials' + + params = { + 'name': name, + 'width': width, + 'height': height, + 'color': color, + 'background': background + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_q_r(text:, size: 400, margin: 1, download: false) + path = '/avatars/qr' + + params = { + 'text': text, + 'size': size, + 'margin': margin, + 'download': download + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/database.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/database.rb new file mode 100644 index 0000000000..41a151c73a --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/database.rb @@ -0,0 +1,158 @@ +module Appwrite + class Database < Service + + def list_collections(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/database/collections' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_collection(name:, read:, write:, rules:) + path = '/database/collections' + + params = { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_collection(collection_id:) + path = '/database/collections/{collectionId}' + .gsub('{collectionId}', collection_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_collection(collection_id:, name:, read:, write:, rules: []) + path = '/database/collections/{collectionId}' + .gsub('{collectionId}', collection_id) + + params = { + 'name': name, + 'read': read, + 'write': write, + 'rules': rules + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_collection(collection_id:) + path = '/database/collections/{collectionId}' + .gsub('{collectionId}', collection_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def list_documents(collection_id:, filters: [], limit: 25, offset: 0, order_field: '', order_type: 'ASC', order_cast: 'string', search: '') + path = '/database/collections/{collectionId}/documents' + .gsub('{collectionId}', collection_id) + + params = { + 'filters': filters, + 'limit': limit, + 'offset': offset, + 'orderField': order_field, + 'orderType': order_type, + 'orderCast': order_cast, + 'search': search + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_document(collection_id:, data:, read:, write:, parent_document: '', parent_property: '', parent_property_type: 'assign') + path = '/database/collections/{collectionId}/documents' + .gsub('{collectionId}', collection_id) + + params = { + 'data': data, + 'read': read, + 'write': write, + 'parentDocument': parent_document, + 'parentProperty': parent_property, + 'parentPropertyType': parent_property_type + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_document(collection_id:, document_id:) + path = '/database/collections/{collectionId}/documents/{documentId}' + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_document(collection_id:, document_id:, data:, read:, write:) + path = '/database/collections/{collectionId}/documents/{documentId}' + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + params = { + 'data': data, + 'read': read, + 'write': write + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_document(collection_id:, document_id:) + path = '/database/collections/{collectionId}/documents/{documentId}' + .gsub('{collectionId}', collection_id) + .gsub('{documentId}', document_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/functions.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/functions.rb new file mode 100644 index 0000000000..3d133efc9d --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/functions.rb @@ -0,0 +1,192 @@ +module Appwrite + class Functions < Service + + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/functions' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create(name:, env:, vars: [], events: [], schedule: '', timeout: 15) + path = '/functions' + + params = { + 'name': name, + 'env': env, + 'vars': vars, + 'events': events, + 'schedule': schedule, + 'timeout': timeout + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get(function_id:) + path = '/functions/{functionId}' + .gsub('{functionId}', function_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update(function_id:, name:, vars: [], events: [], schedule: '', timeout: 15) + path = '/functions/{functionId}' + .gsub('{functionId}', function_id) + + params = { + 'name': name, + 'vars': vars, + 'events': events, + 'schedule': schedule, + 'timeout': timeout + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete(function_id:) + path = '/functions/{functionId}' + .gsub('{functionId}', function_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def list_executions(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/functions/{functionId}/executions' + .gsub('{functionId}', function_id) + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_execution(function_id:) + path = '/functions/{functionId}/executions' + .gsub('{functionId}', function_id) + + params = { + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_execution(function_id:, execution_id:) + path = '/functions/{functionId}/executions/{executionId}' + .gsub('{functionId}', function_id) + .gsub('{executionId}', execution_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_tag(function_id:, tag:) + path = '/functions/{functionId}/tag' + .gsub('{functionId}', function_id) + + params = { + 'tag': tag + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + def list_tags(function_id:, search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/functions/{functionId}/tags' + .gsub('{functionId}', function_id) + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_tag(function_id:, command:, code:) + path = '/functions/{functionId}/tags' + .gsub('{functionId}', function_id) + + params = { + 'command': command, + 'code': code + } + + return @client.call('post', path, { + 'content-type' => 'multipart/form-data', + }, params); + end + + def get_tag(function_id:, tag_id:) + path = '/functions/{functionId}/tags/{tagId}' + .gsub('{functionId}', function_id) + .gsub('{tagId}', tag_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_tag(function_id:, tag_id:) + path = '/functions/{functionId}/tags/{tagId}' + .gsub('{functionId}', function_id) + .gsub('{tagId}', tag_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/health.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/health.rb new file mode 100644 index 0000000000..d2c6bc7b60 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/health.rb @@ -0,0 +1,141 @@ +module Appwrite + class Health < Service + + def get() + path = '/health' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_anti_virus() + path = '/health/anti-virus' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_cache() + path = '/health/cache' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_d_b() + path = '/health/db' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_certificates() + path = '/health/queue/certificates' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_functions() + path = '/health/queue/functions' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_logs() + path = '/health/queue/logs' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_tasks() + path = '/health/queue/tasks' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_usage() + path = '/health/queue/usage' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_queue_webhooks() + path = '/health/queue/webhooks' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_storage_local() + path = '/health/storage/local' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_time() + path = '/health/time' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/locale.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/locale.rb new file mode 100644 index 0000000000..e71756b2a7 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/locale.rb @@ -0,0 +1,86 @@ +module Appwrite + class Locale < Service + + def get() + path = '/locale' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_continents() + path = '/locale/continents' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_countries() + path = '/locale/countries' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_countries_e_u() + path = '/locale/countries/eu' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_countries_phones() + path = '/locale/countries/phones' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_currencies() + path = '/locale/currencies' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_languages() + path = '/locale/languages' + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/storage.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/storage.rb new file mode 100644 index 0000000000..0e99a2b0d5 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/storage.rb @@ -0,0 +1,118 @@ +module Appwrite + class Storage < Service + + def list_files(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/storage/files' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_file(file:, read:, write:) + path = '/storage/files' + + params = { + 'file': file, + 'read': read, + 'write': write + } + + return @client.call('post', path, { + 'content-type' => 'multipart/form-data', + }, params); + end + + def get_file(file_id:) + path = '/storage/files/{fileId}' + .gsub('{fileId}', file_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_file(file_id:, read:, write:) + path = '/storage/files/{fileId}' + .gsub('{fileId}', file_id) + + params = { + 'read': read, + 'write': write + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_file(file_id:) + path = '/storage/files/{fileId}' + .gsub('{fileId}', file_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_file_download(file_id:) + path = '/storage/files/{fileId}/download' + .gsub('{fileId}', file_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_file_preview(file_id:, width: 0, height: 0, quality: 100, background: '', output: '') + path = '/storage/files/{fileId}/preview' + .gsub('{fileId}', file_id) + + params = { + 'width': width, + 'height': height, + 'quality': quality, + 'background': background, + 'output': output + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_file_view(file_id:, as: '') + path = '/storage/files/{fileId}/view' + .gsub('{fileId}', file_id) + + params = { + 'as': as + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/teams.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/teams.rb new file mode 100644 index 0000000000..0480a4507e --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/teams.rb @@ -0,0 +1,119 @@ +module Appwrite + class Teams < Service + + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/teams' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create(name:, roles: ["owner"]) + path = '/teams' + + params = { + 'name': name, + 'roles': roles + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get(team_id:) + path = '/teams/{teamId}' + .gsub('{teamId}', team_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update(team_id:, name:) + path = '/teams/{teamId}' + .gsub('{teamId}', team_id) + + params = { + 'name': name + } + + return @client.call('put', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete(team_id:) + path = '/teams/{teamId}' + .gsub('{teamId}', team_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_memberships(team_id:, search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/teams/{teamId}/memberships' + .gsub('{teamId}', team_id) + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create_membership(team_id:, email:, roles:, url:, name: '') + path = '/teams/{teamId}/memberships' + .gsub('{teamId}', team_id) + + params = { + 'email': email, + 'name': name, + 'roles': roles, + 'url': url + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_membership(team_id:, invite_id:) + path = '/teams/{teamId}/memberships/{inviteId}' + .gsub('{teamId}', team_id) + .gsub('{inviteId}', invite_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file diff --git a/app/sdks/0.7.0/server-ruby/lib/appwrite/services/users.rb b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/users.rb new file mode 100644 index 0000000000..3c70843519 --- /dev/null +++ b/app/sdks/0.7.0/server-ruby/lib/appwrite/services/users.rb @@ -0,0 +1,149 @@ +module Appwrite + class Users < Service + + def list(search: '', limit: 25, offset: 0, order_type: 'ASC') + path = '/users' + + params = { + 'search': search, + 'limit': limit, + 'offset': offset, + 'orderType': order_type + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def create(email:, password:, name: '') + path = '/users' + + params = { + 'email': email, + 'password': password, + 'name': name + } + + return @client.call('post', path, { + 'content-type' => 'application/json', + }, params); + end + + def get(user_id:) + path = '/users/{userId}' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_user(user_id:) + path = '/users/{userId}' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_logs(user_id:) + path = '/users/{userId}/logs' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_prefs(user_id:) + path = '/users/{userId}/prefs' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_prefs(user_id:, prefs:) + path = '/users/{userId}/prefs' + .gsub('{userId}', user_id) + + params = { + 'prefs': prefs + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + def get_sessions(user_id:) + path = '/users/{userId}/sessions' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('get', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_sessions(user_id:) + path = '/users/{userId}/sessions' + .gsub('{userId}', user_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def delete_session(user_id:, session_id:) + path = '/users/{userId}/sessions/{sessionId}' + .gsub('{userId}', user_id) + .gsub('{sessionId}', session_id) + + params = { + } + + return @client.call('delete', path, { + 'content-type' => 'application/json', + }, params); + end + + def update_status(user_id:, status:) + path = '/users/{userId}/status' + .gsub('{userId}', user_id) + + params = { + 'status': status + } + + return @client.call('patch', path, { + 'content-type' => 'application/json', + }, params); + end + + + protected + + private + end +end \ No newline at end of file