Skip to content

Commit eeeb372

Browse files
authored
Merge pull request #237 from appwrite/dev
fix: pong response & chunked upload
2 parents e1ed112 + 438ea38 commit eeeb372

File tree

10 files changed

+59
-15
lines changed

10 files changed

+59
-15
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2024 Appwrite (https://appwrite.io) and individual contributors.
1+
Copyright (c) 2025 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

+1-1
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.1
24+
appwrite: ^14.0.0
2525
```
2626
2727
You can install packages from the command line:

docs/examples/account/update-mfa-challenge.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Client client = Client()
66

77
Account account = Account(client);
88

9-
result = await account.updateMfaChallenge(
9+
Session result = await account.updateMfaChallenge(
1010
challengeId: '<CHALLENGE_ID>',
1111
otp: '<OTP>',
1212
);

lib/services/account.dart

+16-5
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class Account extends Service {
283283
/// the flow, use
284284
/// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
285285
/// method.
286-
Future updateMfaChallenge(
286+
Future<models.Session> updateMfaChallenge(
287287
{required String challengeId, required String otp}) async {
288288
const String apiPath = '/account/mfa/challenge';
289289

@@ -299,7 +299,7 @@ class Account extends Service {
299299
final res = await client.call(HttpMethod.put,
300300
path: apiPath, params: apiParams, headers: apiHeaders);
301301

302-
return res.data;
302+
return models.Session.fromMap(res.data);
303303
}
304304

305305
/// List factors
@@ -862,6 +862,11 @@ class Account extends Service {
862862

863863
/// Create push target
864864
///
865+
/// Use this endpoint to register a device for push notifications. Provide a
866+
/// target ID (custom or generated using ID.unique()), a device identifier
867+
/// (usually a device token), and optionally specify which provider should send
868+
/// notifications to this target. The target is automatically linked to the
869+
/// current session and includes device information like brand and model.
865870
Future<models.Target> createPushTarget(
866871
{required String targetId,
867872
required String identifier,
@@ -886,6 +891,11 @@ class Account extends Service {
886891

887892
/// Update push target
888893
///
894+
/// Update the currently logged in user's push notification target. You can
895+
/// modify the target's identifier (device token) and provider ID (token,
896+
/// email, phone etc.). The target must exist and belong to the current user.
897+
/// If you change the provider ID, notifications will be sent through the new
898+
/// messaging provider instead.
889899
Future<models.Target> updatePushTarget(
890900
{required String targetId, required String identifier}) async {
891901
final String apiPath =
@@ -907,6 +917,9 @@ class Account extends Service {
907917

908918
/// Delete push target
909919
///
920+
/// Delete a push notification target for the currently logged in user. After
921+
/// deletion, the device will no longer receive push notifications. The target
922+
/// must exist and belong to the current user.
910923
Future deletePushTarget({required String targetId}) async {
911924
final String apiPath =
912925
'/account/targets/{targetId}/push'.replaceAll('{targetId}', targetId);
@@ -965,9 +978,7 @@ class Account extends Service {
965978
/// [POST
966979
/// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
967980
/// endpoint to complete the login process. The link sent to the user's email
968-
/// address is valid for 1 hour. If you are on a mobile device you can leave
969-
/// the URL parameter empty, so that the login completion will be handled by
970-
/// your Appwrite instance by default.
981+
/// address is valid for 1 hour.
971982
///
972983
/// A user is limited to 10 active sessions at a time by default. [Learn more
973984
/// about session

lib/src/client_browser.dart

+2-2
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.1',
46+
'x-sdk-version': '14.0.0',
4747
'X-Appwrite-Response-Format': '1.6.0',
4848
};
4949

@@ -161,7 +161,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
161161
}
162162

163163
var offset = 0;
164-
if (idParamName.isNotEmpty && params[idParamName] != 'unique()') {
164+
if (idParamName.isNotEmpty) {
165165
//make a request to check if a file already exists
166166
try {
167167
res = await call(

lib/src/client_io.dart

+2-2
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.1',
67+
'x-sdk-version': '14.0.0',
6868
'X-Appwrite-Response-Format': '1.6.0',
6969
};
7070

@@ -279,7 +279,7 @@ class ClientIO extends ClientBase with ClientMixin {
279279
}
280280

281281
var offset = 0;
282-
if (idParamName.isNotEmpty && params[idParamName] != 'unique()') {
282+
if (idParamName.isNotEmpty) {
283283
//make a request to check if a file already exists
284284
try {
285285
res = await call(

lib/src/enums/image_format.dart

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ enum ImageFormat {
66
gif(value: 'gif'),
77
png(value: 'png'),
88
webp(value: 'webp'),
9+
heic(value: 'heic'),
910
avif(value: 'avif');
1011

1112
const ImageFormat({required this.value});

lib/src/realtime_response.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class RealtimeResponse {
2929
factory RealtimeResponse.fromMap(Map<String, dynamic> map) {
3030
return RealtimeResponse(
3131
type: map['type'],
32-
data: Map<String, dynamic>.from(map['data']),
32+
data: Map<String, dynamic>.from(map['data'] ?? {}),
3333
);
3434
}
3535

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: appwrite
2-
version: 13.1.1
2+
version: 14.0.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-flutter

test/services/account_test.dart

+33-1
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,37 @@ void main() {
332332
});
333333

334334
test('test method updateMfaChallenge()', () async {
335-
final data = '';
335+
final Map<String, dynamic> data = {
336+
'\$id': '5e5ea5c16897e',
337+
'\$createdAt': '2020-10-15T06:38:00.000+00:00',
338+
'\$updatedAt': '2020-10-15T06:38:00.000+00:00',
339+
'userId': '5e5bb8c16897e',
340+
'expire': '2020-10-15T06:38:00.000+00:00',
341+
'provider': 'email',
342+
'providerUid': '[email protected]',
343+
'providerAccessToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3',
344+
'providerAccessTokenExpiry': '2020-10-15T06:38:00.000+00:00',
345+
'providerRefreshToken': 'MTQ0NjJkZmQ5OTM2NDE1ZTZjNGZmZjI3',
346+
'ip': '127.0.0.1',
347+
'osCode': 'Mac',
348+
'osName': 'Mac',
349+
'osVersion': 'Mac',
350+
'clientType': 'browser',
351+
'clientCode': 'CM',
352+
'clientName': 'Chrome Mobile iOS',
353+
'clientVersion': '84.0',
354+
'clientEngine': 'WebKit',
355+
'clientEngineVersion': '605.1.15',
356+
'deviceName': 'smartphone',
357+
'deviceBrand': 'Google',
358+
'deviceModel': 'Nexus 5',
359+
'countryCode': 'US',
360+
'countryName': 'United States',
361+
'current': true,
362+
'factors': [],
363+
'secret': '5e5bb8c16897e',
364+
'mfaUpdatedAt': '2020-10-15T06:38:00.000+00:00',};
365+
336366

337367
when(client.call(
338368
HttpMethod.put,
@@ -343,6 +373,8 @@ void main() {
343373
challengeId: '<CHALLENGE_ID>',
344374
otp: '<OTP>',
345375
);
376+
expect(response, isA<models.Session>());
377+
346378
});
347379

348380
test('test method listMfaFactors()', () async {

0 commit comments

Comments
 (0)