Skip to content

Commit

Permalink
(GH-367) SenderAuthentication.GetAllLinksAsync must return PaginatedR…
Browse files Browse the repository at this point in the history
…esponseWithLinks
  • Loading branch information
Jericho committed Aug 9, 2024
1 parent 110d178 commit ab89e11
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 @@ -50,9 +50,9 @@ public async Task RunAsync(IBaseClient client, TextWriter log, CancellationToken
await log.WriteLineAsync("\n***** SENDER AUTHENTICATION: LINKS *****").ConfigureAwait(false);

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

cleanUpTasks = links.Where(d => d.Domain == fictitiousDomain)
cleanUpTasks = links.Records.Where(d => d.Domain == fictitiousDomain)
.Select(async oldDomain =>
{
await client.SenderAuthentication.DeleteDomainAsync(oldDomain.Id, null, cancellationToken).ConfigureAwait(false);
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 @@ -228,14 +228,14 @@ public interface ISenderAuthentication
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An array of <see cref="BrandedLink" />.
/// The <see cref="PaginatedResponseWithLinks{BrandedLink}" />.
/// </returns>
/// <remarks>
/// A link whitelabel consists of a subdomain and domain that will be used to rewrite links in mail
/// messages. Our customer will be asked to create a couple CNAME records for the links to be
/// rewritten to and for us to verify that they are the domain owners.
/// </remarks>
Task<BrandedLink[]> GetAllLinksAsync(string segmentPrefix = null, int limit = 50, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default);
Task<PaginatedResponseWithLinks<BrandedLink>> GetAllLinksAsync(string segmentPrefix = null, int limit = 50, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default);

/// <summary>
/// Get a specific branded link.
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 @@ -405,14 +405,14 @@ public Task<ReverseDnsValidation> ValidateReverseDnsAsync(long ipId, string onBe
/// <param name="onBehalfOf">The user to impersonate.</param>
/// <param name="cancellationToken">Cancellation token.</param>
/// <returns>
/// An array of <see cref="BrandedLink" />.
/// The <see cref="PaginatedResponseWithLinks{BrandedLink}" />.
/// </returns>
/// <remarks>
/// A link whitelabel consists of a subdomain and domain that will be used to rewrite links in mail
/// messages. Our customer will be asked to create a couple CNAME records for the links to be
/// rewritten to and for us to verify that they are the domain owners.
/// </remarks>
public Task<BrandedLink[]> GetAllLinksAsync(string segmentPrefix = null, int limit = 50, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default)
public Task<PaginatedResponseWithLinks<BrandedLink>> GetAllLinksAsync(string segmentPrefix = null, int limit = 50, int offset = 0, string onBehalfOf = null, CancellationToken cancellationToken = default)
{
return _client
.GetAsync($"{_endpoint}/links")
Expand All @@ -421,7 +421,7 @@ public Task<BrandedLink[]> GetAllLinksAsync(string segmentPrefix = null, int lim
.WithArgument("offset", offset)
.WithArgument("ip", segmentPrefix)
.WithCancellationToken(cancellationToken)
.AsObject<BrandedLink[]>();
.AsPaginatedResponseWithLinks<BrandedLink>();
}

/// <summary>
Expand Down

0 comments on commit ab89e11

Please sign in to comment.