update method

  1. @override
Future<Guild> update(
  1. Snowflake id,
  2. covariant GuildUpdateBuilder 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<Guild> update(Snowflake id, GuildUpdateBuilder builder, {String? auditLogReason}) async {
  final route = HttpRoute()..guilds(id: id.toString());
  final request = BasicRequest(route, method: 'PATCH', auditLogReason: auditLogReason, body: jsonEncode(builder.build()));

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

  client.updateCacheWith(guild);
  return guild;
}