Skip to content

Conversation

@lucasfcosta
Copy link
Contributor

@lucasfcosta lucasfcosta commented Oct 9, 2025

This PR is the SDK complement to https://github.com/resend/resend-api/pull/2192. It adds pagination to the inbound email attachments.

I also used this opportunity to:

  • Update the object to list for the method that lists attachment (I did that on the API PR too)
  • Use the new /emails/receiving/:emailId/attachments alias from the API instead of the old /emails/inbound/:emailId/attachments

Summary by cubic

Added pagination for inbound email attachments in the SDK and switched to the new /emails/receiving endpoints. Aligns with PRODUCT-710 to enable cursor-based navigation and reduce large payloads.

  • New Features

    • attachments.receiving.list now supports limit, before, and after.
    • Uses /emails/receiving/:emailId and /emails/receiving/:emailId/attachments/:id.
    • Builds query params only when pagination options are provided.
  • Migration

    • List responses now return object: 'list' and has_more. Update any checks relying on the previous object value.

@lucasfcosta lucasfcosta requested a review from a team as a code owner October 9, 2025 21:09
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/resend/resend-node/resend@670

commit: fb5096e

@lucasfcosta lucasfcosta force-pushed the feature/product-710-paginate-inbound-email-attachments branch from 5b258d6 to 2afef7b Compare October 9, 2025 21:12
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.

1 issue found across 4 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="src/attachments/receiving/receiving.ts">

<violation number="1" location="src/attachments/receiving/receiving.ts:34">
The list call now targets `/emails/receiving/:emailId`, but it needs the `/attachments` suffix; otherwise it fetches the email resource instead of its attachments, breaking the response shape.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@lucasfcosta lucasfcosta force-pushed the feature/product-710-paginate-inbound-email-attachments branch from 2afef7b to 9654979 Compare October 9, 2025 21:32
@lucasfcosta lucasfcosta force-pushed the feature/product-710-paginate-inbound-email-attachments branch from 9654979 to fb5096e Compare October 9, 2025 21:35
async get(options: GetAttachmentOptions): Promise<GetAttachmentResponse> {
const { emailId, id } = options;

const data = await this.resend.get<GetAttachmentResponseSuccess>(
Copy link
Member

Choose a reason for hiding this comment

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

Why is it calling an API and not the DB here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I understand this comment. This is the get method that we call on resend.emails.receiving.get so it can't connect to a DB? Maybe I'm missing something? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For reference, the existing get method for the outbound emails does the same call but to the outbound route:

  async get(id: string): Promise<GetEmailResponse> {
    const data = await this.resend.get<GetEmailResponseSuccess>(
      `/emails/${id}`,
    );

    return data;
  }

@lucasfcosta lucasfcosta merged commit 9d592bc into canary Oct 10, 2025
11 checks passed
@lucasfcosta lucasfcosta deleted the feature/product-710-paginate-inbound-email-attachments branch October 10, 2025 12:02
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.

3 participants