Skip to content

Commit 47c8ba1

Browse files
Merge pull request #39 from appwrite/dev1
2 parents 2e12a95 + da18a13 commit 47c8ba1

13 files changed

+54
-11
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 7.3.0
2+
* Inprove helper classes
3+
* Deprecated `InputFile` default constructor and introduced `InputFile.fromPath` and `InputFile.fromBytes` for consistency with other SDKs
4+
15
## 7.2.0
26

37
* Support for GraphQL

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2022 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2023 Appwrite (https://appwrite.io) and individual contributors.
22
All rights reserved.
33

44
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
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-1.2.0-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.2.1-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)
@@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:
2323

2424
```yml
2525
dependencies:
26-
dart_appwrite: ^7.2.0
26+
dart_appwrite: ^7.3.0
2727
```
2828
2929
You can install packages from the command line:

lib/dart_appwrite.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ library dart_appwrite;
22

33
import 'dart:async';
44
import 'dart:typed_data';
5+
56
import 'src/enums.dart';
6-
import 'src/client.dart';
77
import 'src/service.dart';
88
import 'src/input_file.dart';
99
import 'src/upload_progress.dart';

lib/id.dart

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

33
class ID {
4+
ID._();
5+
46
static String unique() {
57
return 'unique()';
68
}

lib/permission.dart

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

33
class Permission {
4+
Permission._();
5+
46
static String read(String role) {
57
return 'read("$role")';
68
}

lib/query.dart

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

33
class Query {
4+
Query._();
5+
46
static equal(String attribute, dynamic value) =>
57
_addQuery(attribute, 'equal', value);
68

lib/role.dart

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

33
class Role {
4+
Role._();
5+
46
static String any() {
57
return 'any';
68
}

lib/src/client_browser.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
3333
'x-sdk-name': 'Dart',
3434
'x-sdk-platform': 'server',
3535
'x-sdk-language': 'dart',
36-
'x-sdk-version': '7.2.0',
36+
'x-sdk-version': '7.3.0',
3737
'X-Appwrite-Response-Format' : '1.0.0',
3838
};
3939

@@ -133,7 +133,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
133133
}
134134

135135
while (offset < size) {
136-
var chunk;
136+
List<int> chunk;
137137
final end = min(offset + CHUNK_SIZE, size);
138138
chunk = file.bytes!.getRange(offset, end).toList();
139139
params[paramName] =

lib/src/client_io.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ClientIO extends ClientBase with ClientMixin {
4242
'x-sdk-name': 'Dart',
4343
'x-sdk-platform': 'server',
4444
'x-sdk-language': 'dart',
45-
'x-sdk-version': '7.2.0',
45+
'x-sdk-version': '7.3.0',
4646
'X-Appwrite-Response-Format' : '1.0.0',
4747
};
4848

lib/src/input_file.dart

+33-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,42 @@ class InputFile {
66
final String? filename;
77
final String? contentType;
88

9-
/// Provide a file, use `path` for IO platforms
10-
/// and provide `bytes` for web platform
9+
@Deprecated('Use `InputFile.fromPath` or `InputFile.fromBytes` instead.')
1110
InputFile({this.path, this.filename, this.contentType, this.bytes}) {
1211
if (path == null && bytes == null) {
1312
throw AppwriteException('One of `path` or `bytes` is required');
1413
}
1514
}
15+
16+
InputFile._({this.path, this.filename, this.contentType, this.bytes}) {
17+
if (path == null && bytes == null) {
18+
throw AppwriteException('One of `path` or `bytes` is required');
19+
}
20+
}
21+
22+
/// Provide a file using `path`
23+
factory InputFile.fromPath({
24+
required String path,
25+
String? filename,
26+
String? contentType,
27+
}) {
28+
return InputFile._(
29+
path: path,
30+
filename: filename,
31+
contentType: contentType,
32+
);
33+
}
34+
35+
/// Provide a file using `bytes`
36+
factory InputFile.fromBytes({
37+
required List<int> bytes,
38+
required String filename,
39+
String? contentType,
40+
}) {
41+
return InputFile._(
42+
bytes: bytes,
43+
filename: filename,
44+
contentType: contentType,
45+
);
46+
}
1647
}

lib/src/models/locale.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Locale implements Model {
1212
final String continentCode;
1313
/// Continent name. This field support localization.
1414
final String continent;
15-
/// True if country is part of the Europian Union.
15+
/// True if country is part of the European Union.
1616
final bool eu;
1717
/// Currency code in [ISO 4217-1](http://en.wikipedia.org/wiki/ISO_4217) three-character format
1818
final String currency;

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: dart_appwrite
2-
version: 7.2.0
2+
version: 7.3.0
33
description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API
44
homepage: https://appwrite.io
55
repository: https://github.com/appwrite/sdk-for-dart

0 commit comments

Comments
 (0)