refactor(extensions): getrennt nach http-Methoden.
- Kommentare zur Dokumentation hinzugefügt.
This commit is contained in:
parent
7fea71c08d
commit
7d575398c6
@ -2,7 +2,7 @@
|
||||
|
||||
namespace Leanetec.EConnect.Client.Alive;
|
||||
|
||||
public static class MediatRExtensions
|
||||
public static class GetExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if while the application is up.
|
||||
@ -14,4 +14,4 @@ public static class MediatRExtensions
|
||||
{
|
||||
ApiVersion = apiVersion
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -6,10 +6,8 @@ namespace Leanetec.EConnect.Client.Articles;
|
||||
/// <summary>
|
||||
/// Extension methods for the <see cref="IMediator"/> interface to simplify working with <see cref="Article"/> entities.
|
||||
/// </summary>
|
||||
public static class MediatRExtensions
|
||||
public static class GetExtensions
|
||||
{
|
||||
#region GetRequest
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves a single <see cref="Article"/> by its unique identifier.
|
||||
/// </summary>
|
||||
@ -37,24 +35,4 @@ public static class MediatRExtensions
|
||||
{
|
||||
ApiVersion = apiVersion
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region PostRequest
|
||||
|
||||
public static Task CreateArticleAsync(this IMediator mediator, Article article, int? apiVersion = null) => mediator.Send(new PostRequest(article)
|
||||
{
|
||||
ApiVersion = apiVersion
|
||||
});
|
||||
|
||||
#endregion
|
||||
|
||||
#region PutRequest
|
||||
|
||||
public static Task UpdateArticleAsync(this IMediator mediator, Article article, int? apiVersion = null) => mediator.Send(new PutRequest(article)
|
||||
{
|
||||
ApiVersion = apiVersion
|
||||
});
|
||||
|
||||
#endregion
|
||||
}
|
||||
22
src/Leanetec.EConnect.Client/Articles/PostExtensions.cs
Normal file
22
src/Leanetec.EConnect.Client/Articles/PostExtensions.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Leanetec.EConnect.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace Leanetec.EConnect.Client.Articles;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for the <see cref="IMediator"/> interface to simplify working with <see cref="Article"/> entities.
|
||||
/// </summary>
|
||||
public static class PostExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends a request to create a new <see cref="Article"/> using MediatR.
|
||||
/// </summary>
|
||||
/// <param name="mediator">The <see cref="IMediator"/> instance used to send the request.</param>
|
||||
/// <param name="article">The <see cref="Article"/> entity to be created.</param>
|
||||
/// <param name="apiVersion">Optional API version to include in the request.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
public static Task CreateArticleAsync(this IMediator mediator, Article article, int? apiVersion = null) => mediator.Send(new PostRequest(article)
|
||||
{
|
||||
ApiVersion = apiVersion
|
||||
});
|
||||
}
|
||||
23
src/Leanetec.EConnect.Client/Articles/PutExtensions.cs
Normal file
23
src/Leanetec.EConnect.Client/Articles/PutExtensions.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Leanetec.EConnect.Domain.Entities;
|
||||
using MediatR;
|
||||
|
||||
namespace Leanetec.EConnect.Client.Articles;
|
||||
|
||||
/// <summary>
|
||||
/// Extension methods for the <see cref="IMediator"/> interface to simplify working with <see cref="Article"/> entities.
|
||||
/// </summary>
|
||||
public static class PutExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Sends a request to update an existing <see cref="Article"/> using MediatR.
|
||||
/// </summary>
|
||||
/// <param name="mediator">The <see cref="IMediator"/> instance used to send the request.</param>
|
||||
/// <param name="article">The <see cref="Article"/> entity to be updated.</param>
|
||||
/// <param name="apiVersion">Optional API version to include in the request.</param>
|
||||
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
|
||||
public static Task UpdateArticleAsync(this IMediator mediator, Article article, int? apiVersion = null) =>
|
||||
mediator.Send(new PutRequest(article)
|
||||
{
|
||||
ApiVersion = apiVersion
|
||||
});
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user