Skip to content

Commit 1cd79b8

Browse files
implement realtime feature
1 parent bddfa8f commit 1cd79b8

30 files changed

+608
-181
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
[![pub package](https://img.shields.io/pub/v/dart_appwrite.svg?style=flat-square)](https://pub.dartlang.org/packages/dart_appwrite)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-dart.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-0.9.0-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-0.10.0-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite_io?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite_io)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

10-
**This SDK is compatible with Appwrite server version 0.9.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).**
10+
**This SDK is compatible with Appwrite server version 0.10.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-dart/releases).**
1111

1212
> 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)
1313
@@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:
2323

2424
```yml
2525
dependencies:
26-
dart_appwrite: ^0.7.0
26+
dart_appwrite: ^1.0.0
2727
```
2828
2929
You can install packages from the command line:
@@ -75,7 +75,7 @@ try {
7575
```
7676

7777
### Learn more
78-
You can use following resources to learn more and get help
78+
You can use the following resources to learn more and get help
7979
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
8080
- 📜 [Appwrite Docs](https://appwrite.io/docs)
8181
- 💬 [Discord Community](https://appwrite.io/discord)

docs/examples/functions/create-tag.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void main() { // Init SDK
1313
Future result = functions.createTag(
1414
functionId: '[FUNCTION_ID]',
1515
command: '[COMMAND]',
16-
code: await MultipartFile.fromFile('./path-to-files/image.jpg', 'image.jpg'),
16+
code: await MultipartFile.fromPath('code', './path-to-files/image.jpg', 'image.jpg'),
1717
);
1818

1919
result

docs/examples/functions/create.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void main() { // Init SDK
1313
Future result = functions.create(
1414
name: '[NAME]',
1515
execute: [],
16-
runtime: 'java-11.0',
16+
runtime: 'dotnet-5.0',
1717
);
1818

1919
result

docs/examples/storage/create-file.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ void main() { // Init SDK
1212
;
1313

1414
Future result = storage.createFile(
15-
file: await MultipartFile.fromFile('./path-to-files/image.jpg', 'image.jpg'),
15+
file: await MultipartFile.fromPath('file', './path-to-files/image.jpg', 'image.jpg'),
1616
);
1717

1818
result

docs/examples/users/update-email.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Users users = Users(client);
6+
7+
client
8+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
11+
;
12+
13+
Future result = users.updateEmail(
14+
userId: '[USER_ID]',
15+
16+
);
17+
18+
result
19+
.then((response) {
20+
print(response);
21+
}).catchError((error) {
22+
print(error.response);
23+
});
24+
}

docs/examples/users/update-name.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Users users = Users(client);
6+
7+
client
8+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
11+
;
12+
13+
Future result = users.updateName(
14+
userId: '[USER_ID]',
15+
name: '[NAME]',
16+
);
17+
18+
result
19+
.then((response) {
20+
print(response);
21+
}).catchError((error) {
22+
print(error.response);
23+
});
24+
}
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Users users = Users(client);
6+
7+
client
8+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
11+
;
12+
13+
Future result = users.updatePassword(
14+
userId: '[USER_ID]',
15+
password: 'password',
16+
);
17+
18+
result
19+
.then((response) {
20+
print(response);
21+
}).catchError((error) {
22+
print(error.response);
23+
});
24+
}

lib/client.dart

-132
This file was deleted.

lib/dart_appwrite.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
library dart_appwrite;
22

3-
import 'dart:io';
4-
import 'dart:convert';
5-
import 'package:dio/dio.dart';
6-
import 'package:dio/adapter.dart';
3+
import 'dart:async';
4+
import 'package:http/http.dart' as http;
5+
import 'src/enums.dart';
6+
import 'src/client.dart';
7+
import 'src/response.dart';
8+
import 'src/service.dart';
79

10+
export 'src/response.dart';
11+
export 'src/client.dart';
12+
export 'src/exception.dart';
13+
export 'package:http/http.dart' show MultipartFile;
814

9-
export 'package:dio/dio.dart' show Response, MultipartFile;
10-
11-
part 'client.dart';
12-
part 'enums.dart';
13-
part 'service.dart';
14-
part 'exception.dart';
1515
part 'services/account.dart';
1616
part 'services/avatars.dart';
1717
part 'services/database.dart';

lib/enums.dart

-9
This file was deleted.

lib/services/account.dart

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Account extends Service {
54
Account(Client client): super(client);
65

@@ -185,7 +184,7 @@ class Account extends Service {
185184
return client.call(HttpMethod.post, path: path, params: params, headers: headers);
186185
}
187186

188-
/// Complete Password Recovery
187+
/// Create Password Recovery (confirmation)
189188
///
190189
/// Use this endpoint to complete the user account password reset. Both the
191190
/// **userId** and **secret** arguments will be passed as query parameters to
@@ -319,7 +318,7 @@ class Account extends Service {
319318
return client.call(HttpMethod.post, path: path, params: params, headers: headers);
320319
}
321320

322-
/// Complete Email Verification
321+
/// Create Email Verification (confirmation)
323322
///
324323
/// Use this endpoint to complete the user email verification process. Use both
325324
/// the **userId** and **secret** parameters that were attached to your app URL

lib/services/avatars.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Avatars extends Service {
54
Avatars(Client client): super(client);
65

lib/services/database.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Database extends Service {
54
Database(Client client): super(client);
65

lib/services/functions.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Functions extends Service {
54
Functions(Client client): super(client);
65

@@ -226,7 +225,7 @@ class Functions extends Service {
226225
///
227226
/// Use the "command" param to set the entry point used to execute your code.
228227
///
229-
Future<Response> createTag({required String functionId, required String command, required MultipartFile code}) {
228+
Future<Response> createTag({required String functionId, required String command, required http.MultipartFile code}) {
230229
final String path = '/functions/{functionId}/tags'.replaceAll(RegExp('{functionId}'), functionId);
231230

232231
final Map<String, dynamic> params = {

lib/services/health.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Health extends Service {
54
Health(Client client): super(client);
65

lib/services/locale.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Locale extends Service {
54
Locale(Client client): super(client);
65

lib/services/storage.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
part of dart_appwrite;
22

3-
43
class Storage extends Service {
54
Storage(Client client): super(client);
65

@@ -33,7 +32,7 @@ class Storage extends Service {
3332
/// assigned to read and write access unless he has passed custom values for
3433
/// read and write arguments.
3534
///
36-
Future<Response> createFile({required MultipartFile file, List? read, List? write}) {
35+
Future<Response> createFile({required http.MultipartFile file, List? read, List? write}) {
3736
final String path = '/storage/files';
3837

3938
final Map<String, dynamic> params = {

0 commit comments

Comments
 (0)