recentChats method
- int? first,
- RecentChatsCursor? after,
- int? last,
- RecentChatsCursor? before,
- bool noFavorite = false,
- bool archived = false,
- bool? withOngoingCalls,
Returns non-hidden Chats of the authenticated MyUser ordered descending by their last updating DateTime.
Use the noFavorite argument to exclude favorited Chats from the
returned result.
Use the archived argument to only include archived Chats into the
returned result (true), or to exclude them (false).
Use the withOngoingCalls argument to only include Chats with ongoing
ChatCalls into the returned result (true), or to exclude them
(false).
Authentication
Mandatory.
Sorting
Returned Chats are sorted primarily by their last updating DateTime, and secondary by their IDs (if the last updating DateTime is the same), in descending order.
Pagination
It's allowed to specify both first and last counts at the same time,
provided that after and before cursors are equal. In such case the
returned page will include the Chat pointed by the cursor and the
requested count of Chats preceding and following it.
If it's desired to receive the Chat, pointed by the cursor, without
querying in both directions, one can specify first or last count as 0.
Implementation
Future<RecentChats$Query> recentChats({
int? first,
RecentChatsCursor? after,
int? last,
RecentChatsCursor? before,
bool noFavorite = false,
bool archived = false,
bool? withOngoingCalls,
}) async {
Log.debug(
'recentChats($first, $after, $last, $before, $noFavorite, $archived, $withOngoingCalls)',
'$runtimeType',
);
final variables = RecentChatsArguments(
pagination: RecentChatsPagination(
first: first,
after: after,
last: last,
before: before,
),
kw$with: RecentChatsFilter(
noFavorite: noFavorite,
archived: archived,
ongoingCalls: withOngoingCalls,
),
);
final QueryResult result = await client.query(
QueryOptions(
operationName: 'RecentChats',
document: RecentChatsQuery(variables: variables).document,
variables: variables.toJson(),
),
);
return RecentChats$Query.fromJson(result.data!);
}