feat: add Emails.share method

Merged
DI
2mo ago
+78-0

Adds Resend::Emails.share(email_id, params = {}), 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.

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


Summary by cubic

Add Resend::Emails.share to create a shareable link for a sent or received email via POST /emails/{id}/share. Previously you could not generate share links; now you can optionally set expires_in with a human-readable duration. The server defaults to 48h and caps at 48h.

  • Posts to emails/{id}/share; includes a body only when expires_in is provided.
  • Returns id and url. Maps validation and not found responses to existing Resend::Error classes.
  • Specs cover default expiry, custom expires_in ("10m"), invalid durations (>48h), and missing email (404).
  • No breaking changes or configuration.