fetch method

  1. @override
Future<GuildEmoji> fetch(
  1. Snowflake id
)
override

Fetch the item with the given id from the API.

Implementers should ensure this method updates the cache.

Implementation

@override
Future<GuildEmoji> fetch(Snowflake id) async {
  _checkIsConcrete(id);

  final route = HttpRoute()
    ..guilds(id: guildId.toString())
    ..emojis(id: id.toString());
  final request = BasicRequest(route);

  final response = await client.httpHandler.executeSafe(request);
  final emoji = parse(response.jsonBody as Map<String, Object?>) as GuildEmoji;

  client.updateCacheWith(emoji);
  return emoji;
}