feat: add Emails.metrics() for account-level email metrics - #262
Merged
Conversation
Adds GET /emails/metrics support ahead of its GA merge: start/end date, timezone, granularity, metrics, dimensions (period/domain/email/broadcast), and domain_id/email_id/broadcast_id filters, all as comma-joined query params. Sync and async variants included.
The email and broadcast dimensions/filters were only rejected server-side (a 400 from the API). Raise ValueError locally instead, matching how this SDK already reports invalid input elsewhere (e.g. Contacts.update).
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- remove stale beta-endpoint docstring lines, replace with the see-more doc link matching sibling methods - skip empty lists when building the metrics query string, so an explicit dimensions: [] or empty id filter is omitted instead of sent as a bare query param - rename test_should_metrics_raise_exception_when_no_content to drop the disallowed 'should' wording - add async test coverage for metrics_async(), mirroring the sync suite (success, broadcast dimension, all four mutual-exclusivity violations, no-content)
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Requires human review: Auto-approval blocked by 1 unresolved issue from previous reviews.
Re-trigger cubic
dielduarte
marked this pull request as ready for review
August 22, 2026 01:36
…nt-side Feature PRs ship an examples/ entry. The exclusion docstrings said validated server-side, but _validate_metrics_params raises ValueError before the request.
klotty
approved these changes
Aug 24, 2026
klotty
left a comment
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.
Auto-approved: Adds account-level email metrics via new sync and async methods. The change is additive, includes comprehensive tests for parameter validation and API interaction, and follows established SDK patterns.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
Emails.metrics()/metrics_async()for account-level email metrics viaGET /emails/metrics—period/domain/email/broadcastdimensions,domain_id/email_id/broadcast_idfilters (broadcastandemailmutually exclusive),hourly/daily/weekly/monthlygranularity.Mirrors resend/resend-node#1079. Spec: resend/resend-openapi#96