Skip to content

Commit

Permalink
Merge pull request #18 from appwrite/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
abnegate authored Mar 8, 2024
2 parents 69e2f4c + 20dc261 commit 5ba5de3
Show file tree
Hide file tree
Showing 311 changed files with 15,026 additions and 3,463 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
Copyright (c) 2024 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:
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# 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.4.12-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.5.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.4.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.5.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)


![Appwrite](https://appwrite.io/images/github.png)
![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)

## Installation

Expand Down Expand Up @@ -43,7 +43,7 @@ Once your SDK object is set, create any of the Appwrite service objects and choo
```typescript
let users = new sdk.Users(client);

let user = await users.create(ID.unique(), 'email@example.com', 'password');
let user = await users.create(ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien");
console.log(user);
```

Expand All @@ -61,7 +61,7 @@ client
.setSelfSigned() // Use only on dev mode with a self-signed SSL cert
;

let user = await users.create(ID.unique(), 'email@example.com', 'password');
let user = await users.create(ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien");
console.log(user);
```

Expand All @@ -72,7 +72,7 @@ The Appwrite Deno SDK raises `AppwriteException` object with `message`, `code` a
let users = new sdk.Users(client);

try {
let user = await users.create(ID.unique(), 'email@example.com', 'password');
let user = await users.create(ID.unique(), "email@example.com", "+123456789", "password", "Walter O'Brien");
} catch(e) {
console.log(e.message);
}
Expand Down
9 changes: 9 additions & 0 deletions docs/examples/account/create-anonymous-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createAnonymousSession();
12 changes: 12 additions & 0 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createEmailPasswordSession(
'email@example.com', // email
'password' // password
);
13 changes: 13 additions & 0 deletions docs/examples/account/create-email-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createEmailToken(
'<USER_ID>', // userId
'email@example.com', // email
false // phrase (optional)
);
9 changes: 9 additions & 0 deletions docs/examples/account/create-j-w-t.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createJWT();
14 changes: 14 additions & 0 deletions docs/examples/account/create-magic-u-r-l-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createMagicURLToken(
'<USER_ID>', // userId
'email@example.com', // email
'https://example.com', // url (optional)
false // phrase (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/account/create-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Client, Account, AuthenticatorType } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setSession(''); // The user session to authenticate with

const account = new Account(client);

const response = await account.createMfaAuthenticator(
AuthenticatorType.Totp // type
);
11 changes: 11 additions & 0 deletions docs/examples/account/create-mfa-challenge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Client, Account, AuthenticationFactor } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createMfaChallenge(
AuthenticationFactor.Email // factor
);
10 changes: 10 additions & 0 deletions docs/examples/account/create-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setSession(''); // The user session to authenticate with

const account = new Account(client);

const response = await account.createMfaRecoveryCodes();
14 changes: 14 additions & 0 deletions docs/examples/account/create-o-auth2token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Client, Account, OAuthProvider } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

account.createOAuth2Token(
OAuthProvider.Amazon, // provider
'https://example.com', // success (optional)
'https://example.com', // failure (optional)
[] // scopes (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/account/create-phone-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createPhoneToken(
'<USER_ID>', // userId
'+12065550100' // phone
);
21 changes: 5 additions & 16 deletions docs/examples/account/create-phone-verification.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

// Init SDK
let client = new sdk.Client();

let account = new sdk.Account(client);

client
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
;

.setSession(''); // The user session to authenticate with

let promise = account.createPhoneVerification();
const account = new Account(client);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
const response = await account.createPhoneVerification();
24 changes: 8 additions & 16 deletions docs/examples/account/create-recovery.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

// Init SDK
let client = new sdk.Client();

let account = new sdk.Account(client);

client
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
;

.setSession(''); // The user session to authenticate with

let promise = account.createRecovery('email@example.com', 'https://example.com');
const account = new Account(client);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
const response = await account.createRecovery(
'email@example.com', // email
'https://example.com' // url
);
12 changes: 12 additions & 0 deletions docs/examples/account/create-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.createSession(
'<USER_ID>', // userId
'<SECRET>' // secret
);
23 changes: 7 additions & 16 deletions docs/examples/account/create-verification.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

// Init SDK
let client = new sdk.Client();

let account = new sdk.Account(client);

client
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
;

.setSession(''); // The user session to authenticate with

let promise = account.createVerification('https://example.com');
const account = new Account(client);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
const response = await account.createVerification(
'https://example.com' // url
);
14 changes: 14 additions & 0 deletions docs/examples/account/create.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2'); // Your project ID

const account = new Account(client);

const response = await account.create(
'<USER_ID>', // userId
'email@example.com', // email
'', // password
'<NAME>' // name (optional)
);
23 changes: 7 additions & 16 deletions docs/examples/account/delete-identity.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

// Init SDK
let client = new sdk.Client();

let account = new sdk.Account(client);

client
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
;

.setSession(''); // The user session to authenticate with

let promise = account.deleteIdentity('[IDENTITY_ID]');
const account = new Account(client);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
const response = await account.deleteIdentity(
'<IDENTITY_ID>' // identityId
);
13 changes: 13 additions & 0 deletions docs/examples/account/delete-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Client, Account, AuthenticatorType } from "https://deno.land/x/appwrite/mod.ts";

const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setSession(''); // The user session to authenticate with

const account = new Account(client);

const response = await account.deleteMfaAuthenticator(
AuthenticatorType.Totp, // type
'<OTP>' // otp
);
23 changes: 7 additions & 16 deletions docs/examples/account/delete-session.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

// Init SDK
let client = new sdk.Client();

let account = new sdk.Account(client);

client
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
;

.setSession(''); // The user session to authenticate with

let promise = account.deleteSession('[SESSION_ID]');
const account = new Account(client);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
const response = await account.deleteSession(
'<SESSION_ID>' // sessionId
);
21 changes: 5 additions & 16 deletions docs/examples/account/delete-sessions.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import * as sdk from "https://deno.land/x/appwrite/mod.ts";
import { Client, Account } from "https://deno.land/x/appwrite/mod.ts";

// Init SDK
let client = new sdk.Client();

let account = new sdk.Account(client);

client
const client = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
;

.setSession(''); // The user session to authenticate with

let promise = account.deleteSessions();
const account = new Account(client);

promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});
const response = await account.deleteSessions();
Loading

0 comments on commit 5ba5de3

Please sign in to comment.