From 055209cb68fca7b72d1c37b5ba66ddb7b600e831 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sat, 23 Jan 2021 15:59:58 -0500 Subject: [PATCH] (GH-367) Teammates.GetAllTeammatesAsync must return PaginatedResponseWithLinks --- Source/StrongGrid.IntegrationTests/Tests/Teammates.cs | 6 +++--- Source/StrongGrid/Resources/ITeammates.cs | 4 ++-- Source/StrongGrid/Resources/Teammates.cs | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs b/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs index 414f698e..abcc0664 100644 --- a/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs +++ b/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs @@ -18,12 +18,12 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken // GET ALL THE TEAMMATES var allTeammates = await client.Teammates.GetAllTeammatesAsync(50, 0, cancellationToken).ConfigureAwait(false); - await log.WriteLineAsync($"There are {allTeammates.Length} teammates").ConfigureAwait(false); + await log.WriteLineAsync($"There are {allTeammates.Records.Length} teammates").ConfigureAwait(false); - if (allTeammates.Length > 0) + if (allTeammates.Records.Length > 0) { // RETRIEVE THE FIRST TEAMMATE - var teammate = await client.Teammates.GetTeammateAsync(allTeammates[0].Username, cancellationToken).ConfigureAwait(false); + var teammate = await client.Teammates.GetTeammateAsync(allTeammates.Records[0].Username, cancellationToken).ConfigureAwait(false); await log.WriteLineAsync($"Retrieved teammate '{teammate.Username}'").ConfigureAwait(false); } } diff --git a/Source/StrongGrid/Resources/ITeammates.cs b/Source/StrongGrid/Resources/ITeammates.cs index df67206d..3dbff8d5 100644 --- a/Source/StrongGrid/Resources/ITeammates.cs +++ b/Source/StrongGrid/Resources/ITeammates.cs @@ -125,8 +125,8 @@ public interface ITeammates /// The limit. /// The offset. /// The cancellation token. - /// An array of . - Task GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default); + /// The . + Task> GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default); /// /// Retrieve a specific teammate by username. diff --git a/Source/StrongGrid/Resources/Teammates.cs b/Source/StrongGrid/Resources/Teammates.cs index d82adbd6..c5e1cc5b 100644 --- a/Source/StrongGrid/Resources/Teammates.cs +++ b/Source/StrongGrid/Resources/Teammates.cs @@ -195,15 +195,15 @@ public Task InviteTeammateAsAdminAsync(string email, Cancell /// The limit. /// The offset. /// The cancellation token. - /// An array of . - public Task GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default) + /// The . + public Task> GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default) { return _client .GetAsync(_endpoint) .WithArgument("limit", limit) .WithArgument("offset", offset) .WithCancellationToken(cancellationToken) - .AsObject("result"); + .AsPaginatedResponseWithLinks("result"); } ///