diff --git a/src/ReC.Client/ReC.Client.csproj b/src/ReC.Client/ReC.Client.csproj
index 806b76b..af092f1 100644
--- a/src/ReC.Client/ReC.Client.csproj
+++ b/src/ReC.Client/ReC.Client.csproj
@@ -30,8 +30,9 @@
-
-
-
-
+
+
+
+
+
diff --git a/src/ReC.Client/ReCClient.cs b/src/ReC.Client/ReCClient.cs
index 4249c15..c985668 100644
--- a/src/ReC.Client/ReCClient.cs
+++ b/src/ReC.Client/ReCClient.cs
@@ -1,10 +1,13 @@
using Microsoft.Extensions.DependencyInjection;
-
-#if NETFRAMEWORK
using System;
-using System.Net.Http;
+using System.Globalization;
+using System.Linq;
+using System.Net.Http.Json;
using System.Threading;
using System.Threading.Tasks;
+
+#if NETFRAMEWORK
+using System.Net.Http;
#endif
namespace ReC.Client
@@ -30,6 +33,19 @@ namespace ReC.Client
_http = httpClientFactory.CreateClient(ClientName);
}
+ private static string BuildQuery(params (string Key, object Value)[] parameters)
+ {
+ var parts = parameters
+ .Where(p => p.Value != null)
+ .Select(p => $"{Uri.EscapeDataString(p.Key)}={Uri.EscapeDataString(Convert.ToString(p.Value, CultureInfo.InvariantCulture) ?? string.Empty)}");
+
+ var query = string.Join("&", parts);
+ return string.IsNullOrWhiteSpace(query) ? string.Empty : $"?{query}";
+ }
+
+ private static HttpContent ToJsonContent(T payload) => JsonContent.Create(payload);
+
+ #region RecActionController
///
/// Asynchronously invokes a ReC action for a specific profile.
///
@@ -61,6 +77,690 @@ namespace ReC.Client
return resp.IsSuccessStatusCode;
}
+ ///
+ /// Asynchronously retrieves a list of ReC actions for the configured profile.
+ ///
+ ///
+ /// This method sends a GET request to the api/RecAction endpoint with optional query parameters.
+ ///
+ /// The ID of the profile to retrieve actions for. If null, actions for all profiles are retrieved.
+ /// Filter for invoked actions. If null, both invoked and not invoked actions are retrieved.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task GetRecActionsAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default)
+ {
+ var query = BuildQuery(("ProfileId", profileId), ("Invoked", invoked));
+ return _http.GetAsync($"api/RecAction{query}", cancel);
+ }
+
+ ///
+ /// Synchronously retrieves a list of ReC actions for the configured profile.
+ ///
+ ///
+ /// This method sends a GET request to the api/RecAction endpoint with optional query parameters.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the profile to retrieve actions for. If null, actions for all profiles are retrieved.
+ /// Filter for invoked actions. If null, both invoked and not invoked actions are retrieved.
+ /// A containing the response data.
+ [Obsolete("Use GetRecActionsAsync instead.")]
+ public HttpResponseMessage GetRecActions(long? profileId = null, bool? invoked = null)
+ => GetRecActionsAsync(profileId, invoked).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously creates a new ReC action.
+ ///
+ ///
+ /// This method sends a POST request to the api/RecAction endpoint with the action data as JSON.
+ ///
+ /// The action data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateRecActionAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/RecAction", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates a new ReC action.
+ ///
+ ///
+ /// This method sends a POST request to the api/RecAction endpoint with the action data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The action data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateRecActionAsync instead.")]
+ public HttpResponseMessage CreateRecAction(T procedure)
+ => CreateRecActionAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates an existing ReC action.
+ ///
+ ///
+ /// This method sends a PUT request to the api/RecAction/{id} endpoint with the updated action data as JSON.
+ ///
+ /// The ID of the action to update.
+ /// The updated action data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateRecActionAsync(long id, T procedure, CancellationToken cancel = default)
+ => _http.PutAsync($"api/RecAction/{id}", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates an existing ReC action.
+ ///
+ ///
+ /// This method sends a PUT request to the api/RecAction/{id} endpoint with the updated action data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the action to update.
+ /// The updated action data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateRecActionAsync instead.")]
+ public HttpResponseMessage UpdateRecAction(long id, T procedure)
+ => UpdateRecActionAsync(id, procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more ReC actions.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/RecAction endpoint with the IDs of the actions to delete as JSON.
+ ///
+ /// An object containing the IDs of the actions to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteRecActionsAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/RecAction")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more ReC actions.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/RecAction endpoint with the IDs of the actions to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the actions to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteRecActionsAsync instead.")]
+ public HttpResponseMessage DeleteRecActions(T procedure)
+ => DeleteRecActionsAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
+ #region OutResController
+ ///
+ /// Asynchronously retrieves results for the configured profile.
+ ///
+ ///
+ /// This method sends a GET request to the api/OutRes endpoint with optional query parameters.
+ ///
+ /// Filter by result ID.
+ /// Filter by action ID.
+ /// Filter by profile ID.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task GetResultsAsync(long? id = null, long? actionId = null, long? profileId = null, CancellationToken cancel = default)
+ {
+ var query = BuildQuery(("Id", id), ("ActionId", actionId), ("ProfileId", profileId));
+ return _http.GetAsync($"api/OutRes{query}", cancel);
+ }
+
+ ///
+ /// Synchronously retrieves results for the configured profile.
+ ///
+ ///
+ /// This method sends a GET request to the api/OutRes endpoint with optional query parameters.
+ /// This is the synchronous version of .
+ ///
+ /// Filter by result ID.
+ /// Filter by action ID.
+ /// Filter by profile ID.
+ /// A containing the response data.
+ [Obsolete("Use GetResultsAsync instead.")]
+ public HttpResponseMessage GetResults(long? id = null, long? actionId = null, long? profileId = null)
+ => GetResultsAsync(id, actionId, profileId).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously creates a new result.
+ ///
+ ///
+ /// This method sends a POST request to the api/OutRes endpoint with the result data as JSON.
+ ///
+ /// The result data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateResultAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/OutRes", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates a new result.
+ ///
+ ///
+ /// This method sends a POST request to the api/OutRes endpoint with the result data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The result data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateResultAsync instead.")]
+ public HttpResponseMessage CreateResult(T procedure)
+ => CreateResultAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates an existing result.
+ ///
+ ///
+ /// This method sends a PUT request to the api/OutRes/{id} endpoint with the updated result data as JSON.
+ ///
+ /// The ID of the result to update.
+ /// The updated result data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateResultAsync(long id, T procedure, CancellationToken cancel = default)
+ => _http.PutAsync($"api/OutRes/{id}", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates an existing result.
+ ///
+ ///
+ /// This method sends a PUT request to the api/OutRes/{id} endpoint with the updated result data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the result to update.
+ /// The updated result data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateResultAsync instead.")]
+ public HttpResponseMessage UpdateResult(long id, T procedure)
+ => UpdateResultAsync(id, procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more results.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/OutRes endpoint with the IDs of the results to delete as JSON.
+ ///
+ /// An object containing the IDs of the results to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteResultsAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/OutRes")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more results.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/OutRes endpoint with the IDs of the results to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the results to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteResultsAsync instead.")]
+ public HttpResponseMessage DeleteResults(T procedure)
+ => DeleteResultsAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
+ #region ProfileController
+ ///
+ /// Asynchronously retrieves a profile by ID.
+ ///
+ ///
+ /// This method sends a GET request to the api/Profile endpoint with the profile ID as a query parameter.
+ ///
+ /// The ID of the profile to retrieve.
+ /// Whether to include associated actions in the response.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task GetProfileAsync(long id, bool includeActions = false, CancellationToken cancel = default)
+ {
+ var query = BuildQuery(("Id", id), ("IncludeActions", includeActions));
+ return _http.GetAsync($"api/Profile{query}", cancel);
+ }
+
+ ///
+ /// Synchronously retrieves a profile by ID.
+ ///
+ ///
+ /// This method sends a GET request to the api/Profile endpoint with the profile ID as a query parameter.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the profile to retrieve.
+ /// Whether to include associated actions in the response.
+ /// A containing the response data.
+ [Obsolete("Use GetProfileAsync instead.")]
+ public HttpResponseMessage GetProfile(long id, bool includeActions = false)
+ => GetProfileAsync(id, includeActions).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously creates a new profile.
+ ///
+ ///
+ /// This method sends a POST request to the api/Profile endpoint with the profile data as JSON.
+ ///
+ /// The profile data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateProfileAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/Profile", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates a new profile.
+ ///
+ ///
+ /// This method sends a POST request to the api/Profile endpoint with the profile data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The profile data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateProfileAsync instead.")]
+ public HttpResponseMessage CreateProfile(T procedure)
+ => CreateProfileAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates an existing profile.
+ ///
+ ///
+ /// This method sends a PUT request to the api/Profile/{id} endpoint with the updated profile data as JSON.
+ ///
+ /// The ID of the profile to update.
+ /// The updated profile data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateProfileAsync(long id, T procedure, CancellationToken cancel = default)
+ => _http.PutAsync($"api/Profile/{id}", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates an existing profile.
+ ///
+ ///
+ /// This method sends a PUT request to the api/Profile/{id} endpoint with the updated profile data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the profile to update.
+ /// The updated profile data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateProfileAsync instead.")]
+ public HttpResponseMessage UpdateProfile(long id, T procedure)
+ => UpdateProfileAsync(id, procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more profiles.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/Profile endpoint with the IDs of the profiles to delete as JSON.
+ ///
+ /// An object containing the IDs of the profiles to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteProfilesAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/Profile")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more profiles.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/Profile endpoint with the IDs of the profiles to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the profiles to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteProfilesAsync instead.")]
+ public HttpResponseMessage DeleteProfiles(T procedure)
+ => DeleteProfilesAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
+ #region EndpointAuthController
+ ///
+ /// Asynchronously creates a new endpoint authentication.
+ ///
+ ///
+ /// This method sends a POST request to the api/EndpointAuth endpoint with the authentication data as JSON.
+ ///
+ /// The authentication data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateEndpointAuthAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/EndpointAuth", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates a new endpoint authentication.
+ ///
+ ///
+ /// This method sends a POST request to the api/EndpointAuth endpoint with the authentication data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The authentication data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateEndpointAuthAsync instead.")]
+ public HttpResponseMessage CreateEndpointAuth(T procedure)
+ => CreateEndpointAuthAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates an existing endpoint authentication.
+ ///
+ ///
+ /// This method sends a PUT request to the api/EndpointAuth/{id} endpoint with the updated authentication data as JSON.
+ ///
+ /// The ID of the authentication to update.
+ /// The updated authentication data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateEndpointAuthAsync(long id, T procedure, CancellationToken cancel = default)
+ => _http.PutAsync($"api/EndpointAuth/{id}", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates an existing endpoint authentication.
+ ///
+ ///
+ /// This method sends a PUT request to the api/EndpointAuth/{id} endpoint with the updated authentication data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the authentication to update.
+ /// The updated authentication data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateEndpointAuthAsync instead.")]
+ public HttpResponseMessage UpdateEndpointAuth(long id, T procedure)
+ => UpdateEndpointAuthAsync(id, procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more endpoint authentications.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/EndpointAuth endpoint with the IDs of the authentications to delete as JSON.
+ ///
+ /// An object containing the IDs of the authentications to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteEndpointAuthAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/EndpointAuth")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more endpoint authentications.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/EndpointAuth endpoint with the IDs of the authentications to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the authentications to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteEndpointAuthAsync instead.")]
+ public HttpResponseMessage DeleteEndpointAuth(T procedure)
+ => DeleteEndpointAuthAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
+ #region EndpointParamsController
+ ///
+ /// Asynchronously creates new endpoint parameters.
+ ///
+ ///
+ /// This method sends a POST request to the api/EndpointParams endpoint with the parameters data as JSON.
+ ///
+ /// The parameters data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateEndpointParamsAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/EndpointParams", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates new endpoint parameters.
+ ///
+ ///
+ /// This method sends a POST request to the api/EndpointParams endpoint with the parameters data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The parameters data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateEndpointParamsAsync instead.")]
+ public HttpResponseMessage CreateEndpointParams(T procedure)
+ => CreateEndpointParamsAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates existing endpoint parameters.
+ ///
+ ///
+ /// This method sends a PUT request to the api/EndpointParams/{id} endpoint with the updated parameters data as JSON.
+ ///
+ /// The ID of the parameters to update.
+ /// The updated parameters data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateEndpointParamsAsync(long id, T procedure, CancellationToken cancel = default)
+ => _http.PutAsync($"api/EndpointParams/{id}", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates existing endpoint parameters.
+ ///
+ ///
+ /// This method sends a PUT request to the api/EndpointParams/{id} endpoint with the updated parameters data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the parameters to update.
+ /// The updated parameters data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateEndpointParamsAsync instead.")]
+ public HttpResponseMessage UpdateEndpointParams(long id, T procedure)
+ => UpdateEndpointParamsAsync(id, procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more endpoint parameters.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/EndpointParams endpoint with the IDs of the parameters to delete as JSON.
+ ///
+ /// An object containing the IDs of the parameters to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteEndpointParamsAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/EndpointParams")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more endpoint parameters.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/EndpointParams endpoint with the IDs of the parameters to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the parameters to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteEndpointParamsAsync instead.")]
+ public HttpResponseMessage DeleteEndpointParams(T procedure)
+ => DeleteEndpointParamsAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
+ #region EndpointsController
+ ///
+ /// Asynchronously creates a new endpoint.
+ ///
+ ///
+ /// This method sends a POST request to the api/Endpoints endpoint with the endpoint data as JSON.
+ ///
+ /// The endpoint data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateEndpointAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/Endpoints", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates a new endpoint.
+ ///
+ ///
+ /// This method sends a POST request to the api/Endpoints endpoint with the endpoint data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The endpoint data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateEndpointAsync instead.")]
+ public HttpResponseMessage CreateEndpoint(T procedure)
+ => CreateEndpointAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates an existing endpoint.
+ ///
+ ///
+ /// This method sends a PUT request to the api/Endpoints/{id} endpoint with the updated endpoint data as JSON.
+ ///
+ /// The ID of the endpoint to update.
+ /// The updated endpoint data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateEndpointAsync(long id, T procedure, CancellationToken cancel = default)
+ => _http.PutAsync($"api/Endpoints/{id}", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates an existing endpoint.
+ ///
+ ///
+ /// This method sends a PUT request to the api/Endpoints/{id} endpoint with the updated endpoint data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The ID of the endpoint to update.
+ /// The updated endpoint data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateEndpointAsync instead.")]
+ public HttpResponseMessage UpdateEndpoint(long id, T procedure)
+ => UpdateEndpointAsync(id, procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more endpoints.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/Endpoints endpoint with the IDs of the endpoints to delete as JSON.
+ ///
+ /// An object containing the IDs of the endpoints to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteEndpointAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/Endpoints")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more endpoints.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/Endpoints endpoint with the IDs of the endpoints to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the endpoints to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteEndpointAsync instead.")]
+ public HttpResponseMessage DeleteEndpoint(T procedure)
+ => DeleteEndpointAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
+ #region CommonController
+ ///
+ /// Asynchronously creates a new object.
+ ///
+ ///
+ /// This method sends a POST request to the api/Common endpoint with the object data as JSON.
+ ///
+ /// The object data to create.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task CreateObjectAsync(T procedure, CancellationToken cancel = default)
+ => _http.PostAsync("api/Common", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously creates a new object.
+ ///
+ ///
+ /// This method sends a POST request to the api/Common endpoint with the object data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The object data to create.
+ /// A containing the response data.
+ [Obsolete("Use CreateObjectAsync instead.")]
+ public HttpResponseMessage CreateObject(T procedure)
+ => CreateObjectAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously updates an existing object.
+ ///
+ ///
+ /// This method sends a PUT request to the api/Common endpoint with the updated object data as JSON.
+ ///
+ /// The updated object data.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task UpdateObjectAsync(T procedure, CancellationToken cancel = default)
+ => _http.PutAsync("api/Common", ToJsonContent(procedure), cancel);
+
+ ///
+ /// Synchronously updates an existing object.
+ ///
+ ///
+ /// This method sends a PUT request to the api/Common endpoint with the updated object data as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// The updated object data.
+ /// A containing the response data.
+ [Obsolete("Use UpdateObjectAsync instead.")]
+ public HttpResponseMessage UpdateObject(T procedure)
+ => UpdateObjectAsync(procedure).GetAwaiter().GetResult();
+
+ ///
+ /// Asynchronously deletes one or more objects.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/Common endpoint with the IDs of the objects to delete as JSON.
+ ///
+ /// An object containing the IDs of the objects to delete.
+ /// A token to cancel the asynchronous operation.
+ /// A task representing the asynchronous operation, with a result containing the response data.
+ public Task DeleteObjectAsync(T procedure, CancellationToken cancel = default)
+ {
+ var request = new HttpRequestMessage(HttpMethod.Delete, "api/Common")
+ {
+ Content = ToJsonContent(procedure)
+ };
+ return _http.SendAsync(request, cancel);
+ }
+
+ ///
+ /// Synchronously deletes one or more objects.
+ ///
+ ///
+ /// This method sends a DELETE request to the api/Common endpoint with the IDs of the objects to delete as JSON.
+ /// This is the synchronous version of .
+ ///
+ /// An object containing the IDs of the objects to delete.
+ /// A containing the response data.
+ [Obsolete("Use DeleteObjectAsync instead.")]
+ public HttpResponseMessage DeleteObject(T procedure)
+ => DeleteObjectAsync(procedure).GetAwaiter().GetResult();
+ #endregion
+
#region Static
private static readonly IServiceCollection Services = new ServiceCollection();
@@ -121,4 +821,14 @@ namespace ReC.Client
}
#endregion
}
+
+ ///
+ /// Specifies which part of the result to return for result view endpoints.
+ ///
+ public enum ResultType
+ {
+ Full,
+ OnlyHeader,
+ OnlyBody
+ }
}
\ No newline at end of file