Skip to content

feat: add OAuth grants management (list + revoke)#233

Open
dielduarte wants to merge 4 commits into
mainfrom
feat/oauth-grants
Open

feat: add OAuth grants management (list + revoke)#233
dielduarte wants to merge 4 commits into
mainfrom
feat/oauth-grants

Conversation

@dielduarte

@dielduarte dielduarte commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds OAuth grant management to the Python SDK, mirroring resend-node#998.

  • resend.OAuthGrants.list(params?)GET /oauth/grants (paginated via limit / before / after)
  • resend.OAuthGrants.revoke(oauth_grant_id)DELETE /oauth/grants/{oauth_grant_id}
  • Async variants: list_async / revoke_async
  • New exported types: OAuthGrant, OAuthGrantClient

Usage

import resend
resend.api_key = "re_..."

grants = resend.OAuthGrants.list({"limit": 20})
resend.OAuthGrants.revoke(oauth_grant_id="grant_id")

Notes

  • resource field omitted. The Node PR still carries it, but per the launch thread it's a dead field being removed from the API everywhere ("assume it doesn't exist"), so it's intentionally not modeled here.
  • Delete method named revoke (not remove) to match the Node SDK and the API semantics — a grant is revoked (it stays in the list with revoked_at set), not deleted.

Docs

Testing

  • 11 new tests (sync + async); full suite: 459 passed
  • mypy --strict clean

Summary by cubic

Adds OAuth grant management to the Python SDK. List grants with pagination and revoke them, sync and async, via resend.OAuthGrants. Includes sync/async usage examples.

  • New Features
    • resend.OAuthGrants.list(params?) → GET /oauth/grants with limit, before, after.
    • resend.OAuthGrants.revoke(oauth_grant_id) → DELETE /oauth/grants/{oauth_grant_id}; revoked grants show revoked_at.
    • Async methods: list_async, revoke_async.
    • Exported from resend and resend.oauth_grants: OAuthGrants, OAuthGrant, OAuthGrantClient; deprecated resource field omitted. Test names updated to drop “should” per project convention.
    • Examples: examples/oauth_grants.py and examples/async/oauth_grants_async.py.

Written for commit 0cbe1c6. Summary will update on new commits.

Review in cubic

@dielduarte dielduarte marked this pull request as ready for review July 8, 2026 20:30

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

Copy link
Copy Markdown
Contributor

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 8 files

Confidence score: 5/5

  • Safe to merge after the addressed issues were fixed.

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

Re-trigger cubic

Comment thread tests/oauth_grants_async_test.py Outdated

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

Copy link
Copy Markdown
Contributor

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).

Requires human review: Adds new OAuth grants feature (list+revoke), new module, types, and version bump. Requires human review to validate API design and production readiness.

Re-trigger cubic

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Jul 9, 2026
Comment thread resend/oauth_grants/__init__.py

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

Copy link
Copy Markdown
Contributor

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).

Auto-approved: Adds OAuth grants list and revoke functionality with sync/async support and tests. No changes to existing core logic.

Re-trigger cubic

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

Copy link
Copy Markdown
Contributor

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).

Auto-approved: Adds new OAuth grants list/revoke endpoints with types, examples, and tests. No changes to core logic or infrastructure; low risk addition to API wrappers.

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants