From 9fdfdbdc4b4ba4958a83870bcabc4e22cf1ef770 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 8 Mar 2021 17:00:39 +0545 Subject: [PATCH 01/52] getting started in the SDKs --- app/tasks/sdks.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index f8d4ed397..be99b7d15 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -67,6 +67,8 @@ $cli $target = \realpath(__DIR__.'/..').'/sdks/git/'.$language['key'].'/'; $readme = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/README.md'); $readme = ($readme) ? \file_get_contents($readme) : ''; + $gettingStarted = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/GETTING_STARTED.md'); + $gettingStarted = ($gettingStarted) ? \file_get_contents($gettingStarted) : ''; $examples = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/EXAMPLES.md'); $examples = ($examples) ? \file_get_contents($examples) : ''; $changelog = \realpath(__DIR__ . '/../../docs/sdks/'.$language['key'].'/CHANGELOG.md'); @@ -188,6 +190,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ->setShareVia('appwrite_io') ->setWarning($warning) ->setReadme($readme) + ->setGettingStarted($gettingStarted) ->setChangelog($changelog) ->setExamples($examples) ; From b087d8ffc3343d74a5daa36ab827c1875b30b6bc Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 8 Mar 2021 17:04:18 +0545 Subject: [PATCH 02/52] dart getting started section --- composer.json | 2 +- composer.lock | 97 ++++++++++++++----------------- docs/sdks/dart/GETTING_STARTED.md | 31 ++++++++++ 3 files changed, 76 insertions(+), 54 deletions(-) create mode 100644 docs/sdks/dart/GETTING_STARTED.md diff --git a/composer.json b/composer.json index 1e8954e04..39e8a0416 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "slickdeals/statsd": "~3.0" }, "require-dev": { - "appwrite/sdk-generator": "0.6.2", + "appwrite/sdk-generator": "dev-master", "phpunit/phpunit": "9.4.2", "swoole/ide-helper": "4.5.5", "vimeo/psalm": "4.1.1" diff --git a/composer.lock b/composer.lock index 41cf579ab..691ed7386 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "442d6d8b6c76ef7ae5ea26e500af6479", + "content-hash": "a328295b2b11cf89bbae0f3a8d9143ee", "packages": [ { "name": "adhocore/jwt", @@ -466,12 +466,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "ddfeedfff2a52661429437da0702979f708e6ac6" + "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/ddfeedfff2a52661429437da0702979f708e6ac6", - "reference": "ddfeedfff2a52661429437da0702979f708e6ac6", + "url": "https://api.github.com/repos/guzzle/promises/zipball/8e7d04f1f6450fef59366c399cfad4b9383aa30d", + "reference": "8e7d04f1f6450fef59366c399cfad4b9383aa30d", "shasum": "" }, "require": { @@ -512,9 +512,9 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/master" + "source": "https://github.com/guzzle/promises/tree/1.4.1" }, - "time": "2020-10-19T16:50:15+00:00" + "time": "2021-03-07T09:25:29+00:00" }, { "name": "guzzlehttp/psr7", @@ -522,12 +522,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "2f3e4f6cf8fd4aad7624c90a94f0ab38fde25976" + "reference": "64245c4a03d43ddb638c4ff0b2d330c2af726ec5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/2f3e4f6cf8fd4aad7624c90a94f0ab38fde25976", - "reference": "2f3e4f6cf8fd4aad7624c90a94f0ab38fde25976", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/64245c4a03d43ddb638c4ff0b2d330c2af726ec5", + "reference": "64245c4a03d43ddb638c4ff0b2d330c2af726ec5", "shasum": "" }, "require": { @@ -589,7 +589,7 @@ "issues": "https://github.com/guzzle/psr7/issues", "source": "https://github.com/guzzle/psr7/tree/1.x" }, - "time": "2021-03-02T18:57:24+00:00" + "time": "2021-03-07T16:17:45+00:00" }, { "name": "influxdb/influxdb-php", @@ -2063,20 +2063,20 @@ }, { "name": "webmozart/assert", - "version": "dev-master", + "version": "1.9.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "4631e2c7d2d7132adac9fd84d4c1a98c10a6e049" + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/4631e2c7d2d7132adac9fd84d4c1a98c10a6e049", - "reference": "4631e2c7d2d7132adac9fd84d4c1a98c10a6e049", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", + "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^5.3.3 || ^7.0 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -2084,15 +2084,9 @@ "vimeo/psalm": "<3.9.1" }, "require-dev": { - "phpunit/phpunit": "^8.5.13" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, - "default-branch": true, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.10-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2116,9 +2110,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/master" + "source": "https://github.com/webmozarts/assert/tree/1.9.1" }, - "time": "2021-02-28T20:01:57+00:00" + "time": "2020-07-08T17:02:28+00:00" } ], "packages-dev": [ @@ -2292,11 +2286,11 @@ }, { "name": "appwrite/sdk-generator", - "version": "0.6.2", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "d96376295c9265a054634d21dcdbfc02b832c677" + "reference": "583248c57c5bcbd9c74f8312cc7fc3ab6cda51a3" }, "require": { "ext-curl": "*", @@ -2309,6 +2303,7 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, + "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -2326,7 +2321,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2021-03-03T12:53:32+00:00" + "time": "2021-03-07T08:45:05+00:00" }, { "name": "composer/package-versions-deprecated", @@ -3277,12 +3272,12 @@ "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "e3324ecbde7319b0bbcf0fd7ca4af19469c38da9" + "reference": "f8d350d8514ff60b5993dd0121c62299480c989c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e3324ecbde7319b0bbcf0fd7ca4af19469c38da9", - "reference": "e3324ecbde7319b0bbcf0fd7ca4af19469c38da9", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/f8d350d8514ff60b5993dd0121c62299480c989c", + "reference": "f8d350d8514ff60b5993dd0121c62299480c989c", "shasum": "" }, "require": { @@ -3326,7 +3321,7 @@ "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" }, - "time": "2020-11-18T14:27:38+00:00" + "time": "2021-03-07T11:12:25+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3872,28 +3867,22 @@ }, { "name": "psr/container", - "version": "dev-master", + "version": "1.1.x-dev", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "381524e8568e07f31d504a945b88556548c8c42e" + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/381524e8568e07f31d504a945b88556548c8c42e", - "reference": "381524e8568e07f31d504a945b88556548c8c42e", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", "shasum": "" }, "require": { "php": ">=7.2.0" }, - "default-branch": true, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -3920,9 +3909,9 @@ ], "support": { "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/master" + "source": "https://github.com/php-fig/container/tree/1.1.x" }, - "time": "2020-10-13T07:07:53+00:00" + "time": "2021-03-05T17:36:06+00:00" }, { "name": "sebastian/cli-parser", @@ -4944,12 +4933,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c08d7d0d458eceb62996d81d3be8d9fbf5564ec4" + "reference": "92e1b7c4381c3c51e327b99c7ff067411e291783" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c08d7d0d458eceb62996d81d3be8d9fbf5564ec4", - "reference": "c08d7d0d458eceb62996d81d3be8d9fbf5564ec4", + "url": "https://api.github.com/repos/symfony/console/zipball/92e1b7c4381c3c51e327b99c7ff067411e291783", + "reference": "92e1b7c4381c3c51e327b99c7ff067411e291783", "shasum": "" }, "require": { @@ -5034,7 +5023,7 @@ "type": "tidelift" } ], - "time": "2021-02-23T10:10:15+00:00" + "time": "2021-03-06T13:50:37+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -5454,17 +5443,17 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "e830e6ceebd6377b019e4c9a523d6f2c27007e4a" + "reference": "96cd360b9f03a22a30cf5354e630c557bd3aac33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/e830e6ceebd6377b019e4c9a523d6f2c27007e4a", - "reference": "e830e6ceebd6377b019e4c9a523d6f2c27007e4a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/96cd360b9f03a22a30cf5354e630c557bd3aac33", + "reference": "96cd360b9f03a22a30cf5354e630c557bd3aac33", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.0" + "psr/container": "^1.1" }, "suggest": { "symfony/service-implementation": "" @@ -5526,7 +5515,7 @@ "type": "tidelift" } ], - "time": "2021-02-25T16:38:04+00:00" + "time": "2021-03-05T22:51:52+00:00" }, { "name": "symfony/string", @@ -5900,7 +5889,9 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": [], + "stability-flags": { + "appwrite/sdk-generator": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md new file mode 100644 index 000000000..02923733c --- /dev/null +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -0,0 +1,31 @@ +## Getting Started + +[Add Appwrite](https://github.com/appwrite/sdk-for-dart) SDK to your project’s **pubspec.yaml** dependencies. + +```yaml +dependencies: + Dart_appwrite: ^0.1.0 +``` + +Then get the dependencies by running +```bash +dart pub get +``` + +### Initialize & Make API Request +Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example: + +```dart +import 'package:dart_appwrite/dart_appwrite.dart'; + +void main() async { + Client client = Client(); + .setEndpoint( + 'http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible + .setProject('5ff3379a01d25') // Your project ID + .setKey('cd868c7af8bdc893b4...93b7535db89') + Users users = Users(client); + final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); + print(response.data); +} +``` \ No newline at end of file From e157ac95844031933d1f935353bafb7196825046 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 10 Mar 2021 07:21:25 +0545 Subject: [PATCH 03/52] updates --- docs/sdks/dart/GETTING_STARTED.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 02923733c..02a3aa631 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -1,17 +1,5 @@ ## Getting Started -[Add Appwrite](https://github.com/appwrite/sdk-for-dart) SDK to your project’s **pubspec.yaml** dependencies. - -```yaml -dependencies: - Dart_appwrite: ^0.1.0 -``` - -Then get the dependencies by running -```bash -dart pub get -``` - ### Initialize & Make API Request Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example: @@ -24,7 +12,9 @@ void main() async { 'http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible .setProject('5ff3379a01d25') // Your project ID .setKey('cd868c7af8bdc893b4...93b7535db89') + Users users = Users(client); + final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); print(response.data); } From 13c7ded9dbec689c49a852c7e9e4ef77de24a148 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 10 Mar 2021 12:29:28 +0545 Subject: [PATCH 04/52] Flutter getting started --- docs/sdks/flutter/GETTING_STARTED.md | 112 +++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 docs/sdks/flutter/GETTING_STARTED.md diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md new file mode 100644 index 000000000..bd9b63578 --- /dev/null +++ b/docs/sdks/flutter/GETTING_STARTED.md @@ -0,0 +1,112 @@ +## Getting Started for Flutter + +### Create Your First Appwrite Project +Go to your new Appwrite console, and once inside, click the (plus) icon in the top navigation header or on the **'Create Project'** button on your console homepage. Choose a name for your project and click create to get started. + +### Add your Flutter Platform +To init your SDK and start interacting with Appwrite services, you need to add a new Flutter platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button. + +From the options, choose to add a new **Flutter** platform and add your app credentials. Appwrite Flutter SDK currently supports building apps for both iOS and Android. + +If you are building your Flutter application for multiple devices, you have to follow this process for each different device. + +### iOS +For **iOS** add your app name and Bundle ID, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode. + +### Android +For **Android** add your app name and package name, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API. + +#### iOS + +The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthenticationSession on iOS 11 to allow OAuth authentication. You have to change your iOS Deployment Target in Xcode to be iOS >= 11 to be able to build your app on an emulator or a real device. + +1. In Xcode, open Runner.xcworkspace in your app's ios folder. +2. To view your app's settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select the Runner target. +3. Select the General tab. +4. In Deployment Info, 'Target' select iOS 11.0 + +### Android +In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console. + +``` + + + + + + + + + + + + +``` + +#### Web +Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.

