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

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.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

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

Lines changed: 6 additions & 3 deletions
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

Lines changed: 3 additions & 0 deletions
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

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

Lines changed: 11 additions & 13 deletions
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

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

Lines changed: 17 additions & 5 deletions
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

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

Lines changed: 4 additions & 2 deletions
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}'

0 commit comments

Comments
 (0)