Skip to content

Conversation

drish
Copy link
Collaborator

@drish drish commented Sep 21, 2025

Summary by cubic

Adds optional pagination to all list methods in the Ruby SDK so you can pass limit, after, and before without building URLs yourself. Improves ergonomics and keeps methods backward-compatible.

  • New Features
    • New PaginationHelper.build_paginated_path with URL encoding and limit validation (1–100).
    • Updated list methods: ApiKeys.list(params = {}), Audiences.list(params = {}), Broadcasts.list(params = {}), Domains.list(params = {}), Contacts.list(audience_id, params = {}).
    • Example scripts updated; added examples/with_examples.rb to demo pagination.
    • RSpec coverage for the helper and each paginated list method.

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive pagination support to all list methods across the Resend Ruby SDK. The implementation includes a reusable pagination helper, query parameter validation, and consistent pagination parameters (limit, after, before) for all list operations.

  • Introduces PaginationHelper class to centralize pagination logic with URL encoding and parameter validation
  • Updates all list methods (ApiKeys, Audiences, Broadcasts, Contacts, Domains) to accept optional pagination parameters
  • Adds comprehensive test coverage for pagination functionality and example usage

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
lib/resend/pagination_helper.rb New helper class for building paginated query strings with validation
spec/pagination_spec.rb Comprehensive test suite covering pagination helper and all list methods
lib/resend/*.rb Updates to list methods to accept pagination parameters
lib/resend.rb Adds CGI require and pagination helper import
examples/*.rb Adds pagination examples to demonstrate new functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@lucasfcosta lucasfcosta left a comment

Choose a reason for hiding this comment

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

Just one small comment on letting the API surface errors, wdyt? It seems like we didn't do that in the Go and Python SDKs.

@drish drish requested a review from gabrielmfern October 1, 2025 14:59
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