diff --git a/app/app.php b/app/app.php index 0cbbf737ba..40eaee7cf6 100644 --- a/app/app.php +++ b/app/app.php @@ -590,7 +590,7 @@ $utopia->get('/v1/open-api-2.json') 'operationId' => $route->getLabel('sdk.method', uniqid()), 'consumes' => [], 'tags' => [$route->getLabel('sdk.namespace', 'default')], - 'description' => file_get_contents(realpath(__DIR__ . '/../') . $route->getLabel('sdk.description', '')), + 'description' => file_get_contents(realpath('../') . $route->getLabel('sdk.description', '')), 'responses' => [ 200 => [ 'description' => 'An paged array of pets', diff --git a/app/sdks/dart/lib/client.dart b/app/sdks/dart/lib/client.dart index 0792ebf839..c03342e33e 100644 --- a/app/sdks/dart/lib/client.dart +++ b/app/sdks/dart/lib/client.dart @@ -23,7 +23,7 @@ class Client { } - /// Your Appwrite project ID. You can find your project ID in your Appwrite console project settings. + /// Your Appwrite project ID Client setProject(value) { this.addHeader('X-Appwrite-Project', value); @@ -31,7 +31,7 @@ class Client { } - /// Your Appwrite project secret key. You can can create a new API key from your Appwrite console API keys dashboard. + /// Your Appwrite project secret key Client setKey(value) { this.addHeader('X-Appwrite-Key', value); diff --git a/app/sdks/js/README.md b/app/sdks/js/README.md index 4e6897838a..65711154fa 100644 --- a/app/sdks/js/README.md +++ b/app/sdks/js/README.md @@ -19,7 +19,7 @@ To install via [NPM](https://www.npmjs.com/): npm install appwrite --save ``` -If you're using a bundler (like Browserify or webpack), you can import the Appwrite module when you need it: +If you're using a bundler (like [Browserify](http://browserify.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it: ```js import * as Appwrite from "appwrite"; @@ -33,6 +33,22 @@ To install with a CDN (content delivery network) add the following scripts to th ``` +## Getting Started + +Initialise the Appwrite SDK in your code, and setup your API credentials: + +```js + +// Init your JS SDK +var appwrite = new Appwrite(); + +appwrite + .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution + .setProject('455x34dfkj') // Your Appwrite Project UID +; + +``` + ## License Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. \ No newline at end of file diff --git a/app/sdks/js/src/sdk.js b/app/sdks/js/src/sdk.js index 696a9de335..5c8a0bc134 100644 --- a/app/sdks/js/src/sdk.js +++ b/app/sdks/js/src/sdk.js @@ -25,8 +25,7 @@ /** * Set Project * - * Your Appwrite project ID. You can find your project ID in your Appwrite -\ * console project settings. + * Your Appwrite project ID * * @param value string * @@ -44,8 +43,7 @@ /** * Set Key * - * Your Appwrite project secret key. You can can create a new API key from -\ * your Appwrite console API keys dashboard. + * Your Appwrite project secret key * * @param value string * diff --git a/app/sdks/node/docs/examples/projects/create-task.md b/app/sdks/node/docs/examples/projects/create-task.md index fda7179388..8923742294 100644 --- a/app/sdks/node/docs/examples/projects/create-task.md +++ b/app/sdks/node/docs/examples/projects/create-task.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com'); +let promise = projects.createTask('[PROJECT_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/node/docs/examples/projects/update-task.md b/app/sdks/node/docs/examples/projects/update-task.md index c834dc01ff..06f0dd21e4 100644 --- a/app/sdks/node/docs/examples/projects/update-task.md +++ b/app/sdks/node/docs/examples/projects/update-task.md @@ -10,7 +10,7 @@ client .setKey('') ; -let promise = projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com'); +let promise = projects.updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com'); promise.then(function (response) { console.log(response); diff --git a/app/sdks/node/lib/client.js b/app/sdks/node/lib/client.js index 7ed091de53..f3329fe080 100644 --- a/app/sdks/node/lib/client.js +++ b/app/sdks/node/lib/client.js @@ -15,7 +15,7 @@ class Client { /** * Set Project * - * Your Appwrite project ID. You can find your project ID in your Appwrite console project settings. + * Your Appwrite project ID * * @param string value * @@ -30,7 +30,7 @@ class Client { /** * Set Key * - * Your Appwrite project secret key. You can can create a new API key from your Appwrite console API keys dashboard. + * Your Appwrite project secret key * * @param string value * diff --git a/app/sdks/php/docs/examples/projects/create-webhook.md b/app/sdks/php/docs/examples/projects/create-webhook.md index 6eacda1fc0..1bf92c8925 100644 --- a/app/sdks/php/docs/examples/projects/create-webhook.md +++ b/app/sdks/php/docs/examples/projects/create-webhook.md @@ -12,4 +12,4 @@ $client $projects = new Projects($client); -$result = $projects->createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 0); \ No newline at end of file +$result = $projects->createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1); \ No newline at end of file diff --git a/app/sdks/php/docs/examples/projects/update-task.md b/app/sdks/php/docs/examples/projects/update-task.md index 59308c5d6d..0d9f3fb7a6 100644 --- a/app/sdks/php/docs/examples/projects/update-task.md +++ b/app/sdks/php/docs/examples/projects/update-task.md @@ -12,4 +12,4 @@ $client $projects = new Projects($client); -$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com'); \ No newline at end of file +$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com'); \ No newline at end of file diff --git a/app/sdks/php/src/Appwrite/Client.php b/app/sdks/php/src/Appwrite/Client.php index ea9f145347..29240ec495 100644 --- a/app/sdks/php/src/Appwrite/Client.php +++ b/app/sdks/php/src/Appwrite/Client.php @@ -50,7 +50,7 @@ class Client /** * Set Project * - * Your Appwrite project ID. You can find your project ID in your Appwrite console project settings. + * Your Appwrite project ID * * @param string $value * @@ -66,7 +66,7 @@ class Client /** * Set Key * - * Your Appwrite project secret key. You can can create a new API key from your Appwrite console API keys dashboard. + * Your Appwrite project secret key * * @param string $value * diff --git a/app/sdks/python/appwrite/client.py b/app/sdks/python/appwrite/client.py index 2e6d226e23..835c3ba011 100644 --- a/app/sdks/python/appwrite/client.py +++ b/app/sdks/python/appwrite/client.py @@ -23,13 +23,13 @@ class Client: return self def set_project(self, value): - """Your Appwrite project ID. You can find your project ID in your Appwrite console project settings.""" + """Your Appwrite project ID""" self._global_headers['x-appwrite-project'] = value.lower() return self def set_key(self, value): - """Your Appwrite project secret key. You can can create a new API key from your Appwrite console API keys dashboard.""" + """Your Appwrite project secret key""" self._global_headers['x-appwrite-key'] = value.lower() return self diff --git a/app/tasks/sdks.php b/app/tasks/sdks.php index 8d0f02b1fb..313b0fb776 100644 --- a/app/tasks/sdks.php +++ b/app/tasks/sdks.php @@ -45,6 +45,7 @@ $cli 'gitRepoName' => 'sdk-for-php', 'gitUserName' => 'appwrite', 'warning' => $warning, + 'readme' => false, 'platform' => 'server', ], 'js' => [ @@ -55,6 +56,7 @@ $cli 'gitRepoName' => 'sdk-for-js', 'gitUserName' => 'appwrite', 'warning' => $warning, + 'readme' => realpath(__DIR__ . '/../../docs/sdks/js.md'), 'platform' => 'client', ], 'node' => [ @@ -65,6 +67,7 @@ $cli 'gitRepoName' => 'sdk-for-node', 'gitUserName' => 'appwrite', 'warning' => $warning, + 'readme' => false, 'platform' => 'server', ], 'python' => [ @@ -75,6 +78,7 @@ $cli 'gitRepoName' => 'sdk-for-python', 'gitUserName' => 'appwrite', 'warning' => '**WORK IN PROGRESS - NOT READY FOR USAGE - Want to help us improve this client SDK? Send a pull request to Appwrite [SDK generator repository](https://github.com/appwrite/sdk-generator).**', + 'readme' => false, 'platform' => 'server', ], 'ruby' => [ @@ -85,6 +89,7 @@ $cli 'gitRepoName' => 'sdk-for-ruby', 'gitUserName' => 'appwrite', 'warning' => '**WORK IN PROGRESS - NOT READY FOR USAGE - Want to help us improve this client SDK? Send a pull request to Appwrite [SDK generator repository](https://github.com/appwrite/sdk-generator).**', + 'readme' => false, 'platform' => 'server', ], 'dart' => [ @@ -95,6 +100,7 @@ $cli 'gitRepoName' => 'sdk-for-dart', 'gitUserName' => 'appwrite', 'warning' => '**WORK IN PROGRESS - NOT READY FOR USAGE - Want to help us improve this client SDK? Send a pull request to Appwrite [SDK generator repository](https://github.com/appwrite/sdk-generator).**', + 'readme' => false, 'platform' => 'client', ], ]; @@ -176,8 +182,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ->setShareURL('http://appwrite.io') ->setShareTags('JS,javascript,reactjs,angular,ios,android') ->setShareVia('appwrite_io') - //->setWarning('**WORK IN PROGRESS - NOT READY FOR USAGE**') ->setWarning($client['warning']) + ->setReadme(($client['readme'] && file_exists($client['readme'])) ? file_get_contents($client['readme']) : '') ; $target = __DIR__.'/../sdks/git/'.$name; diff --git a/composer.lock b/composer.lock index 45e6b59372..8412ef11f0 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/appwrite/sdk-for-php.git", - "reference": "62d52f408ee13e152fd077c845de44bca07e6ca2" + "reference": "ac310ede83c8520c038fdab6e646322eb634d9e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/62d52f408ee13e152fd077c845de44bca07e6ca2", - "reference": "62d52f408ee13e152fd077c845de44bca07e6ca2", + "url": "https://api.github.com/repos/appwrite/sdk-for-php/zipball/ac310ede83c8520c038fdab6e646322eb634d9e3", + "reference": "ac310ede83c8520c038fdab6e646322eb634d9e3", "shasum": "" }, "require": { @@ -39,7 +39,7 @@ "BSD-3-Clause" ], "description": "Appwrite backend as a service cuts up to 70% of the time and costs required for building a modern application. We abstract and simplify common development tasks behind a REST APIs, to help you develop your app in a fast and secure way. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)", - "time": "2019-10-09T08:32:30+00:00" + "time": "2019-10-09T10:26:29+00:00" }, { "name": "appwrite/php-clamav", @@ -92,7 +92,7 @@ "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator", - "reference": "14c25a8160c8dc4f97b87c4647bdff65c36aa474" + "reference": "45d82c2c53c38926a45c5e153aaa4794860954a0" }, "require": { "ext-curl": "*", @@ -122,7 +122,7 @@ } ], "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", - "time": "2019-10-09 10:25:20" + "time": "2019-10-09 14:12:31" }, { "name": "bacon/bacon-qr-code", diff --git a/docs/sdks/js.md b/docs/sdks/js.md new file mode 100644 index 0000000000..8ab72889ee --- /dev/null +++ b/docs/sdks/js.md @@ -0,0 +1,15 @@ +## Getting Started + +Initialise the Appwrite SDK in your code, and setup your API credentials: + +```js + +// Init your JS SDK +var appwrite = new Appwrite(); + +appwrite + .setEndpoint('http://localhost/v1') // Set only when using self-hosted solution + .setProject('455x34dfkj') // Your Appwrite Project UID +; + +```