Refactor API methods for improved query handling
Updated `DeleteAsync` in `BaseCrudApi.cs` to serialize payloads into query strings to align with API expectations. Added `UpdateAsync` to `CommonApi.cs` for payload-based updates, overriding inherited CRUD helpers to match the API's behavior. Enhanced `GetAsync` in `ProfileApi.cs` to support optional profile filtering and default `includeActions` to `true`. Refactored `InvokeAsync` in `RecActionApi.cs` to use `long` for `profileId`, support nullable `references`, and handle batches of RecActions. Extended `GetAsync` in `ResultApi.cs` with new optional filters (`batchId`, `includeAction`, `includeProfile`, `lastBatch`) and updated query-building logic.
This commit is contained in:
@@ -25,13 +25,17 @@ namespace ReC.Client.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a ReC action for the specified profile.
|
||||
/// Invokes a batch of RecActions for the specified profile.
|
||||
/// </summary>
|
||||
/// <param name="profileId">The profile identifier.</param>
|
||||
/// <param name="references">Optional reference values to pass through to all result records.</param>
|
||||
/// <param name="cancellationToken">A token to cancel the operation.</param>
|
||||
/// <exception cref="ReCApiException">Thrown when the API responds with a non-success status code.</exception>
|
||||
public async Task InvokeAsync(int profileId, InvokeReferences references, CancellationToken cancellationToken = default)
|
||||
#if NETFRAMEWORK
|
||||
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)
|
||||
#endif
|
||||
{
|
||||
var content = references != null ? ReCClientHelpers.ToJsonContent(references) : null;
|
||||
using (content)
|
||||
@@ -42,13 +46,13 @@ namespace ReC.Client.Api
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes a ReC action for the specified profile.
|
||||
/// Invokes a batch of RecActions for the specified profile.
|
||||
/// </summary>
|
||||
/// <param name="profileId">The profile identifier.</param>
|
||||
/// <param name="batchId">Batch identifier.</param>
|
||||
/// <param name="cancellationToken">A token to cancel the operation.</param>
|
||||
/// <exception cref="ReCApiException">Thrown when the API responds with a non-success status code.</exception>
|
||||
public Task InvokeAsync(int profileId, string batchId, CancellationToken cancellationToken = default)
|
||||
public Task InvokeAsync(long profileId, string batchId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
return InvokeAsync(profileId, new InvokeReferences() { BatchId = batchId }, cancellationToken);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user