1
0
Fork 0
mirror of synced 2024-06-26 18:20:43 +12:00

Updated SDKs

This commit is contained in:
eldadfux 2019-10-09 21:55:28 +03:00
parent 4f107a7319
commit ec81946485
14 changed files with 60 additions and 25 deletions

View file

@ -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',

View file

@ -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);

View file

@ -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
<script src="https://cdn.jsdelivr.net/npm/appwrite@1.0.23"></script>
```
## 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.

View file

@ -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
*

View file

@ -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);

View file

@ -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);

View file

@ -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
*

View file

@ -12,4 +12,4 @@ $client
$projects = new Projects($client);
$result = $projects->createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 0);
$result = $projects->createWebhook('[PROJECT_ID]', '[NAME]', [], '[URL]', 1);

View file

@ -12,4 +12,4 @@ $client
$projects = new Projects($client);
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 0, 'GET', 'https://example.com');
$result = $projects->updateTask('[PROJECT_ID]', '[TASK_ID]', '[NAME]', 'play', '', 1, 'GET', 'https://example.com');

View file

@ -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
*

View file

@ -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

View file

@ -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;

12
composer.lock generated
View file

@ -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",

15
docs/sdks/js.md Normal file
View file

@ -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
;
```