diff --git a/src/ReC.Client/Api/ProfileApi.cs b/src/ReC.Client/Api/ProfileApi.cs
index b0a62be..4347095 100644
--- a/src/ReC.Client/Api/ProfileApi.cs
+++ b/src/ReC.Client/Api/ProfileApi.cs
@@ -25,16 +25,20 @@ namespace ReC.Client.Api
}
///
- /// Retrieves profiles, optionally filtered by identifier.
+ /// Retrieves profiles and deserializes the JSON response into .
///
- /// Optional profile identifier filter. When , all profiles are returned.
- /// Whether to include related actions. Defaults to to match the API default.
- /// A token to cancel the operation.
- /// The HTTP response message.
- public Task GetAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default)
+#if NETFRAMEWORK
+ public async Task GetAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default)
+#else
+ public async Task GetAsync(long? id = null, bool includeActions = true, CancellationToken cancel = default)
+#endif
{
var query = ReCClientHelpers.BuildQuery(("Id", id), ("IncludeActions", includeActions));
- return Http.GetAsync($"{ResourcePath}{query}", cancel);
+ using (var resp = await Http.GetAsync($"{ResourcePath}{query}", cancel).ConfigureAwait(false))
+ {
+ var body = await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancel).ConfigureAwait(false);
+ return ReCClientHelpers.Deserialize(body);
+ }
}
}
}
diff --git a/src/ReC.Client/Api/RecActionApi.cs b/src/ReC.Client/Api/RecActionApi.cs
index f038a90..9429d3f 100644
--- a/src/ReC.Client/Api/RecActionApi.cs
+++ b/src/ReC.Client/Api/RecActionApi.cs
@@ -58,16 +58,20 @@ namespace ReC.Client.Api
}
///
- /// Retrieves Rec actions.
+ /// Retrieves Rec actions and deserializes the JSON response into .
///
- /// Optional profile filter.
- /// Optional invoked filter.
- /// A token to cancel the operation.
- /// The HTTP response message.
- public Task GetAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default)
+#if NETFRAMEWORK
+ public async Task GetAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default)
+#else
+ public async Task GetAsync(long? profileId = null, bool? invoked = null, CancellationToken cancel = default)
+#endif
{
var query = ReCClientHelpers.BuildQuery(("ProfileId", profileId), ("Invoked", invoked));
- return Http.GetAsync($"{ResourcePath}{query}", cancel);
+ using (var resp = await Http.GetAsync($"{ResourcePath}{query}", cancel).ConfigureAwait(false))
+ {
+ var body = await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancel).ConfigureAwait(false);
+ return ReCClientHelpers.Deserialize(body);
+ }
}
}
}
diff --git a/src/ReC.Client/Api/ResultApi.cs b/src/ReC.Client/Api/ResultApi.cs
index 1a818c3..6a6d21e 100644
--- a/src/ReC.Client/Api/ResultApi.cs
+++ b/src/ReC.Client/Api/ResultApi.cs
@@ -25,21 +25,12 @@ namespace ReC.Client.Api
}
///
- /// Retrieves results with optional filters.
+ /// Retrieves results with optional filters and deserializes the JSON response into .
///
- /// Optional result identifier.
- /// Optional action identifier.
- /// Optional profile identifier.
- /// Optional batch identifier.
- /// Whether to include the related action. Defaults to to match the API default.
- /// Whether to include the related profile. Defaults to to match the API default.
- /// When , restricts results to those belonging to the most recent batch matching the other filters.
- /// A token to cancel the operation.
- /// The HTTP response message.
#if NETFRAMEWORK
- 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)
+ public async 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 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)
+ public async 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
{
var query = ReCClientHelpers.BuildQuery(
@@ -50,7 +41,12 @@ namespace ReC.Client.Api
("IncludeAction", includeAction),
("IncludeProfile", includeProfile),
("LastBatch", lastBatch));
- return Http.GetAsync($"{ResourcePath}{query}", cancel);
+
+ using (var resp = await Http.GetAsync($"{ResourcePath}{query}", cancel).ConfigureAwait(false))
+ {
+ var body = await ReCClientHelpers.HandleResponseAsync(resp, Logger, Options.LogSuccessfulRequests, cancel).ConfigureAwait(false);
+ return ReCClientHelpers.Deserialize(body);
+ }
}
}
}