Conversation
Greptile OverviewGreptile SummaryImplements complete API key management functionality for the WorkOS Python SDK, adding creation and listing methods to the Organizations module and a deletion method to the ApiKeys module. All new methods follow established SDK patterns with both synchronous and asynchronous implementations, proper type definitions, and comprehensive test coverage including auto-pagination tests. Confidence Score: 5/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant Client
participant Organizations
participant ApiKeys
participant HTTPClient
participant WorkOSAPI
Note over Client,WorkOSAPI: Create API Key Flow
Client->>Organizations: create_api_key(org_id, name, permissions)
Organizations->>HTTPClient: POST /organizations/{org_id}/api_keys
HTTPClient->>WorkOSAPI: HTTP Request
WorkOSAPI-->>HTTPClient: ApiKeyWithValue (includes full value)
HTTPClient-->>Organizations: Response
Organizations-->>Client: ApiKeyWithValue
Note over Client,WorkOSAPI: List API Keys Flow
Client->>Organizations: list_api_keys(org_id, limit, before, after, order)
Organizations->>HTTPClient: GET /organizations/{org_id}/api_keys
HTTPClient->>WorkOSAPI: HTTP Request with pagination params
WorkOSAPI-->>HTTPClient: List response with ApiKey objects
HTTPClient-->>Organizations: Response
Organizations-->>Client: WorkOSListResource (supports auto-pagination)
Note over Client,WorkOSAPI: Delete API Key Flow
Client->>ApiKeys: delete_api_key(api_key_id)
ApiKeys->>HTTPClient: DELETE /api_keys/{api_key_id}
HTTPClient->>WorkOSAPI: HTTP Request
WorkOSAPI-->>HTTPClient: 204 No Content
HTTPClient-->>ApiKeys: Response
ApiKeys-->>Client: None
|
8e25de7 to
50e2606
Compare
# Conflicts: # src/workos/types/api_keys/list_filters.py
|
@faroceann - Can we get this merged please? |
| order: PaginationOrder = "desc", | ||
| ) -> ApiKeysListResource: | ||
| list_params: ApiKeyListFilters = { | ||
| "organization_id": organization_id, |
There was a problem hiding this comment.
The pagination docs for this endpoint don't make use of this param.
| order: PaginationOrder = "desc", | ||
| ) -> ApiKeysListResource: | ||
| list_params: ApiKeyListFilters = { | ||
| "organization_id": organization_id, |
There was a problem hiding this comment.
same comment as above here
|
|
||
|
|
||
| class ApiKeyListFilters(ListArgs, total=False): | ||
| organization_id: Optional[str] |
There was a problem hiding this comment.
This shouldn't be needed since the organization ID is part of the URL path, not a query parameter.
Description
Adds full API key management support to the SDK:
Organizations module:
API Keys module:
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.