Skip to content

Commit

Permalink
(GH-367) InvalidEmails.GetAllAsync must return PaginatedResponseWithL…
Browse files Browse the repository at this point in the history
…inks
  • Loading branch information
Jericho committed Aug 4, 2024
1 parent 062dda6 commit 34ddb3d
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/InvalidEmails.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 invalidEmails = await client.InvalidEmails.GetAllAsync(startDate, endDate, 25, 0, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All invalid emails retrieved. There are {invalidEmails.Length} invalid email addresses in {lastYear} and {thisYear}").ConfigureAwait(false);
await log.WriteLineAsync($"All invalid emails retrieved. There are {invalidEmails.Records.Length} invalid email addresses in {lastYear} and {thisYear}").ConfigureAwait(false);
}
}
}
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/IInvalidEmails.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 All @@ -24,9 +24,9 @@ public interface IInvalidEmails
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An array of <see cref="InvalidEmail" />.
/// The <see cref="PaginatedResponseWithLinks{InvalidEmail}" />.
/// </returns>
Task<InvalidEmail[]> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default);
Task<PaginatedResponseWithLinks<InvalidEmail>> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default);

/// <summary>
/// Retrieve invalid emails for a given email address.
Expand Down
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/InvalidEmails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ internal InvalidEmails(Pathoschild.Http.Client.IClient client)
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An array of <see cref="InvalidEmail" />.
/// The <see cref="PaginatedResponseWithLinks{InvalidEmail}" />.
/// </returns>
public Task<InvalidEmail[]> GetAllAsync(DateTime? startDate = null, DateTime? endDate = null, int limit = 25, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default)
public Task<PaginatedResponseWithLinks<InvalidEmail>> 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 @@ -51,7 +51,7 @@ public Task<InvalidEmail[]> GetAllAsync(DateTime? startDate = null, DateTime? en
.WithArgument("limit", limit)
.WithArgument("offset", offset)
.WithCancellationToken(cancellationToken)
.AsObject<InvalidEmail[]>();
.AsPaginatedResponseWithLinks<InvalidEmail>();
}

/// <summary>
Expand Down

0 comments on commit 34ddb3d

Please sign in to comment.