From afd5cd5fbd176fc3fef4ca615d16c294a882f7c8 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 20 May 2026 13:50:55 +0200 Subject: [PATCH] Refactor: Rename GetDynamicAsync to GetAsync Renamed `GetDynamicAsync` to `GetAsync` across `ProfileApi.cs`, `RecActionApi.cs`, and `ResultApi.cs` to improve consistency and align with naming conventions for asynchronous methods. Updated XML documentation to clarify that the non-generic `GetAsync` overload returns a dynamically deserialized payload, typically a `System.Text.Json.JsonElement`. Highlighted its relation to the generic `GetAsync` method. Adjusted method signatures for both `NETFRAMEWORK` and non-`NETFRAMEWORK` code paths. Updated test files (`ProfileApiTests.cs`, `RecActionApiTests.cs`, and `ResultApiTests.cs`) to reflect the renaming, including test method names and assertions. These changes enhance code readability, maintainability, and consistency. --- src/ReC.Client/Api/ProfileApi.cs | 18 ++++++++++-------- src/ReC.Client/Api/RecActionApi.cs | 8 +++++--- src/ReC.Client/Api/ResultApi.cs | 18 ++++++++++-------- tests/ReC.Tests/Client/ProfileApiTests.cs | 8 ++++---- tests/ReC.Tests/Client/RecActionApiTests.cs | 8 ++++---- tests/ReC.Tests/Client/ResultApiTests.cs | 4 ++-- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/src/ReC.Client/Api/ProfileApi.cs b/src/ReC.Client/Api/ProfileApi.cs index 6c610d3..5337c33 100644 --- a/src/ReC.Client/Api/ProfileApi.cs +++ b/src/ReC.Client/Api/ProfileApi.cs @@ -41,16 +41,18 @@ namespace ReC.Client.Api } } - /// - /// Retrieves profiles and returns a dynamically deserialized payload. - /// + /// + /// Retrieves profiles and returns a dynamically deserialized payload + /// (typically a ). This is the non-generic + /// overload of . + /// #if NETFRAMEWORK - public Task GetDynamicAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default) + public Task GetAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default) #else - public Task GetDynamicAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default) + public Task GetAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default) #endif - { - return GetAsync(id, includeActions, cancel); - } + { + return GetAsync(id, includeActions, cancel); + } } } diff --git a/src/ReC.Client/Api/RecActionApi.cs b/src/ReC.Client/Api/RecActionApi.cs index cb85870..17fce3c 100644 --- a/src/ReC.Client/Api/RecActionApi.cs +++ b/src/ReC.Client/Api/RecActionApi.cs @@ -75,12 +75,14 @@ namespace ReC.Client.Api } /// - /// Retrieves Rec actions and returns a dynamically deserialized payload. + /// Retrieves Rec actions and returns a dynamically deserialized payload + /// (typically a ). This is the non-generic + /// overload of . /// #if NETFRAMEWORK - public Task GetDynamicAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default) + public Task GetAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default) #else - public Task GetDynamicAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default) + public Task GetAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default) #endif { return GetAsync(profileId, invoked, cancel); diff --git a/src/ReC.Client/Api/ResultApi.cs b/src/ReC.Client/Api/ResultApi.cs index 94f38ba..81a0566 100644 --- a/src/ReC.Client/Api/ResultApi.cs +++ b/src/ReC.Client/Api/ResultApi.cs @@ -49,16 +49,18 @@ namespace ReC.Client.Api } } - /// - /// Retrieves results with optional filters and returns a dynamically deserialized payload. - /// + /// + /// Retrieves results with optional filters and returns a dynamically deserialized payload + /// (typically a ). This is the non-generic + /// overload of . + /// #if NETFRAMEWORK - public Task GetDynamicAsync(long? id = null, long? actionId = null, long? profileId = null, string batchId = null, bool includeAction = true, bool includeProfile = false, bool lastBatch = false, CancellationToken cancel = default) + public Task GetAsync(long? id = null, long? actionId = null, long? profileId = null, string batchId = null, bool includeAction = true, bool includeProfile = false, bool lastBatch = false, CancellationToken cancel = default) #else - public Task GetDynamicAsync(long? id = null, long? actionId = null, long? profileId = null, string? batchId = null, bool includeAction = true, bool includeProfile = false, bool lastBatch = false, CancellationToken cancel = default) + public Task GetAsync(long? id = null, long? actionId = null, long? profileId = null, string? batchId = null, bool includeAction = true, bool includeProfile = false, bool lastBatch = false, CancellationToken cancel = default) #endif - { - return GetAsync(id, actionId, profileId, batchId, includeAction, includeProfile, lastBatch, cancel); - } + { + return GetAsync(id, actionId, profileId, batchId, includeAction, includeProfile, lastBatch, cancel); + } } } diff --git a/tests/ReC.Tests/Client/ProfileApiTests.cs b/tests/ReC.Tests/Client/ProfileApiTests.cs index 30a8e60..9364a6b 100644 --- a/tests/ReC.Tests/Client/ProfileApiTests.cs +++ b/tests/ReC.Tests/Client/ProfileApiTests.cs @@ -36,13 +36,13 @@ public class ProfileApiTests : RecClientTestBase } [Test] - public void GetDynamicAsync_with_unknown_id_throws_not_found() + public void GetAsync_non_generic_with_unknown_id_throws_not_found() { var (client, scope) = CreateScopedClient(); using var _ = scope; var ex = Assert.ThrowsAsync(async () => - await client.Profiles.GetDynamicAsync(id: long.MaxValue)); + await client.Profiles.GetAsync(id: long.MaxValue)); Assert.That(ex, Is.Not.Null); Assert.That(ex!.StatusCode, Is.EqualTo(HttpStatusCode.NotFound)); @@ -50,14 +50,14 @@ public class ProfileApiTests : RecClientTestBase } [Test] - public async Task GetDynamicAsync_without_filters_returns_dynamic_payload_or_throws_not_found() + public async Task GetAsync_non_generic_returns_dynamic_payload_or_throws_not_found() { var (client, scope) = CreateScopedClient(); using var _ = scope; try { - dynamic profiles = await client.Profiles.GetDynamicAsync(); + dynamic? profiles = await client.Profiles.GetAsync(); Assert.That(profiles, Is.Not.Null); Assert.That(profiles, Is.TypeOf()); } diff --git a/tests/ReC.Tests/Client/RecActionApiTests.cs b/tests/ReC.Tests/Client/RecActionApiTests.cs index 4bb05ce..6dc5e72 100644 --- a/tests/ReC.Tests/Client/RecActionApiTests.cs +++ b/tests/ReC.Tests/Client/RecActionApiTests.cs @@ -43,14 +43,14 @@ public class RecActionApiTests : RecClientTestBase } [Test] - public async Task GetDynamicAsync_without_filters_returns_dynamic_payload_or_throws_not_found() + public async Task GetAsync_non_generic_returns_dynamic_payload_or_throws_not_found() { var (client, scope) = CreateScopedClient(); using var _ = scope; try { - dynamic? actions = await client.RecActions.GetDynamicAsync(); + dynamic? actions = await client.RecActions.GetAsync(); Assert.That(actions, Is.Not.Null); Assert.That(actions, Is.TypeOf()); Assert.That(((JsonElement)actions).ValueKind, Is.EqualTo(JsonValueKind.Array)); @@ -104,13 +104,13 @@ public class RecActionApiTests : RecClientTestBase } [Test] - public void GetDynamicAsync_with_unknown_profile_throws_not_found() + public void GetAsync_non_generic_with_unknown_profile_throws_not_found() { var (client, scope) = CreateScopedClient(); using var _ = scope; var ex = Assert.ThrowsAsync(async () => - await client.RecActions.GetDynamicAsync(profileId: long.MaxValue)); + await client.RecActions.GetAsync(profileId: long.MaxValue)); Assert.That(ex, Is.Not.Null); Assert.That(ex!.StatusCode, Is.EqualTo(HttpStatusCode.NotFound)); diff --git a/tests/ReC.Tests/Client/ResultApiTests.cs b/tests/ReC.Tests/Client/ResultApiTests.cs index a0ad676..c63e446 100644 --- a/tests/ReC.Tests/Client/ResultApiTests.cs +++ b/tests/ReC.Tests/Client/ResultApiTests.cs @@ -38,14 +38,14 @@ public class ResultApiTests : RecClientTestBase } [Test] - public async Task GetDynamicAsync_without_filters_returns_dynamic_payload_or_throws_not_found() + public async Task GetAsync_non_generic_returns_dynamic_payload_or_throws_not_found() { var (client, scope) = CreateScopedClient(); using var _ = scope; try { - dynamic results = await client.Results.GetDynamicAsync(); + dynamic? results = await client.Results.GetAsync(); Assert.That(results, Is.Not.Null); Assert.That(results, Is.TypeOf()); }