Add InvokeReferences support to InvokeAsync method
Added InvokeReferences class for passing optional reference values (Reference1–Reference5) when invoking a profile. Updated InvokeAsync to accept and serialize these references in the POST request. Improved XML docs to reflect the new parameter.
This commit is contained in:
46
src/ReC.Client/Api/InvokeReferences.cs
Normal file
46
src/ReC.Client/Api/InvokeReferences.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
namespace ReC.Client.Api
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Optional reference values that are passed through to all result records when invoking a profile.
|
||||||
|
/// </summary>
|
||||||
|
public class InvokeReferences
|
||||||
|
{
|
||||||
|
/// <summary>Reference value 1.</summary>
|
||||||
|
public string
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Reference1 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Reference value 2.</summary>
|
||||||
|
public string
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Reference2 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Reference value 3.</summary>
|
||||||
|
public string
|
||||||
|
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Reference3 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Reference value 4.</summary>
|
||||||
|
public string
|
||||||
|
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Reference4 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Reference value 5.</summary>
|
||||||
|
public string
|
||||||
|
|
||||||
|
#if NET
|
||||||
|
?
|
||||||
|
#endif
|
||||||
|
Reference5 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,11 +21,13 @@ namespace ReC.Client.Api
|
|||||||
/// Invokes a ReC action for the specified profile.
|
/// Invokes a ReC action for the specified profile.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="profileId">The profile identifier.</param>
|
/// <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>
|
/// <param name="cancellationToken">A token to cancel the operation.</param>
|
||||||
/// <returns><see langword="true"/> if the request succeeds; otherwise, <see langword="false"/>.</returns>
|
/// <returns><see langword="true"/> if the request succeeds; otherwise, <see langword="false"/>.</returns>
|
||||||
public async Task<bool> InvokeAsync(int profileId, CancellationToken cancellationToken = default)
|
public async Task<bool> InvokeAsync(int profileId, InvokeReferences references = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content: null, cancellationToken);
|
var content = references != null ? ReCClientHelpers.ToJsonContent(references) : null;
|
||||||
|
var resp = await Http.PostAsync($"{ResourcePath}/invoke/{profileId}", content, cancellationToken);
|
||||||
return resp.IsSuccessStatusCode;
|
return resp.IsSuccessStatusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user