feat: add Emails.Metrics for account-level email metrics - #152
Conversation
Adds Emails.Metrics/MetricsWithContext/MetricsWithOptions for the upcoming GET /emails/metrics endpoint. Supports filtering by domain_id/email_id/broadcast_id and grouping by period/domain/email/ broadcast dimensions, ahead of the endpoint's GA merge.
The email and broadcast dimensions/filters are mutually exclusive per the API, but MetricsWithOptions sent the request regardless and let a 400 come back. Validate client-side before the request, mirroring the existing "either/or but not both" pattern in Suppressions.Batch.Remove.
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: Adds support for the new account-level email metrics API, including new service methods, types, and client-side validation.
Re-trigger cubic
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: This PR adds account-level email metrics support to the SDK. Human review is required to verify the new public API design, response type safety, and the implementation of client-side validation logic.
Re-trigger cubic
There was a problem hiding this comment.
a note on go comments:
Go convention requires a doc comment on every exported identifier (types, consts, struct fields). Tooling like golint/staticcheck flags anything exported without one, and it's how godoc.org-style documentation gets generated. This SDK already did this everywhere before this feature, e.g. EmailTemplate, SendEmailRequest, EmailAttachment and their fields all have the same one-line-per-field doc comments already in emails.go.
The emails/metrics slug returns 404. The live page is emails/get-metrics, the same slug the Node SDK links.
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: This PR adds account-level email metrics support. Human review is required to verify the new public API surface, response type safety, and the implementation of client-side validation logic.
Re-trigger cubic
Adds
Emails.MetricsWithOptionsfor 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