using Leanetec.EConnect.Domain.Entities;
using MediatR;
namespace Leanetec.EConnect.Client.Articles;
///
/// Extension methods for the interface to simplify working with entities.
///
public static class PutExtensions
{
///
/// Sends a request to update an existing using MediatR.
///
/// The instance used to send the request.
/// The entity to be updated.
/// Optional API version to include in the request.
/// A representing the asynchronous operation.
public static Task UpdateArticleAsync(this IMediator mediator, Article article, int? apiVersion = null) => mediator.Send(new PutRequest(article)
{
ApiVersion = apiVersion
});
///
/// Sends a request to update an existing using MediatR.
///
/// The instance used to send the request.
/// The entity to be updated.
/// Optional API version to include in the request.
public static void UpdateArticle(this IMediator mediator, Article article, int? apiVersion = null) => mediator.Send(new PutRequest(article)
{
ApiVersion = apiVersion
}).GetAwaiter().GetResult();
}