update method

  1. @override
Future<GuildSticker> update(
  1. Snowflake id,
  2. covariant StickerUpdateBuilder 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<GuildSticker> update(Snowflake id, StickerUpdateBuilder builder, {String? auditLogReason}) async {
  final route = HttpRoute()
    ..guilds(id: guildId.toString())
    ..stickers(id: id.toString());

  final request = BasicRequest(route, body: jsonEncode(builder.build()), method: 'PATCH', auditLogReason: auditLogReason);
  final response = await client.httpHandler.executeSafe(request);

  final sticker = parse(response.jsonBody as Map<String, Object?>);

  client.updateCacheWith(sticker);
  return sticker;
}