Skip to content

feat: add EmailShareAsync method - #142

Merged
dielduarte merged 2 commits into
mainfrom
share-email-link
Aug 20, 2026
Merged

feat: add EmailShareAsync method#142
dielduarte merged 2 commits into
mainfrom
share-email-link

Conversation

@dielduarte

@dielduarte dielduarte commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Adds EmailShareAsync(Guid emailId, string? expiresIn = null, ...), calling the new POST /emails/{id}/share endpoint that creates a shareable link for a sent or received email. See the spec PR resend/resend-openapi#92.

expiresIn is an optional human-readable duration (e.g. 10m, 2 hours, 1 day; server defaults to 48h, capped at 48h).


Summary by cubic

Creates shareable links for sent or received emails via a new EmailShareAsync API, enabling external sharing. Previously the client could not generate shareable links; links now accept an optional human-readable expiration that defaults to and is capped at 48h.

  • Adds IResend.EmailShareAsync(Guid emailId, string? expiresIn = null, CancellationToken) and ResendClient implementation posting to POST emails/{id}/share.
  • Introduces EmailShareRequest (expires_in) and EmailShareResult (object, id, url).
  • Tests cover default 48h, accepted formats ("10m", "2 hours", "1 day", "1h 30m", "48h"), invalid inputs ("banana", >48h) returning 422, and missing email returning 404.
  • Fake API server implements /emails/{id}/share; replaces regex-like duration parsing with an allow-list matching test inputs and enforces the 48h cap.
  • Migration: If you implement IResend, add EmailShareAsync. Users of ResendClient have no action.

Written for commit ebabbba. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tools/Resend.ApiServer/Controllers/EmailController.cs Outdated
@dielduarte
dielduarte marked this pull request as ready for review August 20, 2026 15:07
Comment thread tools/Resend.ApiServer/Controllers/EmailController.cs Outdated
…server

The test fixture doesn't need to parse durations like the real API --
it only needs to return realistic responses for the fixed set of
inputs the test suite exercises. Replaces the regex-based parser with
a plain allow-list.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 1 file (changes from recent commits).

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Adds a net-new EmailShareAsync API, including a public interface method that breaks existing IResend implementers and new public DTOs — a public contract change needing human sign-off.

Re-trigger cubic

@dielduarte
dielduarte merged commit ceb1434 into main Aug 20, 2026
3 checks passed
@dielduarte dielduarte mentioned this pull request Aug 21, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants