Skip to content

feat: add contact imports endpoints#220

Merged
drish merged 17 commits into
mainfrom
feat/contact-imports
Jun 17, 2026
Merged

feat: add contact imports endpoints#220
drish merged 17 commits into
mainfrom
feat/contact-imports

Conversation

@drish

@drish drish commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary by cubic

Adds contact import endpoints to the resend Python SDK with CSV multipart upload (sync/async) and a resend.Contacts.Imports.* access pattern. Improves multipart handling, adds completed_at, and bumps version to 2.32.0.

  • New Features

    • Contacts.Imports.create uploads CSV via multipart with filename, column_map, on_conflict, segments, topics; get and list support status filtering and pagination. Async: create_async, get_async, list_async.
    • Models: ContactImport (with completed_at, optional counts) and ContactImportCounts. Types use direct class refs for Python 3.7 compatibility.
  • Migration

    • If you provide a custom HTTP client, update its request signature to accept files: Dict[str, Any] and data: Dict[str, str], and only send json when not sending data/files. Defaults for requests/httpx are updated; see examples/with_custom_http_client.py.

Written for commit 3d31f4d. Summary will update on new commits.

Review in cubic

@drish drish requested review from gabrielmfern and vcapretz June 16, 2026 20:20

@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.

5 issues found and verified against the latest diff

Confidence score: 2/5

  • In resend/request.py and resend/http_client_requests.py, request payload handling is inconsistent: always passing new kwargs can break custom sync HTTP clients, and data can be silently dropped when files is None, risking failed requests and lost form fields in production — gate files/data kwargs so they are only sent when present and ensure the data-only path is preserved before merging.
  • In resend/contacts/imports/_contact_import.py, typing counts as Optional[...] models a nullable value instead of an absent key, which can mislead consumers and cause parsing/validation bugs for queued or in-progress imports — switch to NotRequired[ContactImportCounts] to match actual API shape.
  • In resend/contacts/imports/_contact_imports.py, appending status twice creates duplicate query parameters, which can lead to ambiguous backend filtering and hard-to-debug list results — remove the duplicate append so each filter key is emitted once.
  • In tests/contact_imports_test.py, exception tests using bare try/except can pass even if errors stop being raised, reducing regression detection for critical validation paths — convert these to assertRaises/pytest.raises (or add explicit fail() in an else) before merge.

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

Re-trigger cubic

Comment thread resend/request.py Outdated
Comment thread resend/contacts/imports/_contact_imports.py Outdated
Comment thread resend/contacts/imports/_contact_import.py Outdated
Comment thread resend/http_client_requests.py
Comment thread tests/contact_imports_test.py Outdated

@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.

0 issues found across 3 files (changes from recent commits).

Requires human review: Auto-approval blocked by 5 unresolved issues from previous reviews.

Re-trigger cubic

@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.

0 issues found across 1 file (changes from recent commits).

Requires human review: Auto-approval blocked by 5 unresolved issues from previous reviews.

Re-trigger cubic

@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.

0 issues found across 3 files (changes from recent commits).

Requires human review: Auto-approval blocked by 5 unresolved issues from previous reviews.

Re-trigger cubic

@drish

drish commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@cubic-dev-ai

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai

@drish I have started the AI code review. It will take a few minutes to complete.

@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.

2 issues found across 16 files

Confidence score: 3/5

  • In resend/http_client_requests.py, sending both data and json risks the JSON body being silently dropped, which can change API request payloads for callers and cause hard-to-trace behavior regressions; ensure the request builder enforces one body mode (or deterministic precedence) before merging.
  • In resend/contacts/imports/_contact_imports.py, duplicated multipart assembly across sync/async paths increases drift risk, so a future fix may land in only one path and create inconsistent import behavior; factor shared payload construction into a common helper to de-risk maintenance.

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

Re-trigger cubic

Comment thread resend/http_client_requests.py
Comment thread resend/contacts/imports/_contact_imports.py

@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.

0 issues found across 3 files (changes from recent commits).

Requires human review: Adds new API endpoints for contact imports with multipart file uploads, new models, and HTTP client refactoring. These are non-trivial changes to business logic and network request handling that require human review.

Re-trigger cubic

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

You're iterating quickly on this pull request. To help protect your rate limits, cubic has paused automatic reviews on new pushes for now—when you're ready for another review, comment @cubic-dev-ai review.

@drish

drish commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@drish I have started the AI code review. It will take a few minutes to complete.

@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.

0 issues found across 0 files (changes from recent commits).

Requires human review: Adds new API endpoints for contact imports (CSV upload, get, list) with multipart handling, requiring human review for API design, error handling, and breaking changes to the HTTP client interface.

Re-trigger cubic

@drish drish merged commit 10b4758 into main Jun 17, 2026
22 checks passed
@drish drish deleted the feat/contact-imports branch June 17, 2026 18:03
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