From 3915ae135b26d82b4087b701e769b889b2f5f1a1 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 2b9f707b..96354755 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 93d5328b..a4b40fc0 100644 --- a/Source/StrongGrid/Resources/ITeammates.cs +++ b/Source/StrongGrid/Resources/ITeammates.cs @@ -139,8 +139,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 572e1195..bc725f6b 100644 --- a/Source/StrongGrid/Resources/Teammates.cs +++ b/Source/StrongGrid/Resources/Teammates.cs @@ -235,15 +235,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"); } ///