Skip to content

Commit e1ed112

Browse files
Merge pull request #228 from appwrite/dev
fix: type errors
2 parents 4216a5b + 194dd1b commit e1ed112

13 files changed

+40
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
2121

2222
```yml
2323
dependencies:
24-
appwrite: ^13.1.0
24+
appwrite: ^13.1.1
2525
```
2626
2727
You can install packages from the command line:

lib/src/client.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ abstract class Client {
7676
/// Add headers that should be sent with all API calls.
7777
Client addHeader(String key, String value);
7878

79+
/// Sends a "ping" request to Appwrite to verify connectivity.
80+
Future<String> ping();
81+
7982
/// Send the API request.
8083
Future<Response> call(
8184
HttpMethod method, {

lib/src/client_base.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ abstract class ClientBase implements Client {
2929
@override
3030
ClientBase addHeader(String key, String value);
3131

32+
@override
33+
Future<String> ping();
34+
3235
@override
3336
Future<Response> call(
3437
HttpMethod method, {

lib/src/client_browser.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
4343
'x-sdk-name': 'Flutter',
4444
'x-sdk-platform': 'client',
4545
'x-sdk-language': 'flutter',
46-
'x-sdk-version': '13.1.0',
46+
'x-sdk-version': '13.1.1',
4747
'X-Appwrite-Response-Format': '1.6.0',
4848
};
4949

@@ -115,6 +115,15 @@ class ClientBrowser extends ClientBase with ClientMixin {
115115
return this;
116116
}
117117

118+
@override
119+
Future<String> ping() async {
120+
final String apiPath = '/ping';
121+
final response = await call(HttpMethod.get,
122+
path: apiPath, responseType: ResponseType.plain);
123+
124+
return response.data;
125+
}
126+
118127
Future init() async {
119128
final cookieFallback = web.window.localStorage['cookieFallback'];
120129
if (cookieFallback != null) {

lib/src/client_io.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ClientIO extends ClientBase with ClientMixin {
6464
'x-sdk-name': 'Flutter',
6565
'x-sdk-platform': 'client',
6666
'x-sdk-language': 'flutter',
67-
'x-sdk-version': '13.1.0',
67+
'x-sdk-version': '13.1.1',
6868
'X-Appwrite-Response-Format': '1.6.0',
6969
};
7070

@@ -147,6 +147,15 @@ class ClientIO extends ClientBase with ClientMixin {
147147
return this;
148148
}
149149

150+
@override
151+
Future<String> ping() async {
152+
final String apiPath = '/ping';
153+
final response = await call(HttpMethod.get,
154+
path: apiPath, responseType: ResponseType.plain);
155+
156+
return response.data;
157+
}
158+
150159
Future init() async {
151160
if (_initProgress) return;
152161
_initProgress = true;

lib/src/models/document.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class Document implements Model {
3838
$databaseId: map['\$databaseId'].toString(),
3939
$createdAt: map['\$createdAt'].toString(),
4040
$updatedAt: map['\$updatedAt'].toString(),
41-
$permissions: map['\$permissions'] ?? [],
41+
$permissions: List<String>.from(
42+
map['\$permissions']?.map((x) => x.toString()) ?? []),
4243
data: map,
4344
);
4445
}

lib/src/models/execution.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ class Execution implements Model {
7878
$id: map['\$id'].toString(),
7979
$createdAt: map['\$createdAt'].toString(),
8080
$updatedAt: map['\$updatedAt'].toString(),
81-
$permissions: map['\$permissions'] ?? [],
81+
$permissions: List<String>.from(
82+
map['\$permissions']?.map((x) => x.toString()) ?? []),
8283
functionId: map['functionId'].toString(),
8384
trigger: map['trigger'].toString(),
8485
status: map['status'].toString(),

lib/src/models/file.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class File implements Model {
5555
bucketId: map['bucketId'].toString(),
5656
$createdAt: map['\$createdAt'].toString(),
5757
$updatedAt: map['\$updatedAt'].toString(),
58-
$permissions: map['\$permissions'] ?? [],
58+
$permissions: List<String>.from(
59+
map['\$permissions']?.map((x) => x.toString()) ?? []),
5960
name: map['name'].toString(),
6061
signature: map['signature'].toString(),
6162
mimeType: map['mimeType'].toString(),

lib/src/models/membership.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Membership implements Model {
7171
joined: map['joined'].toString(),
7272
confirm: map['confirm'],
7373
mfa: map['mfa'],
74-
roles: map['roles'] ?? [],
74+
roles: List<String>.from(map['roles']?.map((x) => x.toString()) ?? []),
7575
);
7676
}
7777

lib/src/models/mfa_recovery_codes.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class MfaRecoveryCodes implements Model {
1111

1212
factory MfaRecoveryCodes.fromMap(Map<String, dynamic> map) {
1313
return MfaRecoveryCodes(
14-
recoveryCodes: map['recoveryCodes'] ?? [],
14+
recoveryCodes: List<String>.from(
15+
map['recoveryCodes']?.map((x) => x.toString()) ?? []),
1516
);
1617
}
1718

0 commit comments

Comments
 (0)