feat(domains): add forge activation methods

LU
3d ago
+169-6

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 full Domain. The return path is optional (with_return_path("send")); a bare new() 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/verify with {"scope":["forge"]}. Scoped, only the Forge record is re-checked, so the records that are already verified are not re-proven. A bare VerifyDomainOptions::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 422 return_path_unavailable. Composes with the other DomainChanges fields.

Part of DEV-2478.

Validation

  • cargo fmt --check, cargo clippy --all-targets -- -Dwarnings (plus the --no-default-features --features rustls-tls and --features blocking variants) and the offline serde tests all pass locally.
  • Tests assert the wire shapes: the empty enable body and return_path mapping, the scoped verify body (and the no-body default), and forge_return_path composed with another change in one PATCH body.

Notes for reviewers

  • verify changed signature to take VerifyDomainOptions, which breaks existing verify(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 keep verify(id) intact, a separate scoped method works too, happy to rework.
  • VerifyDomainScope is an enum with the single Forge variant, serialized as "forge".
  • Happy to drop the version bump commit if you prefer bumping at release time.

The Forge enable endpoint is live in production; the scoped verify and forge_return_path land with the API reshape, which deploys before this ships. Ships with the next resend-rust release.