Skip to content

Commit a93cae2

Browse files
feat: support for 0.13.0
1 parent 6467698 commit a93cae2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1188
-377
lines changed

README.md

Lines changed: 2 additions & 2 deletions
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.12.1-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-0.13.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?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
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.12.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.13.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
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Account account = Account(client);
6+
7+
client
8+
.setEndpoint('https://[HOSTNAME_OR_IP]/v1') // Your API Endpoint
9+
.setProject('5df5acd0d48c2') // Your project ID
10+
.setJWT('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...') // Your secret JSON Web Token
11+
;
12+
13+
Future result = account.updateSession(
14+
sessionId: '[SESSION_ID]',
15+
);
16+
17+
result
18+
.then((response) {
19+
print(response);
20+
}).catchError((error) {
21+
print(error.response);
22+
});
23+
}

docs/examples/functions/create-tag.md renamed to docs/examples/functions/create-deployment.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ void main() { // Init SDK
1010
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1111
;
1212

13-
Future result = functions.createTag(
13+
Future result = functions.createDeployment(
1414
functionId: '[FUNCTION_ID]',
15-
command: '[COMMAND]',
15+
entrypoint: '[ENTRYPOINT]',
1616
code: await MultipartFile.fromPath('code', './path-to-files/image.jpg', 'image.jpg'),
17+
activate: false,
1718
);
1819

1920
result

docs/examples/functions/delete-tag.md renamed to docs/examples/functions/delete-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ void main() { // Init SDK
1010
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1111
;
1212

13-
Future result = functions.deleteTag(
13+
Future result = functions.deleteDeployment(
1414
functionId: '[FUNCTION_ID]',
15-
tagId: '[TAG_ID]',
15+
deploymentId: '[DEPLOYMENT_ID]',
1616
);
1717

1818
result

docs/examples/functions/update-tag.md renamed to docs/examples/functions/get-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ void main() { // Init SDK
1010
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1111
;
1212

13-
Future result = functions.updateTag(
13+
Future result = functions.getDeployment(
1414
functionId: '[FUNCTION_ID]',
15-
tag: '[TAG]',
15+
deploymentId: '[DEPLOYMENT_ID]',
1616
);
1717

1818
result

docs/examples/functions/list-tags.md renamed to docs/examples/functions/list-deployments.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ void main() { // Init SDK
1010
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1111
;
1212

13-
Future result = functions.listTags(
13+
Future result = functions.listDeployments(
1414
functionId: '[FUNCTION_ID]',
1515
);
1616

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Functions functions = Functions(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 = functions.retryBuild(
14+
functionId: '[FUNCTION_ID]',
15+
deploymentId: '[DEPLOYMENT_ID]',
16+
buildId: '[BUILD_ID]',
17+
);
18+
19+
result
20+
.then((response) {
21+
print(response);
22+
}).catchError((error) {
23+
print(error.response);
24+
});
25+
}

docs/examples/functions/get-tag.md renamed to docs/examples/functions/update-deployment.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ void main() { // Init SDK
1010
.setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
1111
;
1212

13-
Future result = functions.getTag(
13+
Future result = functions.updateDeployment(
1414
functionId: '[FUNCTION_ID]',
15-
tagId: '[TAG_ID]',
15+
deploymentId: '[DEPLOYMENT_ID]',
1616
);
1717

1818
result
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Storage storage = Storage(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 = storage.createBucket(
14+
bucketId: '[BUCKET_ID]',
15+
name: '[NAME]',
16+
permission: 'file',
17+
);
18+
19+
result
20+
.then((response) {
21+
print(response);
22+
}).catchError((error) {
23+
print(error.response);
24+
});
25+
}

docs/examples/storage/create-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ void main() { // Init SDK
1212
;
1313

1414
Future result = storage.createFile(
15+
bucketId: '[BUCKET_ID]',
1516
fileId: '[FILE_ID]',
1617
file: await MultipartFile.fromPath('file', './path-to-files/image.jpg', 'image.jpg'),
1718
);
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Storage storage = Storage(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 = storage.deleteBucket(
14+
bucketId: '[BUCKET_ID]',
15+
);
16+
17+
result
18+
.then((response) {
19+
print(response);
20+
}).catchError((error) {
21+
print(error.response);
22+
});
23+
}

docs/examples/storage/delete-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.deleteFile(
14+
bucketId: '[BUCKET_ID]',
1415
fileId: '[FILE_ID]',
1516
);
1617

docs/examples/storage/get-bucket.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Storage storage = Storage(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 = storage.getBucket(
14+
bucketId: '[BUCKET_ID]',
15+
);
16+
17+
result
18+
.then((response) {
19+
print(response);
20+
}).catchError((error) {
21+
print(error.response);
22+
});
23+
}

docs/examples/storage/get-file-download.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.getFileDownload(
14+
bucketId: '[BUCKET_ID]',
1415
fileId: '[FILE_ID]',
1516
);
1617

docs/examples/storage/get-file-preview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.getFilePreview(
14+
bucketId: '[BUCKET_ID]',
1415
fileId: '[FILE_ID]',
1516
);
1617

docs/examples/storage/get-file-view.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.getFileView(
14+
bucketId: '[BUCKET_ID]',
1415
fileId: '[FILE_ID]',
1516
);
1617

docs/examples/storage/get-file.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.getFile(
14+
bucketId: '[BUCKET_ID]',
1415
fileId: '[FILE_ID]',
1516
);
1617

docs/examples/storage/list-buckets.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Storage storage = Storage(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 = storage.listBuckets(
14+
);
15+
16+
result
17+
.then((response) {
18+
print(response);
19+
}).catchError((error) {
20+
print(error.response);
21+
});
22+
}

docs/examples/storage/list-files.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.listFiles(
14+
bucketId: '[BUCKET_ID]',
1415
);
1516

1617
result
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'package:dart_appwrite/dart_appwrite.dart';
2+
3+
void main() { // Init SDK
4+
Client client = Client();
5+
Storage storage = Storage(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 = storage.updateBucket(
14+
bucketId: '[BUCKET_ID]',
15+
name: '[NAME]',
16+
permission: 'file',
17+
);
18+
19+
result
20+
.then((response) {
21+
print(response);
22+
}).catchError((error) {
23+
print(error.response);
24+
});
25+
}

docs/examples/storage/update-file.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ void main() { // Init SDK
1111
;
1212

1313
Future result = storage.updateFile(
14+
bucketId: '[BUCKET_ID]',
1415
fileId: '[FILE_ID]',
15-
read: [],
16-
write: [],
1716
);
1817

1918
result

lib/dart_appwrite.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,20 @@ library dart_appwrite;
22

33
import 'dart:async';
44
import 'dart:typed_data';
5-
import 'package:http/http.dart' as http;
5+
import 'src/chunked_upload_stub.dart'
6+
if (dart.library.io) 'src/chunked_upload_io.dart';
67
import 'src/enums.dart';
78
import 'src/client.dart';
89
import 'src/service.dart';
10+
import 'src/input_file.dart';
11+
import 'src/upload_progress.dart';
912
import 'models.dart' as models;
1013

1114
export 'src/response.dart';
1215
export 'src/client.dart';
1316
export 'src/exception.dart';
17+
export 'src/input_file.dart';
18+
export 'src/upload_progress.dart';
1419
export 'package:http/http.dart' show MultipartFile;
1520

1621
part 'query.dart';

lib/models.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
library dart_appwrite.models;
22

3+
part 'src/models/document_list.dart';
34
part 'src/models/collection_list.dart';
45
part 'src/models/index_list.dart';
5-
part 'src/models/document_list.dart';
66
part 'src/models/user_list.dart';
77
part 'src/models/session_list.dart';
88
part 'src/models/log_list.dart';
99
part 'src/models/file_list.dart';
10+
part 'src/models/bucket_list.dart';
1011
part 'src/models/team_list.dart';
1112
part 'src/models/membership_list.dart';
1213
part 'src/models/function_list.dart';
1314
part 'src/models/runtime_list.dart';
14-
part 'src/models/tag_list.dart';
15+
part 'src/models/deployment_list.dart';
1516
part 'src/models/execution_list.dart';
1617
part 'src/models/country_list.dart';
1718
part 'src/models/continent_list.dart';
@@ -37,11 +38,12 @@ part 'src/models/session.dart';
3738
part 'src/models/token.dart';
3839
part 'src/models/locale.dart';
3940
part 'src/models/file.dart';
41+
part 'src/models/bucket.dart';
4042
part 'src/models/team.dart';
4143
part 'src/models/membership.dart';
4244
part 'src/models/function.dart';
4345
part 'src/models/runtime.dart';
44-
part 'src/models/tag.dart';
46+
part 'src/models/deployment.dart';
4547
part 'src/models/execution.dart';
4648
part 'src/models/country.dart';
4749
part 'src/models/continent.dart';

0 commit comments

Comments
 (0)