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:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user