From 4bc6df4d91c7d93d386643205cb3a5a1a2427f28 Mon Sep 17 00:00:00 2001 From: TekH Date: Fri, 16 Jan 2026 14:39:12 +0100 Subject: [PATCH] Revert "Refactor BaseCrudApi to use generic type parameters" This reverts commit 5197ad1481a075a2588b56ef9e04b06d83a12567. --- src/ReC.Client/Api/BaseCrudApi.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ReC.Client/Api/BaseCrudApi.cs b/src/ReC.Client/Api/BaseCrudApi.cs index f12b6ab..cce0594 100644 --- a/src/ReC.Client/Api/BaseCrudApi.cs +++ b/src/ReC.Client/Api/BaseCrudApi.cs @@ -8,7 +8,7 @@ namespace ReC.Client.Api /// /// Provides shared CRUD operations for API resources. /// - public abstract class BaseCrudApi + public abstract class BaseCrudApi { /// /// The HTTP client used to send requests. @@ -21,7 +21,7 @@ namespace ReC.Client.Api protected readonly string ResourcePath; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The HTTP client used for requests. /// The base resource path for the API endpoint. @@ -34,29 +34,32 @@ namespace ReC.Client.Api /// /// Creates a resource. /// + /// The payload type. /// The payload to send. /// A token to cancel the operation. /// The HTTP response message. - public Task CreateAsync(TCreate payload, CancellationToken cancel = default) + public Task CreateAsync(T payload, CancellationToken cancel = default) => Http.PostAsync(ResourcePath, ReCClientHelpers.ToJsonContent(payload), cancel); /// /// Updates a resource by identifier. /// + /// The payload type. /// The resource identifier. /// The payload to send. /// A token to cancel the operation. /// The HTTP response message. - public Task UpdateAsync(long id, TUpdate payload, CancellationToken cancel = default) + public Task UpdateAsync(long id, T payload, CancellationToken cancel = default) => Http.PutAsync($"{ResourcePath}/{id}", ReCClientHelpers.ToJsonContent(payload), cancel); /// /// Deletes resources with identifiers supplied in the payload. /// + /// The payload type containing identifiers. /// The payload to send. /// A token to cancel the operation. /// The HTTP response message. - public Task DeleteAsync(TDelete payload, CancellationToken cancel = default) + public Task DeleteAsync(T payload, CancellationToken cancel = default) { var request = new HttpRequestMessage(HttpMethod.Delete, ResourcePath) {