Skip to content

Commit

Permalink
(GH-367) Teammates.GetAllTeammatesAsync must return PaginatedResponse…
Browse files Browse the repository at this point in the history
…WithLinks
  • Loading branch information
Jericho committed Jan 23, 2021
1 parent 1c6ab01 commit 3915ae1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Source/StrongGrid.IntegrationTests/Tests/Teammates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
4 changes: 2 additions & 2 deletions Source/StrongGrid/Resources/ITeammates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public interface ITeammates
/// <param name="limit">The limit.</param>
/// <param name="offset">The offset.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>An array of <see cref="Teammate" />.</returns>
Task<Teammate[]> GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default);
/// <returns>The <see cref="PaginatedResponseWithLinks{Teammate}" />.</returns>
Task<PaginatedResponseWithLinks<Teammate>> GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieve a specific teammate by username.
Expand Down
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/Teammates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,15 @@ public Task<TeammateInvitation> InviteTeammateAsAdminAsync(string email, Cancell
/// <param name="limit">The limit.</param>
/// <param name="offset">The offset.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>An array of <see cref="Teammate" />.</returns>
public Task<Teammate[]> GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default)
/// <returns>The <see cref="PaginatedResponseWithLinks{Teammate}" />.</returns>
public Task<PaginatedResponseWithLinks<Teammate>> GetAllTeammatesAsync(int limit = 10, int offset = 0, CancellationToken cancellationToken = default)
{
return _client
.GetAsync(_endpoint)
.WithArgument("limit", limit)
.WithArgument("offset", offset)
.WithCancellationToken(cancellationToken)
.AsObject<Teammate[]>("result");
.AsPaginatedResponseWithLinks<Teammate>("result");
}

/// <summary>
Expand Down

0 comments on commit 3915ae1

Please sign in to comment.