Skip to content

Commit

Permalink
(GH-367) SpamReports.GetAllAsync must return PaginatedResponseWithLinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jericho committed Aug 9, 2024
1 parent ab89e11 commit f9319a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Source/StrongGrid.IntegrationTests/Tests/SpamReports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
var endDate = new DateTime(thisYear, 12, 31, 23, 59, 59);

var spamReports = await client.SpamReports.GetAllAsync(startDate, endDate, 25, 0, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All spam reports retrieved. There are {spamReports.Length} reports in {lastYear} and {thisYear}").ConfigureAwait(false);
await log.WriteLineAsync($"All spam reports retrieved. There are {spamReports.Records.Length} reports in {lastYear} and {thisYear}").ConfigureAwait(false);
}
}
}
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/ISpamReports.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using StrongGrid.Models;
using StrongGrid.Models;
using System;
using System.Collections.Generic;
using System.Threading;
Expand Down Expand Up @@ -35,9 +35,9 @@ public interface ISpamReports
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An array of <see cref="SpamReport" />.
/// The <see cref="PaginatedResponseWithLinks{SpamReport}" />.
/// </returns>
Task<SpamReport[]> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default);
Task<PaginatedResponseWithLinks<SpamReport>> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default);

/// <summary>
/// Delete all spam reports.
Expand Down
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/SpamReports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public Task<SpamReport[]> GetAsync(string emailAddress, string onBehalfOf = null
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An array of <see cref="SpamReport" />.
/// The <see cref="PaginatedResponseWithLinks{SpamReport}" />.
/// </returns>
public Task<SpamReport[]> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default)
public Task<PaginatedResponseWithLinks<SpamReport>> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default)
{
return _client
.GetAsync(_endpoint)
Expand All @@ -72,7 +72,7 @@ public Task<SpamReport[]> GetAllAsync(DateTime? startDate = null, DateTime? endD
.WithArgument("limit", limit)
.WithArgument("offset", offset)
.WithCancellationToken(cancellationToken)
.AsObject<SpamReport[]>();
.AsPaginatedResponseWithLinks<SpamReport>();
}

/// <summary>
Expand Down

0 comments on commit f9319a5

Please sign in to comment.