Skip to content

Commit

Permalink
(GH-367) Teammates.GetAllPendingInvitationsAsync must return Paginate…
Browse files Browse the repository at this point in the history
…dResponseWithLinks
  • Loading branch information
Jericho committed Jan 23, 2021
1 parent ac7f429 commit 1c6ab01
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Source/StrongGrid.IntegrationTests/Tests/Teammates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/ITeammates.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using StrongGrid.Models;
using StrongGrid.Models;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
Expand Down Expand Up @@ -63,12 +63,12 @@ public interface ITeammates
/// Retrieve a list of all pending teammate invitations.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>An array of <see cref="TeammateInvitation" />.</returns>
/// <returns>The <see cref="PaginatedResponseWithLinks{TeammateInvitation}" />.</returns>
/// <remarks>
/// Each teammate invitation is valid for 7 days.
/// Users may resend the invite to refresh the expiration date.
/// </remarks>
Task<TeammateInvitation[]> GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default);
Task<PaginatedResponseWithLinks<TeammateInvitation>> GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default);

/// <summary>
/// Delete a pending teammate invite.
Expand Down
9 changes: 4 additions & 5 deletions Source/StrongGrid/Resources/Teammates.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -106,17 +105,17 @@ public Task ResendInvitationAsync(string token, CancellationToken cancellationTo
/// Retrieve a list of all pending teammate invitations.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>An array of <see cref="TeammateInvitation" />.</returns>
/// <returns>The <see cref="PaginatedResponseWithLinks{TeammateInvitation}" />.</returns>
/// <remarks>
/// Each teammate invitation is valid for 7 days.
/// Users may resend the invite to refresh the expiration date.
/// </remarks>
public Task<TeammateInvitation[]> GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default)
public Task<PaginatedResponseWithLinks<TeammateInvitation>> GetAllPendingInvitationsAsync(CancellationToken cancellationToken = default)
{
return _client
.GetAsync($"{_endpoint}/pending")
.WithCancellationToken(cancellationToken)
.AsObject<TeammateInvitation[]>("result");
.AsPaginatedResponseWithLinks<TeammateInvitation>("result");
}

/// <summary>
Expand Down

0 comments on commit 1c6ab01

Please sign in to comment.