Skip to content

Commit

Permalink
Merge pull request #54 from appwrite/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
abnegate committed Mar 8, 2024
2 parents e29166b + 0c07cab commit f028e7d
Show file tree
Hide file tree
Showing 347 changed files with 9,196 additions and 3,409 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 11.0.0

* Added enum support
* Added SSR support
* Added messaging service support
* Added contains query support
* Added or query support

## 10.1.0

* Add new queue health endpoints
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

[![pub package](https://img.shields.io/pub/v/dart_appwrite.svg?style=flat-square)](https://pub.dartlang.org/packages/dart_appwrite)
![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.4.x-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.5.x-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-dart/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-dart/releases).**

> This is the Dart SDK for integrating with Appwrite from your Dart server-side code. If you're looking for the Flutter SDK you should check [appwrite/sdk-for-flutter](https://github.com/appwrite/sdk-for-flutter)
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 Dart 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

Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
dart_appwrite: ^10.1.1
dart_appwrite: ^11.0.0
```

You can install packages from the command line:
Expand Down Expand Up @@ -51,7 +51,7 @@ void main() async {
Users users = Users(client);
try {
final user = await users.create(userId: ID.unique(), email: email@example.com’,password: password, name: ‘name’);
final user = await users.create(userId: ID.unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
print(user.toMap());
} on AppwriteException catch(e) {
print(e.message);
Expand All @@ -66,7 +66,7 @@ The Appwrite Dart SDK raises `AppwriteException` object with `message`, `code` a
Users users = Users(client);
try {
final user = await users.create(userId: ID.unique(), email: email@example.com’,password: password, name: ‘name’);
final user = await users.create(userId: ID.unique(), email: "email@example.com", phone: "+123456789", password: "password", name: "Walter O'Brien");
print(user.toMap());
} on AppwriteException catch(e) {
//show message to user or do other operation based on error as required
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Session result = 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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Session result = await account.createEmailPasswordSession(
email: 'email@example.com',
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Token result = await account.createEmailToken(
userId: '<USER_ID>',
email: 'email@example.com',
phrase: false, // (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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Jwt result = 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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Token result = await account.createMagicURLToken(
userId: '<USER_ID>',
email: 'email@example.com',
url: 'https://example.com', // (optional)
phrase: false, // (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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

MfaType result = await account.createMfaAuthenticator(
type: AuthenticatorType.totp,
);
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

MfaChallenge result = await account.createMfaChallenge(
factor: AuthenticationFactor.email,
);
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

MfaRecoveryCodes result = 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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

await account.createOAuth2Token(
provider: OAuthProvider.amazon,
success: 'https://example.com', // (optional)
failure: 'https://example.com', // (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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Token result = await account.createPhoneToken(
userId: '<USER_ID>',
phone: '+12065550100',
);
19 changes: 4 additions & 15 deletions docs/examples/account/create-phone-verification.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import 'package:dart_appwrite/dart_appwrite.dart';

void main() { // Init SDK
Client client = Client();
Account account = Account(client);

client
Client client = 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

Future result = account.createPhoneVerification();
Account account = Account(client);

result
.then((response) {
print(response);
}).catchError((error) {
print(error.response);
});
}
Token result = await account.createPhoneVerification();
23 changes: 6 additions & 17 deletions docs/examples/account/create-recovery.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
import 'package:dart_appwrite/dart_appwrite.dart';

void main() { // Init SDK
Client client = Client();
Account account = Account(client);

client
Client client = 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

Account account = Account(client);

Future result = account.createRecovery(
Token result = await account.createRecovery(
email: 'email@example.com',
url: 'https://example.com',
);

result
.then((response) {
print(response);
}).catchError((error) {
print(error.response);
});
}
);
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

Session result = await account.createSession(
userId: '<USER_ID>',
secret: '<SECRET>',
);
23 changes: 6 additions & 17 deletions docs/examples/account/create-verification.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

void main() { // Init SDK
Client client = Client();
Account account = Account(client);

client
Client client = 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

Future result = account.createVerification(
url: 'https://example.com',
);
Account account = Account(client);

result
.then((response) {
print(response);
}).catchError((error) {
print(error.response);
});
}
Token result = await account.createVerification(
url: 'https://example.com',
);
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

User result = await account.create(
userId: '<USER_ID>',
email: 'email@example.com',
password: '',
name: '<NAME>', // (optional)
);
23 changes: 6 additions & 17 deletions docs/examples/account/delete-identity.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

void main() { // Init SDK
Client client = Client();
Account account = Account(client);

client
Client client = 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

Future result = account.deleteIdentity(
identityId: '[IDENTITY_ID]',
);
Account account = Account(client);

result
.then((response) {
print(response);
}).catchError((error) {
print(error.response);
});
}
await account.deleteIdentity(
identityId: '<IDENTITY_ID>',
);
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 'package:dart_appwrite/dart_appwrite.dart';

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

Account account = Account(client);

await account.deleteMfaAuthenticator(
type: AuthenticatorType.totp,
otp: '<OTP>',
);
23 changes: 6 additions & 17 deletions docs/examples/account/delete-session.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

void main() { // Init SDK
Client client = Client();
Account account = Account(client);

client
Client client = 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

Future result = account.deleteSession(
sessionId: '[SESSION_ID]',
);
Account account = Account(client);

result
.then((response) {
print(response);
}).catchError((error) {
print(error.response);
});
}
await account.deleteSession(
sessionId: '<SESSION_ID>',
);

0 comments on commit f028e7d

Please sign in to comment.