Skip to content

Commit

Permalink
(GH-367) SenderAuthentication.GetAllDomainsAsync must return Paginate…
Browse files Browse the repository at this point in the history
…dResponseWithLinks
  • Loading branch information
Jericho committed Aug 9, 2024
1 parent c27c72a commit 1505d74
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
await log.WriteLineAsync("\n***** SENDER AUTHENTICATION: DOMAINS *****\n").ConfigureAwait(false);

var domains = await client.SenderAuthentication.GetAllDomainsAsync(50, 0, false, null, null, null, cancellationToken).ConfigureAwait(false);
await log.WriteLineAsync($"All AuthenticatedSender domains retrieved. There are {domains.Length} domains").ConfigureAwait(false);
await log.WriteLineAsync($"All AuthenticatedSender domains retrieved. There are {domains.Records.Length} domains").ConfigureAwait(false);

var fictitiousDomain = "StrongGridIntegrationTesting.com";
var cleanUpTasks = domains
var cleanUpTasks = domains.Records
.Where(d => d.Domain == fictitiousDomain)
.Select(async oldDomain =>
{
Expand Down
4 changes: 2 additions & 2 deletions Source/StrongGrid/Resources/ISenderAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public interface ISenderAuthentication
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// An array of <see cref="AuthenticatedDomain" />.
/// The <see cref="PaginatedResponseWithLinks{AuthenticatedDomain}" />.
/// </returns>
Task<AuthenticatedDomain[]> GetAllDomainsAsync(int limit = 50, int offset = 0, bool excludeSubusers = false, string username = null, string domain = null, string onBehalfOf = null, CancellationToken cancellationToken = default);
Task<PaginatedResponseWithLinks<AuthenticatedDomain>> GetAllDomainsAsync(int limit = 50, int offset = 0, bool excludeSubusers = false, string username = null, string domain = null, string onBehalfOf = null, CancellationToken cancellationToken = default);

/// <summary>
/// Get a specific authenticated domain.
Expand Down
6 changes: 3 additions & 3 deletions Source/StrongGrid/Resources/SenderAuthentication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ internal SenderAuthentication(Pathoschild.Http.Client.IClient client)
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
/// An array of <see cref="AuthenticatedDomain" />.
/// The <see cref="PaginatedResponseWithLinks{AuthenticatedDomain}" />.
/// </returns>
public Task<AuthenticatedDomain[]> GetAllDomainsAsync(int limit = 50, int offset = 0, bool excludeSubusers = false, string username = null, string domain = null, string onBehalfOf = null, CancellationToken cancellationToken = default)
public Task<PaginatedResponseWithLinks<AuthenticatedDomain>> GetAllDomainsAsync(int limit = 50, int offset = 0, bool excludeSubusers = false, string username = null, string domain = null, string onBehalfOf = null, CancellationToken cancellationToken = default)
{
return _client
.GetAsync($"{_endpoint}/domains")
Expand All @@ -54,7 +54,7 @@ public Task<AuthenticatedDomain[]> GetAllDomainsAsync(int limit = 50, int offset
.WithArgument("username", username)
.WithArgument("domain", domain)
.WithCancellationToken(cancellationToken)
.AsObject<AuthenticatedDomain[]>();
.AsPaginatedResponseWithLinks<AuthenticatedDomain>();
}

/// <summary>
Expand Down

0 comments on commit 1505d74

Please sign in to comment.