From c27c72a7655e7265030a48927737db033df45ec0 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sat, 23 Jan 2021 15:38:00 -0500 Subject: [PATCH] (GH-367) IpAddresses.GetAllAsync must return PaginatedResponseWithLinks --- Source/StrongGrid.IntegrationTests/Tests/IpAddresses.cs | 6 +++--- Source/StrongGrid/Resources/IIpAddresses.cs | 6 +++--- Source/StrongGrid/Resources/IpAddresses.cs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Source/StrongGrid.IntegrationTests/Tests/IpAddresses.cs b/Source/StrongGrid.IntegrationTests/Tests/IpAddresses.cs index b16f1cf3..a5590afc 100644 --- a/Source/StrongGrid.IntegrationTests/Tests/IpAddresses.cs +++ b/Source/StrongGrid.IntegrationTests/Tests/IpAddresses.cs @@ -15,12 +15,12 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken // GET ALL THE IP ADDRESSES var allIpAddresses = await client.IpAddresses.GetAllAsync(false, null, 10, 0, cancellationToken).ConfigureAwait(false); - await log.WriteLineAsync($"There are {allIpAddresses.Length} IP addresses on your account").ConfigureAwait(false); + await log.WriteLineAsync($"There are {allIpAddresses.Records.Length} IP addresses on your account").ConfigureAwait(false); // GET A SPECIFIC IP ADDRESS - if (allIpAddresses != null && allIpAddresses.Any()) + if (allIpAddresses != null && allIpAddresses.Records.Any()) { - var firstAddress = await client.IpAddresses.GetAsync(allIpAddresses.First().Address, cancellationToken).ConfigureAwait(false); + var firstAddress = await client.IpAddresses.GetAsync(allIpAddresses.Records.First().Address, cancellationToken).ConfigureAwait(false); await log.WriteLineAsync($"IP address {firstAddress.Address} was retrieved").ConfigureAwait(false); } diff --git a/Source/StrongGrid/Resources/IIpAddresses.cs b/Source/StrongGrid/Resources/IIpAddresses.cs index 6e87b28e..9b6a9345 100644 --- a/Source/StrongGrid/Resources/IIpAddresses.cs +++ b/Source/StrongGrid/Resources/IIpAddresses.cs @@ -1,4 +1,4 @@ -using StrongGrid.Models; +using StrongGrid.Models; using System.Threading; using System.Threading.Tasks; @@ -50,9 +50,9 @@ public interface IIpAddresses /// The offset for the number of IPs that you are requesting. /// Cancellation token. /// - /// An array of IP addresses. + /// The IP addresses. /// - Task GetAllAsync(bool excludeWhitelabels = false, string subuser = null, int limit = 10, int offset = 0, CancellationToken cancellationToken = default); + Task> GetAllAsync(bool excludeWhitelabels = false, string subuser = null, int limit = 10, int offset = 0, CancellationToken cancellationToken = default); /// /// Retrieve assigned IP addresses. diff --git a/Source/StrongGrid/Resources/IpAddresses.cs b/Source/StrongGrid/Resources/IpAddresses.cs index 9e5e3e4e..5c1fb78a 100644 --- a/Source/StrongGrid/Resources/IpAddresses.cs +++ b/Source/StrongGrid/Resources/IpAddresses.cs @@ -99,9 +99,9 @@ public Task GetAsync(string address, CancellationToken cancellationTo /// The offset for the number of IPs that you are requesting. /// Cancellation token. /// - /// An array of IP addresses. + /// The IP addresses. /// - public Task GetAllAsync(bool excludeWhitelabels = false, string subuser = null, int limit = 10, int offset = 0, CancellationToken cancellationToken = default) + public Task> GetAllAsync(bool excludeWhitelabels = false, string subuser = null, int limit = 10, int offset = 0, CancellationToken cancellationToken = default) { var request = _client .GetAsync(_endpoint) @@ -113,7 +113,7 @@ public Task GetAllAsync(bool excludeWhitelabels = false, string sub if (!string.IsNullOrEmpty(subuser)) request.WithArgument("subuser", subuser); - return request.AsObject(); + return request.AsPaginatedResponseWithLinks(); } ///