#nullable enable using System; using System.Threading; using System.Threading.Tasks; using BTCPayServer.Rating; namespace BTCPayServer.Services.Rates { public interface IRateProvider { RateSourceInfo RateSourceInfo { get; } /// /// Returns rates of the provider /// /// /// /// If using this provider isn't supported (For example if a requires a context) Task GetRatesAsync(CancellationToken cancellationToken); } public interface IRateContext { } public interface IHasStoreIdRateContext : IRateContext { string StoreId { get; } } public record StoreIdRateContext(string StoreId) : IHasStoreIdRateContext; /// /// A rate provider which know additional context about the rate query. /// public interface IContextualRateProvider : IRateProvider { /// /// Returns rates of the provider when a context is available /// /// /// /// If using this provider isn't getting an expected context Task GetRatesAsync(IRateContext context, CancellationToken cancellationToken); } }