fetch method

  1. @override
Future<AuditLogEntry> 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<AuditLogEntry> fetch(Snowflake id) async {
  // Add one because before and after are exclusive.
  final entries = await list(before: Snowflake(id.value + 1));

  return entries.firstWhere(
    (entry) => entry.id == id,
    orElse: () => throw AuditLogEntryNotFoundException(guildId, id),
  );
}