refactor(BurnPdfCommand): add extension methods for ISender
- Introduce BurnPdfCommandExtensions to simplify sending BurnPdfCommand via ISender - Enables calling `sender.BurnPdf(envelopeId, cancel)` or `sender.BurnPdf(envelopeUuid, cancel)` - No changes to the underlying PDF burning logic in BurnPdfCommandHandler
This commit is contained in:
@@ -20,6 +20,32 @@ namespace EnvelopeGenerator.Application.Pdf;
|
||||
/// </summary>
|
||||
public record BurnPdfCommand(int? EnvelopeId = null, string? EnvelopeUuid = null) : IRequest<byte[]>;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static class BurnPdfCommandExtensions
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="envelopeId"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
public static Task<byte[]> BurnPdf(this ISender sender, int envelopeId, CancellationToken cancel)
|
||||
=> sender.Send(new BurnPdfCommand(EnvelopeId: envelopeId), cancel);
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="envelopeUuid"></param>
|
||||
/// <param name="cancel"></param>
|
||||
/// <returns></returns>
|
||||
public static Task<byte[]> BurnPdf(this ISender sender, string envelopeUuid, CancellationToken cancel)
|
||||
=> sender.Send(new BurnPdfCommand(EnvelopeUuid: envelopeUuid), cancel);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user