Skip to content

feat: add emails.share() method - #127

Merged
dielduarte merged 1 commit into
mainfrom
share-email-link
Aug 21, 2026
Merged

feat: add emails.share() method#127
dielduarte merged 1 commit into
mainfrom
share-email-link

Conversation

@dielduarte

@dielduarte dielduarte commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Adds resend.emails().share(id) / share(id, ShareEmailOptions), 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.

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


Summary by cubic

Adds emails.share() to create a shareable link for a sent or received email. Previously there was no way to generate a share URL; now share(emailId[, options]) returns a url with a default 48h expiry, or a custom expiry up to 48h.

  • Adds two overloads: share(String emailId) and share(String emailId, ShareEmailOptions) calling POST /emails/{id}/share with an empty or JSON body (expires_in).
  • Introduces ShareEmailOptions (builder with expiresIn human-readable duration) and ShareEmailResponse (extends EmailResponse, adds url).
  • On non-2xx, throws ResendException with status/body; tests cover default/custom expiry, 422 when expiry exceeds 48h, and 404 not found.
  • No changes to existing email APIs.

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

Review in cubic

Adds support for the new POST /emails/{id}/share endpoint, which
creates a shareable link for a sent or received email. Mirrors the
existing cancel/update conventions: a ShareEmailOptions builder for
the optional expires_in field and a ShareEmailResponse carrying the
returned url.

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

Copy link
Copy Markdown
Contributor

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 5 files

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

Re-trigger cubic

Comment thread src/main/java/com/resend/services/emails/Emails.java
@dielduarte
dielduarte marked this pull request as ready for review August 20, 2026 15:07
@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Aug 21, 2026
@dielduarte
dielduarte merged commit 26adc5d into main Aug 21, 2026
4 checks passed
@dielduarte
dielduarte deleted the share-email-link branch August 21, 2026 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants