Skip to content

Commit 8b6eb0c

Browse files
Merge pull request #67 from appwrite/feat-push-params
Add new push message parameters
2 parents f1ba4a5 + fb6041f commit 8b6eb0c

Some content is hidden

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

61 files changed

+374
-100
lines changed

README.md

+1-1
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.1.0
26+
dart_appwrite: ^12.2.0
2727
```
2828
2929
You can install packages from the command line:

docs/examples/databases/update-string-attribute.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ AttributeString result = await databases.updateStringAttribute(
1313
key: '',
1414
xrequired: false,
1515
xdefault: '<DEFAULT>',
16-
size: 0, // (optional)
16+
size: 1, // (optional)
1717
newKey: '', // (optional)
1818
);

docs/examples/messaging/create-push.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Messaging messaging = Messaging(client);
99

1010
Message result = await messaging.createPush(
1111
messageId: '<MESSAGE_ID>',
12-
title: '<TITLE>',
13-
body: '<BODY>',
12+
title: '<TITLE>', // (optional)
13+
body: '<BODY>', // (optional)
1414
topics: [], // (optional)
1515
users: [], // (optional)
1616
targets: [], // (optional)
@@ -21,7 +21,10 @@ Message result = await messaging.createPush(
2121
sound: '<SOUND>', // (optional)
2222
color: '<COLOR>', // (optional)
2323
tag: '<TAG>', // (optional)
24-
badge: '<BADGE>', // (optional)
24+
badge: 0, // (optional)
2525
draft: false, // (optional)
2626
scheduledAt: '', // (optional)
27+
contentAvailable: false, // (optional)
28+
critical: false, // (optional)
29+
priority: MessagePriority.normal, // (optional)
2730
);

docs/examples/messaging/update-push.md

+3
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ Message result = await messaging.updatePush(
2424
badge: 0, // (optional)
2525
draft: false, // (optional)
2626
scheduledAt: '', // (optional)
27+
contentAvailable: false, // (optional)
28+
critical: false, // (optional)
29+
priority: MessagePriority.normal, // (optional)
2730
);

lib/enums.dart

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ part 'src/enums/index_type.dart';
1313
part 'src/enums/runtime.dart';
1414
part 'src/enums/execution_method.dart';
1515
part 'src/enums/name.dart';
16+
part 'src/enums/message_priority.dart';
1617
part 'src/enums/smtp_encryption.dart';
1718
part 'src/enums/compression.dart';
1819
part 'src/enums/image_gravity.dart';

lib/services/account.dart

+11-13
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Account extends Service {
8484
return models.User.fromMap(res.data);
8585
}
8686

87-
/// List Identities
87+
/// List identities
8888
///
8989
/// Get the list of identities for the currently logged in user.
9090
Future<models.IdentityList> listIdentities({List<String>? queries}) async {
@@ -186,7 +186,7 @@ class Account extends Service {
186186
return models.User.fromMap(res.data);
187187
}
188188

189-
/// Create Authenticator
189+
/// Create authenticator
190190
///
191191
/// Add an authenticator app to be used as an MFA factor. Verify the
192192
/// authenticator using the [verify
@@ -209,7 +209,7 @@ class Account extends Service {
209209
return models.MfaType.fromMap(res.data);
210210
}
211211

212-
/// Verify Authenticator
212+
/// Verify authenticator
213213
///
214214
/// Verify an authenticator app after adding it using the [add
215215
/// authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator)
@@ -233,7 +233,7 @@ class Account extends Service {
233233
return models.User.fromMap(res.data);
234234
}
235235

236-
/// Delete Authenticator
236+
/// Delete authenticator
237237
///
238238
/// Delete an authenticator for a user by ID.
239239
Future deleteMfaAuthenticator({required enums.AuthenticatorType type}) async {
@@ -252,7 +252,7 @@ class Account extends Service {
252252
return res.data;
253253
}
254254

255-
/// Create MFA Challenge
255+
/// Create MFA challenge
256256
///
257257
/// Begin the process of MFA verification after sign-in. Finish the flow with
258258
/// [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge)
@@ -275,7 +275,7 @@ class Account extends Service {
275275
return models.MfaChallenge.fromMap(res.data);
276276
}
277277

278-
/// Create MFA Challenge (confirmation)
278+
/// Create MFA challenge (confirmation)
279279
///
280280
/// Complete the MFA challenge by providing the one-time password. Finish the
281281
/// process of MFA verification by providing the one-time password. To begin
@@ -301,7 +301,7 @@ class Account extends Service {
301301
return res.data;
302302
}
303303

304-
/// List Factors
304+
/// List factors
305305
///
306306
/// List the factors available on the account to be used as a MFA challange.
307307
Future<models.MfaFactors> listMfaFactors() async {
@@ -319,7 +319,7 @@ class Account extends Service {
319319
return models.MfaFactors.fromMap(res.data);
320320
}
321321

322-
/// Get MFA Recovery Codes
322+
/// Get MFA recovery codes
323323
///
324324
/// Get recovery codes that can be used as backup for MFA flow. Before getting
325325
/// codes, they must be generated using
@@ -340,7 +340,7 @@ class Account extends Service {
340340
return models.MfaRecoveryCodes.fromMap(res.data);
341341
}
342342

343-
/// Create MFA Recovery Codes
343+
/// Create MFA recovery codes
344344
///
345345
/// Generate recovery codes as backup for MFA flow. It's recommended to
346346
/// generate and show then immediately after user successfully adds their
@@ -362,7 +362,7 @@ class Account extends Service {
362362
return models.MfaRecoveryCodes.fromMap(res.data);
363363
}
364364

365-
/// Regenerate MFA Recovery Codes
365+
/// Regenerate MFA recovery codes
366366
///
367367
/// Regenerate recovery codes that can be used as backup for MFA flow. Before
368368
/// regenerating codes, they must be first generated using
@@ -843,9 +843,7 @@ class Account extends Service {
843843
/// [POST
844844
/// /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession)
845845
/// endpoint to complete the login process. The link sent to the user's email
846-
/// address is valid for 1 hour. If you are on a mobile device you can leave
847-
/// the URL parameter empty, so that the login completion will be handled by
848-
/// your Appwrite instance by default.
846+
/// address is valid for 1 hour.
849847
///
850848
/// A user is limited to 10 active sessions at a time by default. [Learn more
851849
/// about session

lib/services/locale.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Locale extends Service {
2828
return models.Locale.fromMap(res.data);
2929
}
3030

31-
/// List Locale Codes
31+
/// List locale codes
3232
///
3333
/// List of all locale codes in [ISO
3434
/// 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).

lib/services/messaging.dart

+17-5
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ class Messaging extends Service {
119119
/// Create a new push notification.
120120
Future<models.Message> createPush(
121121
{required String messageId,
122-
required String title,
123-
required String body,
122+
String? title,
123+
String? body,
124124
List<String>? topics,
125125
List<String>? users,
126126
List<String>? targets,
@@ -131,9 +131,12 @@ class Messaging extends Service {
131131
String? sound,
132132
String? color,
133133
String? tag,
134-
String? badge,
134+
int? badge,
135135
bool? draft,
136-
String? scheduledAt}) async {
136+
String? scheduledAt,
137+
bool? contentAvailable,
138+
bool? critical,
139+
enums.MessagePriority? priority}) async {
137140
final String apiPath = '/messaging/messages/push';
138141

139142
final Map<String, dynamic> apiParams = {
@@ -153,6 +156,9 @@ class Messaging extends Service {
153156
'badge': badge,
154157
'draft': draft,
155158
'scheduledAt': scheduledAt,
159+
'contentAvailable': contentAvailable,
160+
'critical': critical,
161+
'priority': priority?.value,
156162
};
157163

158164
final Map<String, String> apiHeaders = {
@@ -185,7 +191,10 @@ class Messaging extends Service {
185191
String? tag,
186192
int? badge,
187193
bool? draft,
188-
String? scheduledAt}) async {
194+
String? scheduledAt,
195+
bool? contentAvailable,
196+
bool? critical,
197+
enums.MessagePriority? priority}) async {
189198
final String apiPath = '/messaging/messages/push/{messageId}'
190199
.replaceAll('{messageId}', messageId);
191200

@@ -205,6 +214,9 @@ class Messaging extends Service {
205214
'badge': badge,
206215
'draft': draft,
207216
'scheduledAt': scheduledAt,
217+
'contentAvailable': contentAvailable,
218+
'critical': critical,
219+
'priority': priority?.value,
208220
};
209221

210222
final Map<String, String> apiHeaders = {

lib/services/storage.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ class Storage extends Service {
272272
return models.File.fromMap(res.data);
273273
}
274274

275-
/// Delete File
275+
/// Delete file
276276
///
277277
/// Delete a file by its unique ID. Only users with write permissions have
278278
/// access to delete this resource.

lib/services/teams.dart

+4-2
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ class Teams extends Service {
115115
/// List team memberships
116116
///
117117
/// Use this endpoint to list a team's members using the team's ID. All team
118-
/// members have read access to this endpoint.
118+
/// members have read access to this endpoint. Hide sensitive attributes from
119+
/// the response by toggling membership privacy in the Console.
119120
Future<models.MembershipList> listMemberships(
120121
{required String teamId, List<String>? queries, String? search}) async {
121122
final String apiPath =
@@ -192,7 +193,8 @@ class Teams extends Service {
192193
/// Get team membership
193194
///
194195
/// Get a team member by the membership unique id. All team members have read
195-
/// access for this resource.
196+
/// access for this resource. Hide sensitive attributes from the response by
197+
/// toggling membership privacy in the Console.
196198
Future<models.Membership> getMembership(
197199
{required String teamId, required String membershipId}) async {
198200
final String apiPath = '/teams/{teamId}/memberships/{membershipId}'

lib/services/users.dart

+10-10
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Users extends Service {
115115
return models.User.fromMap(res.data);
116116
}
117117

118-
/// List Identities
118+
/// List identities
119119
///
120120
/// Get identities for all users.
121121
Future<models.IdentityList> listIdentities(
@@ -503,7 +503,7 @@ class Users extends Service {
503503
return models.User.fromMap(res.data);
504504
}
505505

506-
/// Delete Authenticator
506+
/// Delete authenticator
507507
///
508508
/// Delete an authenticator app.
509509
Future<models.User> deleteMfaAuthenticator(
@@ -524,7 +524,7 @@ class Users extends Service {
524524
return models.User.fromMap(res.data);
525525
}
526526

527-
/// List Factors
527+
/// List factors
528528
///
529529
/// List the factors available on the account to be used as a MFA challange.
530530
Future<models.MfaFactors> listMfaFactors({required String userId}) async {
@@ -543,7 +543,7 @@ class Users extends Service {
543543
return models.MfaFactors.fromMap(res.data);
544544
}
545545

546-
/// Get MFA Recovery Codes
546+
/// Get MFA recovery codes
547547
///
548548
/// Get recovery codes that can be used as backup for MFA flow by User ID.
549549
/// Before getting codes, they must be generated using
@@ -566,7 +566,7 @@ class Users extends Service {
566566
return models.MfaRecoveryCodes.fromMap(res.data);
567567
}
568568

569-
/// Regenerate MFA Recovery Codes
569+
/// Regenerate MFA recovery codes
570570
///
571571
/// Regenerate recovery codes that can be used as backup for MFA flow by User
572572
/// ID. Before regenerating codes, they must be first generated using
@@ -589,7 +589,7 @@ class Users extends Service {
589589
return models.MfaRecoveryCodes.fromMap(res.data);
590590
}
591591

592-
/// Create MFA Recovery Codes
592+
/// Create MFA recovery codes
593593
///
594594
/// Generate recovery codes used as backup for MFA flow for User ID. Recovery
595595
/// codes can be used as a MFA verification type in
@@ -827,7 +827,7 @@ class Users extends Service {
827827
return models.User.fromMap(res.data);
828828
}
829829

830-
/// List User Targets
830+
/// List user targets
831831
///
832832
/// List the messaging targets that are associated with a user.
833833
Future<models.TargetList> listTargets(
@@ -849,7 +849,7 @@ class Users extends Service {
849849
return models.TargetList.fromMap(res.data);
850850
}
851851

852-
/// Create User Target
852+
/// Create user target
853853
///
854854
/// Create a messaging target.
855855
Future<models.Target> createTarget(
@@ -880,7 +880,7 @@ class Users extends Service {
880880
return models.Target.fromMap(res.data);
881881
}
882882

883-
/// Get User Target
883+
/// Get user target
884884
///
885885
/// Get a user's push notification target by ID.
886886
Future<models.Target> getTarget(
@@ -901,7 +901,7 @@ class Users extends Service {
901901
return models.Target.fromMap(res.data);
902902
}
903903

904-
/// Update User target
904+
/// Update user target
905905
///
906906
/// Update a messaging target.
907907
Future<models.Target> updateTarget(

lib/src/client_browser.dart

+1-1
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.1.0',
36+
'x-sdk-version': '12.2.0',
3737
'X-Appwrite-Response-Format': '1.6.0',
3838
};
3939

lib/src/client_io.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ 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': '12.1.0',
45+
'x-sdk-version': '12.2.0',
4646
'user-agent':
47-
'AppwriteDartSDK/12.1.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
47+
'AppwriteDartSDK/12.2.0 (${Platform.operatingSystem}; ${Platform.operatingSystemVersion})',
4848
'X-Appwrite-Response-Format': '1.6.0',
4949
};
5050

lib/src/enums/image_format.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ enum ImageFormat {
55
jpeg(value: 'jpeg'),
66
gif(value: 'gif'),
77
png(value: 'png'),
8-
webp(value: 'webp');
8+
webp(value: 'webp'),
9+
avif(value: 'avif');
910

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

lib/src/enums/message_priority.dart

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
part of '../../enums.dart';
2+
3+
enum MessagePriority {
4+
normal(value: 'normal'),
5+
high(value: 'high');
6+
7+
const MessagePriority({required this.value});
8+
9+
final String value;
10+
11+
String toJson() => value;
12+
}

0 commit comments

Comments
 (0)