main page
This commit is contained in:
82
node_modules/appwrite/.github/ISSUE_TEMPLATE/bug.yaml
generated
vendored
Normal file
82
node_modules/appwrite/.github/ISSUE_TEMPLATE/bug.yaml
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
name: "🐛 Bug Report"
|
||||
description: "Submit a bug report to help us improve"
|
||||
title: "🐛 Bug Report: "
|
||||
labels: [bug]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out our bug report form 🙏
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "👟 Reproduction steps"
|
||||
description: "How do you trigger this bug? Please walk us through it step by step."
|
||||
placeholder: "When I ..."
|
||||
- type: textarea
|
||||
id: expected-behavior
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "👍 Expected behavior"
|
||||
description: "What did you think would happen?"
|
||||
placeholder: "It should ..."
|
||||
- type: textarea
|
||||
id: actual-behavior
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "👎 Actual Behavior"
|
||||
description: "What did actually happen? Add screenshots, if applicable."
|
||||
placeholder: "It actually ..."
|
||||
- type: dropdown
|
||||
id: appwrite-version
|
||||
attributes:
|
||||
label: "🎲 Appwrite version"
|
||||
description: "What version of Appwrite are you running?"
|
||||
options:
|
||||
- Version 0.10.x
|
||||
- Version 0.9.x
|
||||
- Version 0.8.x
|
||||
- Version 0.7.x
|
||||
- Version 0.6.x
|
||||
- Different version (specify in environment)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: "💻 Operating system"
|
||||
description: "What OS is your server / device running on?"
|
||||
options:
|
||||
- Linux
|
||||
- MacOS
|
||||
- Windows
|
||||
- Something else
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: enviromnemt
|
||||
validations:
|
||||
required: false
|
||||
attributes:
|
||||
label: "🧱 Your Environment"
|
||||
description: "Is your environment customized in any way?"
|
||||
placeholder: "I use Cloudflare for ..."
|
||||
- type: checkboxes
|
||||
id: no-duplicate-issues
|
||||
attributes:
|
||||
label: "👀 Have you spent some time to check if this issue has been raised before?"
|
||||
description: "Have you Googled for a similar issue or checked our older issues for a similar bug?"
|
||||
options:
|
||||
- label: "I checked and didn't find similar issue"
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: read-code-of-conduct
|
||||
attributes:
|
||||
label: "🏢 Have you read the Code of Conduct?"
|
||||
options:
|
||||
- label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)"
|
||||
required: true
|
||||
32
node_modules/appwrite/.github/ISSUE_TEMPLATE/documentation.yaml
generated
vendored
Normal file
32
node_modules/appwrite/.github/ISSUE_TEMPLATE/documentation.yaml
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: "📚 Documentation"
|
||||
description: "Report an issue related to documentation"
|
||||
title: "📚 Documentation: "
|
||||
labels: [documentation]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to make our documentation better 🙏
|
||||
- type: textarea
|
||||
id: issue-description
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "💭 Description"
|
||||
description: "A clear and concise description of what the issue is."
|
||||
placeholder: "Documentation should not ..."
|
||||
- type: checkboxes
|
||||
id: no-duplicate-issues
|
||||
attributes:
|
||||
label: "👀 Have you spent some time to check if this issue has been raised before?"
|
||||
description: "Have you Googled for a similar issue or checked our older issues for a similar bug?"
|
||||
options:
|
||||
- label: "I checked and didn't find similar issue"
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: read-code-of-conduct
|
||||
attributes:
|
||||
label: "🏢 Have you read the Code of Conduct?"
|
||||
options:
|
||||
- label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)"
|
||||
required: true
|
||||
40
node_modules/appwrite/.github/ISSUE_TEMPLATE/feature.yaml
generated
vendored
Normal file
40
node_modules/appwrite/.github/ISSUE_TEMPLATE/feature.yaml
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
name: 🚀 Feature
|
||||
description: "Submit a proposal for a new feature"
|
||||
title: "🚀 Feature: "
|
||||
labels: [feature]
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out our feature request form 🙏
|
||||
- type: textarea
|
||||
id: feature-description
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "🔖 Feature description"
|
||||
description: "A clear and concise description of what the feature is."
|
||||
placeholder: "You should add ..."
|
||||
- type: textarea
|
||||
id: pitch
|
||||
validations:
|
||||
required: true
|
||||
attributes:
|
||||
label: "🎤 Pitch"
|
||||
description: "Please explain why this feature should be implemented and how it would be used. Add examples, if applicable."
|
||||
placeholder: "In my use-case, ..."
|
||||
- type: checkboxes
|
||||
id: no-duplicate-issues
|
||||
attributes:
|
||||
label: "👀 Have you spent some time to check if this issue has been raised before?"
|
||||
description: "Have you Googled for a similar issue or checked our older issues for a similar bug?"
|
||||
options:
|
||||
- label: "I checked and didn't find similar issue"
|
||||
required: true
|
||||
- type: checkboxes
|
||||
id: read-code-of-conduct
|
||||
attributes:
|
||||
label: "🏢 Have you read the Code of Conduct?"
|
||||
options:
|
||||
- label: "I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)"
|
||||
required: true
|
||||
32
node_modules/appwrite/.travis.yml
generated
vendored
Normal file
32
node_modules/appwrite/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "14.16"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: NPM RC Release
|
||||
if: tag =~ /-(rc|RC)/
|
||||
node_js: "14.16"
|
||||
script:
|
||||
- npm install
|
||||
- npm run build
|
||||
- echo "Deploying RC to NPM..."
|
||||
deploy:
|
||||
provider: npm
|
||||
email: $NPM_EMAIL
|
||||
api_key: $NPM_API_KEY
|
||||
tag: next
|
||||
- stage: NPM Release
|
||||
if: not tag =~ /-(rc|RC)/
|
||||
node_js: "14.16"
|
||||
script:
|
||||
- npm install
|
||||
- npm run build
|
||||
- echo "Deploying to NPM..."
|
||||
deploy:
|
||||
provider: npm
|
||||
email: $NPM_EMAIL
|
||||
api_key: $NPM_API_KEY
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
||||
1
node_modules/appwrite/CHANGELOG.md
generated
vendored
Normal file
1
node_modules/appwrite/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
# Change Log
|
||||
12
node_modules/appwrite/LICENSE
generated
vendored
Normal file
12
node_modules/appwrite/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name 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.
|
||||
111
node_modules/appwrite/README.md
generated
vendored
Normal file
111
node_modules/appwrite/README.md
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
# Appwrite Web 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.4.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-web/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 Web SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)
|
||||
|
||||

