Add InvokeRecActionAsync method to ReCClient class

Added the `InvokeRecActionAsync` method to the `ReCClient` class in the `ReC.Client` namespace. This method performs an asynchronous HTTP POST request to the `api/RecAction/invoke/{profileId}` endpoint. It accepts a `profileId` parameter to specify the profile ID and an optional `CancellationToken` for task cancellation. The method ensures the HTTP response indicates success by calling `EnsureSuccessStatusCode()`. Included XML documentation comments for clarity and maintainability.
This commit is contained in:
Developer 02
2025-12-05 23:02:45 +01:00
parent 1fc4570210
commit e774afc85e

View File

@@ -18,5 +18,17 @@ namespace ReC.Client
{
_http = http ?? throw new ArgumentNullException(nameof(http));
}
/// <summary>
/// POST api/RecAction/invoke/{profileId}
/// </summary>
/// <param name="profileId"></param>
/// <param name="ct"></param>
/// <returns></returns>
public async Task InvokeRecActionAsync(int profileId, CancellationToken ct = default)
{
var resp = await _http.PostAsync($"api/RecAction/invoke/{profileId}", content: null, ct);
resp.EnsureSuccessStatusCode();
}
}
}