-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5267f00
commit 68a2db9
Showing
227 changed files
with
14,467 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Change Log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
MIT License | ||
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors. | ||
All rights reserved. | ||
|
||
Copyright (c) 2022 Appwrite | ||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,111 @@ | ||
# sdk-for-console | ||
# Appwrite Console SDK | ||
|
||
 | ||
 | ||
[](https://travis-ci.com/appwrite/sdk-generator) | ||
[](https://twitter.com/appwrite) | ||
[](https://appwrite.io/discord) | ||
|
||
**This SDK is compatible with Appwrite server version 1.2.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-console/releases).** | ||
|
||
Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Console SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) | ||
|
||
 | ||
|
||
## Installation | ||
|
||
### NPM | ||
|
||
To install via [NPM](https://www.npmjs.com/): | ||
|
||
```bash | ||
npm install appwrite --save | ||
``` | ||
|
||
If you're using a bundler (like [Rollup](https://rollupjs.org/) or [webpack](https://webpack.js.org/)), you can import the Appwrite module when you need it: | ||
|
||
```js | ||
import { Client, Account } from "appwrite"; | ||
``` | ||
|
||
### CDN | ||
|
||
To install with a CDN (content delivery network) add the following scripts to the bottom of your <body> tag, but before you use any Appwrite services: | ||
|
||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
``` | ||
|
||
|
||
## Getting Started | ||
|
||
### Add your Web Platform | ||
For you to init your SDK and interact with Appwrite services you need to add a web 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 **Web** platform and add your client app hostname. By adding your hostname to your project platform you are allowing cross-domain communication between your project and the Appwrite API. | ||
|
||
### Init your SDK | ||
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page. | ||
|
||
```js | ||
// Init your Web SDK | ||
const client = new Client(); | ||
|
||
client | ||
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint | ||
.setProject('455x34dfkj') // Your project ID | ||
; | ||
``` | ||
|
||
### 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](https://appwrite.io/docs) section. | ||
|
||
```js | ||
const account = new Account(client); | ||
|
||
// Register User | ||
account.create(ID.unique(), '[email protected]', 'password', 'Jane Doe') | ||
.then(function (response) { | ||
console.log(response); | ||
}, function (error) { | ||
console.log(error); | ||
}); | ||
|
||
``` | ||
|
||
### Full Example | ||
```js | ||
// Init your Web SDK | ||
const client = new Client(); | ||
|
||
client | ||
.setEndpoint('http://localhost/v1') // Your Appwrite Endpoint | ||
.setProject('455x34dfkj') | ||
; | ||
|
||
const account = new Account(client); | ||
|
||
// Register User | ||
account.create(ID.unique(), '[email protected]', 'password', 'Jane Doe') | ||
.then(function (response) { | ||
console.log(response); | ||
}, function (error) { | ||
console.log(error); | ||
}); | ||
``` | ||
|
||
### Learn more | ||
You can use the following resources to learn more and get help | ||
- 🚀 [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) | ||
|
||
|
||
## Contribution | ||
|
||
This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request. | ||
|
||
## License | ||
|
||
Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createAnonymousSession(); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createEmailSession('[email protected]', 'password'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createJWT(); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createMagicURLSession('[USER_ID]', '[email protected]'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
// Go to OAuth provider login page | ||
account.createOAuth2Session('amazon'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createPhoneSession('[USER_ID]', '+12065550100'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createPhoneVerification(); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createRecovery('[email protected]', 'https://example.com'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.createVerification('https://example.com'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.create('[USER_ID]', '[email protected]', 'password'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.deleteSession('[SESSION_ID]'); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Client, Account } from "appwrite"; | ||
|
||
const client = new Client(); | ||
|
||
const account = new Account(client); | ||
|
||
client | ||
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint | ||
.setProject('5df5acd0d48c2') // Your project ID | ||
; | ||
|
||
const promise = account.deleteSessions(); | ||
|
||
promise.then(function (response) { | ||
console.log(response); // Success | ||
}, function (error) { | ||
console.log(error); // Failure | ||
}); |
Oops, something went wrong.