Skip to content

feat: make new attachments API conform to updated spec#174

Merged
drish merged 4 commits intomainfrom
feat/updated-attachments-api
Oct 29, 2025
Merged

feat: make new attachments API conform to updated spec#174
drish merged 4 commits intomainfrom
feat/updated-attachments-api

Conversation

@lucasfcosta
Copy link
Contributor

@lucasfcosta lucasfcosta commented Oct 28, 2025

This updates the API for the inbound methods on this SDK to conform to the new specification.

Note that I also fixed an incorrect wrapping in data that I ended up missing from the first review.

This is as per @vieiralucas message's from Monday:

Hey folks,
We recently changed how we are calling the methods related to attachments on the Node SDK
resend.attachments.sending → resend.emails.attachments
resend.attachments.receiving → resend.emails.receiving.attachments

If you already had implemented those in your language, you might want to check if it makes sense to adjust them.

We also changed the attachment routes for sending:
From: GET /emails/sending/:emailId/attachments
To: GET /emails/:emailId/attachments

From: GET /emails/sending/:emailId/attachments/:attachmentId
To: GET /emails/:emailId/attachments/:attachmentId

Basically, removed the /sending/. We're not removing the old endpoints from the API, but you must change the SDK to call the new one.

In Python, that means we now have:

# Attachments for sent emails (added)
sent_attachments_list = resend.Emails.Attachments.list(email_id=sent_email_id)
    sent_attachment_details = resend.Emails.Attachments.get(
        email_id=sent_email_id,
        attachment_id=first_attachment_id
    )

# Attachments for received emails (now nested inside `Receiving`)
received_attachments = resend.Emails.Receiving.Attachments.list(email_id=last_email_id)
received_attachment_details = resend.Emails.Receiving.Attachments.get(
    email_id=last_email_id,
    attachment_id=received_attachment_id
)

What I need from you

Please review/test my changes carefully. I have already created a test file locally to test all these functions, but please do test it too.

If you need to make any changes, please go ahead and make commits to this PR.

Once done, please let's release a new version with these changes. I'm not sure if you have already released a version with this, but please do once you merge this (let's avoid releasing the old SDK API if it's not released yet just to avoid a major bump if possible).


Summary by cubic

Updated the attachments API to match the new spec. Attachment methods are now under resend.Emails and responses return the attachment object directly (no data wrapper).

  • Refactors

    • Sent attachments: resend.Emails.Attachments.list/get → calls /emails/:emailId/attachments and /emails/:emailId/attachments/:attachmentId.
    • Received attachments: moved to resend.Emails.Receiving.Attachments.
    • Removed the old resend.attachments module and exports; Emails exposes Attachments via resend.Emails.Attachments.
    • Updated examples and tests to the new structure and response shape.
  • Migration

    • Replace imports: resend.Attachments.Receiving → resend.Emails.Receiving.Attachments.
    • Use resend.Emails.Attachments for sent email attachments.
    • Expect a direct attachment object in get responses (no data field).

Copy link
Contributor

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

Choose a reason for hiding this comment

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

No issues found across 8 files

@drish drish merged commit 45e451e into main Oct 29, 2025
19 checks passed
@drish drish deleted the feat/updated-attachments-api branch October 29, 2025 00:42
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