diff --git a/src/ReC.Client/Api/BatchRecActionViewResponse.cs b/src/ReC.Client/Api/BatchRecActionViewResponse.cs new file mode 100644 index 0000000..d70f315 --- /dev/null +++ b/src/ReC.Client/Api/BatchRecActionViewResponse.cs @@ -0,0 +1,14 @@ +namespace ReC.Client.Api +{ + /// + /// Represents the result of a batch RecAction invocation. + /// + public class BatchRecActionViewResponse + { + /// Total number of actions that were processed. + public int TotalActionCount { get; set; } + + /// Number of actions that resulted in an exception. + public int ActionExceptionCount { get; set; } + } +} diff --git a/src/ReC.Client/Api/RecActionApi.cs b/src/ReC.Client/Api/RecActionApi.cs index 17fce3c..e0f7982 100644 --- a/src/ReC.Client/Api/RecActionApi.cs +++ b/src/ReC.Client/Api/RecActionApi.cs @@ -30,18 +30,20 @@ namespace ReC.Client.Api /// The profile identifier. /// Optional reference values to pass through to all result records. /// A token to cancel the operation. + /// A describing the outcome of the batch invocation. /// Thrown when the API responds with a non-success status code. #if NETFRAMEWORK - public async Task InvokeAsync(long profileId, InvokeReferences references = null, CancellationToken cancellationToken = default) + public async Task InvokeAsync(long profileId, InvokeReferences references = null, CancellationToken cancellationToken = default) #else - public async Task InvokeAsync(long profileId, InvokeReferences? references = null, CancellationToken cancellationToken = default) + public async Task InvokeAsync(long profileId, InvokeReferences? references = null, CancellationToken cancellationToken = default) #endif { var content = references != null ? ReCClientHelpers.ToJsonContent(references) : null; using (content) using (var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content, cancellationToken)) { - await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancellationToken).ConfigureAwait(false); + var body = await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancellationToken).ConfigureAwait(false); + return ReCClientHelpers.Deserialize(body); } } @@ -51,8 +53,13 @@ namespace ReC.Client.Api /// The profile identifier. /// Batch identifier. /// A token to cancel the operation. + /// A describing the outcome of the batch invocation. /// Thrown when the API responds with a non-success status code. - public Task InvokeAsync(long profileId, string batchId, CancellationToken cancellationToken = default) +#if NETFRAMEWORK + public Task InvokeAsync(long profileId, string batchId, CancellationToken cancellationToken = default) +#else + public Task InvokeAsync(long profileId, string batchId, CancellationToken cancellationToken = default) +#endif { return InvokeAsync(profileId, new InvokeReferences() { BatchId = batchId }, cancellationToken); }