Example #1
0
        public static Task <IReadOnlyList <TAuditLog> > FetchAuditLogsAsync <TAuditLog>(this IRestClient client, Snowflake guildId, int limit = 100, Snowflake?actorId = null, Snowflake?startFromId = null, IRestRequestOptions options = null)
            where TAuditLog : IAuditLog
        {
            if (limit == 0)
            {
                return(Task.FromResult(ReadOnlyList <TAuditLog> .Empty));
            }

            if (limit <= 100)
            {
                return(client.InternalFetchAuditLogsAsync <TAuditLog>(guildId, limit, actorId, startFromId, options));
            }

            var enumerable = client.EnumerateAuditLogs <TAuditLog>(guildId, limit, actorId, startFromId, options);

            return(enumerable.FlattenAsync());
        }
Example #2
0
 public static IPagedEnumerable <IAuditLog> EnumerateAuditLogs(this IRestClient client, Snowflake guildId, int limit, Snowflake?actorId = null, Snowflake?startFromId = null, IRestRequestOptions options = null)
 => client.EnumerateAuditLogs <IAuditLog>(guildId, limit, actorId, startFromId, options);