listCurrentUserGuilds method

Future<List<UserGuild>> listCurrentUserGuilds(
  1. {Snowflake? after,
  2. Snowflake? before,
  3. int? limit,
  4. bool? withCounts}
)

List the guilds the current user is a member of.

Implementation

Future<List<UserGuild>> listCurrentUserGuilds({Snowflake? after, Snowflake? before, int? limit, bool? withCounts}) async {
  final route = HttpRoute()
    ..users(id: '@me')
    ..guilds();
  final request = BasicRequest(route, queryParameters: {
    if (before != null) 'before': before.toString(),
    if (after != null) 'after': after.toString(),
    if (limit != null) 'limit': limit.toString(),
    if (withCounts != null) 'with_counts': withCounts.toString(),
  });

  final response = await client.httpHandler.executeSafe(request);
  return parseMany(
    response.jsonBody as List,
    (Map<String, Object?> raw) => client.guilds.parseUserGuild(raw),
  );
}