Skip to content

Commit cd1cb3d

Browse files
Merge pull request #72 from appwrite/dev
fix: pong response & chunked upload
2 parents 8b6eb0c + 5cf5046 commit cd1cb3d

31 files changed

+116
-61
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
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

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

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Client client = Client()
77

88
Account account = Account(client);
99

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

lib/services/account.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class Account extends Service {
282282
/// the flow, use
283283
/// [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge)
284284
/// method.
285-
Future updateMfaChallenge(
285+
Future<models.Session> updateMfaChallenge(
286286
{required String challengeId, required String otp}) async {
287287
final String apiPath = '/account/mfa/challenge';
288288

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

301-
return res.data;
301+
return models.Session.fromMap(res.data);
302302
}
303303

304304
/// List factors

lib/services/functions.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ class Functions extends Service {
364364

365365
/// Rebuild deployment
366366
///
367+
/// Create a new build for an existing function deployment. This endpoint
368+
/// allows you to rebuild a deployment with the updated function configuration,
369+
/// including its entrypoint and build commands if they have been modified The
370+
/// build process will be queued and executed asynchronously. The original
371+
/// deployment's code will be preserved and used for the new build.
367372
Future createBuild(
368373
{required String functionId,
369374
required String deploymentId,
@@ -389,6 +394,11 @@ class Functions extends Service {
389394

390395
/// Cancel deployment
391396
///
397+
/// Cancel an ongoing function deployment build. If the build is already in
398+
/// progress, it will be stopped and marked as canceled. If the build hasn't
399+
/// started yet, it will be marked as canceled without executing. You cannot
400+
/// cancel builds that have already completed (status 'ready') or failed. The
401+
/// response includes the final build status and details.
392402
Future<models.Build> updateDeploymentBuild(
393403
{required String functionId, required String deploymentId}) async {
394404
final String apiPath =

lib/services/messaging.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ class Messaging extends Service {
7272

7373
/// Update email
7474
///
75-
/// Update an email message by its unique ID.
75+
/// Update an email message by its unique ID. This endpoint only works on
76+
/// messages that are in draft status. Messages that are already processing,
77+
/// sent, or failed cannot be updated.
7678
///
7779
Future<models.Message> updateEmail(
7880
{required String messageId,
@@ -173,7 +175,9 @@ class Messaging extends Service {
173175

174176
/// Update push notification
175177
///
176-
/// Update a push notification by its unique ID.
178+
/// Update a push notification by its unique ID. This endpoint only works on
179+
/// messages that are in draft status. Messages that are already processing,
180+
/// sent, or failed cannot be updated.
177181
///
178182
Future<models.Message> updatePush(
179183
{required String messageId,
@@ -264,7 +268,9 @@ class Messaging extends Service {
264268

265269
/// Update SMS
266270
///
267-
/// Update an email message by its unique ID.
271+
/// Update an SMS message by its unique ID. This endpoint only works on
272+
/// messages that are in draft status. Messages that are already processing,
273+
/// sent, or failed cannot be updated.
268274
///
269275
Future<models.Message> updateSms(
270276
{required String messageId,

lib/services/users.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ class Users extends Service {
506506
/// Delete authenticator
507507
///
508508
/// Delete an authenticator app.
509-
Future<models.User> deleteMfaAuthenticator(
509+
Future deleteMfaAuthenticator(
510510
{required String userId, required enums.AuthenticatorType type}) async {
511511
final String apiPath = '/users/{userId}/mfa/authenticators/{type}'
512512
.replaceAll('{userId}', userId)
@@ -521,7 +521,7 @@ class Users extends Service {
521521
final res = await client.call(HttpMethod.delete,
522522
path: apiPath, params: apiParams, headers: apiHeaders);
523523

524-
return models.User.fromMap(res.data);
524+
return res.data;
525525
}
526526

527527
/// List factors

lib/src/client.dart

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

70+
/// Sends a "ping" request to Appwrite to verify connectivity.
71+
Future<String> ping();
72+
7073
/// Upload a file in chunks.
7174
Future<Response> chunkedUpload({
7275
required String path,

lib/src/client_base.dart

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

37+
@override
38+
Future<String> ping();
39+
3740
@override
3841
Future<Response> call(
3942
HttpMethod method, {

lib/src/client_browser.dart

Lines changed: 11 additions & 2 deletions
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': '12.2.0',
36+
'x-sdk-version': '13.0.0',
3737
'X-Appwrite-Response-Format': '1.6.0',
3838
};
3939

@@ -110,6 +110,15 @@ class ClientBrowser extends ClientBase with ClientMixin {
110110
return this;
111111
}
112112

113+
@override
114+
Future<String> ping() async {
115+
final String apiPath = '/ping';
116+
final response = await call(HttpMethod.get,
117+
path: apiPath, responseType: ResponseType.plain);
118+
119+
return response.data;
120+
}
121+
113122
@override
114123
Future<String?> webAuth(Uri url) async {
115124
final request = http.Request('GET', url);
@@ -147,7 +156,7 @@ class ClientBrowser extends ClientBase with ClientMixin {
147156
}
148157

149158
var offset = 0;
150-
if (idParamName.isNotEmpty && params[idParamName] != 'unique()') {
159+
if (idParamName.isNotEmpty) {
151160
//make a request to check if a file already exists
152161
try {
153162
res = await call(

0 commit comments

Comments
 (0)