diff --git a/Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs b/Source/StrongGrid.IntegrationTests/Tests/ApiKeys.cs index f3a8d4ca..5b4576f3 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(50, 0, null, cancellationToken).ConfigureAwait(false); await log.WriteLineAsync($"There are {apiKeys.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 a7f3f8e2..2ad0df22 100644 --- a/Source/StrongGrid/Resources/ApiKeys.cs +++ b/Source/StrongGrid/Resources/ApiKeys.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using Pathoschild.Http.Client; using StrongGrid.Models; using StrongGrid.Utilities; @@ -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) .AsObject("result"); diff --git a/Source/StrongGrid/Resources/IApiKeys.cs b/Source/StrongGrid/Resources/IApiKeys.cs index 77580d37..c8537c7c 100644 --- a/Source/StrongGrid/Resources/IApiKeys.cs +++ b/Source/StrongGrid/Resources/IApiKeys.cs @@ -1,4 +1,4 @@ -using StrongGrid.Models; +using StrongGrid.Models; using StrongGrid.Utilities; using System.Collections.Generic; using System.Threading; @@ -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.