searchAccounts method

Future<List<Account>> searchAccounts(
  1. String q, {
  2. int limit = 40,
  3. bool resolve = false,
  4. bool following = false,
})
inherited

Search for matching accounts by username or display name.

GET /api/v1/accounts/search

  • authenticated
  • read read:accounts

Implementation

Future<List<Account>> searchAccounts(
  String q, {
  int limit = 40,
  bool resolve = false,
  bool following = false,
}) async {
  final response = await request(
    Method.get,
    "/api/v1/accounts/search",
    authenticated: true,
    payload: {
      "q": q,
      "limit": limit.toString(),
      "resolve": resolve.toString(),
      "following": following.toString(),
    },
  );

  final body = List<Map<String, dynamic>>.from(json.decode(response.body));

  return body.map((m) => Account.fromJson(m)).toList();
}