+ +### Flutter Web Cross-Domain Communication & Cookies +

While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple custom-domains for each project.

+ +### Init your SDK + +

Initialize your SDK code with your project ID, which can be found in your project settings page. + +``` +import 'package:appwrite/appwrite.dart'; +Client client = Client(); + + +client +.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint +.setProject('5e8cf4f46b5e8') // Your project ID +.setSelfSigned() // Remove in production +; +``` + +

Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address.

When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like ngrok to proxy the Appwrite API.

+ +### Make Your First Request + +

Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +``` +// Register User +Account account = Account(client); +Response user = await account +.create( +email: 'me@appwrite.io', +password: 'password', +name: 'My Name' +); +``` + +### Full Example + +``` +import 'package:appwrite/appwrite.dart'; +Client client = Client(); + + +client +.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint +.setProject('5e8cf4f46b5e8') // Your project ID +.setSelfSigned() // Remove in production +; + + +// Register User +Account account = Account(client); + + +Response user = await account +.create( +email: 'me@appwrite.io', +password: 'password', +name: 'My Name' +); +``` + +### Next Steps +Appwrite has many services and tools to help improve your app and speed up your development. The best way to learn how you can take advantage of them is to explore the different API references docs. \ No newline at end of file From 3f96ff85b8e7771c0f175fd6e8da8a587f1e8ac2 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 10 Mar 2021 12:38:51 +0545 Subject: [PATCH 05/52] deno getting started --- docs/sdks/deno/GETTING_STARTED.md | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 docs/sdks/deno/GETTING_STARTED.md diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md new file mode 100644 index 000000000..c9865ea38 --- /dev/null +++ b/docs/sdks/deno/GETTING_STARTED.md @@ -0,0 +1,53 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. + +```typescript +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +``` + +### Make your first request + +Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +```typescript +let users = new sdk.Users(client); + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Full Example +```typescript +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +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 From a70977f27f4205cbf527f47e4c59ba337e6b1552 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 10:27:07 +0545 Subject: [PATCH 06/52] exception and small fixes --- docs/sdks/dart/GETTING_STARTED.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 02a3aa631..fb58f0bbc 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -8,14 +8,17 @@ import 'package:dart_appwrite/dart_appwrite.dart'; void main() async { Client client = Client(); - .setEndpoint( - 'http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible + .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible .setProject('5ff3379a01d25') // Your project ID .setKey('cd868c7af8bdc893b4...93b7535db89') Users users = Users(client); - final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); - print(response.data); + try { + final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); + print(response.data); + } on AppwriteException catch(e) { + print(e.message); + } } ``` \ No newline at end of file From af8c52087b9894e1163554ba765faf235ee2e649 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 10:38:40 +0545 Subject: [PATCH 07/52] learn more section dart SDK --- docs/sdks/dart/GETTING_STARTED.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index fb58f0bbc..78d7c4972 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -21,4 +21,10 @@ void main() async { print(e.message); } } -``` \ No newline at end of file +``` + +### Learn more +You can use followng resources to learn more and get help +- [Appwrite Docs](https://appwrite.io/docs) +- [Discord Community](https://appwrite.io/discord) +- [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file From ce17d5d8860a313d8efeb0da5a492a1e74725c9d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 10:39:49 +0545 Subject: [PATCH 08/52] learn more section in Deno SDK --- docs/sdks/deno/GETTING_STARTED.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md index c9865ea38..d06f5ff58 100644 --- a/docs/sdks/deno/GETTING_STARTED.md +++ b/docs/sdks/deno/GETTING_STARTED.md @@ -50,4 +50,10 @@ promise.then(function (response) { }, function (error) { console.log(error); }); -``` \ No newline at end of file +``` + +### Learn more +You can use followng resources to learn more and get help +- [Appwrite Docs](https://appwrite.io/docs) +- [Discord Community](https://appwrite.io/discord) +- [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) \ No newline at end of file From 90fc752ffeec619566eabee6f4a8dcb64841cb0d Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 10:41:16 +0545 Subject: [PATCH 09/52] flutter sdk learn more section --- docs/sdks/flutter/GETTING_STARTED.md | 29 +++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md index bd9b63578..c66ec5c09 100644 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ b/docs/sdks/flutter/GETTING_STARTED.md @@ -28,18 +28,18 @@ The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthentication ### Android In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console. -``` +```xml - - - - - - - - - - + + + + + + + + + + ``` @@ -108,5 +108,8 @@ name: 'My Name' ); ``` -### Next Steps -Appwrite has many services and tools to help improve your app and speed up your development. The best way to learn how you can take advantage of them is to explore the different API references docs. \ No newline at end of file +### Learn more +You can use followng resources to learn more and get help +- [Appwrite Docs](https://appwrite.io/docs) +- [Discord Community](https://appwrite.io/discord) +- [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter) \ No newline at end of file From 6295bdba86e99268fa6103a52940d4395d21e052 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 13:49:59 +0545 Subject: [PATCH 10/52] remove other files --- docs/sdks/deno/GETTING_STARTED.md | 59 -------------- docs/sdks/flutter/GETTING_STARTED.md | 115 --------------------------- 2 files changed, 174 deletions(-) delete mode 100644 docs/sdks/deno/GETTING_STARTED.md delete mode 100644 docs/sdks/flutter/GETTING_STARTED.md diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md deleted file mode 100644 index d06f5ff58..000000000 --- a/docs/sdks/deno/GETTING_STARTED.md +++ /dev/null @@ -1,59 +0,0 @@ -## Getting Started - -### Init your SDK -Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. - -```typescript -let client = new sdk.Client(); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - -``` - -### Make your first request - -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. - -```typescript -let users = new sdk.Users(client); - -let promise = users.create('email@example.com', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); -``` - -### Full Example -```typescript -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -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); -}); -``` - -### Learn more -You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) \ No newline at end of file diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md deleted file mode 100644 index c66ec5c09..000000000 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ /dev/null @@ -1,115 +0,0 @@ -## Getting Started for Flutter - -### Create Your First Appwrite Project -Go to your new Appwrite console, and once inside, click the (plus) icon in the top navigation header or on the **'Create Project'** button on your console homepage. Choose a name for your project and click create to get started. - -### Add your Flutter Platform -To init your SDK and start interacting with Appwrite services, you need to add a new Flutter platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button. - -From the options, choose to add a new **Flutter** platform and add your app credentials. Appwrite Flutter SDK currently supports building apps for both iOS and Android. - -If you are building your Flutter application for multiple devices, you have to follow this process for each different device. - -### iOS -For **iOS** add your app name and Bundle ID, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode. - -### Android -For **Android** add your app name and package name, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API. - -#### iOS - -The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthenticationSession on iOS 11 to allow OAuth authentication. You have to change your iOS Deployment Target in Xcode to be iOS >= 11 to be able to build your app on an emulator or a real device. - -1. In Xcode, open Runner.xcworkspace in your app's ios folder. -2. To view your app's settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select the Runner target. -3. Select the General tab. -4. In Deployment Info, 'Target' select iOS 11.0 - -### Android -In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console. - -```xml - - - - - - - - - - - - -``` - -#### Web -Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.

- -### Flutter Web Cross-Domain Communication & Cookies -

While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple custom-domains for each project.

- -### Init your SDK - -

Initialize your SDK code with your project ID, which can be found in your project settings page. - -``` -import 'package:appwrite/appwrite.dart'; -Client client = Client(); - - -client -.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint -.setProject('5e8cf4f46b5e8') // Your project ID -.setSelfSigned() // Remove in production -; -``` - -

Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address.

When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like ngrok to proxy the Appwrite API.

- -### Make Your First Request - -

Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. - -``` -// Register User -Account account = Account(client); -Response user = await account -.create( -email: 'me@appwrite.io', -password: 'password', -name: 'My Name' -); -``` - -### Full Example - -``` -import 'package:appwrite/appwrite.dart'; -Client client = Client(); - - -client -.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint -.setProject('5e8cf4f46b5e8') // Your project ID -.setSelfSigned() // Remove in production -; - - -// Register User -Account account = Account(client); - - -Response user = await account -.create( -email: 'me@appwrite.io', -password: 'password', -name: 'My Name' -); -``` - -### Learn more -You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter) \ No newline at end of file From 98d7d13f1611fc76e9be2dd99814be4232641cab Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 11 Mar 2021 14:38:44 +0545 Subject: [PATCH 11/52] remove other files --- docs/sdks/dart/GETTING_STARTED.md | 30 ---------------- docs/sdks/deno/GETTING_STARTED.md | 59 ------------------------------- 2 files changed, 89 deletions(-) delete mode 100644 docs/sdks/dart/GETTING_STARTED.md delete mode 100644 docs/sdks/deno/GETTING_STARTED.md diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md deleted file mode 100644 index 78d7c4972..000000000 --- a/docs/sdks/dart/GETTING_STARTED.md +++ /dev/null @@ -1,30 +0,0 @@ -## Getting Started - -### Initialize & Make API Request -Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example: - -```dart -import 'package:dart_appwrite/dart_appwrite.dart'; - -void main() async { - Client client = Client(); - .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible - .setProject('5ff3379a01d25') // Your project ID - .setKey('cd868c7af8bdc893b4...93b7535db89') - - Users users = Users(client); - - try { - final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); - print(response.data); - } on AppwriteException catch(e) { - print(e.message); - } -} -``` - -### Learn more -You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md deleted file mode 100644 index d06f5ff58..000000000 --- a/docs/sdks/deno/GETTING_STARTED.md +++ /dev/null @@ -1,59 +0,0 @@ -## Getting Started - -### Init your SDK -Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. - -```typescript -let client = new sdk.Client(); - -client - .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint - .setProject('5df5acd0d48c2') // Your project ID - .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key -; - -``` - -### Make your first request - -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. - -```typescript -let users = new sdk.Users(client); - -let promise = users.create('email@example.com', 'password'); - -promise.then(function (response) { - console.log(response); -}, function (error) { - console.log(error); -}); -``` - -### Full Example -```typescript -import * as sdk from "https://deno.land/x/appwrite/mod.ts"; - -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); -}); -``` - -### Learn more -You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) \ No newline at end of file From 16e446bbf5aa4491e6286d24d6f1a6c36235f722 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 14 Mar 2021 10:13:06 +0545 Subject: [PATCH 12/52] update sdk generator version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 39e8a0416..d4135536d 100644 --- a/composer.json +++ b/composer.json @@ -60,7 +60,7 @@ "slickdeals/statsd": "~3.0" }, "require-dev": { - "appwrite/sdk-generator": "dev-master", + "appwrite/sdk-generator": "0.6.3", "phpunit/phpunit": "9.4.2", "swoole/ide-helper": "4.5.5", "vimeo/psalm": "4.1.1" From 583b9c8c5c710bbbceaff56fcd89cd72aebbc387 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 14 Mar 2021 10:14:55 +0545 Subject: [PATCH 13/52] learn more section --- docs/sdks/dart/GETTING_STARTED.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 78d7c4972..50aaab0f8 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -25,6 +25,7 @@ void main() async { ### Learn more You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file +- [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file From 14e7a63287464f65d4417e2d7a631daa16c8636c Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 15 Mar 2021 09:08:24 +0545 Subject: [PATCH 14/52] getting started tutorial --- docs/sdks/dart/GETTING_STARTED.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 50aaab0f8..7a5e8340d 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -25,7 +25,7 @@ void main() async { ### Learn more You can use followng resources to learn more and get help -- [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) - 📜 [Appwrite Docs](https://appwrite.io/docs) - 💬 [Discord Community](https://appwrite.io/discord) -- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) \ No newline at end of file +- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dart) From 95ba49c1c0589cd3389764a7ea2c46fb2c8e60f3 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 15 Mar 2021 16:26:41 +0545 Subject: [PATCH 15/52] updates --- docs/sdks/flutter/GETTING_STARTED.md | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md index c66ec5c09..40da71b35 100644 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ b/docs/sdks/flutter/GETTING_STARTED.md @@ -1,7 +1,4 @@ -## Getting Started for Flutter - -### Create Your First Appwrite Project -Go to your new Appwrite console, and once inside, click the (plus) icon in the top navigation header or on the **'Create Project'** button on your console homepage. Choose a name for your project and click create to get started. +## Getting Started ### Add your Flutter Platform To init your SDK and start interacting with Appwrite services, you need to add a new Flutter platform to your project. To add a new platform, go to your Appwrite console, choose the project you created in the step before, and click the 'Add Platform' button. @@ -10,11 +7,11 @@ From the options, choose to add a new **Flutter** platform and add your app cred If you are building your Flutter application for multiple devices, you have to follow this process for each different device. -### iOS +#### iOS For **iOS** add your app name and Bundle ID, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode. ### Android -For **Android** add your app name and package name, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API. +For **Android** add your app name and package name, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API. #### iOS @@ -44,16 +41,16 @@ In order to capture the Appwrite OAuth callback url, the following activity need ``` #### Web -Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API.

+Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API. ### Flutter Web Cross-Domain Communication & Cookies -

While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple custom-domains for each project.

+While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple [custom-domains](https://appwrite.io/docs/custom-domains) for each project. ### Init your SDK

Initialize your SDK code with your project ID, which can be found in your project settings page. -``` +```dart import 'package:appwrite/appwrite.dart'; Client client = Client(); @@ -65,13 +62,15 @@ client ; ``` -

Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address.

When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like ngrok to proxy the Appwrite API.

+Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address. + +When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like ngrok to proxy the Appwrite API. ### Make Your First Request

Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. -``` +```dart // Register User Account account = Account(client); Response user = await account @@ -84,7 +83,7 @@ name: 'My Name' ### Full Example -``` +```dart import 'package:appwrite/appwrite.dart'; Client client = Client(); @@ -110,6 +109,7 @@ name: 'My Name' ### Learn more You can use followng resources to learn more and get help -- [Appwrite Docs](https://appwrite.io/docs) -- [Discord Community](https://appwrite.io/discord) -- [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter) \ No newline at end of file +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter) \ No newline at end of file From b250364562c341aef868d83a6e3d18b7334d4fd2 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 15 Mar 2021 16:29:13 +0545 Subject: [PATCH 16/52] updates to docs --- docs/sdks/flutter/GETTING_STARTED.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md index 40da71b35..5320dba38 100644 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ b/docs/sdks/flutter/GETTING_STARTED.md @@ -23,7 +23,7 @@ The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthentication 4. In Deployment Info, 'Target' select iOS 11.0 ### Android -In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your AndroidManifest.xml. Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console. +In order to capture the Appwrite OAuth callback url, the following activity needs to be added to your [AndroidManifest.xml](https://github.com/appwrite/playground-for-flutter/blob/master/android/app/src/main/AndroidManifest.xml). Be sure to relpace the **[PROJECT_ID]** string with your actual Appwrite project ID. You can find your Appwrite project ID in you project settings screen in your Appwrite console. ```xml @@ -64,7 +64,7 @@ client Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address. -When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like ngrok to proxy the Appwrite API. +When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like [ngrok](https://ngrok.com/) to proxy the Appwrite API. ### Make Your First Request From 57a3978d7d1350745fc000054de4d7d69fbd45f1 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 16 Mar 2021 15:03:16 +0545 Subject: [PATCH 17/52] fix indentation and headings --- docs/sdks/flutter/GETTING_STARTED.md | 43 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md index 5320dba38..9dae492f7 100644 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ b/docs/sdks/flutter/GETTING_STARTED.md @@ -10,10 +10,10 @@ If you are building your Flutter application for multiple devices, you have to f #### iOS For **iOS** add your app name and Bundle ID, You can find your Bundle Identifier in the General tab for your app's primary target in Xcode. -### Android +#### Android For **Android** add your app name and package name, Your package name is generally the applicationId in your app-level build.gradle file. By registering your new app platform, you are allowing your app to communicate with the Appwrite API. -#### iOS +### iOS The Appwrite SDK uses ASWebAuthenticationSession on iOS 12+ and SFAuthenticationSession on iOS 11 to allow OAuth authentication. You have to change your iOS Deployment Target in Xcode to be iOS >= 11 to be able to build your app on an emulator or a real device. @@ -40,10 +40,10 @@ In order to capture the Appwrite OAuth callback url, the following activity need ``` -#### Web +### Web Appwrite 0.7, and the Appwrite Flutter SDK 0.3.0 have added support for Flutter Web. To build web apps that integrate with Appwrite successfully, all you have to do is add a web platform on your Appwrite project's dashboard and list the domain your website will use to allow communication to the Appwrite API. -### Flutter Web Cross-Domain Communication & Cookies +#### Flutter Web Cross-Domain Communication & Cookies While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple [custom-domains](https://appwrite.io/docs/custom-domains) for each project. ### Init your SDK @@ -56,9 +56,9 @@ Client client = Client(); client -.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint -.setProject('5e8cf4f46b5e8') // Your project ID -.setSelfSigned() // Remove in production + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production ; ``` @@ -74,11 +74,11 @@ When trying to connect to Appwrite from an emulator or a mobile device, localhos // Register User Account account = Account(client); Response user = await account -.create( -email: 'me@appwrite.io', -password: 'password', -name: 'My Name' -); + .create( + email: 'me@appwrite.io', + password: 'password', + name: 'My Name' + ); ``` ### Full Example @@ -89,22 +89,21 @@ Client client = Client(); client -.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint -.setProject('5e8cf4f46b5e8') // Your project ID -.setSelfSigned() // Remove in production -; + .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint + .setProject('5e8cf4f46b5e8') // Your project ID + .setSelfSigned() // Remove in production + ; // Register User Account account = Account(client); - Response user = await account -.create( -email: 'me@appwrite.io', -password: 'password', -name: 'My Name' -); + .create( + email: 'me@appwrite.io', + password: 'password', + name: 'My Name' + ); ``` ### Learn more From 655cc593762fbba9bdb811028fba48d600c27802 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 16 Mar 2021 17:51:17 +0545 Subject: [PATCH 18/52] deno getting started --- docs/sdks/deno/GETTING_STARTED.md | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/sdks/deno/GETTING_STARTED.md diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md new file mode 100644 index 000000000..9c9698e7c --- /dev/null +++ b/docs/sdks/deno/GETTING_STARTED.md @@ -0,0 +1,60 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. + +```typescript +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +``` + +### Make your first request + +Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +```typescript +let users = new sdk.Users(client); + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Full Example +```typescript +import * as sdk from "https://deno.land/x/appwrite/mod.ts"; + +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); +}); +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) \ No newline at end of file From 21da9e3d89f298c459a2b19aa0efda04517a9466 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 16 Mar 2021 19:03:08 +0545 Subject: [PATCH 19/52] PHP SDK getting started --- docs/sdks/php/GETTING_STARTED.md | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/sdks/php/GETTING_STARTED.md diff --git a/docs/sdks/php/GETTING_STARTED.md b/docs/sdks/php/GETTING_STARTED.md new file mode 100644 index 000000000..16f12896c --- /dev/null +++ b/docs/sdks/php/GETTING_STARTED.md @@ -0,0 +1,48 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. + +```php +$client = new Client(); + +$client + ->setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + ->setProject('5df5acd0d48c2') // Your project ID + ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; +``` + +### Make Your First Request +Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +```php +$users = new Users($client); + +$result = $users->create('email@example.com', 'password'); +``` + +### Full Example +```php +use Appwrite\Client; +use Appwrite\Services\Users; + +$client = new Client(); + +$client + ->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'); +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite PHP Playground](https://github.com/appwrite/playground-for-php) From 17b0c9ec9636e923af529a2193d2a9f2ff87d4db Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 16 Mar 2021 19:26:27 +0545 Subject: [PATCH 20/52] Python sdk getting started --- docs/sdks/python/GETTING_STARTED.md | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 docs/sdks/python/GETTING_STARTED.md diff --git a/docs/sdks/python/GETTING_STARTED.md b/docs/sdks/python/GETTING_STARTED.md new file mode 100644 index 000000000..195bf79de --- /dev/null +++ b/docs/sdks/python/GETTING_STARTED.md @@ -0,0 +1,51 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. + +```python +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 +) +``` + +### Make Your First Request +Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +```python +users = Users(client) + +result = users.create('email@example.com', 'password') +``` + +### Full Example +```python +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') +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Python Playground](https://github.com/appwrite/playground-for-python) From 4d9e021eb27ebd309a7801fb6b54501cb59cc68f Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 10:35:27 +0545 Subject: [PATCH 21/52] corrections --- docs/sdks/deno/GETTING_STARTED.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md index 9c9698e7c..2b27d950f 100644 --- a/docs/sdks/deno/GETTING_STARTED.md +++ b/docs/sdks/deno/GETTING_STARTED.md @@ -1,7 +1,7 @@ ## Getting Started ### Init your SDK -Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section. ```typescript let client = new sdk.Client(); @@ -57,4 +57,4 @@ You can use followng resources to learn more and get help - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) - 📜 [Appwrite Docs](https://appwrite.io/docs) - 💬 [Discord Community](https://appwrite.io/discord) -- 🚂 [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) \ No newline at end of file +- 🚂 [Appwrite Deno Playground](https://github.com/appwrite/playground-for-deno) From db7b7f537415320f3f88d134483ccacf98a754ae Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 10:36:02 +0545 Subject: [PATCH 22/52] text corrections --- docs/sdks/php/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/php/GETTING_STARTED.md b/docs/sdks/php/GETTING_STARTED.md index 16f12896c..d467dabac 100644 --- a/docs/sdks/php/GETTING_STARTED.md +++ b/docs/sdks/php/GETTING_STARTED.md @@ -1,7 +1,7 @@ ## Getting Started ### Init your SDK -Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section. ```php $client = new Client(); From 06edde5cafa96c20409caf8d4b37618b51c257c8 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 10:38:24 +0545 Subject: [PATCH 23/52] node sdk getting started --- docs/sdks/nodejs/GETTING_STARTED.md | 60 +++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 docs/sdks/nodejs/GETTING_STARTED.md diff --git a/docs/sdks/nodejs/GETTING_STARTED.md b/docs/sdks/nodejs/GETTING_STARTED.md new file mode 100644 index 000000000..b4096157c --- /dev/null +++ b/docs/sdks/nodejs/GETTING_STARTED.md @@ -0,0 +1,60 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key project API keys section. + +```js +const sdk = require('node-appwrite'); + +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; +``` + +### Make Your First Request +Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +```js +let users = new sdk.Users(client); + +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Full Example +```js +const sdk = require('node-appwrite'); + +let client = new sdk.Client(); + +client + .setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint + .setProject('5df5acd0d48c2') // Your project ID + .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key +; + +let users = new sdk.Users(client); +let promise = users.create('email@example.com', 'password'); + +promise.then(function (response) { + console.log(response); +}, function (error) { + console.log(error); +}); +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Node Playground](https://github.com/appwrite/playground-for-node) From b7538e0a6d191eb6206585edd8d0e6a49027d989 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 10:43:47 +0545 Subject: [PATCH 24/52] text corrections --- docs/sdks/python/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/python/GETTING_STARTED.md b/docs/sdks/python/GETTING_STARTED.md index 195bf79de..06e1221b6 100644 --- a/docs/sdks/python/GETTING_STARTED.md +++ b/docs/sdks/python/GETTING_STARTED.md @@ -1,7 +1,7 @@ ## Getting Started ### Init your SDK -Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from previous phase. +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section. ```python from appwrite.client import Client From 82e1ceb8a93f928b08e5a0af293bd9c9fa53fe79 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 18:29:20 +0545 Subject: [PATCH 25/52] fix grammar --- docs/sdks/deno/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md index 2b27d950f..f0b10ed37 100644 --- a/docs/sdks/deno/GETTING_STARTED.md +++ b/docs/sdks/deno/GETTING_STARTED.md @@ -16,7 +16,7 @@ client ### Make your first request -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. +Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. ```typescript let users = new sdk.Users(client); From ff1ebd0e3a9a03adb15fc11b5d9a90d4fee721fc Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 18:30:47 +0545 Subject: [PATCH 26/52] fix grammar --- docs/sdks/php/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/php/GETTING_STARTED.md b/docs/sdks/php/GETTING_STARTED.md index d467dabac..1fcfa35f6 100644 --- a/docs/sdks/php/GETTING_STARTED.md +++ b/docs/sdks/php/GETTING_STARTED.md @@ -14,7 +14,7 @@ $client ``` ### Make Your First Request -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. +Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. ```php $users = new Users($client); From d5be4f4c88c6b9678d407e95ec4b07cae0329be9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 18:31:40 +0545 Subject: [PATCH 27/52] fix grammar --- docs/sdks/python/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/python/GETTING_STARTED.md b/docs/sdks/python/GETTING_STARTED.md index 06e1221b6..6b16fa3a9 100644 --- a/docs/sdks/python/GETTING_STARTED.md +++ b/docs/sdks/python/GETTING_STARTED.md @@ -17,7 +17,7 @@ client = Client() ``` ### Make Your First Request -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. +Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. ```python users = Users(client) From 8547c4e5233543ceb07f50f4bb3067e22dfe56d1 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Wed, 17 Mar 2021 18:32:00 +0545 Subject: [PATCH 28/52] fix grammar --- docs/sdks/nodejs/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/nodejs/GETTING_STARTED.md b/docs/sdks/nodejs/GETTING_STARTED.md index b4096157c..af2564e21 100644 --- a/docs/sdks/nodejs/GETTING_STARTED.md +++ b/docs/sdks/nodejs/GETTING_STARTED.md @@ -16,7 +16,7 @@ client ``` ### Make Your First Request -Once your SDK object is set, create any of the Appwrite service project objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. +Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. ```js let users = new sdk.Users(client); From 886d303683f668f1266e33a8f151ad44c9484990 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 17 Mar 2021 22:43:54 +0200 Subject: [PATCH 29/52] Updated docs --- app/config/variables.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/config/variables.php b/app/config/variables.php index 369a860fe..cd7db9ba6 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -143,7 +143,7 @@ return [ ], [ 'name' => '_APP_REDIS_USER', - 'description' => 'Redis server user.', + 'description' => 'Redis server user. This is an optional variable. Default value is an empty string.', 'introduction' => '0.7', 'default' => '', 'required' => false, @@ -151,7 +151,7 @@ return [ ], [ 'name' => '_APP_REDIS_PASS', - 'description' => 'Redis server password.', + 'description' => 'Redis server password. This is an optional variable. Default value is an empty string.', 'introduction' => '0.7', 'default' => '', 'required' => false, From 185970a123101c5b702e63e03fd2331703009700 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Thu, 18 Mar 2021 17:07:12 +0545 Subject: [PATCH 30/52] fix workers for redis - user can be null --- bin/schedule | 2 +- bin/worker-audits | 2 +- bin/worker-certificates | 2 +- bin/worker-deletes | 2 +- bin/worker-functions | 2 +- bin/worker-mails | 2 +- bin/worker-tasks | 2 +- bin/worker-usage | 2 +- bin/worker-webhooks | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bin/schedule b/bin/schedule index 857ec9f6f..6300d97ed 100644 --- a/bin/schedule +++ b/bin/schedule @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-audits b/bin/worker-audits index e411aa386..8e99481d2 100644 --- a/bin/worker-audits +++ b/bin/worker-audits @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-certificates b/bin/worker-certificates index 7d474e1ea..9214af513 100755 --- a/bin/worker-certificates +++ b/bin/worker-certificates @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-deletes b/bin/worker-deletes index 9c2fb3118..517f75530 100644 --- a/bin/worker-deletes +++ b/bin/worker-deletes @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-functions b/bin/worker-functions index b41c01994..29cd4b85c 100644 --- a/bin/worker-functions +++ b/bin/worker-functions @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-mails b/bin/worker-mails index 64d10f609..a66394262 100644 --- a/bin/worker-mails +++ b/bin/worker-mails @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-tasks b/bin/worker-tasks index fc395b34a..bac1f54a8 100644 --- a/bin/worker-tasks +++ b/bin/worker-tasks @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-usage b/bin/worker-usage index 4176f54b8..9cb9b5ed8 100644 --- a/bin/worker-usage +++ b/bin/worker-usage @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else diff --git a/bin/worker-webhooks b/bin/worker-webhooks index 13029ecbd..4ae2fadaa 100644 --- a/bin/worker-webhooks +++ b/bin/worker-webhooks @@ -1,6 +1,6 @@ #!/bin/sh -if [ -z "$_APP_REDIS_USER" ] || [ -z "$_APP_REDIS_PASS" ] +if [ -z "$_APP_REDIS_USER" ] && [ -z "$_APP_REDIS_PASS" ] then REDIS_BACKEND="${_APP_REDIS_HOST}:${_APP_REDIS_PORT}" else From d8990fba9978d7fd2fa75191809a4f7cea4d4709 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Thu, 18 Mar 2021 08:11:23 -0400 Subject: [PATCH 31/52] Upgrade utopia-php/abuse to version 0.4.0 --- CHANGES.md | 4 ++++ composer.json | 2 +- composer.lock | 16 ++++++++-------- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index e4b9279a1..1b36e78e5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,6 +2,10 @@ - Anonymous login +## Upgrades + +- Upgraded utopia-php/abuse to version 0.4.0 + # Version 0.7.1 ## Features diff --git a/composer.json b/composer.json index d4135536d..0cd8016d5 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "appwrite/php-clamav": "1.0.*", "utopia-php/framework": "0.10.0", - "utopia-php/abuse": "0.3.*", + "utopia-php/abuse": "0.4.*", "utopia-php/analytics": "0.1.*", "utopia-php/audit": "0.5.*", "utopia-php/cache": "0.2.*", diff --git a/composer.lock b/composer.lock index 18832a1a8..a6e9fc198 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "3463ecea7830f29a67317097ad2aeb66", + "content-hash": "15b6e4ddce09e6fb642988603d734aa8", "packages": [ { "name": "adhocore/jwt", @@ -1272,21 +1272,21 @@ }, { "name": "utopia-php/abuse", - "version": "0.3.1", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/utopia-php/abuse.git", - "reference": "23c2eb533bca8f3ef5548ae265398fa7d4d39a1c" + "reference": "2b8cc40a67c045c137b44d1a11326f494acf50a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/abuse/zipball/23c2eb533bca8f3ef5548ae265398fa7d4d39a1c", - "reference": "23c2eb533bca8f3ef5548ae265398fa7d4d39a1c", + "url": "https://api.github.com/repos/utopia-php/abuse/zipball/2b8cc40a67c045c137b44d1a11326f494acf50a4", + "reference": "2b8cc40a67c045c137b44d1a11326f494acf50a4", "shasum": "" }, "require": { "ext-pdo": "*", - "php": ">=7.1" + "php": ">=7.4" }, "require-dev": { "phpunit/phpunit": "^9.4", @@ -1318,9 +1318,9 @@ ], "support": { "issues": "https://github.com/utopia-php/abuse/issues", - "source": "https://github.com/utopia-php/abuse/tree/0.3.1" + "source": "https://github.com/utopia-php/abuse/tree/0.4.0" }, - "time": "2020-12-21T17:28:03+00:00" + "time": "2021-03-17T20:21:24+00:00" }, { "name": "utopia-php/analytics", From 11053b0b60ba67a7afa6ad250875f2cca44c04c8 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Fri, 19 Mar 2021 00:08:19 +0200 Subject: [PATCH 32/52] Added timestamp --- app/controllers/general.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/general.php b/app/controllers/general.php index fe0016038..18e1ab1bb 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -256,6 +256,8 @@ App::error(function ($error, $utopia, $request, $response, $layout, $project) { $template = ($route) ? $route->getLabel('error', null) : null; if (php_sapi_name() === 'cli') { + Console::error('[Error] Timestamp: '.date('c', time())); + if($route) { Console::error('[Error] Method: '.$route->getMethod()); Console::error('[Error] URL: '.$route->getURL()); From a5295a1c09d71e8d6226a02b548a65b718da95e9 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 21 Mar 2021 20:11:05 +0545 Subject: [PATCH 33/52] test hook to print time --- tests/extensions/TestHook.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/extensions/TestHook.php diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php new file mode 100644 index 000000000..28c41486c --- /dev/null +++ b/tests/extensions/TestHook.php @@ -0,0 +1,15 @@ + Date: Sun, 21 Mar 2021 20:12:37 +0545 Subject: [PATCH 34/52] test hook to print test result --- tests/extensions/TestHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index 28c41486c..240c6111d 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -7,7 +7,7 @@ class TestHook implements AfterTestHook { public function executeAfterTest(string $test, float $time): void { - printf(" %s ended in %s seconds\n", + printf("\n%s ended in %s seconds", $test, $time ); From 6b8876a82ee45519f496bc6d8bae0ef0445cbf24 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 21 Mar 2021 20:12:50 +0545 Subject: [PATCH 35/52] enabling extension in phpunit --- phpunit.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpunit.xml b/phpunit.xml index b0c837272..ba4f4f496 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -8,6 +8,9 @@ processIsolation="false" stopOnFailure="false" > + + + ./tests/e2e/ From 9843d063f643b04d64ead734fb35d1363c0aa475 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Sun, 21 Mar 2021 20:13:03 +0545 Subject: [PATCH 36/52] autoloading test hook --- composer.json | 5 ++++- composer.lock | 22 ++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index 66bb66f51..ef472dc8f 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,10 @@ } }, "autoload-dev": { - "psr-4": {"Tests\\E2E\\": "tests/e2e"} + "psr-4": { + "Tests\\E2E\\": "tests/e2e", + "Appwrite\\Tests\\": "tests/extensions" + } }, "require": { "php": ">=7.4.0", diff --git a/composer.lock b/composer.lock index 8b29ae44f..e571d0140 100644 --- a/composer.lock +++ b/composer.lock @@ -364,12 +364,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "01129f635f45659fd4764a533777d069a978bc9d" + "reference": "f38085e434c6a8affe0d4ba8faa5303a0137566d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/01129f635f45659fd4764a533777d069a978bc9d", - "reference": "01129f635f45659fd4764a533777d069a978bc9d", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f38085e434c6a8affe0d4ba8faa5303a0137566d", + "reference": "f38085e434c6a8affe0d4ba8faa5303a0137566d", "shasum": "" }, "require": { @@ -383,6 +383,7 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", "phpunit/phpunit": "^8.5.5 || ^9.3.5", @@ -459,7 +460,7 @@ "type": "github" } ], - "time": "2021-03-15T07:56:29+00:00" + "time": "2021-03-21T12:52:42+00:00" }, { "name": "guzzlehttp/promises", @@ -523,12 +524,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a67cdbf85690e54a7b92fe91c297b20d2607c0b2" + "reference": "72dde17f3154ea87cadea0b71e37493058d970ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a67cdbf85690e54a7b92fe91c297b20d2607c0b2", - "reference": "a67cdbf85690e54a7b92fe91c297b20d2607c0b2", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/72dde17f3154ea87cadea0b71e37493058d970ce", + "reference": "72dde17f3154ea87cadea0b71e37493058d970ce", "shasum": "" }, "require": { @@ -590,7 +591,7 @@ "issues": "https://github.com/guzzle/psr7/issues", "source": "https://github.com/guzzle/psr7/tree/1.x" }, - "time": "2021-03-15T11:15:53+00:00" + "time": "2021-03-21T13:41:49+00:00" }, { "name": "influxdb/influxdb-php", @@ -2304,7 +2305,6 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -5959,9 +5959,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "appwrite/sdk-generator": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From b5846f5a79c2ed0849cdc0620432e056504788a1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 22 Mar 2021 00:17:20 +0200 Subject: [PATCH 37/52] Updated default permissions --- app/controllers/api/database.php | 28 ++++++++++++++++------------ app/controllers/api/storage.php | 12 +++++++----- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index c386749ca..e12088e50 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -169,8 +169,8 @@ App::put('/v1/database/collections/:collectionId') ->label('sdk.response.model', Response::MODEL_COLLECTION) ->param('collectionId', '', new UID(), 'Collection unique ID.') ->param('name', null, new Text(128), 'Collection name. Max length: 128 chars.') - ->param('read', [], new ArrayList(new Text(64)), '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.') - ->param('write', [], new ArrayList(new Text(64)), '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.') + ->param('read', null, new ArrayList(new Text(64)), 'An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) + ->param('write', null, new ArrayList(new Text(64)), 'An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) ->param('rules', [], function ($projectDB) { return new ArrayList(new Collection($projectDB, [Database::SYSTEM_COLLECTION_RULES], ['$collection' => Database::SYSTEM_COLLECTION_RULES, '$permissions' => ['read' => [], 'write' => []]])); }, 'Array of [rule objects](/docs/rules). Each rule define a collection field name, data type and validation.', true, ['projectDB']) ->inject('response') ->inject('projectDB') @@ -187,6 +187,8 @@ App::put('/v1/database/collections/:collectionId') } $parsedRules = []; + $read = (is_null($read)) ? ($collection->getPermissions()['read'] ?? []) : $read; // By default inherit read permissions + $write = (is_null($write)) ? ($collection->getPermissions()['write'] ?? []) : $write; // By default inherit write permissions foreach ($rules as &$rule) { $parsedRules[] = \array_merge([ @@ -295,17 +297,19 @@ App::post('/v1/database/collections/:collectionId/documents') ->label('sdk.response.model', Response::MODEL_ANY) ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('data', [], new JSON(), 'Document data as JSON object.') - ->param('read', [], new ArrayList(new Text(64)), '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.') - ->param('write', [], new ArrayList(new Text(64)), '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.') + ->param('read', null, new ArrayList(new Text(64)), 'An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) + ->param('write', null, new ArrayList(new Text(64)), 'An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) ->param('parentDocument', '', new UID(), 'Parent document unique ID. Use when you want your new document to be a child of a parent document.', true) ->param('parentProperty', '', new Key(), 'Parent document property name. Use when you want your new document to be a child of a parent document.', true) ->param('parentPropertyType', Document::SET_TYPE_ASSIGN, new WhiteList([Document::SET_TYPE_ASSIGN, Document::SET_TYPE_APPEND, Document::SET_TYPE_PREPEND], true), '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.', true) ->inject('response') ->inject('projectDB') + ->inject('user') ->inject('audits') - ->action(function ($collectionId, $data, $read, $write, $parentDocument, $parentProperty, $parentPropertyType, $response, $projectDB, $audits) { + ->action(function ($collectionId, $data, $read, $write, $parentDocument, $parentProperty, $parentPropertyType, $response, $projectDB, $user, $audits) { /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Database $projectDB */ + /** @var Appwrite\Database\Document $user */ /** @var Appwrite\Event\Event $audits */ $data = (\is_string($data)) ? \json_decode($data, true) : $data; // Cast to JSON array @@ -326,8 +330,8 @@ App::post('/v1/database/collections/:collectionId/documents') $data['$collection'] = $collectionId; // Adding this param to make API easier for developers $data['$permissions'] = [ - 'read' => $read, - 'write' => $write, + 'read' => (is_null($read)) ? ['user:'.$user->getId()] : $read, // By default set read permissions for user + 'write' => (is_null($write)) ? ['user:'.$user->getId()] : $write, // By default set write permissions for user ]; // Read parent document + validate not 404 + validate read / write permission like patch method @@ -508,8 +512,8 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId') ->param('collectionId', null, new UID(), 'Collection unique ID. You can create a new collection with validation rules using the Database service [server integration](/docs/server/database#createCollection).') ->param('documentId', null, new UID(), 'Document unique ID.') ->param('data', [], new JSON(), 'Document data as JSON object.') - ->param('read', [], new ArrayList(new Text(64)), '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.') - ->param('write', [], new ArrayList(new Text(64)), '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.') + ->param('read', null, new ArrayList(new Text(64)), 'An array of strings with read permissions. By default inherits the existing read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) + ->param('write', null, new ArrayList(new Text(64)), 'An array of strings with write permissions. By default inherits the existing write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) ->inject('response') ->inject('projectDB') ->inject('audits') @@ -522,7 +526,7 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId') $document = $projectDB->getDocument($documentId, false); $data = (\is_string($data)) ? \json_decode($data, true) : $data; // Cast to JSON array - + if (!\is_array($data)) { throw new Exception('Data param should be a valid JSON object', 400); } @@ -539,8 +543,8 @@ App::patch('/v1/database/collections/:collectionId/documents/:documentId') $data['$collection'] = $collection->getId(); // Make sure user don't switch collectionID $data['$id'] = $document->getId(); // Make sure user don't switch document unique ID - $data['$permissions']['read'] = $read; - $data['$permissions']['write'] = $write; + $data['$permissions']['read'] = (is_null($read)) ? ($document->getPermissions()['read'] ?? []) : $read; // By default inherit read permissions + $data['$permissions']['write'] = (is_null($write)) ? ($document->getPermissions()['write'] ?? []) : $write; // By default inherit write permissions if (empty($data)) { throw new Exception('Missing payload', 400); diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index d4500e95a..840d1ca4e 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -38,17 +38,19 @@ App::post('/v1/storage/files') ->label('sdk.response.type', Response::CONTENT_TYPE_JSON) ->label('sdk.response.model', Response::MODEL_FILE) ->param('file', [], new File(), 'Binary file.', false) - ->param('read', [], new ArrayList(new Text(64)), '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.') - ->param('write', [], new ArrayList(new Text(64)), '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.') + ->param('read', null, new ArrayList(new Text(64)), 'An array of strings with read permissions. By default only the current user is granted with read permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) + ->param('write', null, new ArrayList(new Text(64)), 'An array of strings with write permissions. By default only the current user is granted with write permissions. [learn more about permissions](/docs/permissions) and get a full list of available permissions.', true) ->inject('request') ->inject('response') ->inject('projectDB') + ->inject('user') ->inject('audits') ->inject('usage') - ->action(function ($file, $read, $write, $request, $response, $projectDB, $audits, $usage) { + ->action(function ($file, $read, $write, $request, $response, $projectDB, $user, $audits, $usage) { /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ /** @var Appwrite\Database\Database $projectDB */ + /** @var Appwrite\Database\Document $user */ /** @var Appwrite\Event\Event $audits */ /** @var Appwrite\Event\Event $usage */ @@ -122,8 +124,8 @@ App::post('/v1/storage/files') $file = $projectDB->createDocument([ '$collection' => Database::SYSTEM_COLLECTION_FILES, '$permissions' => [ - 'read' => $read, - 'write' => $write, + 'read' => (is_null($read)) ? ['user:'.$user->getId()] : $read, // By default set read permissions for user + 'write' => (is_null($write)) ? ['user:'.$user->getId()] : $write, // By default write read permissions for user ], 'dateCreated' => \time(), 'folderId' => '', From e05da0ce3c9a030901f045aed0d176a2ae91a997 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 22 Mar 2021 00:26:00 +0200 Subject: [PATCH 38/52] Fixed comments --- app/controllers/api/storage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 840d1ca4e..82f37f9f6 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -125,7 +125,7 @@ App::post('/v1/storage/files') '$collection' => Database::SYSTEM_COLLECTION_FILES, '$permissions' => [ 'read' => (is_null($read)) ? ['user:'.$user->getId()] : $read, // By default set read permissions for user - 'write' => (is_null($write)) ? ['user:'.$user->getId()] : $write, // By default write read permissions for user + 'write' => (is_null($write)) ? ['user:'.$user->getId()] : $write, // By default set write permissions for user ], 'dateCreated' => \time(), 'folderId' => '', From b7dec3a4f496cec006d8244c5f38adcd4938af4e Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Mon, 22 Mar 2021 10:34:03 +0545 Subject: [PATCH 39/52] fix print line --- tests/extensions/TestHook.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/extensions/TestHook.php b/tests/extensions/TestHook.php index 240c6111d..a8d86304e 100644 --- a/tests/extensions/TestHook.php +++ b/tests/extensions/TestHook.php @@ -7,7 +7,7 @@ class TestHook implements AfterTestHook { public function executeAfterTest(string $test, float $time): void { - printf("\n%s ended in %s seconds", + printf("%s ended in %s seconds\n", $test, $time ); From 46c465b80e53eb3f78e6f9f42f91aade199e11c1 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 22 Mar 2021 09:34:51 +0200 Subject: [PATCH 40/52] Added some fixes and dedicated tests --- app/controllers/api/database.php | 4 +- app/controllers/api/storage.php | 4 +- composer.lock | 122 +++++++++++++----- tests/e2e/Services/Database/DatabaseBase.php | 129 ++++++++++++++++++- 4 files changed, 223 insertions(+), 36 deletions(-) diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php index e12088e50..2c32ae981 100644 --- a/app/controllers/api/database.php +++ b/app/controllers/api/database.php @@ -330,8 +330,8 @@ App::post('/v1/database/collections/:collectionId/documents') $data['$collection'] = $collectionId; // Adding this param to make API easier for developers $data['$permissions'] = [ - 'read' => (is_null($read)) ? ['user:'.$user->getId()] : $read, // By default set read permissions for user - 'write' => (is_null($write)) ? ['user:'.$user->getId()] : $write, // By default set write permissions for user + 'read' => (is_null($read) && !$user->isEmpty()) ? ['user:'.$user->getId()] : $read ?? [], // By default set read permissions for user + 'write' => (is_null($write) && !$user->isEmpty()) ? ['user:'.$user->getId()] : $write ?? [], // By default set write permissions for user ]; // Read parent document + validate not 404 + validate read / write permission like patch method diff --git a/app/controllers/api/storage.php b/app/controllers/api/storage.php index 82f37f9f6..f0ce2e405 100644 --- a/app/controllers/api/storage.php +++ b/app/controllers/api/storage.php @@ -124,8 +124,8 @@ App::post('/v1/storage/files') $file = $projectDB->createDocument([ '$collection' => Database::SYSTEM_COLLECTION_FILES, '$permissions' => [ - 'read' => (is_null($read)) ? ['user:'.$user->getId()] : $read, // By default set read permissions for user - 'write' => (is_null($write)) ? ['user:'.$user->getId()] : $write, // By default set write permissions for user + 'read' => (is_null($read) && !$user->isEmpty()) ? ['user:'.$user->getId()] : $read ?? [], // By default set read permissions for user + 'write' => (is_null($write) && !$user->isEmpty()) ? ['user:'.$user->getId()] : $write ?? [], // By default set write permissions for user ], 'dateCreated' => \time(), 'folderId' => '', diff --git a/composer.lock b/composer.lock index 8b29ae44f..3fa80281f 100644 --- a/composer.lock +++ b/composer.lock @@ -364,18 +364,18 @@ "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "01129f635f45659fd4764a533777d069a978bc9d" + "reference": "98eeb955cbbe0e5d6f3f818e940c84f66aba427b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/01129f635f45659fd4764a533777d069a978bc9d", - "reference": "01129f635f45659fd4764a533777d069a978bc9d", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/98eeb955cbbe0e5d6f3f818e940c84f66aba427b", + "reference": "98eeb955cbbe0e5d6f3f818e940c84f66aba427b", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.4", - "guzzlehttp/psr7": "^1.7", + "guzzlehttp/psr7": "^1.7 || ^2.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0" }, @@ -383,6 +383,7 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", "phpunit/phpunit": "^8.5.5 || ^9.3.5", @@ -459,7 +460,7 @@ "type": "github" } ], - "time": "2021-03-15T07:56:29+00:00" + "time": "2021-03-21T18:42:29+00:00" }, { "name": "guzzlehttp/promises", @@ -519,46 +520,47 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a67cdbf85690e54a7b92fe91c297b20d2607c0b2" + "reference": "c0dcda9f54d145bd4d062a6d15f54931a67732f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a67cdbf85690e54a7b92fe91c297b20d2607c0b2", - "reference": "a67cdbf85690e54a7b92fe91c297b20d2607c0b2", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c0dcda9f54d145bd4d062a6d15f54931a67732f9", + "reference": "c0dcda9f54d145bd4d062a6d15f54931a67732f9", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "2.0-dev" } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -573,6 +575,11 @@ { "name": "Tobias Schultze", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -588,9 +595,9 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.x" + "source": "https://github.com/guzzle/psr7/tree/2.0.0-beta1" }, - "time": "2021-03-15T11:15:53+00:00" + "time": "2021-03-21T17:21:36+00:00" }, { "name": "influxdb/influxdb-php", @@ -906,6 +913,62 @@ }, "time": "2020-09-19T09:12:31+00:00" }, + { + "name": "psr/http-factory", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "36fa03d50ff82abcae81860bdaf4ed9a1510c7cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/36fa03d50ff82abcae81860bdaf4ed9a1510c7cd", + "reference": "36fa03d50ff82abcae81860bdaf4ed9a1510c7cd", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2020-09-17T16:52:55+00:00" + }, { "name": "psr/http-message", "version": "dev-master", @@ -1643,16 +1706,16 @@ }, { "name": "utopia-php/framework", - "version": "0.12.1", + "version": "0.12.2", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "ba17789a16527d24b4fb11ddc359901a295fbf2f" + "reference": "2264a3a3e212e50b9440b219fef3b4afcd2adf5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/ba17789a16527d24b4fb11ddc359901a295fbf2f", - "reference": "ba17789a16527d24b4fb11ddc359901a295fbf2f", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/2264a3a3e212e50b9440b219fef3b4afcd2adf5b", + "reference": "2264a3a3e212e50b9440b219fef3b4afcd2adf5b", "shasum": "" }, "require": { @@ -1686,9 +1749,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.12.1" + "source": "https://github.com/utopia-php/framework/tree/0.12.2" }, - "time": "2021-03-17T22:14:05+00:00" + "time": "2021-03-22T07:26:11+00:00" }, { "name": "utopia-php/image", @@ -2304,7 +2367,6 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -5959,9 +6021,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "appwrite/sdk-generator": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/tests/e2e/Services/Database/DatabaseBase.php b/tests/e2e/Services/Database/DatabaseBase.php index 2b93485f1..eedd312fe 100644 --- a/tests/e2e/Services/Database/DatabaseBase.php +++ b/tests/e2e/Services/Database/DatabaseBase.php @@ -501,6 +501,133 @@ trait DatabaseBase $this->assertEquals($document['headers']['status-code'], 404); - return []; + return $data; + } + + /** + * @depends testDeleteDocument + */ + public function testDefaultPermissions(array $data):array + { + $document = $this->client->call(Client::METHOD_POST, '/database/collections/' . $data['moviesId'] . '/documents', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'data' => [ + 'name' => 'Captain America', + 'releaseYear' => 1944, + 'actors' => [], + ], + ]); + + $id = $document['body']['$id']; + + $this->assertEquals($document['headers']['status-code'], 201); + $this->assertEquals($document['body']['$collection'], $data['moviesId']); + $this->assertEquals($document['body']['name'], 'Captain America'); + $this->assertEquals($document['body']['releaseYear'], 1944); + $this->assertIsArray($document['body']['$permissions']); + $this->assertIsArray($document['body']['$permissions']['read']); + $this->assertIsArray($document['body']['$permissions']['write']); + + if($this->getSide() == 'client') { + $this->assertCount(1, $document['body']['$permissions']['read']); + $this->assertCount(1, $document['body']['$permissions']['write']); + $this->assertEquals(['user:'.$this->getUser()['$id']], $document['body']['$permissions']['read']); + $this->assertEquals(['user:'.$this->getUser()['$id']], $document['body']['$permissions']['write']); + } + + if($this->getSide() == 'server') { + $this->assertCount(0, $document['body']['$permissions']['read']); + $this->assertCount(0, $document['body']['$permissions']['write']); + $this->assertEquals([], $document['body']['$permissions']['read']); + $this->assertEquals([], $document['body']['$permissions']['write']); + } + + // Updated and Inherit Permissions + + $document = $this->client->call(Client::METHOD_PATCH, '/database/collections/' . $data['moviesId'] . '/documents/' . $id, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'data' => [ + 'name' => 'Captain America 2', + 'releaseYear' => 1945, + 'actors' => [], + ], + 'read' => ['*'], + ]); + + $this->assertEquals($document['headers']['status-code'], 200); + $this->assertEquals($document['body']['name'], 'Captain America 2'); + $this->assertEquals($document['body']['releaseYear'], 1945); + + if($this->getSide() == 'client') { + $this->assertCount(1, $document['body']['$permissions']['read']); + $this->assertCount(1, $document['body']['$permissions']['write']); + $this->assertEquals(['*'], $document['body']['$permissions']['read']); + $this->assertEquals(['user:'.$this->getUser()['$id']], $document['body']['$permissions']['write']); + } + + if($this->getSide() == 'server') { + $this->assertCount(1, $document['body']['$permissions']['read']); + $this->assertCount(0, $document['body']['$permissions']['write']); + $this->assertEquals(['*'], $document['body']['$permissions']['read']); + $this->assertEquals([], $document['body']['$permissions']['write']); + } + + $document = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'] . '/documents/' . $id, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders())); + + $this->assertEquals($document['headers']['status-code'], 200); + $this->assertEquals($document['body']['name'], 'Captain America 2'); + $this->assertEquals($document['body']['releaseYear'], 1945); + + if($this->getSide() == 'client') { + $this->assertCount(1, $document['body']['$permissions']['read']); + $this->assertCount(1, $document['body']['$permissions']['write']); + $this->assertEquals(['*'], $document['body']['$permissions']['read']); + $this->assertEquals(['user:'.$this->getUser()['$id']], $document['body']['$permissions']['write']); + } + + if($this->getSide() == 'server') { + $this->assertCount(1, $document['body']['$permissions']['read']); + $this->assertCount(0, $document['body']['$permissions']['write']); + $this->assertEquals(['*'], $document['body']['$permissions']['read']); + $this->assertEquals([], $document['body']['$permissions']['write']); + } + + // Reset Permissions + + $document = $this->client->call(Client::METHOD_PATCH, '/database/collections/' . $data['moviesId'] . '/documents/' . $id, array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()), [ + 'data' => [ + 'name' => 'Captain America 3', + 'releaseYear' => 1946, + 'actors' => [], + ], + 'read' => [], + 'write' => [], + ]); + + if($this->getSide() == 'client') { + $this->assertEquals($document['headers']['status-code'], 401); + } + + if($this->getSide() == 'server') { + $this->assertEquals($document['headers']['status-code'], 200); + $this->assertEquals($document['body']['name'], 'Captain America 3'); + $this->assertEquals($document['body']['releaseYear'], 1946); + $this->assertCount(0, $document['body']['$permissions']['read']); + $this->assertCount(0, $document['body']['$permissions']['write']); + $this->assertEquals([], $document['body']['$permissions']['read']); + $this->assertEquals([], $document['body']['$permissions']['write']); + } + + return $data; } } \ No newline at end of file From d6fc03ca63b2d7dfe3caa78fc3a20a519c230075 Mon Sep 17 00:00:00 2001 From: kodumbeats Date: Mon, 22 Mar 2021 08:44:13 -0400 Subject: [PATCH 41/52] Throw error only on nonzero exit code --- app/workers/certificates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/certificates.php b/app/workers/certificates.php index e8693e356..90907204a 100644 --- a/app/workers/certificates.php +++ b/app/workers/certificates.php @@ -124,7 +124,7 @@ class CertificatesV1 ." -w ".APP_STORAGE_CERTIFICATES ." -d {$domain->get()}", '', $stdout, $stderr); - if($stderr || $exit !== 0) { + if($exit !== 0) { throw new Exception('Failed to issue a certificate with message: '.$stderr); } From a76016fa375fc773295c18c9d5920c23deb33a19 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 22 Mar 2021 18:19:05 +0200 Subject: [PATCH 42/52] Fixed functions tests --- app/controllers/api/functions.php | 2 +- tests/e2e/Services/Functions/FunctionsCustomServerTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/functions.php b/app/controllers/api/functions.php index 7a6b11bcd..92708527a 100644 --- a/app/controllers/api/functions.php +++ b/app/controllers/api/functions.php @@ -435,7 +435,7 @@ App::post('/v1/functions/:functionId/tags') ->label('sdk.response.model', Response::MODEL_TAG) ->param('functionId', '', new UID(), 'Function unique ID.') ->param('command', '', new Text('1028'), 'Code execution command.') - ->param('code', null, new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false) + ->param('code', [], new File(), 'Gzip file with your code package. When used with the Appwrite CLI, pass the path to your code directory, and the CLI will automatically package your code. Use a path that is within the current directory.', false) ->inject('request') ->inject('response') ->inject('projectDB') diff --git a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php index 9dded8fdd..b04a635cf 100644 --- a/tests/e2e/Services/Functions/FunctionsCustomServerTest.php +++ b/tests/e2e/Services/Functions/FunctionsCustomServerTest.php @@ -628,7 +628,7 @@ class FunctionsCustomServerTest extends Scope ], $this->getHeaders()), [ 'tag' => $tagId, ]); - + $this->assertEquals(200, $tag['headers']['status-code']); $execution = $this->client->call(Client::METHOD_POST, '/functions/'.$functionId.'/executions', array_merge([ From 7eb45d30f4cd5a8717f85e0364c59f91799484e3 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 22 Mar 2021 22:07:59 +0200 Subject: [PATCH 43/52] Updated change log --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index cc086bb10..184cd763f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,12 @@ - Upgraded ClamAV to version 1.3.0 +# Version 0.7.2 (Not Released Yet) + +## Bugs + +- Fixed certificates worker error on successful operations + # Version 0.7.1 ## Features From 5ab87a107bac561fc4bf2b7b20a0dcd11a260939 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 23 Mar 2021 00:42:25 +0200 Subject: [PATCH 44/52] Updated utopia libs --- composer.lock | 142 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 101 insertions(+), 41 deletions(-) diff --git a/composer.lock b/composer.lock index 8b29ae44f..9dc046f89 100644 --- a/composer.lock +++ b/composer.lock @@ -364,18 +364,18 @@ "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "01129f635f45659fd4764a533777d069a978bc9d" + "reference": "98eeb955cbbe0e5d6f3f818e940c84f66aba427b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/01129f635f45659fd4764a533777d069a978bc9d", - "reference": "01129f635f45659fd4764a533777d069a978bc9d", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/98eeb955cbbe0e5d6f3f818e940c84f66aba427b", + "reference": "98eeb955cbbe0e5d6f3f818e940c84f66aba427b", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.4", - "guzzlehttp/psr7": "^1.7", + "guzzlehttp/psr7": "^1.7 || ^2.0", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0" }, @@ -383,6 +383,7 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", "phpunit/phpunit": "^8.5.5 || ^9.3.5", @@ -459,7 +460,7 @@ "type": "github" } ], - "time": "2021-03-15T07:56:29+00:00" + "time": "2021-03-21T18:42:29+00:00" }, { "name": "guzzlehttp/promises", @@ -519,46 +520,47 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.x-dev", + "version": "dev-master", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "a67cdbf85690e54a7b92fe91c297b20d2607c0b2" + "reference": "c0dcda9f54d145bd4d062a6d15f54931a67732f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/a67cdbf85690e54a7b92fe91c297b20d2607c0b2", - "reference": "a67cdbf85690e54a7b92fe91c297b20d2607c0b2", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/c0dcda9f54d145bd4d062a6d15f54931a67732f9", + "reference": "c0dcda9f54d145bd4d062a6d15f54931a67732f9", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, + "default-branch": true, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "2.0-dev" } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -573,6 +575,11 @@ { "name": "Tobias Schultze", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -588,9 +595,9 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/1.x" + "source": "https://github.com/guzzle/psr7/tree/2.0.0-beta1" }, - "time": "2021-03-15T11:15:53+00:00" + "time": "2021-03-21T17:21:36+00:00" }, { "name": "influxdb/influxdb-php", @@ -906,6 +913,62 @@ }, "time": "2020-09-19T09:12:31+00:00" }, + { + "name": "psr/http-factory", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "36fa03d50ff82abcae81860bdaf4ed9a1510c7cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/36fa03d50ff82abcae81860bdaf4ed9a1510c7cd", + "reference": "36fa03d50ff82abcae81860bdaf4ed9a1510c7cd", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "default-branch": true, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2020-09-17T16:52:55+00:00" + }, { "name": "psr/http-message", "version": "dev-master", @@ -1643,16 +1706,16 @@ }, { "name": "utopia-php/framework", - "version": "0.12.1", + "version": "0.12.3", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "ba17789a16527d24b4fb11ddc359901a295fbf2f" + "reference": "78be43a0eb711f3677769dfb445e5111bfafaa88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/ba17789a16527d24b4fb11ddc359901a295fbf2f", - "reference": "ba17789a16527d24b4fb11ddc359901a295fbf2f", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/78be43a0eb711f3677769dfb445e5111bfafaa88", + "reference": "78be43a0eb711f3677769dfb445e5111bfafaa88", "shasum": "" }, "require": { @@ -1686,9 +1749,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.12.1" + "source": "https://github.com/utopia-php/framework/tree/0.12.3" }, - "time": "2021-03-17T22:14:05+00:00" + "time": "2021-03-22T22:02:23+00:00" }, { "name": "utopia-php/image", @@ -1953,16 +2016,16 @@ }, { "name": "utopia-php/swoole", - "version": "0.2.2", + "version": "0.2.3", "source": { "type": "git", "url": "https://github.com/utopia-php/swoole.git", - "reference": "17510e90499e73273245c534a05bca522d4ffb37" + "reference": "45c42aae7e7d3f9f82bf194c2cfa5499b674aefe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/swoole/zipball/17510e90499e73273245c534a05bca522d4ffb37", - "reference": "17510e90499e73273245c534a05bca522d4ffb37", + "url": "https://api.github.com/repos/utopia-php/swoole/zipball/45c42aae7e7d3f9f82bf194c2cfa5499b674aefe", + "reference": "45c42aae7e7d3f9f82bf194c2cfa5499b674aefe", "shasum": "" }, "require": { @@ -2003,9 +2066,9 @@ ], "support": { "issues": "https://github.com/utopia-php/swoole/issues", - "source": "https://github.com/utopia-php/swoole/tree/0.2.2" + "source": "https://github.com/utopia-php/swoole/tree/0.2.3" }, - "time": "2021-03-17T22:51:07+00:00" + "time": "2021-03-22T22:39:24+00:00" }, { "name": "utopia-php/system", @@ -2304,7 +2367,6 @@ "require-dev": { "phpunit/phpunit": "^7.0" }, - "default-branch": true, "type": "library", "autoload": { "psr-4": { @@ -5727,12 +5789,12 @@ "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "37e48403c21e06f63bc27d7ccd997fbb72b0ae2a" + "reference": "116bfb0bc9ec2a39db93431b7fe67144164d251e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/37e48403c21e06f63bc27d7ccd997fbb72b0ae2a", - "reference": "37e48403c21e06f63bc27d7ccd997fbb72b0ae2a", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/116bfb0bc9ec2a39db93431b7fe67144164d251e", + "reference": "116bfb0bc9ec2a39db93431b7fe67144164d251e", "shasum": "" }, "require": { @@ -5798,7 +5860,7 @@ "type": "tidelift" } ], - "time": "2021-03-10T10:07:14+00:00" + "time": "2021-03-22T08:23:49+00:00" }, { "name": "vimeo/psalm", @@ -5959,9 +6021,7 @@ ], "aliases": [], "minimum-stability": "dev", - "stability-flags": { - "appwrite/sdk-generator": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 9f5fb08363c7b9486dd5cc47f7a4b4ed66886799 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Tue, 23 Mar 2021 13:50:40 +0545 Subject: [PATCH 45/52] ruby getting started --- docs/sdks/ruby/GETTING_STARTED.md | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/sdks/ruby/GETTING_STARTED.md diff --git a/docs/sdks/ruby/GETTING_STARTED.md b/docs/sdks/ruby/GETTING_STARTED.md new file mode 100644 index 000000000..d353ee196 --- /dev/null +++ b/docs/sdks/ruby/GETTING_STARTED.md @@ -0,0 +1,49 @@ +## Getting Started + +### Init your SDK +Initialize your SDK code with your project ID which can be found in your project settings page and your new API secret Key from project's API keys section. + +```ruby +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint + .set_project(ENV["APPWRITE_PROJECT"]) # Your project ID + .set_key(ENV["APPWRITE_SECRET"]) # Your secret API key +; +``` + +### Make Your First Request +Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the API References section. + +```ruby +users = Appwrite::Users.new(client); + +result = users.create(email: 'email@example.com', password: 'password'); +``` + +### Full Example +```ruby +require 'appwrite' + +client = Appwrite::Client.new() + +client + .set_endpoint(ENV["APPWRITE_ENDPOINT"]) # Your API Endpoint + .set_project(ENV["APPWRITE_PROJECT"]) # Your project ID + .set_key(ENV["APPWRITE_SECRET"]) # Your secret API key +; + +users = Appwrite::Users.new(client); + +result = users.create(email: 'email@example.com', password: 'password'); +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Ruby Playground](https://github.com/appwrite/playground-for-ruby) From 32906110a84b6f14a2fb4118e5670e14133c9b7a Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Tue, 23 Mar 2021 11:35:45 +0100 Subject: [PATCH 46/52] add dotnet getting started --- docs/sdks/dotnet/CHANGELOG.md | 1 + docs/sdks/dotnet/GETTING_STARTED.md | 36 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 docs/sdks/dotnet/CHANGELOG.md create mode 100644 docs/sdks/dotnet/GETTING_STARTED.md diff --git a/docs/sdks/dotnet/CHANGELOG.md b/docs/sdks/dotnet/CHANGELOG.md new file mode 100644 index 000000000..fa4d35e68 --- /dev/null +++ b/docs/sdks/dotnet/CHANGELOG.md @@ -0,0 +1 @@ +# Change Log \ No newline at end of file diff --git a/docs/sdks/dotnet/GETTING_STARTED.md b/docs/sdks/dotnet/GETTING_STARTED.md new file mode 100644 index 000000000..584d571a1 --- /dev/null +++ b/docs/sdks/dotnet/GETTING_STARTED.md @@ -0,0 +1,36 @@ +## Getting Started + +### Initialize & Make API Request +Once you add the dependencies, its extremely easy to get started with the SDK; All you need to do is import the package in your code, set your Appwrite credentials, and start making API calls. Below is a simple example: + +```csharp +using Appwrite; + +static async Task Main(string[] args) +{ + var client = Client(); + + client + .setEndpoint('http://[HOSTNAME_OR_IP]/v1') // Make sure your endpoint is accessible + .setProject('5ff3379a01d25') // Your project ID + .setKey('cd868c7af8bdc893b4...93b7535db89') + ; + + var users = Users(client); + + try { + var request = await users.create('email@example.com', 'password', 'name'); + var response = await request.Content.ReadAsStringAsync(); + Console.WriteLine(response); + } catch (AppwriteException e) { + Console.WriteLine(e.Message); + } +} +``` + +### Learn more +You can use followng resources to learn more and get help +- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server) +- 📜 [Appwrite Docs](https://appwrite.io/docs) +- 💬 [Discord Community](https://appwrite.io/discord) +- 🚂 [Appwrite Dart Playground](https://github.com/appwrite/playground-for-dotnet) From caca0f8c5260129e11ec7e536fdfc21a72b921d6 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Tue, 23 Mar 2021 13:36:20 +0200 Subject: [PATCH 47/52] Updated the changelog for 0.7.2 --- CHANGES.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5ea9c2759..2ae482c9e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,16 +2,25 @@ - Anonymous login +# Version 0.7.2 (Not Released Yet) + +## Features + +- When creating new resources from the client API, the current user gets both read & write permissions by default. (#1007) +- Added timestamp to errors logs on the HTTP API container (#1002) +- Added verbose tests output on the terminal and CI (#1006) + ## Upgrades - Upgraded ClamAV to version 1.3.0 - Upgraded utopia-php/abuse to version 0.4.0 -# Version 0.7.2 (Not Released Yet) - ## Bugs -- Fixed certificates worker error on successful operations +- Fixed certificates worker error on successful operations (#1010) +- Fixed head requests not responding (#998) +- Fixed bug when using auth credential for the Redis container (#993) +- Fixed server warning logs on 3** redirect endpoints (#1013) # Version 0.7.1 From 90a9127bafe7a8bcf193e4341afd02a3c7f4900c Mon Sep 17 00:00:00 2001 From: Torsten Dittmann Date: Wed, 24 Mar 2021 10:44:24 +0100 Subject: [PATCH 48/52] bump utopia/analytics to 0.2.0 --- composer.json | 2 +- composer.lock | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/composer.json b/composer.json index 142d67d0b..f7e589480 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,7 @@ "utopia-php/framework": "0.12.*", "utopia-php/abuse": "0.4.*", - "utopia-php/analytics": "0.1.*", + "utopia-php/analytics": "0.2.*", "utopia-php/audit": "0.5.*", "utopia-php/cache": "0.2.*", "utopia-php/cli": "0.10.0", diff --git a/composer.lock b/composer.lock index 24d495dc7..2d4e127a0 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "40de7f78c6b3d14b63c4ec178dcfe1a2", + "content-hash": "69222438c59581b58de7052befa6ac00", "packages": [ { "name": "adhocore/jwt", @@ -364,12 +364,12 @@ "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "98eeb955cbbe0e5d6f3f818e940c84f66aba427b" + "reference": "de6f1e58e735754b888649495ed4cb9ae3b19589" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/98eeb955cbbe0e5d6f3f818e940c84f66aba427b", - "reference": "98eeb955cbbe0e5d6f3f818e940c84f66aba427b", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/de6f1e58e735754b888649495ed4cb9ae3b19589", + "reference": "de6f1e58e735754b888649495ed4cb9ae3b19589", "shasum": "" }, "require": { @@ -398,7 +398,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.3-dev" + "dev-master": "7.4-dev" } }, "autoload": { @@ -460,7 +460,7 @@ "type": "github" } ], - "time": "2021-03-21T18:42:29+00:00" + "time": "2021-03-23T14:07:59+00:00" }, { "name": "guzzlehttp/promises", @@ -1388,16 +1388,16 @@ }, { "name": "utopia-php/analytics", - "version": "0.1.0", + "version": "0.2.0", "source": { "type": "git", "url": "https://github.com/utopia-php/analytics.git", - "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f" + "reference": "adfc2d057a7f6ab618a77c8a20ed3e35485ff416" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/analytics/zipball/a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", - "reference": "a1f2a1672a927bef8cd4d9b47e5cfbc856a3c72f", + "url": "https://api.github.com/repos/utopia-php/analytics/zipball/adfc2d057a7f6ab618a77c8a20ed3e35485ff416", + "reference": "adfc2d057a7f6ab618a77c8a20ed3e35485ff416", "shasum": "" }, "require": { @@ -1437,9 +1437,9 @@ ], "support": { "issues": "https://github.com/utopia-php/analytics/issues", - "source": "https://github.com/utopia-php/analytics/tree/0.1.0" + "source": "https://github.com/utopia-php/analytics/tree/0.2.0" }, - "time": "2021-02-03T17:07:09+00:00" + "time": "2021-03-23T21:33:07+00:00" }, { "name": "utopia-php/audit", @@ -4996,12 +4996,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "36e4ff2188cb5af6e6e94560b4aaa8042933aa58" + "reference": "5da8b675121f9f4419b7052caa0cc6118a3ccd47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/36e4ff2188cb5af6e6e94560b4aaa8042933aa58", - "reference": "36e4ff2188cb5af6e6e94560b4aaa8042933aa58", + "url": "https://api.github.com/repos/symfony/console/zipball/5da8b675121f9f4419b7052caa0cc6118a3ccd47", + "reference": "5da8b675121f9f4419b7052caa0cc6118a3ccd47", "shasum": "" }, "require": { @@ -5087,7 +5087,7 @@ "type": "tidelift" } ], - "time": "2021-03-17T16:56:09+00:00" + "time": "2021-03-23T14:20:07+00:00" }, { "name": "symfony/deprecation-contracts", @@ -5095,12 +5095,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "49dc45a74cbac5fffc6417372a9f5ae1682ca0b4" + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/49dc45a74cbac5fffc6417372a9f5ae1682ca0b4", - "reference": "49dc45a74cbac5fffc6417372a9f5ae1682ca0b4", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", "shasum": "" }, "require": { @@ -5155,7 +5155,7 @@ "type": "tidelift" } ], - "time": "2021-02-25T16:38:04+00:00" + "time": "2021-03-23T23:28:01+00:00" }, { "name": "symfony/polyfill-intl-grapheme", @@ -5575,12 +5575,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "3d72b4bfab3e991aa66906aa301aa479de4ca6ee" + "reference": "1309413986521646bb0ba91140afdc2a61ed8cfe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/3d72b4bfab3e991aa66906aa301aa479de4ca6ee", - "reference": "3d72b4bfab3e991aa66906aa301aa479de4ca6ee", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1309413986521646bb0ba91140afdc2a61ed8cfe", + "reference": "1309413986521646bb0ba91140afdc2a61ed8cfe", "shasum": "" }, "require": { @@ -5647,7 +5647,7 @@ "type": "tidelift" } ], - "time": "2021-03-16T09:10:58+00:00" + "time": "2021-03-23T23:28:01+00:00" }, { "name": "symfony/string", From 90adfe8760b82906ed442affa665a1c8efa3ed04 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 24 Mar 2021 12:37:58 +0200 Subject: [PATCH 49/52] Revreted back to ClamAV 1.2 --- CHANGES.md | 1 - app/views/install/compose.phtml | 2 +- docker-compose.yml | 2 +- tests/resources/docker/docker-compose.yml | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2ae482c9e..d8fabf5cd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,7 +12,6 @@ ## Upgrades -- Upgraded ClamAV to version 1.3.0 - Upgraded utopia-php/abuse to version 0.4.0 ## Bugs diff --git a/app/views/install/compose.phtml b/app/views/install/compose.phtml index fdbfff2c5..1c0c98108 100644 --- a/app/views/install/compose.phtml +++ b/app/views/install/compose.phtml @@ -352,7 +352,7 @@ services: - appwrite-redis:/data:rw clamav: - image: appwrite/clamav:1.3.0 + image: appwrite/clamav:1.2.0 container_name: appwrite-clamav restart: unless-stopped networks: diff --git a/docker-compose.yml b/docker-compose.yml index 217d67a70..c4ad29c64 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -414,7 +414,7 @@ services: - appwrite-redis:/data:rw clamav: - image: appwrite/clamav:1.3.0 + image: appwrite/clamav:1.2.0 container_name: appwrite-clamav networks: - appwrite diff --git a/tests/resources/docker/docker-compose.yml b/tests/resources/docker/docker-compose.yml index c9e4ea3d4..9f4074c54 100644 --- a/tests/resources/docker/docker-compose.yml +++ b/tests/resources/docker/docker-compose.yml @@ -327,7 +327,7 @@ services: - appwrite-redis:/data:rw clamav: - image: appwrite/clamav:1.3.0 + image: appwrite/clamav:1.2.0 container_name: appwrite-clamav restart: unless-stopped networks: From e36df74be3e97d1ed0287e3eb6d168f6dd046866 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 24 Mar 2021 12:38:19 +0200 Subject: [PATCH 50/52] Enabled ClamAV --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 30bacb2a8..581af6d97 100644 --- a/.env +++ b/.env @@ -16,7 +16,7 @@ _APP_DB_PORT=3306 _APP_DB_SCHEMA=appwrite _APP_DB_USER=user _APP_DB_PASS=password -_APP_STORAGE_ANTIVIRUS=disabled +_APP_STORAGE_ANTIVIRUS=enabled _APP_STORAGE_ANTIVIRUS_HOST=clamav _APP_STORAGE_ANTIVIRUS_PORT=3310 _APP_INFLUXDB_HOST=influxdb From 9709667fc154cc4a6363624343dfb1e502df7c81 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 24 Mar 2021 14:27:12 +0200 Subject: [PATCH 51/52] Updated changelog --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index d8fabf5cd..99e480f78 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,7 @@ ## Upgrades - Upgraded utopia-php/abuse to version 0.4.0 +- Upgraded utopia-php/analytics to version 0.2.0 ## Bugs From 86d962e17fed8cc0eeabe9ce85578b92b53f3ad8 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Wed, 24 Mar 2021 14:29:19 +0200 Subject: [PATCH 52/52] Updated version numbers --- README.md | 6 +++--- app/init.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3d4bd7573..ede2f0c4e 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:0.7.1 + appwrite/appwrite:0.7.2 ``` ### Windows @@ -65,7 +65,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:0.7.1 + appwrite/appwrite:0.7.2 ``` #### PowerShell @@ -75,7 +75,7 @@ docker run -it --rm , --volume /var/run/docker.sock:/var/run/docker.sock , --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw , --entrypoint="install" , - appwrite/appwrite:0.7.1 + appwrite/appwrite:0.7.2 ``` Once the Docker installation completes, go to http://localhost to access the Appwrite console from your browser. Please note that on non-linux native hosts, the server might take a few minutes to start after installation completes. diff --git a/app/init.php b/app/init.php index 86f172ed4..2aa5fb020 100644 --- a/app/init.php +++ b/app/init.php @@ -40,7 +40,7 @@ const APP_MODE_DEFAULT = 'default'; const APP_MODE_ADMIN = 'admin'; const APP_PAGING_LIMIT = 12; const APP_CACHE_BUSTER = 145; -const APP_VERSION_STABLE = '0.7.1'; +const APP_VERSION_STABLE = '0.7.2'; const APP_STORAGE_UPLOADS = '/storage/uploads'; const APP_STORAGE_FUNCTIONS = '/storage/functions'; const APP_STORAGE_CACHE = '/storage/cache';