From 278fcfd75b5b2f9e1ab04bd18721139d28e5f705 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 16 Jan 2026 11:04:11 +0100 Subject: [PATCH] Remove obsolete sync API methods from ReCClient All synchronous (blocking) HTTP API methods have been removed from the ReCClient class, leaving only their asynchronous counterparts. These sync methods were previously marked as [Obsolete] and simply wrapped the async methods with .GetAwaiter().GetResult(). Additionally, the ToJsonContent method's return type was updated from HttpContent to JsonContent for improved type specificity. --- src/ReC.Client/ReCClient.cs | 340 +----------------------------------- 1 file changed, 1 insertion(+), 339 deletions(-) diff --git a/src/ReC.Client/ReCClient.cs b/src/ReC.Client/ReCClient.cs index 923e5ac..11a4713 100644 --- a/src/ReC.Client/ReCClient.cs +++ b/src/ReC.Client/ReCClient.cs @@ -47,7 +47,7 @@ namespace ReC.Client return string.IsNullOrWhiteSpace(query) ? string.Empty : $"?{query}"; } - private static HttpContent ToJsonContent(T payload) => JsonContent.Create(payload); + private static JsonContent ToJsonContent(T payload) => JsonContent.Create(payload); #region RecActionController /// @@ -65,22 +65,6 @@ namespace ReC.Client return resp.IsSuccessStatusCode; } - /// - /// Synchronously invokes a ReC action for a specific profile. - /// - /// - /// This method sends a POST request to the api/RecAction/invoke/{profileId} endpoint. - /// This is the synchronous version of . - /// - /// The ID of the profile to invoke the action for. - /// if the request was successful; otherwise, . - [Obsolete("Use InvokeRecActionAsync instead to avoid potential deadlocks and improve performance.")] - public bool InvokeRecAction(int profileId) - { - var resp = _http.PostAsync($"api/RecAction/invoke/{profileId}", content: null).GetAwaiter().GetResult(); - return resp.IsSuccessStatusCode; - } - /// /// Asynchronously retrieves a list of ReC actions for the configured profile. /// @@ -97,20 +81,6 @@ namespace ReC.Client 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. /// @@ -123,19 +93,6 @@ namespace ReC.Client 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. /// @@ -149,20 +106,6 @@ namespace ReC.Client 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. /// @@ -180,19 +123,6 @@ namespace ReC.Client }; 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 @@ -213,21 +143,6 @@ namespace ReC.Client 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. /// @@ -240,19 +155,6 @@ namespace ReC.Client 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. /// @@ -266,20 +168,6 @@ namespace ReC.Client 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. /// @@ -297,19 +185,6 @@ namespace ReC.Client }; 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 @@ -329,20 +204,6 @@ namespace ReC.Client 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. /// @@ -355,19 +216,6 @@ namespace ReC.Client 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. /// @@ -381,20 +229,6 @@ namespace ReC.Client 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. /// @@ -412,19 +246,6 @@ namespace ReC.Client }; 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 @@ -440,19 +261,6 @@ namespace ReC.Client 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. /// @@ -466,20 +274,6 @@ namespace ReC.Client 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. /// @@ -497,19 +291,6 @@ namespace ReC.Client }; 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 @@ -525,19 +306,6 @@ namespace ReC.Client 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. /// @@ -551,20 +319,6 @@ namespace ReC.Client 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. /// @@ -582,19 +336,6 @@ namespace ReC.Client }; 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 @@ -610,19 +351,6 @@ namespace ReC.Client 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. /// @@ -636,20 +364,6 @@ namespace ReC.Client 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. /// @@ -667,19 +381,6 @@ namespace ReC.Client }; 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 @@ -695,19 +396,6 @@ namespace ReC.Client 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. /// @@ -720,19 +408,6 @@ namespace ReC.Client 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. /// @@ -750,19 +425,6 @@ namespace ReC.Client }; 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