Skip to content

feat: add EmailMetricsAsync for account-level email metrics - #146

Merged
dielduarte merged 5 commits into
mainfrom
feature/emails-metrics-broadcast-dimension
Aug 24, 2026
Merged

feat: add EmailMetricsAsync for account-level email metrics#146
dielduarte merged 5 commits into
mainfrom
feature/emails-metrics-broadcast-dimension

Conversation

@dielduarte

@dielduarte dielduarte commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Adds EmailMetricsAsync for account-level email metrics via GET /emails/metricsperiod/domain/email/broadcast dimensions, domain_id/email_id/broadcast_id filters (broadcast and email mutually exclusive), hourly/daily/weekly/monthly granularity.

Mirrors resend/resend-node#1079. Spec: resend/resend-openapi#96

Adds EmailMetricsAsync, covering the beta GET /emails/metrics endpoint
ahead of its GA merge: filtering by domain/email/broadcast id, breaking
down by period/domain/email/broadcast dimensions, and metric/granularity/
timezone selection. Includes a fake controller in Resend.ApiServer and
matching tests.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 10 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tools/Resend.ApiServer/Controllers/EmailController.cs Outdated
Comment thread src/Resend/ResendClient.cs Outdated
Drops "beta" language from the metrics docs/comments - the endpoint
isn't beta. Also fixes two review findings: the fake test server now
rejects combining the email/broadcast dimensions or filters (matching
the real API), and start_date/end_date values with Kind.Unspecified
are now sent as UTC as-is instead of being reinterpreted through the
host machine's local offset.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread tests/Resend.Tests/ResendClientTests.Metrics.cs Outdated
…e test

The previous version only compared the round-tripped response value,
which goes through the fake server's own DateTime.Parse().ToUniversalTime()
before coming back - not what this test actually intends to guard. Uses
the existing RecordingHandler pattern (see ApiKeyRequestTests.cs) to
inspect the request that was actually sent instead.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 introduces a new public API feature for account-level email metrics, including new interface methods, data models, and query logic.

Re-trigger cubic

@dielduarte
dielduarte marked this pull request as ready for review August 22, 2026 01:36
The live API returns 422 validation_error for the email+broadcast combination. Align the fake server and both assertions with the real contract.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 a new public EmailMetricsAsync API endpoint method with new request/response models, enums, and query serialization; the delta since prior review only swaps the fake-server validation status code and does not resolve the contract/architecture questions.

Re-trigger cubic

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