Repository navigation
feat(inboxes): add support for the Inboxes API - #251
Conversation
There was a problem hiding this comment.
cubic analysis
7 issues found across 16 files
Confidence score: 4/5
examples/inboxes.rbonly works for accounts that ownacme.comand have receiving configured. Read the inbox address from configuration and reuse it in thegetcall.- The new inbox specs use
shouldphrasing in their example descriptions, which violates the project’s test-naming rule. Reword the descriptions declaratively in the affected specs.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="spec/inboxes/drafts_spec.rb">
<violation number="1" location="spec/inboxes/drafts_spec.rb:22">
P3: Custom agent: **No `should` in tests**
All 10 `it` descriptions in this spec begin with "should" (e.g., "should list drafts with pagination"), which the No `should` in tests rule forbids. Rewrite them declaratively: "lists drafts with pagination", "raises when inbox_id is missing", "creates a reply draft", "retrieves a draft", "updates a draft and keeps explicit nils", "removes a draft", "sends a draft with no body".</violation>
</file>
<file name="spec/inboxes/threads_spec.rb">
<violation number="1" location="spec/inboxes/threads_spec.rb:20">
P2: Custom agent: **No `should` in tests**
All 11 `it` descriptions in this file start with "should" (lines 20, 32, 42, 48, 66, 72, 80, 88, 98, 107, 115), which the No `should` in tests rule flags. Reword them declaratively, e.g. "lists threads", "joins array filters with commas", "raises when inbox_id is missing", "searches threads", "retrieves a thread", "raises when thread_id is missing", "updates a thread with label changes", "sends the deprecated label_id", "removes a thread".</violation>
</file>
<file name="spec/inboxes/labels_spec.rb">
<violation number="1" location="spec/inboxes/labels_spec.rb:18">
P3: Custom agent: **No `should` in tests**
All seven `it` descriptions in this spec start with "should" (e.g. "should list labels", "should raise when label_id is missing"), which the No `should` in tests rule flags. Rewrite them declaratively: "lists labels", "raises when label_id is missing", "creates a label", "updates a label", "removes a label".</violation>
</file>
<file name="spec/inboxes/threads/emails_spec.rb">
<violation number="1" location="spec/inboxes/threads/emails_spec.rb:22">
P3: Custom agent: **No `should` in tests**
All eight `it` descriptions in this new spec use "should" phrasing. Per the project's "No `should` in tests" rule, descriptions must be declarative. Rename them, e.g. "lists thread emails with pagination", "raises when thread_id is missing", "retrieves a thread email", "raises when email_id is missing" (both), "replies with attachments", "forwards an email", and "raises when inbox_id is missing".</violation>
</file>
<file name="spec/inboxes_spec.rb">
<violation number="1" location="spec/inboxes_spec.rb:17">
P3: Custom agent: **No `should` in tests**
All 8 `it` descriptions in this file use "should" (e.g., `"should create an inbox"`, `"should list inboxes"`). Per the project's test-naming rule, use declarative phrasing instead: `it "creates an inbox"`, `it "lists inboxes"`, `it "passes pagination parameters"`, `it "retrieves an inbox by id"`, `it "encodes an email address"`, `it "updates an inbox"`, `it "raises when inbox_id is missing"`, `it "removes an inbox"`.</violation>
</file>
<file name="spec/inboxes/agent_spec.rb">
<violation number="1" location="spec/inboxes/agent_spec.rb:17">
P2: Custom agent: **No `should` in tests**
Four `it` descriptions in this new spec start with "should" (lines 17, 26, 32, 42), e.g. `it "should retrieve the agent settings"`. Per the no-`should`-in-tests rule, use declarative phrasing: "retrieves the agent settings", "raises when inbox_id is missing", "updates the agent settings and keeps explicit nils".</violation>
</file>
<file name="examples/inboxes.rb">
<violation number="1" location="examples/inboxes.rb:9">
P2: This example cannot create an inbox for accounts that do not own `acme.com` (and it also requires receiving to be configured). Read an inbox address from configuration and reuse it in the subsequent `get` call.</violation>
</file>
Linked issue analysis
Linked issue: DEV-2324: Ruby SDK (internal, squad-devtools)
| Status | Acceptance criteria | Notes |
|---|---|---|
| Add the Inboxes endpoints to the Ruby SDK | The PR adds wrappers and specs for all 26 routes, but thread label updates still receive 422 until the upstream API change ships. |
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| @@ -0,0 +1,121 @@ | |||
| # frozen_string_literal: true | |||
There was a problem hiding this comment.
P2: Custom agent: No should in tests
All 11 it descriptions in this file start with "should" (lines 20, 32, 42, 48, 66, 72, 80, 88, 98, 107, 115), which the No should in tests rule flags. Reword them declaratively, e.g. "lists threads", "joins array filters with commas", "raises when inbox_id is missing", "searches threads", "retrieves a thread", "raises when thread_id is missing", "updates a thread with label changes", "sends the deprecated label_id", "removes a thread".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes/threads_spec.rb, line 20:
<comment>All 11 `it` descriptions in this file start with "should" (lines 20, 32, 42, 48, 66, 72, 80, 88, 98, 107, 115), which the No `should` in tests rule flags. Reword them declaratively, e.g. "lists threads", "joins array filters with commas", "raises when inbox_id is missing", "searches threads", "retrieves a thread", "raises when thread_id is missing", "updates a thread with label changes", "sends the deprecated label_id", "removes a thread".</comment>
<file context>
@@ -0,0 +1,121 @@
+ end
+
+ describe "list" do
+ it "should list threads" do
+ resp = {
+ object: "list",
</file context>
| end | ||
|
|
||
| describe "get" do | ||
| it "should retrieve the agent settings" do |
There was a problem hiding this comment.
P2: Custom agent: No should in tests
Four it descriptions in this new spec start with "should" (lines 17, 26, 32, 42), e.g. it "should retrieve the agent settings". Per the no-should-in-tests rule, use declarative phrasing: "retrieves the agent settings", "raises when inbox_id is missing", "updates the agent settings and keeps explicit nils".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes/agent_spec.rb, line 17:
<comment>Four `it` descriptions in this new spec start with "should" (lines 17, 26, 32, 42), e.g. `it "should retrieve the agent settings"`. Per the no-`should`-in-tests rule, use declarative phrasing: "retrieves the agent settings", "raises when inbox_id is missing", "updates the agent settings and keeps explicit nils".</comment>
<file context>
@@ -0,0 +1,46 @@
+ end
+
+ describe "get" do
+ it "should retrieve the agent settings" do
+ resp = { object: "inbox_agent", instructions: nil, tone: nil, enabled_actions: [] }
+ expect_request("inboxes/#{inbox_id}/agent", {}, "get", resp)
</file context>
|
|
||
| Resend.api_key = ENV["RESEND_API_KEY"] | ||
|
|
||
| inbox = Resend::Inboxes.create({ email_address: "support@acme.com", name: "Customer Support" }) |
There was a problem hiding this comment.
P2: This example cannot create an inbox for accounts that do not own acme.com (and it also requires receiving to be configured). Read an inbox address from configuration and reuse it in the subsequent get call.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At examples/inboxes.rb, line 9:
<comment>This example cannot create an inbox for accounts that do not own `acme.com` (and it also requires receiving to be configured). Read an inbox address from configuration and reuse it in the subsequent `get` call.</comment>
<file context>
@@ -0,0 +1,63 @@
+
+Resend.api_key = ENV["RESEND_API_KEY"]
+
+inbox = Resend::Inboxes.create({ email_address: "support@acme.com", name: "Customer Support" })
+inbox_id = inbox[:id]
+puts "created inbox: #{inbox_id}"
</file context>
| end | ||
|
|
||
| describe "list" do | ||
| it "should list drafts with pagination" do |
There was a problem hiding this comment.
P3: Custom agent: No should in tests
All 10 it descriptions in this spec begin with "should" (e.g., "should list drafts with pagination"), which the No should in tests rule forbids. Rewrite them declaratively: "lists drafts with pagination", "raises when inbox_id is missing", "creates a reply draft", "retrieves a draft", "updates a draft and keeps explicit nils", "removes a draft", "sends a draft with no body".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes/drafts_spec.rb, line 22:
<comment>All 10 `it` descriptions in this spec begin with "should" (e.g., "should list drafts with pagination"), which the No `should` in tests rule forbids. Rewrite them declaratively: "lists drafts with pagination", "raises when inbox_id is missing", "creates a reply draft", "retrieves a draft", "updates a draft and keeps explicit nils", "removes a draft", "sends a draft with no body".</comment>
<file context>
@@ -0,0 +1,95 @@
+ end
+
+ describe "list" do
+ it "should list drafts with pagination" do
+ resp = { object: "list", has_more: false, data: [{ "id" => draft_id, "type" => "standalone", "snippet" => "Hi" }] }
+ expect_request("inboxes/#{inbox_id}/drafts?limit=10&before=#{draft_id}", {}, "get", resp)
</file context>
| @@ -0,0 +1,75 @@ | |||
| # frozen_string_literal: true | |||
There was a problem hiding this comment.
P3: Custom agent: No should in tests
All seven it descriptions in this spec start with "should" (e.g. "should list labels", "should raise when label_id is missing"), which the No should in tests rule flags. Rewrite them declaratively: "lists labels", "raises when label_id is missing", "creates a label", "updates a label", "removes a label".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes/labels_spec.rb, line 18:
<comment>All seven `it` descriptions in this spec start with "should" (e.g. "should list labels", "should raise when label_id is missing"), which the No `should` in tests rule flags. Rewrite them declaratively: "lists labels", "raises when label_id is missing", "creates a label", "updates a label", "removes a label".</comment>
<file context>
@@ -0,0 +1,75 @@
+ end
+
+ describe "list" do
+ it "should list labels" do
+ resp = {
+ object: "list",
</file context>
| @@ -0,0 +1,90 @@ | |||
| # frozen_string_literal: true | |||
There was a problem hiding this comment.
P3: Custom agent: No should in tests
All eight it descriptions in this new spec use "should" phrasing. Per the project's "No should in tests" rule, descriptions must be declarative. Rename them, e.g. "lists thread emails with pagination", "raises when thread_id is missing", "retrieves a thread email", "raises when email_id is missing" (both), "replies with attachments", "forwards an email", and "raises when inbox_id is missing".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes/threads/emails_spec.rb, line 22:
<comment>All eight `it` descriptions in this new spec use "should" phrasing. Per the project's "No `should` in tests" rule, descriptions must be declarative. Rename them, e.g. "lists thread emails with pagination", "raises when thread_id is missing", "retrieves a thread email", "raises when email_id is missing" (both), "replies with attachments", "forwards an email", and "raises when inbox_id is missing".</comment>
<file context>
@@ -0,0 +1,90 @@
+ end
+
+ describe "list" do
+ it "should list thread emails with pagination" do
+ resp = { object: "list", has_more: true, data: [{ "id" => email_id, "direction" => "inbound" }] }
+ expect_request("inboxes/#{inbox_id}/threads/#{thread_id}/emails?limit=1", {}, "get", resp)
</file context>
| end | ||
|
|
||
| describe "create" do | ||
| it "should create an inbox" do |
There was a problem hiding this comment.
P3: Custom agent: No should in tests
All 8 it descriptions in this file use "should" (e.g., "should create an inbox", "should list inboxes"). Per the project's test-naming rule, use declarative phrasing instead: it "creates an inbox", it "lists inboxes", it "passes pagination parameters", it "retrieves an inbox by id", it "encodes an email address", it "updates an inbox", it "raises when inbox_id is missing", it "removes an inbox".
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes_spec.rb, line 17:
<comment>All 8 `it` descriptions in this file use "should" (e.g., `"should create an inbox"`, `"should list inboxes"`). Per the project's test-naming rule, use declarative phrasing instead: `it "creates an inbox"`, `it "lists inboxes"`, `it "passes pagination parameters"`, `it "retrieves an inbox by id"`, `it "encodes an email address"`, `it "updates an inbox"`, `it "raises when inbox_id is missing"`, `it "removes an inbox"`.</comment>
<file context>
@@ -0,0 +1,95 @@
+ end
+
+ describe "create" do
+ it "should create an inbox" do
+ params = { email_address: "support@acme.com", name: "Customer Support", from_name: "Ada", forwarding: true }
+ expect_request("inboxes", params, "post", { object: "inbox", id: inbox_id })
</file context>
| it "should create an inbox" do | |
| it "creates an inbox" do |
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
2 existing issues remain and no new issues found across 5 files (changes from recent commits).
Confidence score: 5/5
- The new test names in
spec/inboxes/threads_spec.rbandspec/inboxes/drafts_spec.rbuse “should,” which violates the test naming rule. Rename them with declarative descriptions.
Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
… reply and forward
There was a problem hiding this comment.
2 existing issues remain and no new issues found across 4 files (changes from recent commits).
Confidence score: 5/5
- The new test descriptions in
spec/inboxes/threads/emails_spec.rbandspec/inboxes/drafts_spec.rbuse “should,” contrary to the repository’s naming convention. Rename them declaratively.
Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
2 existing issues remain and no new issues found across 4 files (changes from recent commits).
Confidence score: 5/5
- The new test descriptions in
spec/inboxes/threads/emails_spec.rbandspec/inboxes/drafts_spec.rbuse “should,” which violates the repo’s test-naming rule. Rephrase them declaratively.
Requires human review: Auto-approval blocked by 7 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Confidence score: 5/5
- The
@optiontype inlib/resend/inboxes/drafts.rbstill excludesnil, so the generated API docs misrepresent the new claim. Includenilin the type.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="lib/resend/inboxes/drafts.rb">
<violation number="1" location="lib/resend/inboxes/drafts.rb:103">
P3: The option type still excludes `nil`, contradicting this new claim and misrepresenting the generated API docs. Update the `@option` type to include `nil`.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| # @option params [String, nil] :html the HTML body. Pass nil to clear | ||
| # @option params [String, nil] :text the plain text body. Pass nil to clear | ||
| # @option params [Array<Hash>] :attachments files to store on the draft, as in {create}. Sending | ||
| # the field replaces every attachment on the draft. Send [] or nil to remove them all |
There was a problem hiding this comment.
P3: The option type still excludes nil, contradicting this new claim and misrepresenting the generated API docs. Update the @option type to include nil.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At lib/resend/inboxes/drafts.rb, line 103:
<comment>The option type still excludes `nil`, contradicting this new claim and misrepresenting the generated API docs. Update the `@option` type to include `nil`.</comment>
<file context>
@@ -99,7 +100,7 @@ def get(params = {})
# @option params [String, nil] :text the plain text body. Pass nil to clear
# @option params [Array<Hash>] :attachments files to store on the draft, as in {create}. Sending
- # the field replaces every attachment on the draft. Send [] to remove them all
+ # the field replaces every attachment on the draft. Send [] or nil to remove them all
#
# https://resend.com/docs/api-reference/inboxes/update-draft
</file context>
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval blocked by 8 unresolved issues from previous reviews.
View guided diff | Re-trigger cubic
dielduarte
left a comment
There was a problem hiding this comment.
Some findings so far in code, I tested locally and behavior wise is all good tho.
- Attachment doc text: the doc comment on draft attachments, drafts.rb:52-54, says "a path or content_id returns a 422". The spec says a path without content returns a 422, and path is ignored when content is also sent.
- Nits:
- folders: [] is sent as folders=
- the search tests don't cover the to, cc, bcc, labels and read filters
- only draft send's test checks the Idempotency-Key header itself
Follow resend-openapi #137 and resend-node 7943103: - Every inbox route takes the Inbox ID or the inbox email address. `Resend::Inboxes.path` encodes it once for every module. - Agent: document `actions`, the `archive` and `move_to_trash` actions, and the four `tone` presets. - Add `Resend::Inboxes::Threads::Labels` with `add`, `set` and `remove`. Thread update no longer documents `add_label_ids` or `remove_label_ids`. - Reply and forward no longer cap attachments at 10 files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
3 existing issues remain and 3 new issues found across 13 files (changes from recent commits).
Confidence score: 4/5
- In
examples/inboxes.rb, the cleanup still calls the removedThreads.updateAPI, so the example will fail. UseThreads::Labels.removefor cleanup. - In
lib/resend.rb, the new Inboxes operations may require full-access API keys. Confirm production keys have the required permissions. - Several new test descriptions still use “should,” contrary to the project convention. Rename them declaratively in
spec/inboxes/threads/labels_spec.rb,spec/inboxes/threads_spec.rb,spec/inboxes_spec.rb, andspec/inboxes/agent_spec.rb.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="examples/inboxes.rb">
<violation number="1" location="examples/inboxes.rb:34">
P2: The example adds the label through the new endpoint, but its later `Threads.update(... remove_label_ids: ...)` cleanup still uses the removed API and will fail. Replace that cleanup call with `Threads::Labels.remove`.</violation>
</file>
<file name="spec/inboxes/threads/labels_spec.rb">
<violation number="1" location="spec/inboxes/threads/labels_spec.rb:21">
P2: Custom agent: **No `should` in tests**
All nine `it` descriptions in this file start with "should" (e.g., "should add labels to a thread", "should raise when labels is missing"). Rename them declaratively per the project rule: "adds labels to a thread", "raises when labels is missing", "removes a label from a thread", etc.</violation>
</file>
<file name="lib/resend.rb">
<violation number="1" location="lib/resend.rb:50">
P2: Custom agent: **API Key Permission Check SDK Methods**
Please confirm production API keys have the permissions required by the new Inboxes operations; Resend restricts most of these endpoints to full-access keys.</violation>
</file>
Requires human review: Auto-approval blocked because this review re-detected 3 unresolved issues already reported by Cubic.
View guided diff | Re-trigger cubic
|
|
||
| if (thread_id = threads[:data].first&.dig("id")) | ||
| Resend::Inboxes::Threads.update({ inbox_id: inbox_id, thread_id: thread_id, read: true }) | ||
| thread_labels = Resend::Inboxes::Threads::Labels.add({ inbox_id: inbox_id, thread_id: thread_id, labels: [label[:id]] }) |
There was a problem hiding this comment.
P2: The example adds the label through the new endpoint, but its later Threads.update(... remove_label_ids: ...) cleanup still uses the removed API and will fail. Replace that cleanup call with Threads::Labels.remove.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At examples/inboxes.rb, line 34:
<comment>The example adds the label through the new endpoint, but its later `Threads.update(... remove_label_ids: ...)` cleanup still uses the removed API and will fail. Replace that cleanup call with `Threads::Labels.remove`.</comment>
<file context>
@@ -30,7 +30,9 @@
if (thread_id = threads[:data].first&.dig("id"))
- Resend::Inboxes::Threads.update({ inbox_id: inbox_id, thread_id: thread_id, read: true, add_label_ids: [label[:id]] })
+ Resend::Inboxes::Threads.update({ inbox_id: inbox_id, thread_id: thread_id, read: true })
+ thread_labels = Resend::Inboxes::Threads::Labels.add({ inbox_id: inbox_id, thread_id: thread_id, labels: [label[:id]] })
+ puts "thread labels: #{thread_labels[:data].length}"
</file context>
| end | ||
|
|
||
| describe "add" do | ||
| it "should add labels to a thread" do |
There was a problem hiding this comment.
P2: Custom agent: No should in tests
All nine it descriptions in this file start with "should" (e.g., "should add labels to a thread", "should raise when labels is missing"). Rename them declaratively per the project rule: "adds labels to a thread", "raises when labels is missing", "removes a label from a thread", etc.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At spec/inboxes/threads/labels_spec.rb, line 21:
<comment>All nine `it` descriptions in this file start with "should" (e.g., "should add labels to a thread", "should raise when labels is missing"). Rename them declaratively per the project rule: "adds labels to a thread", "raises when labels is missing", "removes a label from a thread", etc.</comment>
<file context>
@@ -0,0 +1,83 @@
+ end
+
+ describe "add" do
+ it "should add labels to a thread" do
+ expect_request(labels_path, { labels: [label_id] }, "post", label_list)
+
</file context>
| it "should add labels to a thread" do | |
| it "adds labels to a thread" do |
| require "resend/inboxes/labels" | ||
| require "resend/inboxes/threads" | ||
| require "resend/inboxes/threads/emails" | ||
| require "resend/inboxes/threads/labels" |
There was a problem hiding this comment.
P2: Custom agent: API Key Permission Check SDK Methods
Please confirm production API keys have the permissions required by the new Inboxes operations; Resend restricts most of these endpoints to full-access keys.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At lib/resend.rb, line 50:
<comment>Please confirm production API keys have the permissions required by the new Inboxes operations; Resend restricts most of these endpoints to full-access keys.</comment>
<file context>
@@ -47,6 +47,7 @@
require "resend/inboxes/labels"
require "resend/inboxes/threads"
require "resend/inboxes/threads/emails"
+require "resend/inboxes/threads/labels"
require "resend/inboxes/drafts"
</file context>
Summary
Add the Inboxes API to the Ruby SDK. The PR covers the 26 routes under
/inboxes. The names follow the Node SDK preview (resend.inboxes.*) and the nested modules of this SDK.Resend::Inboxes:create,list,get,update,remove.gettakes an inbox ID or an email address.Resend::Inboxes::Agent:get,update.Resend::Inboxes::Labels:list,create,update,remove.Resend::Inboxes::Threads:list,search,get,update,remove. Array filters (folders,labels,from,to,cc,bcc) go out as one comma-separated value.Resend::Inboxes::Threads::Emails:list,get,reply,forward. Reply and forward acceptattachments.Resend::Inboxes::Drafts:list,create,get,update,remove,send. Create and update acceptattachments. On update,attachmentsreplaces every attachment on the draft, and[]removes them all.Nested methods take one params hash with the path IDs (
inbox_id,thread_id,email_id,label_id,draft_id). A missing path ID raisesArgumentError, as inContacts::Segments. The other keys go to the API as they are, sonilclears a field where the API allows it.Thread update accepts
read,folder,add_label_idsandremove_label_ids. The API removedlabel_id, so the SDK does not document it.Draft create, draft send, reply and forward take
options: { idempotency_key: "..." }, the same way asResend::Emails.send. The params hash then needs braces, as withEmails.send.Reply, forward and draft send accept
headers, a hash of string values, as onResend::Emails.send. Draft send sends a body only whenheadersis set.In-Reply-To,ReferencesandReply-Toare reserved, and the API returns 422 for them.The PR also adds
examples/inboxes.rband bumps the version to 1.18.0.Depends on
add_label_idsandremove_label_idson thread update.headerson reply, forward and draft send.Idempotency-Keyheader on draft create, draft send, reply and forward.Verification
Result: rubocop has no offenses. 466 examples, 0 failures.
End to end against https://api.resend.com with the shared test team, through the built code (
bundle exec ruby -I lib e2e.rb). 39 calls, 0 failures.You have reached the inbox limit of your plan.#E93D82), list, update, remove.from,has_attachmentandstart_date, list withfoldersandread, list bylabels, get, updatereadandfolder, remove.add_label_idsadds the label,remove_label_idsremoves it, and the label still exists after. A body with the same ID in both arrays returns 422.delivered@resend.dev.[]empties it, send with one attachment. A second draft created and removed.Idempotency: a draft created twice with one key gives one draft and
idempotent-replayed: true. A draft sent twice with one key returns the same email id. The same key with a different body returns 409.Headers: a reply with
X-Ticket-Idgoes todelivered@resend.dev. A draft sends withX-Ticket-Id. A reply withreply-toinheadersreturns 422.examples/inboxes.rbalso runs against the test inbox, with the inbox create and remove replaced by the existing inbox.The e2e script removed every label, thread and draft it made. It is not in this PR.
Not in this PR
Resend::Webhooks.verifyworks for theinbox.*events as it is.