searchChatContacts method
- UserName? name,
- UserEmail? email,
- UserPhone? phone,
- int? first,
- ChatContactsCursor? after,
- int? last,
- ChatContactsCursor? before,
Searches ChatContacts by the given criteria.
Exactly one of name/email/phone arguments must be specified
(be non-null).
Searching by email/phone is exact.
Searching by name is fuzzy.
Authentication
Mandatory.
Sorting
Returned ChatContacts are sorted depending on the provided arguments:
-
If one of the
email/phonearguments is specified, then returned ChatContacts are sorted by theirnames (by IDs if thenameis the same) in ascending order. -
If the
nameargument is specified, then returned ChatContacts are sorted primarily by theLevenshtein distanceof theirnames, and secondary by their IDs (if theLevenshtein distanceis 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 ChatContact pointed by the cursor and the
requested count of ChatContacts preceding and following it.
If it's desired to receive the ChatContact, pointed by the cursor,
without querying in both directions, one can specify first or last
count as 0.
Implementation
Future<SearchChatContacts$Query> searchChatContacts({
UserName? name,
UserEmail? email,
UserPhone? phone,
int? first,
ChatContactsCursor? after,
int? last,
ChatContactsCursor? before,
}) async {
Log.debug(
'searchChatContacts($name, $email, $phone, $first, $after, $last, $before)',
'$runtimeType',
);
final variables = SearchChatContactsArguments(
name: name,
email: email,
phone: phone,
first: first,
after: after,
last: last,
before: before,
);
final QueryResult res = await client.query(
QueryOptions(
operationName: 'SearchChatContacts',
document: SearchChatContactsQuery(variables: variables).document,
variables: variables.toJson(),
),
);
return SearchChatContacts$Query.fromJson(res.data!);
}