Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Appwrite Deno SDK

![License](https://img.shields.io/github/license/appwrite/sdk-for-deno.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.7.4-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.8.0-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)

**This SDK is compatible with Appwrite server version 1.7.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-deno/releases).**
**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-deno/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 Deno 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)

Expand All @@ -23,6 +23,7 @@ import * as sdk from "https://deno.land/x/appwrite/mod.ts";
## Getting Started

### Init your SDK

Initialize your SDK with your Appwrite server API endpoint and project ID which can be found in your project settings page and your new API secret Key from project's API keys section.

```typescript
Expand All @@ -48,6 +49,7 @@ console.log(user);
```

### Full Example

```typescript
import * as sdk from "https://deno.land/x/appwrite/mod.ts";

Expand All @@ -66,6 +68,7 @@ console.log(user);
```

### Error Handling

The Appwrite Deno SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example.

```typescript
Expand All @@ -79,6 +82,7 @@ try {
```

### Learn more

You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.createEmailPasswordSession(
'[email protected]', // email
'password' // password
);
const response = await account.createEmailPasswordSession({
email: '[email protected]',
password: 'password'
});
10 changes: 5 additions & 5 deletions docs/examples/account/create-email-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const client = new Client()

const account = new Account(client);

const response = await account.createEmailToken(
'<USER_ID>', // userId
'[email protected]', // email
false // phrase (optional)
);
const response = await account.createEmailToken({
userId: '<USER_ID>',
email: '[email protected]',
phrase: false // optional
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const client = new Client()

const account = new Account(client);

const response = await account.createMagicURLToken(
'<USER_ID>', // userId
'[email protected]', // email
'https://example.com', // url (optional)
false // phrase (optional)
);
const response = await account.createMagicURLToken({
userId: '<USER_ID>',
email: '[email protected]',
url: 'https://example.com', // optional
phrase: false // optional
});
6 changes: 3 additions & 3 deletions docs/examples/account/create-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.createMfaAuthenticator(
AuthenticatorType.Totp // type
);
const response = await account.createMFAAuthenticator({
type: AuthenticatorType.Totp
});
6 changes: 3 additions & 3 deletions docs/examples/account/create-mfa-challenge.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.createMfaChallenge(
AuthenticationFactor.Email // factor
);
const response = await account.createMFAChallenge({
factor: AuthenticationFactor.Email
});
2 changes: 1 addition & 1 deletion docs/examples/account/create-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const client = new Client()

const account = new Account(client);

const response = await account.createMfaRecoveryCodes();
const response = await account.createMFARecoveryCodes();
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const client = new Client()

const account = new Account(client);

account.createOAuth2Token(
OAuthProvider.Amazon, // provider
'https://example.com', // success (optional)
'https://example.com', // failure (optional)
[] // scopes (optional)
);
account.createOAuth2Token({
provider: OAuthProvider.Amazon,
success: 'https://example.com', // optional
failure: 'https://example.com', // optional
scopes: [] // optional
});
8 changes: 4 additions & 4 deletions docs/examples/account/create-phone-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.createPhoneToken(
'<USER_ID>', // userId
'+12065550100' // phone
);
const response = await account.createPhoneToken({
userId: '<USER_ID>',
phone: '+12065550100'
});
8 changes: 4 additions & 4 deletions docs/examples/account/create-recovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.createRecovery(
'[email protected]', // email
'https://example.com' // url
);
const response = await account.createRecovery({
email: '[email protected]',
url: 'https://example.com'
});
8 changes: 4 additions & 4 deletions docs/examples/account/create-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.createSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
const response = await account.createSession({
userId: '<USER_ID>',
secret: '<SECRET>'
});
6 changes: 3 additions & 3 deletions docs/examples/account/create-verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.createVerification(
'https://example.com' // url
);
const response = await account.createVerification({
url: 'https://example.com'
});
12 changes: 6 additions & 6 deletions docs/examples/account/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const client = new Client()

const account = new Account(client);

const response = await account.create(
'<USER_ID>', // userId
'[email protected]', // email
'', // password
'<NAME>' // name (optional)
);
const response = await account.create({
userId: '<USER_ID>',
email: '[email protected]',
password: '',
name: '<NAME>' // optional
});
6 changes: 3 additions & 3 deletions docs/examples/account/delete-identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.deleteIdentity(
'<IDENTITY_ID>' // identityId
);
const response = await account.deleteIdentity({
identityId: '<IDENTITY_ID>'
});
6 changes: 3 additions & 3 deletions docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.deleteMfaAuthenticator(
AuthenticatorType.Totp // type
);
const response = await account.deleteMFAAuthenticator({
type: AuthenticatorType.Totp
});
6 changes: 3 additions & 3 deletions docs/examples/account/delete-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.deleteSession(
'<SESSION_ID>' // sessionId
);
const response = await account.deleteSession({
sessionId: '<SESSION_ID>'
});
2 changes: 1 addition & 1 deletion docs/examples/account/get-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const client = new Client()

const account = new Account(client);

const response = await account.getMfaRecoveryCodes();
const response = await account.getMFARecoveryCodes();
6 changes: 3 additions & 3 deletions docs/examples/account/get-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.getSession(
'<SESSION_ID>' // sessionId
);
const response = await account.getSession({
sessionId: '<SESSION_ID>'
});
6 changes: 3 additions & 3 deletions docs/examples/account/list-identities.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.listIdentities(
[] // queries (optional)
);
const response = await account.listIdentities({
queries: [] // optional
});
6 changes: 3 additions & 3 deletions docs/examples/account/list-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.listLogs(
[] // queries (optional)
);
const response = await account.listLogs({
queries: [] // optional
});
2 changes: 1 addition & 1 deletion docs/examples/account/list-mfa-factors.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const client = new Client()

const account = new Account(client);

const response = await account.listMfaFactors();
const response = await account.listMFAFactors();
8 changes: 4 additions & 4 deletions docs/examples/account/update-email.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateEmail(
'[email protected]', // email
'password' // password
);
const response = await account.updateEmail({
email: '[email protected]',
password: 'password'
});
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateMagicURLSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
const response = await account.updateMagicURLSession({
userId: '<USER_ID>',
secret: '<SECRET>'
});
8 changes: 4 additions & 4 deletions docs/examples/account/update-mfa-authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateMfaAuthenticator(
AuthenticatorType.Totp, // type
'<OTP>' // otp
);
const response = await account.updateMFAAuthenticator({
type: AuthenticatorType.Totp,
otp: '<OTP>'
});
8 changes: 4 additions & 4 deletions docs/examples/account/update-mfa-challenge.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateMfaChallenge(
'<CHALLENGE_ID>', // challengeId
'<OTP>' // otp
);
const response = await account.updateMFAChallenge({
challengeId: '<CHALLENGE_ID>',
otp: '<OTP>'
});
2 changes: 1 addition & 1 deletion docs/examples/account/update-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateMfaRecoveryCodes();
const response = await account.updateMFARecoveryCodes();
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateMFA(
false // mfa
);
const response = await account.updateMFA({
mfa: false
});
6 changes: 3 additions & 3 deletions docs/examples/account/update-name.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.updateName(
'<NAME>' // name
);
const response = await account.updateName({
name: '<NAME>'
});
8 changes: 4 additions & 4 deletions docs/examples/account/update-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updatePassword(
'', // password
'password' // oldPassword (optional)
);
const response = await account.updatePassword({
password: '',
oldPassword: 'password' // optional
});
8 changes: 4 additions & 4 deletions docs/examples/account/update-phone-session.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updatePhoneSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
const response = await account.updatePhoneSession({
userId: '<USER_ID>',
secret: '<SECRET>'
});
8 changes: 4 additions & 4 deletions docs/examples/account/update-phone-verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updatePhoneVerification(
'<USER_ID>', // userId
'<SECRET>' // secret
);
const response = await account.updatePhoneVerification({
userId: '<USER_ID>',
secret: '<SECRET>'
});
8 changes: 4 additions & 4 deletions docs/examples/account/update-phone.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const client = new Client()

const account = new Account(client);

const response = await account.updatePhone(
'+12065550100', // phone
'password' // password
);
const response = await account.updatePhone({
phone: '+12065550100',
password: 'password'
});
6 changes: 3 additions & 3 deletions docs/examples/account/update-prefs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ const client = new Client()

const account = new Account(client);

const response = await account.updatePrefs(
{} // prefs
);
const response = await account.updatePrefs({
prefs: {}
});
Loading