diff --git a/src/ReC.Client/DependencyInjection.cs b/src/ReC.Client/DependencyInjection.cs
index 1b9c122..aa1ddd5 100644
--- a/src/ReC.Client/DependencyInjection.cs
+++ b/src/ReC.Client/DependencyInjection.cs
@@ -6,8 +6,17 @@ using System.Net.Http;
namespace ReC.Client
{
+ ///
+ /// Provides extension methods for setting up the ReC client in an .
+ ///
public static class DependencyInjection
{
+ ///
+ /// Adds and configures the for the to the specified
+ ///
+ /// The to add the services to.
+ /// The base URI of the ReC API.
+ /// An that can be used to configure the client.
public static IHttpClientBuilder AddRecClient(this IServiceCollection services, string apiUri)
{
return services.AddHttpClient(ReCClient.ClientName, client =>
@@ -16,6 +25,12 @@ namespace ReC.Client
});
}
+ ///
+ /// Adds and configures the for the to the specified
+ ///
+ /// The to add the services to.
+ /// An action to configure the .
+ /// An that can be used to configure the client.
public static IHttpClientBuilder AddRecClient(this IServiceCollection services, Action configureClient)
{
return services.AddHttpClient(ReCClient.ClientName, configureClient);
diff --git a/src/ReC.Client/ReC.Client.csproj b/src/ReC.Client/ReC.Client.csproj
index 0b561b9..ea6f807 100644
--- a/src/ReC.Client/ReC.Client.csproj
+++ b/src/ReC.Client/ReC.Client.csproj
@@ -2,6 +2,7 @@
net462;net8.0
+ bin\$(Configuration)\$(TargetFramework)\$(MSBuildProjectName).xml
@@ -10,8 +11,7 @@
-
+
-
diff --git a/src/ReC.Client/ReCClient.cs b/src/ReC.Client/ReCClient.cs
index bde38c9..9a7faf1 100644
--- a/src/ReC.Client/ReCClient.cs
+++ b/src/ReC.Client/ReCClient.cs
@@ -1,5 +1,4 @@
-using System.Text.Json;
-using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection;
#if NETFRAMEWORK
using System;
@@ -10,23 +9,36 @@ using System.Threading.Tasks;
namespace ReC.Client
{
+ ///
+ /// A client for interacting with the ReC API.
+ ///
public class ReCClient
{
private readonly HttpClient _http;
+ ///
+ /// A unique name for the HttpClient used by the ReCClient.
+ ///
public static readonly string ClientName = Guid.NewGuid().ToString();
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The factory to create HttpClients.
public ReCClient(IHttpClientFactory httpClientFactory)
{
_http = httpClientFactory.CreateClient(ClientName);
}
///
- /// POST api/RecAction/invoke/{profileId}
+ /// Asynchronously invokes a ReC action for a specific profile.
///
- ///
- ///
- /// True if the request was successful, false otherwise
+ ///
+ /// This method sends a POST request to the api/RecAction/invoke/{profileId} endpoint.
+ ///
+ /// The ID of the profile to invoke the action for.
+ /// A token to cancel the asynchronous operation.
+ /// A that represents the asynchronous operation. The task result is if the request was successful; otherwise, .
public async Task InvokeRecActionAsync(int profileId, CancellationToken cancellationToken = default)
{
var resp = await _http.PostAsync($"api/RecAction/invoke/{profileId}", content: null, cancellationToken);
@@ -34,10 +46,14 @@ namespace ReC.Client
}
///
- /// POST api/RecAction/invoke/{profileId} (Synchronous version)
+ /// Synchronously invokes a ReC action for a specific profile.
///
- ///
- /// True if the request was successful, false otherwise
+ ///
+ /// This method sends a POST request to the api/RecAction/invoke/{profileId} endpoint.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the profile to invoke the action for.
+ /// if the request was successful; otherwise, .
[Obsolete("Use InvokeRecActionAsync instead to avoid potential deadlocks and improve performance.")]
public bool InvokeRecAction(int profileId)
{
@@ -54,6 +70,14 @@ namespace ReC.Client
private static IServiceProvider Provider = null;
#endif
+ ///
+ /// Configures and builds the static for creating instances.
+ ///
+ ///
+ /// This method should only be called once during application startup.
+ ///
+ /// The base URI of the ReC API.
+ /// Thrown if the static provider has already been built.
public static void BuildStaticClient(string apiUri)
{
if(Provider != null)
@@ -66,6 +90,11 @@ namespace ReC.Client
Provider = Services.BuildServiceProvider();
}
+ ///
+ /// Creates a new instance using the statically configured provider.
+ ///
+ /// A new instance of the .
+ /// Thrown if has not been called yet.
public static ReCClient Create()
{
if (Provider == null)