delete method

  1. @override
Future<void> delete(
  1. Snowflake id,
  2. {String? token,
  3. String? auditLogReason}
)
override

Delete the item with the given id from the API.

Implementers should ensure this method updates the cache.

Implementation

@override
Future<void> delete(Snowflake id, {String? token, String? auditLogReason}) async {
  final route = HttpRoute()..webhooks(id: id.toString());
  if (token != null) {
    route.add(HttpRoutePart(token));
  }
  final request = BasicRequest(route, method: 'DELETE', authenticated: token == null, auditLogReason: auditLogReason);

  await client.httpHandler.executeSafe(request);

  cache.remove(id);
}