diff --git a/src/ReC.Client/Api/BaseCrudApi.cs b/src/ReC.Client/Api/BaseCrudApi.cs index cce0594..f12b6ab 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,32 +34,29 @@ 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(T payload, CancellationToken cancel = default) + public Task CreateAsync(TCreate 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, T payload, CancellationToken cancel = default) + public Task UpdateAsync(long id, TUpdate 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(T payload, CancellationToken cancel = default) + public Task DeleteAsync(TDelete payload, CancellationToken cancel = default) { var request = new HttpRequestMessage(HttpMethod.Delete, ResourcePath) {