favoriteChats method
- int? first,
- FavoriteChatsCursor? after,
- int? last,
- FavoriteChatsCursor? before,
Returns favorite Chats of the authenticated MyUser ordered by the custom order of MyUser's favorites list (using Chat.favoritePosition field).
Use favoriteChat to update the position of a Chat in MyUser's favorites list.
Authentication
Mandatory.
Sorting
Returned Chats are sorted in the order specified by the authenticated MyUser in favoriteChat descending (starting from the highest ChatFavoritePosition and finishing at the lowest).
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<FavoriteChats$Query> favoriteChats({
int? first,
FavoriteChatsCursor? after,
int? last,
FavoriteChatsCursor? before,
}) async {
Log.debug('favoriteChats($first, $after, $last, $before)', '$runtimeType');
final variables = FavoriteChatsArguments(
first: first,
after: after,
last: last,
before: before,
);
final QueryResult result = await client.query(
QueryOptions(
operationName: 'FavoriteChats',
document: FavoriteChatsQuery(variables: variables).document,
variables: variables.toJson(),
),
);
return FavoriteChats$Query.fromJson(result.data!);
}