Conversation
…s/copy)
Extends the existing TokensNamespace (JWT creation, static token
declaration) with operations on tokens the SDK already references:
list, get, scopes, refresh, revoke, and copy, matching
tb token ls/rm/refresh/scopes/copy. Verified the real endpoint contract
(GET/DELETE /v0/tokens/{name}, POST /v0/tokens/{name}/refresh) against
the vendored Forward CLI client rather than guessing.
tb token copy writes the token value to the system clipboard, which
has no equivalent in a library; client.tokens.copy() returns the same
underlying value instead.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
define_token) but had no way to manage tokens it created afterward. Extends the existingTokensNamespace(client.tokens) withlist(),get(name),scopes(name),refresh(name),revoke(name), andcopy(name), matchingtb token ls/rm/refresh/scopes/copy.TinybirdApi.list_tokens(),get_token(),refresh_token(),revoke_token()wrappingGET /v0/tokens,GET/DELETE /v0/tokens/{name}, andPOST /v0/tokens/{name}/refresh, following the existingcreate_tokenrequest-building conventions.Verified the real contract instead of guessing: read the vendored Forward CLI client (
tinybird/tb/client.py/tinybird/tb/modules/token.pyin this project's own dependency tree) to confirm endpoint paths, methods, and — importantly — whattb token copyactually does.Note on
copy:tb token copycopies the token's value to the system clipboard viapyperclip— it does not duplicate a token under a new name, as the ticket's phrasing might suggest. A library has no clipboard, soclient.tokens.copy(name)returns the token's current value instead (same underlying datatb token copyputs on the clipboard), for the caller to use or store as needed. Documented clearly in the README so no one goes looking for clipboard behavior.revokemaps toDELETE /v0/tokens/{name}— there's no separate "revoke" endpoint distinct from delete in the real API; namedrevokeper the ticket's own wording since that's the more accurate verb for a bearer token (there's nothing to restore).Checklist
lint,typecheck,test,secrets)pre-commit run --all-filespasses locally (gitleaks step fails in this sandbox on an unrelated SSL/network error fetching its environment — not a code issue)README.md/CONTRIBUTING.md) if neededCHANGELOG.mdwas updated when user-facing behavior changed