-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clen 1924: support for pagination params for push channels #123
Changes from 4 commits
9b2fbe8
d145f55
4f599fc
1b475c1
690b280
f2bef4d
25a3867
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,12 +19,16 @@ mixin PushNotificationDx on Core { | |
/// If [gateway] is [PushGateway.apns2] then [topic] is mandatory to provide. | ||
/// [topic] is bundle id of the mobile application. | ||
/// [environment] denoting the environment of the mobile application for [PushGateway.apns2], it can be either: | ||
/// [start] Starting channel for pagination. Use the last channel from the previous page request. | ||
/// [count] Number of channels to return for pagination. Max of 1000 tokens at a time. Defaults to 500. | ||
/// * [Environment.development] (which is the default value). | ||
/// * [Environment.production]. | ||
Future<ListPushChannelsResult> listPushChannels( | ||
String deviceId, PushGateway gateway, | ||
{String? topic, | ||
Environment? environment, | ||
String? start, | ||
int? count, | ||
Keyset? keyset, | ||
String? using}) async { | ||
keyset ??= keysets[using]; | ||
|
@@ -33,7 +37,7 @@ mixin PushNotificationDx on Core { | |
if (gateway == PushGateway.apns2) Ensure(topic).isNotNull('topic'); | ||
|
||
var params = ListPushChannelsParams(keyset, deviceId, gateway, | ||
topic: topic, environment: environment); | ||
topic: topic, environment: environment, start: start, count: count); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same nitpick here, you can add a trailing comma , after |
||
return defaultFlow<ListPushChannelsParams, ListPushChannelsResult>( | ||
keyset: keyset, | ||
core: this, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -189,6 +189,33 @@ void main() { | |
#environment: null | ||
})); | ||
}); | ||
|
||
test('listPushChannels delegate supported arguments', () async { | ||
fakePubnub.returnWhen( | ||
#listPushChannels, | ||
Future.value( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also use trailing commas here, I leave it up to you |
||
ListPushChannelsResult.fromJson(['ch1', 'ch2', 'ch3']))); | ||
|
||
await fakePubnub.listPushChannels('A332C23D', PushGateway.mpns, | ||
start: 'ch2', count: 10); | ||
|
||
var invocation = fakePubnub.invocations[0]; | ||
|
||
expect(invocation.isMethod, equals(true)); | ||
expect(invocation.memberName, equals(#listPushChannels)); | ||
expect(invocation.positionalArguments, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can also use trailing commas here, I leave it up to you |
||
equals(['A332C23D', PushGateway.mpns])); | ||
expect( | ||
invocation.namedArguments, | ||
equals({ | ||
#keyset: null, | ||
#using: null, | ||
#topic: null, | ||
#environment: null, | ||
#start: 'ch2', | ||
#count: 10 | ||
})); | ||
}); | ||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, you can add a trailing comma
,
afterthis.count
so your IDE should break the line