- Mark `IEmailTemplateRepository` and `_repository` in `ReadEmailTemplateQueryHandler` as obsolete, suggesting the use of `IRepository`. - Update `ResetEmailTemplateCommand` with additional documentation and examples for `Type`. - Change return type of `CreateEnvelopeReceiverCommand` to `IRequest<CreateEnvelopeReceiverResponse>`. - Improve caching methods in `CacheExtensions.cs` for better functionality and clarity. - Add XML documentation to the `Ok` method in `MappingExtensions`. - Make `UserReference` property required in `ReadHistoryResponse`.
27 lines
1.2 KiB
C#
27 lines
1.2 KiB
C#
using EnvelopeGenerator.Application.DTOs.Messaging;
|
|
|
|
namespace EnvelopeGenerator.Application.Extensions;
|
|
|
|
/// <summary>
|
|
/// Provides extension methods for common mapping and conversion operations.
|
|
/// </summary>
|
|
public static class MappingExtensions
|
|
{
|
|
/// <summary>
|
|
/// Determines whether the response indicates a successful "OK" message status.
|
|
/// </summary>
|
|
/// <param name="gtxMessagingResponse">The response object to evaluate.</param>
|
|
/// <returns><see langword="true"/> if the response contains a "message-status" key with a value of "ok" (case-insensitive);
|
|
/// otherwise, <see langword="false"/>.</returns>
|
|
public static bool Ok(this GtxMessagingResponse gtxMessagingResponse)
|
|
=> gtxMessagingResponse.TryGetValue("message-status", out var status)
|
|
&& status?.ToString()?.ToLower() == "ok";
|
|
|
|
/// <summary>
|
|
/// Converts the specified byte array to its equivalent string representation encoded in base-64.
|
|
/// </summary>
|
|
/// <param name="bytes">The byte array to encode.</param>
|
|
/// <returns>A base-64 encoded string representation of the input byte array.</returns>
|
|
public static string ToBase64String(this byte[] bytes)
|
|
=> Convert.ToBase64String(bytes);
|
|
} |