update method

  1. @override
Future<GuildEmoji> update(
  1. Snowflake id,
  2. covariant EmojiUpdateBuilder builder, {
  3. String? auditLogReason,
})
override

Update the item with the given id in the API.

Implementers should ensure this method updates the cache.

Implementation

@override
Future<GuildEmoji> update(Snowflake id, EmojiUpdateBuilder builder, {String? auditLogReason}) async {
  _checkIsConcrete(id);

  final route = HttpRoute()
    ..guilds(id: guildId.toString())
    ..emojis(id: id.toString());
  final request = BasicRequest(route, method: 'PATCH', body: jsonEncode(builder.build()), auditLogReason: auditLogReason);

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

  client.updateCacheWith(emoji);
  return emoji;
}