chatItems method
- ChatId id, {
- int? first,
- ChatItemsCursor? after,
- int? last,
- ChatItemsCursor? before,
- ChatItemsFilter? filter,
Fetches ChatItems of a Chat identified by its id
ordered by their
posting time.
It is allowed to specify both first
and last
at the same time provided
that after
and before
are equal. In such cases the returned page will
include the ChatItem pointed by the cursor and the requested number of
ChatItems preceding and following it.
If it is desired to receive the ChatItem under the cursor without
querying in both directions one can specify first
or last
as 0.
Authentication
Mandatory.
Implementation
Future<GetMessages$Query> chatItems(
ChatId id, {
int? first,
ChatItemsCursor? after,
int? last,
ChatItemsCursor? before,
ChatItemsFilter? filter,
}) async {
Log.debug(
'chatItems($id, first: $first, after: $after, last: $last, before: $before, filter: $filter)',
'$runtimeType',
);
final variables = GetMessagesArguments(
id: id,
first: first,
after: after,
last: last,
before: before,
filter: filter,
);
final QueryResult result = await client.query(
QueryOptions(
operationName: 'GetMessages',
document: GetMessagesQuery(variables: variables).document,
variables: variables.toJson(),
),
);
return GetMessages$Query.fromJson(result.data!);
}