From c2f0bdc8a481b2cdad56c2b13f6cb739a1147186 Mon Sep 17 00:00:00 2001 From: Jericho Date: Thu, 28 Jan 2021 14:03:37 -0500 Subject: [PATCH] (GH-368) Add missing 'limit' and 'offset' parameters --- Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs | 2 +- Source/StrongGrid/Resources/ApiKeys.cs | 6 +++++- Source/StrongGrid/Resources/IApiKeys.cs | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs b/Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs index fec76e19..1dc44eed 100644 --- a/Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs +++ b/Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs @@ -15,7 +15,7 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken await log.WriteLineAsync("\n***** API KEYS *****\n").ConfigureAwait(false); // GET ALL THE API KEYS - var apiKeys = await client.ApiKeys.GetAllAsync(null, cancellationToken).ConfigureAwait(false); + var apiKeys = await client.ApiKeys.GetAllAsync(100, 0, null, cancellationToken).ConfigureAwait(false); await log.WriteLineAsync($"There are {apiKeys.Records.Length} Api Keys").ConfigureAwait(false); // CLEANUP PREVIOUS INTEGRATION TESTS THAT MIGHT HAVE BEEN INTERRUPTED BEFORE THEY HAD TIME TO CLEANUP AFTER THEMSELVES diff --git a/Source/StrongGrid/Resources/ApiKeys.cs b/Source/StrongGrid/Resources/ApiKeys.cs index 1c047bba..ddc96c9d 100644 --- a/Source/StrongGrid/Resources/ApiKeys.cs +++ b/Source/StrongGrid/Resources/ApiKeys.cs @@ -52,6 +52,8 @@ public Task GetAsync(string keyId, string onBehalfOf = null, Cancellatio /// /// Get all API Keys belonging to the authenticated user. /// + /// The limit. + /// The offset. /// The user to impersonate. /// Cancellation token. /// @@ -61,10 +63,12 @@ public Task GetAsync(string keyId, string onBehalfOf = null, Cancellatio /// The response does not include the permissions associated with each api key. /// In order to get the permission for a given key, you need to retrieve keys one at a time. /// - public Task> GetAllAsync(string onBehalfOf = null, CancellationToken cancellationToken = default) + public Task> GetAllAsync(int limit = 50, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default) { return _client .GetAsync(_endpoint) + .WithArgument("limit", limit) + .WithArgument("offset", offset) .OnBehalfOf(onBehalfOf) .WithCancellationToken(cancellationToken) .AsPaginatedResponseWithLinks("result"); diff --git a/Source/StrongGrid/Resources/IApiKeys.cs b/Source/StrongGrid/Resources/IApiKeys.cs index 94c77ed2..ce56f802 100644 --- a/Source/StrongGrid/Resources/IApiKeys.cs +++ b/Source/StrongGrid/Resources/IApiKeys.cs @@ -28,6 +28,8 @@ public interface IApiKeys /// /// Get all API Keys belonging to the authenticated user. /// + /// The limit. + /// The offset. /// The user to impersonate. /// Cancellation token. /// @@ -37,7 +39,7 @@ public interface IApiKeys /// The response does not include the permissions associated with each api key. /// In order to get the permission for a given key, you need to retrieve keys one at a time. /// - Task> GetAllAsync(string onBehalfOf = null, CancellationToken cancellationToken = default); + Task> GetAllAsync(int limit = 50, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default); /// /// Generate a new API Key.