Skip to content

feat: implement automations and events APIs#197

Merged
zenorocha merged 4 commits intomainfrom
feat/automations-events-api
Apr 10, 2026
Merged

feat: implement automations and events APIs#197
zenorocha merged 4 commits intomainfrom
feat/automations-events-api

Conversation

@drish
Copy link
Copy Markdown
Member

@drish drish commented Apr 10, 2026

Summary by cubic

Adds Automations and Events APIs with full sync and async support, including examples and tests. Introduces resend.Automations and resend.Events namespaces and mirrors the Node SDK runs pattern.

  • New Features

    • resend.Automations: create/get/list/update/remove/stop; runs via Automations.Runs.list(id) and Automations.Runs.get(id, run_id); sync and _async variants.
    • resend.Events: create/get/list/update/remove/send; sync and _async variants.
    • New types exported on the package (Automation*, Event*) and resources registered on the main resend client.
    • Added sync/async examples and full tests, including step types: delay (duration string), wait_for_event (timeout string), and send_email with template.id.
  • Refactors

    • Adopt nested runs namespace: Automations.Runs for parity with the Node SDK.
    • Strip path params from PATCH bodies before sending.
    • Align field names with OpenAPI: key, connections, type, template.id.
    • Examples: use distinct loop variable run_step to satisfy mypy.
    • Linting and import cleanups across examples/tests and HTTP client modules; no behavior changes.

Written for commit b4b83f2. Summary will update on new commits.

drish added 4 commits April 10, 2026 20:30
Introduces two new resource namespaces:

- Automations: create, get, list, update, remove, stop, list_runs, get_run
- Events: create, get, list, update, remove, send

Each method has a sync and async (_async) variant. Both resources are
registered on the main resend client and fully exported from the package.

Includes tests (sync + async) for every method and examples covering
all documented step types — delay with duration string, wait_for_event
with timeout string, and send_email with template object.

Field names verified against resend/resend-openapi main:
- Step identifier: key (not ref)
- Connections array: connections (not edges)
- Connection type field: type (not edge_type)
- Send email config: template.id (not template_id)
- PATCH body strips path params (automation_id, identifier) before sending
…lass

Mirror the Node SDK pattern where runs are accessed via a nested namespace:
resend.Automations.Runs.list(id) / resend.Automations.Runs.get(id, run_id)
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 15 files

Confidence score: 3/5

  • There is a concrete runtime risk in resend/automations/_automations.py: except ImportError: pass can leave AsyncRequest undefined, which may trigger a NameError when async automation APIs are used without async extras installed.
  • I’m scoring this as moderate merge risk because the impact is user-facing for a specific configuration path (async usage), even though it is not a universal failure path for all users.
  • Pay close attention to resend/automations/_automations.py - missing async dependency handling can surface as runtime errors instead of a controlled fallback.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="resend/automations/_automations.py">

<violation number="1" location="resend/automations/_automations.py:23">
P2: The `except ImportError: pass` leaves `AsyncRequest` undefined, causing runtime `NameError` when any async API is called without async extras installed.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@zenorocha zenorocha merged commit 645ed28 into main Apr 10, 2026
20 checks passed
@zenorocha zenorocha deleted the feat/automations-events-api branch April 10, 2026 23:56
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