|
||||
|
||||
## 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/appwrite@13.0.1"></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(), 'me@example.com', '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(), 'me@example.com', '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-web)
|
||||
- 📜 [Appwrite Docs](https://appwrite.io/docs)
|
||||
- 💬 [Discord Community](https://appwrite.io/discord)
|
||||
- 🚂 [Appwrite Web Playground](https://github.com/appwrite/playground-for-web)
|
||||
|
||||
|
||||
## 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.
|
||||
3
node_modules/appwrite/dist/cjs/package.json
generated
vendored
Normal file
3
node_modules/appwrite/dist/cjs/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
3127
node_modules/appwrite/dist/cjs/sdk.js
generated
vendored
Normal file
3127
node_modules/appwrite/dist/cjs/sdk.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/appwrite/dist/cjs/sdk.js.map
generated
vendored
Normal file
1
node_modules/appwrite/dist/cjs/sdk.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3
node_modules/appwrite/dist/esm/package.json
generated
vendored
Normal file
3
node_modules/appwrite/dist/esm/package.json
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"type": "module"
|
||||
}
|
||||
3112
node_modules/appwrite/dist/esm/sdk.js
generated
vendored
Normal file
3112
node_modules/appwrite/dist/esm/sdk.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
node_modules/appwrite/dist/esm/sdk.js.map
generated
vendored
Normal file
1
node_modules/appwrite/dist/esm/sdk.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3128
node_modules/appwrite/dist/iife/sdk.js
generated
vendored
Normal file
3128
node_modules/appwrite/dist/iife/sdk.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
18
node_modules/appwrite/docs/examples/account/create-anonymous-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-anonymous-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create-email-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-email-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.createEmailSession('email@example.com', 'password');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create-j-w-t.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-j-w-t.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create-magic-u-r-l-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-magic-u-r-l-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.createMagicURLSession('[USER_ID]', 'email@example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
14
node_modules/appwrite/docs/examples/account/create-o-auth2session.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/account/create-o-auth2session.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
// Go to OAuth provider login page
|
||||
account.createOAuth2Session('amazon');
|
||||
|
||||
18
node_modules/appwrite/docs/examples/account/create-phone-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-phone-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create-phone-verification.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-phone-verification.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create-recovery.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-recovery.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.createRecovery('email@example.com', 'https://example.com');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create-verification.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create-verification.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/create.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/create.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.create('[USER_ID]', 'email@example.com', '');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/delete-identity.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/delete-identity.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.deleteIdentity('[IDENTITY_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/delete-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/delete-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/delete-sessions.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/delete-sessions.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/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
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/get-prefs.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/get-prefs.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.getPrefs();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/get-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/get-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.getSession('[SESSION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/get.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/get.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.get();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/list-identities.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/list-identities.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.listIdentities();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/list-logs.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/list-logs.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.listLogs();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/list-sessions.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/list-sessions.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.listSessions();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-email.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-email.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateEmail('email@example.com', 'password');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-magic-u-r-l-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-magic-u-r-l-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateMagicURLSession('[USER_ID]', '[SECRET]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-name.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-name.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateName('[NAME]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-password.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-password.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updatePassword('');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-phone-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-phone-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updatePhoneSession('[USER_ID]', '[SECRET]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-phone-verification.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-phone-verification.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updatePhoneVerification('[USER_ID]', '[SECRET]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-phone.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-phone.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updatePhone('+12065550100', 'password');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-prefs.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-prefs.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updatePrefs({});
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-recovery.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-recovery.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateRecovery('[USER_ID]', '[SECRET]', 'password', 'password');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-session.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-session.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateSession('[SESSION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-status.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-status.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateStatus();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/account/update-verification.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/account/update-verification.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Account } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const account = new Account(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = account.updateVerification('[USER_ID]', '[SECRET]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-browser.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-browser.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getBrowser('aa');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-credit-card.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-credit-card.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getCreditCard('amex');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-favicon.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-favicon.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getFavicon('https://example.com');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-flag.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-flag.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getFlag('af');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-image.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-image.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getImage('https://example.com');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-initials.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-initials.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getInitials();
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/avatars/get-q-r.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/avatars/get-q-r.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Avatars } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const avatars = new Avatars(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = avatars.getQR('[TEXT]');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
18
node_modules/appwrite/docs/examples/databases/create-document.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/databases/create-document.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Databases } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const databases = new Databases(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = databases.createDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]', {});
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/databases/delete-document.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/databases/delete-document.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Databases } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const databases = new Databases(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = databases.deleteDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/databases/get-document.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/databases/get-document.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Databases } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const databases = new Databases(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = databases.getDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/databases/list-documents.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/databases/list-documents.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Databases } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const databases = new Databases(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = databases.listDocuments('[DATABASE_ID]', '[COLLECTION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/databases/update-document.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/databases/update-document.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Databases } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const databases = new Databases(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = databases.updateDocument('[DATABASE_ID]', '[COLLECTION_ID]', '[DOCUMENT_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/functions/create-execution.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/functions/create-execution.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Functions } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const functions = new Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = functions.createExecution('[FUNCTION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/functions/get-execution.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/functions/get-execution.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Functions } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const functions = new Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = functions.getExecution('[FUNCTION_ID]', '[EXECUTION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/functions/list-executions.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/functions/list-executions.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Functions } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const functions = new Functions(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = functions.listExecutions('[FUNCTION_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/graphql/mutation.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/graphql/mutation.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Graphql } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const graphql = new Graphql(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = graphql.mutation({});
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/graphql/query.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/graphql/query.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Graphql } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const graphql = new Graphql(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = graphql.query({});
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/get.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/get.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.get();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-codes.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-codes.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listCodes();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-continents.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-continents.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listContinents();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-countries-e-u.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-countries-e-u.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listCountriesEU();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-countries-phones.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-countries-phones.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listCountriesPhones();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-countries.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-countries.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listCountries();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-currencies.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-currencies.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listCurrencies();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/locale/list-languages.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/locale/list-languages.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Locale } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const locale = new Locale(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = locale.listLanguages();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/storage/create-file.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/storage/create-file.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', document.getElementById('uploader').files[0]);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/storage/delete-file.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/storage/delete-file.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = storage.deleteFile('[BUCKET_ID]', '[FILE_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
14
node_modules/appwrite/docs/examples/storage/get-file-download.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/storage/get-file-download.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/storage/get-file-preview.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/storage/get-file-preview.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = storage.getFilePreview('[BUCKET_ID]', '[FILE_ID]');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
14
node_modules/appwrite/docs/examples/storage/get-file-view.md
generated
vendored
Normal file
14
node_modules/appwrite/docs/examples/storage/get-file-view.md
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const result = storage.getFileView('[BUCKET_ID]', '[FILE_ID]');
|
||||
|
||||
console.log(result); // Resource URL
|
||||
18
node_modules/appwrite/docs/examples/storage/get-file.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/storage/get-file.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = storage.getFile('[BUCKET_ID]', '[FILE_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/storage/list-files.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/storage/list-files.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = storage.listFiles('[BUCKET_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/storage/update-file.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/storage/update-file.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Storage } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const storage = new Storage(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = storage.updateFile('[BUCKET_ID]', '[FILE_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/create-membership.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/create-membership.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.createMembership('[TEAM_ID]', []);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/create.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/create.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.create('[TEAM_ID]', '[NAME]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/delete-membership.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/delete-membership.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.deleteMembership('[TEAM_ID]', '[MEMBERSHIP_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/delete.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/delete.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.delete('[TEAM_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/get-membership.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/get-membership.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.getMembership('[TEAM_ID]', '[MEMBERSHIP_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/get-prefs.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/get-prefs.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.getPrefs('[TEAM_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/get.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/get.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.get('[TEAM_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/list-memberships.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/list-memberships.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.listMemberships('[TEAM_ID]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/list.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/list.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.list();
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/update-membership-status.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/update-membership-status.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.updateMembershipStatus('[TEAM_ID]', '[MEMBERSHIP_ID]', '[USER_ID]', '[SECRET]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/update-membership.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/update-membership.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.updateMembership('[TEAM_ID]', '[MEMBERSHIP_ID]', []);
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/update-name.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/update-name.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.updateName('[TEAM_ID]', '[NAME]');
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
18
node_modules/appwrite/docs/examples/teams/update-prefs.md
generated
vendored
Normal file
18
node_modules/appwrite/docs/examples/teams/update-prefs.md
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { Client, Teams } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
const teams = new Teams(client);
|
||||
|
||||
client
|
||||
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
|
||||
.setProject('5df5acd0d48c2') // Your project ID
|
||||
;
|
||||
|
||||
const promise = teams.updatePrefs('[TEAM_ID]', {});
|
||||
|
||||
promise.then(function (response) {
|
||||
console.log(response); // Success
|
||||
}, function (error) {
|
||||
console.log(error); // Failure
|
||||
});
|
||||
41
node_modules/appwrite/package.json
generated
vendored
Normal file
41
node_modules/appwrite/package.json
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"name": "appwrite",
|
||||
"homepage": "https://appwrite.io/support",
|
||||
"description": "Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
|
||||
"version": "13.0.2",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "dist/cjs/sdk.js",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/esm/sdk.js",
|
||||
"require": "./dist/cjs/sdk.js",
|
||||
"types": "./types/index.d.ts"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"module": "dist/esm/sdk.js",
|
||||
"types": "types/index.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-for-web"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:types && npm run build:libs",
|
||||
"build:types": "tsc --declaration --emitDeclarationOnly --outDir types",
|
||||
"build:libs": "rollup -c"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-typescript": "8.3.2",
|
||||
"playwright": "1.15.0",
|
||||
"rollup": "2.75.4",
|
||||
"serve-handler": "6.1.0",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "4.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"cross-fetch": "3.1.5",
|
||||
"isomorphic-form-data": "2.0.0"
|
||||
},
|
||||
"jsdelivr": "dist/iife/sdk.js",
|
||||
"unpkg": "dist/iife/sdk.js"
|
||||
}
|
||||
31
node_modules/appwrite/rollup.config.js
generated
vendored
Normal file
31
node_modules/appwrite/rollup.config.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import pkg from "./package.json";
|
||||
import typescript from "@rollup/plugin-typescript";
|
||||
|
||||
export default {
|
||||
external: Object.keys(pkg.dependencies),
|
||||
input: "src/index.ts",
|
||||
plugins: [typescript()],
|
||||
output: [
|
||||
{
|
||||
format: "cjs",
|
||||
file: pkg.main,
|
||||
esModule: false,
|
||||
sourcemap: true,
|
||||
},
|
||||
{
|
||||
format: "es",
|
||||
file: pkg.module,
|
||||
sourcemap: true,
|
||||
},
|
||||
{
|
||||
format: "iife",
|
||||
file: pkg.jsdelivr,
|
||||
name: "Appwrite",
|
||||
extend: true,
|
||||
globals: {
|
||||
"cross-fetch": "window",
|
||||
"FormData": "FormData",
|
||||
},
|
||||
},
|
||||
],
|
||||
};
|
||||
442
node_modules/appwrite/src/client.ts
generated
vendored
Normal file
442
node_modules/appwrite/src/client.ts
generated
vendored
Normal file
@@ -0,0 +1,442 @@
|
||||
import 'isomorphic-form-data';
|
||||
import { fetch } from 'cross-fetch';
|
||||
import { Models } from './models';
|
||||
import { Service } from './service';
|
||||
|
||||
type Payload = {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
type Headers = {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
type RealtimeResponse = {
|
||||
type: 'error' | 'event' | 'connected' | 'response';
|
||||
data: RealtimeResponseAuthenticated | RealtimeResponseConnected | RealtimeResponseError | RealtimeResponseEvent<unknown>;
|
||||
}
|
||||
|
||||
type RealtimeRequest = {
|
||||
type: 'authentication';
|
||||
data: RealtimeRequestAuthenticate;
|
||||
}
|
||||
|
||||
export type RealtimeResponseEvent<T extends unknown> = {
|
||||
events: string[];
|
||||
channels: string[];
|
||||
timestamp: number;
|
||||
payload: T;
|
||||
}
|
||||
|
||||
type RealtimeResponseError = {
|
||||
code: number;
|
||||
message: string;
|
||||
}
|
||||
|
||||
type RealtimeResponseConnected = {
|
||||
channels: string[];
|
||||
user?: object;
|
||||
}
|
||||
|
||||
type RealtimeResponseAuthenticated = {
|
||||
to: string;
|
||||
success: boolean;
|
||||
user: object;
|
||||
}
|
||||
|
||||
type RealtimeRequestAuthenticate = {
|
||||
session: string;
|
||||
}
|
||||
|
||||
type Realtime = {
|
||||
socket?: WebSocket;
|
||||
timeout?: number;
|
||||
url?: string;
|
||||
lastMessage?: RealtimeResponse;
|
||||
channels: Set<string>;
|
||||
subscriptions: Map<number, {
|
||||
channels: string[];
|
||||
callback: (payload: RealtimeResponseEvent<any>) => void
|
||||
}>;
|
||||
subscriptionsCounter: number;
|
||||
reconnect: boolean;
|
||||
reconnectAttempts: number;
|
||||
getTimeout: () => number;
|
||||
connect: () => void;
|
||||
createSocket: () => void;
|
||||
cleanUp: (channels: string[]) => void;
|
||||
onMessage: (event: MessageEvent) => void;
|
||||
}
|
||||
|
||||
export type UploadProgress = {
|
||||
$id: string;
|
||||
progress: number;
|
||||
sizeUploaded: number;
|
||||
chunksTotal: number;
|
||||
chunksUploaded: number;
|
||||
}
|
||||
|
||||
class AppwriteException extends Error {
|
||||
code: number;
|
||||
response: string;
|
||||
type: string;
|
||||
constructor(message: string, code: number = 0, type: string = '', response: string = '') {
|
||||
super(message);
|
||||
this.name = 'AppwriteException';
|
||||
this.message = message;
|
||||
this.code = code;
|
||||
this.type = type;
|
||||
this.response = response;
|
||||
}
|
||||
}
|
||||
|
||||
class Client {
|
||||
config = {
|
||||
endpoint: 'https://HOSTNAME/v1',
|
||||
endpointRealtime: '',
|
||||
project: '',
|
||||
jwt: '',
|
||||
locale: '',
|
||||
};
|
||||
headers: Headers = {
|
||||
'x-sdk-name': 'Web',
|
||||
'x-sdk-platform': 'client',
|
||||
'x-sdk-language': 'web',
|
||||
'x-sdk-version': '13.0.2',
|
||||
'X-Appwrite-Response-Format': '1.4.0',
|
||||
};
|
||||
|
||||
/**
|
||||
* Set Endpoint
|
||||
*
|
||||
* Your project endpoint
|
||||
*
|
||||
* @param {string} endpoint
|
||||
*
|
||||
* @returns {this}
|
||||
*/
|
||||
setEndpoint(endpoint: string): this {
|
||||
this.config.endpoint = endpoint;
|
||||
this.config.endpointRealtime = this.config.endpointRealtime || this.config.endpoint.replace('https://', 'wss://').replace('http://', 'ws://');
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Realtime Endpoint
|
||||
*
|
||||
* @param {string} endpointRealtime
|
||||
*
|
||||
* @returns {this}
|
||||
*/
|
||||
setEndpointRealtime(endpointRealtime: string): this {
|
||||
this.config.endpointRealtime = endpointRealtime;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Project
|
||||
*
|
||||
* Your project ID
|
||||
*
|
||||
* @param value string
|
||||
*
|
||||
* @return {this}
|
||||
*/
|
||||
setProject(value: string): this {
|
||||
this.headers['X-Appwrite-Project'] = value;
|
||||
this.config.project = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set JWT
|
||||
*
|
||||
* Your secret JSON Web Token
|
||||
*
|
||||
* @param value string
|
||||
*
|
||||
* @return {this}
|
||||
*/
|
||||
setJWT(value: string): this {
|
||||
this.headers['X-Appwrite-JWT'] = value;
|
||||
this.config.jwt = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Locale
|
||||
*
|
||||
* @param value string
|
||||
*
|
||||
* @return {this}
|
||||
*/
|
||||
setLocale(value: string): this {
|
||||
this.headers['X-Appwrite-Locale'] = value;
|
||||
this.config.locale = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private realtime: Realtime = {
|
||||
socket: undefined,
|
||||
timeout: undefined,
|
||||
url: '',
|
||||
channels: new Set(),
|
||||
subscriptions: new Map(),
|
||||
subscriptionsCounter: 0,
|
||||
reconnect: true,
|
||||
reconnectAttempts: 0,
|
||||
lastMessage: undefined,
|
||||
connect: () => {
|
||||
clearTimeout(this.realtime.timeout);
|
||||
this.realtime.timeout = window?.setTimeout(() => {
|
||||
this.realtime.createSocket();
|
||||
}, 50);
|
||||
},
|
||||
getTimeout: () => {
|
||||
switch (true) {
|
||||
case this.realtime.reconnectAttempts < 5:
|
||||
return 1000;
|
||||
case this.realtime.reconnectAttempts < 15:
|
||||
return 5000;
|
||||
case this.realtime.reconnectAttempts < 100:
|
||||
return 10_000;
|
||||
default:
|
||||
return 60_000;
|
||||
}
|
||||
},
|
||||
createSocket: () => {
|
||||
if (this.realtime.channels.size < 1) return;
|
||||
|
||||
const channels = new URLSearchParams();
|
||||
channels.set('project', this.config.project);
|
||||
this.realtime.channels.forEach(channel => {
|
||||
channels.append('channels[]', channel);
|
||||
});
|
||||
|
||||
const url = this.config.endpointRealtime + '/realtime?' + channels.toString();
|
||||
|
||||
if (
|
||||
url !== this.realtime.url || // Check if URL is present
|
||||
!this.realtime.socket || // Check if WebSocket has not been created
|
||||
this.realtime.socket?.readyState > WebSocket.OPEN // Check if WebSocket is CLOSING (3) or CLOSED (4)
|
||||
) {
|
||||
if (
|
||||
this.realtime.socket &&
|
||||
this.realtime.socket?.readyState < WebSocket.CLOSING // Close WebSocket if it is CONNECTING (0) or OPEN (1)
|
||||
) {
|
||||
this.realtime.reconnect = false;
|
||||
this.realtime.socket.close();
|
||||
}
|
||||
|
||||
this.realtime.url = url;
|
||||
this.realtime.socket = new WebSocket(url);
|
||||
this.realtime.socket.addEventListener('message', this.realtime.onMessage);
|
||||
this.realtime.socket.addEventListener('open', _event => {
|
||||
this.realtime.reconnectAttempts = 0;
|
||||
});
|
||||
this.realtime.socket.addEventListener('close', event => {
|
||||
if (
|
||||
!this.realtime.reconnect ||
|
||||
(
|
||||
this.realtime?.lastMessage?.type === 'error' && // Check if last message was of type error
|
||||
(<RealtimeResponseError>this.realtime?.lastMessage.data).code === 1008 // Check for policy violation 1008
|
||||
)
|
||||
) {
|
||||
this.realtime.reconnect = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const timeout = this.realtime.getTimeout();
|
||||
console.error(`Realtime got disconnected. Reconnect will be attempted in ${timeout / 1000} seconds.`, event.reason);
|
||||
|
||||
setTimeout(() => {
|
||||
this.realtime.reconnectAttempts++;
|
||||
this.realtime.createSocket();
|
||||
}, timeout);
|
||||
})
|
||||
}
|
||||
},
|
||||
onMessage: (event) => {
|
||||
try {
|
||||
const message: RealtimeResponse = JSON.parse(event.data);
|
||||
this.realtime.lastMessage = message;
|
||||
switch (message.type) {
|
||||
case 'connected':
|
||||
const cookie = JSON.parse(window.localStorage.getItem('cookieFallback') ?? '{}');
|
||||
const session = cookie?.[`a_session_${this.config.project}`];
|
||||
const messageData = <RealtimeResponseConnected>message.data;
|
||||
|
||||
if (session && !messageData.user) {
|
||||
this.realtime.socket?.send(JSON.stringify(<RealtimeRequest>{
|
||||
type: 'authentication',
|
||||
data: {
|
||||
session
|
||||
}
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case 'event':
|
||||
let data = <RealtimeResponseEvent<unknown>>message.data;
|
||||
if (data?.channels) {
|
||||
const isSubscribed = data.channels.some(channel => this.realtime.channels.has(channel));
|
||||
if (!isSubscribed) return;
|
||||
this.realtime.subscriptions.forEach(subscription => {
|
||||
if (data.channels.some(channel => subscription.channels.includes(channel))) {
|
||||
setTimeout(() => subscription.callback(data));
|
||||
}
|
||||
})
|
||||
}
|
||||
break;
|
||||
case 'error':
|
||||
throw message.data;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
cleanUp: channels => {
|
||||
this.realtime.channels.forEach(channel => {
|
||||
if (channels.includes(channel)) {
|
||||
let found = Array.from(this.realtime.subscriptions).some(([_key, subscription] )=> {
|
||||
return subscription.channels.includes(channel);
|
||||
})
|
||||
|
||||
if (!found) {
|
||||
this.realtime.channels.delete(channel);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes to Appwrite events and passes you the payload in realtime.
|
||||
*
|
||||
* @param {string|string[]} channels
|
||||
* Channel to subscribe - pass a single channel as a string or multiple with an array of strings.
|
||||
*
|
||||
* Possible channels are:
|
||||
* - account
|
||||
* - collections
|
||||
* - collections.[ID]
|
||||
* - collections.[ID].documents
|
||||
* - documents
|
||||
* - documents.[ID]
|
||||
* - files
|
||||
* - files.[ID]
|
||||
* - executions
|
||||
* - executions.[ID]
|
||||
* - functions.[ID]
|
||||
* - teams
|
||||
* - teams.[ID]
|
||||
* - memberships
|
||||
* - memberships.[ID]
|
||||
* @param {(payload: RealtimeMessage) => void} callback Is called on every realtime update.
|
||||
* @returns {() => void} Unsubscribes from events.
|
||||
*/
|
||||
subscribe<T extends unknown>(channels: string | string[], callback: (payload: RealtimeResponseEvent<T>) => void): () => void {
|
||||
let channelArray = typeof channels === 'string' ? [channels] : channels;
|
||||
channelArray.forEach(channel => this.realtime.channels.add(channel));
|
||||
|
||||
const counter = this.realtime.subscriptionsCounter++;
|
||||
this.realtime.subscriptions.set(counter, {
|
||||
channels: channelArray,
|
||||
callback
|
||||
});
|
||||
|
||||
this.realtime.connect();
|
||||
|
||||
return () => {
|
||||
this.realtime.subscriptions.delete(counter);
|
||||
this.realtime.cleanUp(channelArray);
|
||||
this.realtime.connect();
|
||||
}
|
||||
}
|
||||
|
||||
async call(method: string, url: URL, headers: Headers = {}, params: Payload = {}): Promise<any> {
|
||||
method = method.toUpperCase();
|
||||
|
||||
|
||||
headers = Object.assign({}, this.headers, headers);
|
||||
|
||||
let options: RequestInit = {
|
||||
method,
|
||||
headers,
|
||||
credentials: 'include'
|
||||
};
|
||||
|
||||
if (typeof window !== 'undefined' && window.localStorage) {
|
||||
headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback') ?? '';
|
||||
}
|
||||
|
||||
if (method === 'GET') {
|
||||
for (const [key, value] of Object.entries(Service.flatten(params))) {
|
||||
url.searchParams.append(key, value);
|
||||
}
|
||||
} else {
|
||||
switch (headers['content-type']) {
|
||||
case 'application/json':
|
||||
options.body = JSON.stringify(params);
|
||||
break;
|
||||
|
||||
case 'multipart/form-data':
|
||||
let formData = new FormData();
|
||||
|
||||
for (const key in params) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((value: any) => {
|
||||
formData.append(key + '[]', value);
|
||||
})
|
||||
} else {
|
||||
formData.append(key, params[key]);
|
||||
}
|
||||
}
|
||||
|
||||
options.body = formData;
|
||||
delete headers['content-type'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
let data = null;
|
||||
const response = await fetch(url.toString(), options);
|
||||
|
||||
if (response.headers.get('content-type')?.includes('application/json')) {
|
||||
data = await response.json();
|
||||
} else {
|
||||
data = {
|
||||
message: await response.text()
|
||||
};
|
||||
}
|
||||
|
||||
if (400 <= response.status) {
|
||||
throw new AppwriteException(data?.message, response.status, data?.type, data);
|
||||
}
|
||||
|
||||
const cookieFallback = response.headers.get('X-Fallback-Cookies');
|
||||
|
||||
if (typeof window !== 'undefined' && window.localStorage && cookieFallback) {
|
||||
window.console.warn('Appwrite is using localStorage for session management. Increase your security by adding a custom domain as your API endpoint.');
|
||||
window.localStorage.setItem('cookieFallback', cookieFallback);
|
||||
}
|
||||
|
||||
return data;
|
||||
} catch (e) {
|
||||
if (e instanceof AppwriteException) {
|
||||
throw e;
|
||||
}
|
||||
throw new AppwriteException((<Error>e).message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { Client, AppwriteException };
|
||||
export { Query } from './query';
|
||||
export type { Models, Payload };
|
||||
export type { QueryTypes, QueryTypesList } from './query';
|
||||
9
node_modules/appwrite/src/id.ts
generated
vendored
Normal file
9
node_modules/appwrite/src/id.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export class ID {
|
||||
public static custom(id: string): string {
|
||||
return id
|
||||
}
|
||||
|
||||
public static unique(): string {
|
||||
return 'unique()'
|
||||
}
|
||||
}
|
||||
14
node_modules/appwrite/src/index.ts
generated
vendored
Normal file
14
node_modules/appwrite/src/index.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export { Client, Query, AppwriteException } from './client';
|
||||
export { Account } from './services/account';
|
||||
export { Avatars } from './services/avatars';
|
||||
export { Databases } from './services/databases';
|
||||
export { Functions } from './services/functions';
|
||||
export { Graphql } from './services/graphql';
|
||||
export { Locale } from './services/locale';
|
||||
export { Storage } from './services/storage';
|
||||
export { Teams } from './services/teams';
|
||||
export type { Models, Payload, RealtimeResponseEvent, UploadProgress } from './client';
|
||||
export type { QueryTypes, QueryTypesList } from './query';
|
||||
export { Permission } from './permission';
|
||||
export { Role } from './role';
|
||||
export { ID } from './id';
|
||||
1021
node_modules/appwrite/src/models.ts
generated
vendored
Normal file
1021
node_modules/appwrite/src/models.ts
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
22
node_modules/appwrite/src/permission.ts
generated
vendored
Normal file
22
node_modules/appwrite/src/permission.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
export class Permission {
|
||||
|
||||
static read = (role: string): string => {
|
||||
return `read("${role}")`
|
||||
}
|
||||
|
||||
static write = (role: string): string => {
|
||||
return `write("${role}")`
|
||||
}
|
||||
|
||||
static create = (role: string): string => {
|
||||
return `create("${role}")`
|
||||
}
|
||||
|
||||
static update = (role: string): string => {
|
||||
return `update("${role}")`
|
||||
}
|
||||
|
||||
static delete = (role: string): string => {
|
||||
return `delete("${role}")`
|
||||
}
|
||||
}
|
||||
74
node_modules/appwrite/src/query.ts
generated
vendored
Normal file
74
node_modules/appwrite/src/query.ts
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
type QueryTypesSingle = string | number | boolean;
|
||||
export type QueryTypesList = string[] | number[] | boolean[];
|
||||
export type QueryTypes = QueryTypesSingle | QueryTypesList;
|
||||
|
||||
export class Query {
|
||||
static equal = (attribute: string, value: QueryTypes): string =>
|
||||
Query.addQuery(attribute, "equal", value);
|
||||
|
||||
static notEqual = (attribute: string, value: QueryTypes): string =>
|
||||
Query.addQuery(attribute, "notEqual", value);
|
||||
|
||||
static lessThan = (attribute: string, value: QueryTypes): string =>
|
||||
Query.addQuery(attribute, "lessThan", value);
|
||||
|
||||
static lessThanEqual = (attribute: string, value: QueryTypes): string =>
|
||||
Query.addQuery(attribute, "lessThanEqual", value);
|
||||
|
||||
static greaterThan = (attribute: string, value: QueryTypes): string =>
|
||||
Query.addQuery(attribute, "greaterThan", value);
|
||||
|
||||
static greaterThanEqual = (attribute: string, value: QueryTypes): string =>
|
||||
Query.addQuery(attribute, "greaterThanEqual", value);
|
||||
|
||||
static isNull = (attribute: string): string =>
|
||||
`isNull("${attribute}")`;
|
||||
|
||||
static isNotNull = (attribute: string): string =>
|
||||
`isNotNull("${attribute}")`;
|
||||
|
||||
static between = (attribute: string, start: string|number, end: string|number): string =>
|
||||
`between("${attribute}", ${Query.parseValues(start)}, ${Query.parseValues(end)})`;
|
||||
|
||||
static startsWith = (attribute: string, value: string): string =>
|
||||
Query.addQuery(attribute, "startsWith", value);
|
||||
|
||||
static endsWith = (attribute: string, value: string): string =>
|
||||
Query.addQuery(attribute, "endsWith", value);
|
||||
|
||||
static select = (attributes: string[]): string =>
|
||||
`select([${attributes.map((attr: string) => `"${attr}"`).join(",")}])`;
|
||||
|
||||
static search = (attribute: string, value: string): string =>
|
||||
Query.addQuery(attribute, "search", value);
|
||||
|
||||
static orderDesc = (attribute: string): string =>
|
||||
`orderDesc("${attribute}")`;
|
||||
|
||||
static orderAsc = (attribute: string): string =>
|
||||
`orderAsc("${attribute}")`;
|
||||
|
||||
static cursorAfter = (documentId: string): string =>
|
||||
`cursorAfter("${documentId}")`;
|
||||
|
||||
static cursorBefore = (documentId: string): string =>
|
||||
`cursorBefore("${documentId}")`;
|
||||
|
||||
static limit = (limit: number): string =>
|
||||
`limit(${limit})`;
|
||||
|
||||
static offset = (offset: number): string =>
|
||||
`offset(${offset})`;
|
||||
|
||||
private static addQuery = (attribute: string, method: string, value: QueryTypes): string =>
|
||||
value instanceof Array
|
||||
? `${method}("${attribute}", [${value
|
||||
.map((v: QueryTypesSingle) => Query.parseValues(v))
|
||||
.join(",")}])`
|
||||
: `${method}("${attribute}", [${Query.parseValues(value)}])`;
|
||||
|
||||
private static parseValues = (value: QueryTypes): string =>
|
||||
typeof value === "string" || value instanceof String
|
||||
? `"${value}"`
|
||||
: `${value}`;
|
||||
}
|
||||
100
node_modules/appwrite/src/role.ts
generated
vendored
Normal file
100
node_modules/appwrite/src/role.ts
generated
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
/**
|
||||
* Helper class to generate role strings for `Permission`.
|
||||
*/
|
||||
export class Role {
|
||||
|
||||
/**
|
||||
* Grants access to anyone.
|
||||
*
|
||||
* This includes authenticated and unauthenticated users.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
public static any(): string {
|
||||
return 'any'
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access to a specific user by user ID.
|
||||
*
|
||||
* You can optionally pass verified or unverified for
|
||||
* `status` to target specific types of users.
|
||||
*
|
||||
* @param {string} id
|
||||
* @param {string} status
|
||||
* @returns {string}
|
||||
*/
|
||||
public static user(id: string, status: string = ''): string {
|
||||
if (status === '') {
|
||||
return `user:${id}`
|
||||
}
|
||||
return `user:${id}/${status}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access to any authenticated or anonymous user.
|
||||
*
|
||||
* You can optionally pass verified or unverified for
|
||||
* `status` to target specific types of users.
|
||||
*
|
||||
* @param {string} status
|
||||
* @returns {string}
|
||||
*/
|
||||
public static users(status: string = ''): string {
|
||||
if (status === '') {
|
||||
return 'users'
|
||||
}
|
||||
return `users/${status}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access to any guest user without a session.
|
||||
*
|
||||
* Authenticated users don't have access to this role.
|
||||
*
|
||||
* @returns {string}
|
||||
*/
|
||||
public static guests(): string {
|
||||
return 'guests'
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access to a team by team ID.
|
||||
*
|
||||
* You can optionally pass a role for `role` to target
|
||||
* team members with the specified role.
|
||||
*
|
||||
* @param {string} id
|
||||
* @param {string} role
|
||||
* @returns {string}
|
||||
*/
|
||||
public static team(id: string, role: string = ''): string {
|
||||
if (role === '') {
|
||||
return `team:${id}`
|
||||
}
|
||||
return `team:${id}/${role}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access to a specific member of a team.
|
||||
*
|
||||
* When the member is removed from the team, they will
|
||||
* no longer have access.
|
||||
*
|
||||
* @param {string} id
|
||||
* @returns {string}
|
||||
*/
|
||||
public static member(id: string): string {
|
||||
return `member:${id}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Grants access to a user with the specified label.
|
||||
*
|
||||
* @param {string} name
|
||||
* @returns {string}
|
||||
*/
|
||||
public static label(name: string): string {
|
||||
return `label:${name}`
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user