24 lines
629 B
C#
24 lines
629 B
C#
using QRRapidoApp.Models;
|
|
|
|
namespace QRRapidoApp.Services
|
|
{
|
|
public record RateLimitResult(
|
|
bool Allowed,
|
|
int PerMinuteLimit,
|
|
int PerMinuteUsed,
|
|
long ResetUnixTimestamp,
|
|
int MonthlyLimit,
|
|
int MonthlyUsed,
|
|
bool MonthlyExceeded
|
|
);
|
|
|
|
public interface IApiRateLimitService
|
|
{
|
|
/// <summary>
|
|
/// Checks the rate limit for the given API key prefix and plan tier.
|
|
/// Increments the counter only if the request is allowed.
|
|
/// </summary>
|
|
Task<RateLimitResult> CheckAndIncrementAsync(string keyPrefix, ApiPlanTier tier);
|
|
}
|
|
}
|