Repository navigation
feat(domains): add forge activation methods - #128
lucasfcosta wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
No issues found across 3 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: This adds new public Forge client methods and a forge_status field, extending the SDK's public API; the author is also holding merge until the remaining Forge endpoints roll out.
View guided diff | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 2 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: Adds new public Forge client methods and request types; the earlier forge_status addition was removed. The author is holding merge until remaining Forge endpoints roll out, and key API behaviors are not verifiable from the diff.
View guided diff | Re-trigger cubic
6cb8305 to
1bc3a53
Compare
There was a problem hiding this comment.
0 issues found across 2 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: Adds new public Forge activation methods and request/status types to the SDK. This expands the public API contract and depends on external Forge API behavior not verifiable from the diff, so it needs human sign-off.
View guided diff | Re-trigger cubic
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1bc3a53 to
add4743
Compare
There was a problem hiding this comment.
0 issues found across 2 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: Adds new public Forge activation methods and types to the SDK, expanding the public API contract for downstream consumers. The external Forge API behaviors are claimed but not verifiable from this diff, so the signature and contract choices need maintainer sign-off.
View guided diff | Re-trigger cubic
Matches the reshaped API: forge keeps only enable_forge (return path optional, the server picks a free DNS label when omitted), verify gains an optional scope of [forge] that re-checks only the Forge record, and DomainChanges gains forge_return_path to move the Forge return path without starting verification. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Confidence score: 4/5
- In
src/domains.rs,with_scope([])sends an empty scope array instead of the documented no-scope request, so the API may reject it or return no records. Normalize an empty iterator toNoneor reject it beforeverify.
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="src/domains.rs">
<violation number="1" location="src/domains.rs:573">
P2: `with_scope([])` sends an empty scope array instead of using the documented no-scope request, which can be rejected by the API or verify no records. Normalize an empty iterator to `None` (or reject it) before `verify` serializes the options.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| /// checked. | ||
| #[inline] | ||
| pub fn with_scope(mut self, scope: impl IntoIterator<Item = VerifyDomainScope>) -> Self { | ||
| self.scope = Some(scope.into_iter().collect()); |
There was a problem hiding this comment.
P2: with_scope([]) sends an empty scope array instead of using the documented no-scope request, which can be rejected by the API or verify no records. Normalize an empty iterator to None (or reject it) before verify serializes the options.
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 src/domains.rs, line 573:
<comment>`with_scope([])` sends an empty scope array instead of using the documented no-scope request, which can be rejected by the API or verify no records. Normalize an empty iterator to `None` (or reject it) before `verify` serializes the options.</comment>
<file context>
@@ -567,6 +541,44 @@ pub mod types {
+ /// checked.
+ #[inline]
+ pub fn with_scope(mut self, scope: impl IntoIterator<Item = VerifyDomainScope>) -> Self {
+ self.scope = Some(scope.into_iter().collect());
+ self
+ }
</file context>
| self.scope = Some(scope.into_iter().collect()); | |
| let scope = scope.into_iter().collect::<Vec<_>>(); | |
| self.scope = (!scope.is_empty()).then_some(scope); |
Summary
Adds Forge activation to
DomainsSvc, matching the folded API surface (the standalone forge verify and update endpoints no longer exist). This is the Rust port of resend/resend-node#1193; the endpoints are specified in resend/resend-openapi#144.resend.domains.enable_forge(id, EnableForgeOptions::new())→POST /domains/:id/forge. Returns the fullDomain. The return path is optional (with_return_path("send")); a barenew()sends an empty body and the API picks a label that is free in the domain's DNS. Idempotent on the API side.resend.domains.verify(id, VerifyDomainOptions::new().with_scope([VerifyDomainScope::Forge]))→POST /domains/:id/verifywith{"scope":["forge"]}. Scoped, only the Forge record is re-checked, so the records that are already verified are not re-proven. A bareVerifyDomainOptions::new()sends no body, preserving the old wire behavior exactly.resend.domains.update(id, DomainChanges::new().with_forge_return_path("outbound"))→PATCH /domains/:id. Moves the Forge return path while the Forge record is still verifying, does not start verification, and once the record verifies the API refuses with 422return_path_unavailable. Composes with the otherDomainChangesfields.Part of DEV-2478.
Validation
cargo fmt --check,cargo clippy --all-targets -- -Dwarnings(plus the--no-default-features --features rustls-tlsand--features blockingvariants) and the offline serde tests all pass locally.return_pathmapping, the scoped verify body (and the no-body default), andforge_return_pathcomposed with another change in one PATCH body.Notes for reviewers
verifychanged signature to takeVerifyDomainOptions, which breaks existingverify(id)callers; the branch already bumps 0.35.2 → 0.36.0, a breaking bump in 0.x, so semver is covered. If you would rather keepverify(id)intact, a separate scoped method works too, happy to rework.VerifyDomainScopeis an enum with the singleForgevariant, serialized as"forge".The Forge enable endpoint is live in production; the scoped verify and
forge_return_pathland with the API reshape, which deploys before this ships. Ships with the next resend-rust release.