Basketball-API client with Keycloak auth #5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Feature
Lineage
Depends on forgejo_admin/westside-ai-assistant #4 (scaffold). Keycloak client provisioned by #1.
Repo
forgejo_admin/westside-ai-assistantUser Story
As Marcus (admin)
I want the AI to authenticate to basketball-api and call its endpoints
So that the AI can read and write program data on my behalf
Context
The AI assistant needs an HTTP client that authenticates to basketball-api via Keycloak client credentials flow. The client
westside-ai-botin thewestside-basketballrealm has admin role (provisioned by ticket #1). The client caches tokens and refreshes 30s before expiry. Each basketball-api operation gets a typed function. Tenant slug is hardcoded to "westside-kings-queens" (the only tenant).File Targets
Files the agent should create:
app/basketball.py— async httpx client class with Keycloak token management and operation functionstests/test_basketball.py— unit tests with mocked HTTP responsesFiles the agent should modify:
requirements.txt— ensure httpx is listed (should already be from #4)Files the agent should NOT touch:
app/groupme.py— wiring happens in #6Acceptance Criteria
{KEYCLOAK_REALM_URL}/protocol/openid-connect/tokenEndpoint Reference Table
Reads:
Writes:
Test Expectations
pytest tests/test_basketball.py -vConstraints
Checklist
Related
project-westside-ai-assistant— parent projectarch-domain-westside-ai-assistant— A3: Basketball-API ClientScope Review: NEEDS_REFINEMENT
Review note:
review-597-2026-03-28Ticket is well-structured but missing critical endpoint mapping details that would cause an agent to guess URLs incorrectly.
westside-ai-botKeycloak client. Clarify whether #1 handles this or if a new ticket is needed.tenant_idortenant_slugparams. Issue body doesn't specify how the client resolves tenant identity./admin/,/api/,/tenants/,/tryouts/).assign_tryout_numberis bulk: Actual endpoint bulk-assigns all unassigned players. Rename toassign_tryout_numbers(plural) and note bulk semantics.Scope refinement (review-597-2026-03-28):
assign_tryout_numbertobulk_assign_tryout_numbers— the real endpoint is bulk, not per-playerScope Review: READY
Review note:
review-597-2026-03-28-r2Re-review after refinement. All 4 previous NEEDS_REFINEMENT recommendations resolved:
bulk_assign_tryout_numbersrenamed + BULK note addedThree non-blocking nits noted for agent awareness:
POST /teams/{team_id}/playersandDELETE /teams/{team_id}/players/{player_id}require?tenant_id=query param/teams/,/players/) vs canonical (/api/teams/,/api/players/) — both workassign_player_to_teamactual body schema is{"player_ids": [...]}(list)Ticket is ready for
todo -> next_uppromotion.