From 1c6ab016f77af7164b08e192b0c401aa39de14b1 Mon Sep 17 00:00:00 2001 From: Jericho Date: Sat, 23 Jan 2021 15:57:03 -0500 Subject: [PATCH] (GH-367) Teammates.GetAllPendingInvitationsAsync must return PaginatedResponseWithLinks --- Source/StrongGrid.IntegrationTests/Tests/Teammates.cs | 2 +- Source/StrongGrid/Resources/ITeammates.cs | 6 +++--- Source/StrongGrid/Resources/Teammates.cs | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs b/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs index 3e85df8f..2b9f707b 100644 --- a/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs +++ b/Source/StrongGrid.IntegrationTests/Tests/Teammates.cs @@ -14,7 +14,7 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken // GET ALL THE PENDING INVITATIONS var pendingInvitation = await client.Teammates.GetAllPendingInvitationsAsync(cancellationToken).ConfigureAwait(false); - await log.WriteLineAsync($"There are {pendingInvitation.Length} pending invitations").ConfigureAwait(false); + await log.WriteLineAsync($"There are {pendingInvitation.Records.Length} pending invitations").ConfigureAwait(false); // GET ALL THE TEAMMATES var allTeammates = await client.Teammates.GetAllTeammatesAsync(50, 0, cancellationToken).ConfigureAwait(false); diff --git a/Source/StrongGrid/Resources/ITeammates.cs b/Source/StrongGrid/Resources/ITeammates.cs index 2b2a83f9..93d5328b 100644 --- a/Source/StrongGrid/Resources/ITeammates.cs +++ b/Source/StrongGrid/Resources/ITeammates.cs @@ -1,4 +1,4 @@ -using StrongGrid.Models; +using StrongGrid.Models; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -63,12 +63,12 @@ public interface ITeammates /// Retrieve a list of all pending teammate invitations. /// /// The cancellation token. - /// An array of . + /// The . /// /// Each teammate invitation is valid for 7 days. /// Users may resend the invite to refresh the expiration date. /// - Task GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default); + Task> GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default); /// /// Delete a pending teammate invite. diff --git a/Source/StrongGrid/Resources/Teammates.cs b/Source/StrongGrid/Resources/Teammates.cs index 7027715e..572e1195 100644 --- a/Source/StrongGrid/Resources/Teammates.cs +++ b/Source/StrongGrid/Resources/Teammates.cs @@ -1,7 +1,6 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json.Linq; using Pathoschild.Http.Client; using StrongGrid.Models; -using StrongGrid.Utilities; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -106,17 +105,17 @@ public Task ResendInvitationAsync(string token, CancellationToken cancellationTo /// Retrieve a list of all pending teammate invitations. /// /// The cancellation token. - /// An array of . + /// The . /// /// Each teammate invitation is valid for 7 days. /// Users may resend the invite to refresh the expiration date. /// - public Task GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default) + public Task> GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default) { return _client .GetAsync($"{_endpoint}/pending") .WithCancellationToken(cancellationToken) - .AsObject("result"); + .AsPaginatedResponseWithLinks("result"); } ///