Skip to content

Commit 1239d82

Browse files
committed
remove AI slop, actually validate API key
1 parent 1566ff0 commit 1239d82

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

workos/api_keys.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class ApiKeysModule(Protocol):
11-
def validate_api_key(self) -> SyncOrAsync[ApiKey]:
11+
def validate_api_key(self, *, value: str) -> SyncOrAsync[ApiKey]:
1212
"""Validates the configured API key.
1313
1414
Returns:
@@ -31,13 +31,12 @@ class ApiKeys(ApiKeysModule):
3131
def __init__(self, http_client: SyncHTTPClient):
3232
self._http_client = http_client
3333

34-
def validate_api_key(self) -> ApiKey:
34+
def validate_api_key(self, *, value: str) -> ApiKey:
3535
response = self._http_client.request(
36-
"api_keys/validate",
37-
method=REQUEST_METHOD_POST,
36+
"api_keys/validations", method=REQUEST_METHOD_POST, json={
37+
"value": value}
3838
)
39-
40-
return ApiKey.model_validate(response)
39+
return ApiKey.model_validate(response["api_key"])
4140

4241

4342
class AsyncApiKeys(ApiKeysModule):
@@ -46,10 +45,9 @@ class AsyncApiKeys(ApiKeysModule):
4645
def __init__(self, http_client: AsyncHTTPClient):
4746
self._http_client = http_client
4847

49-
async def validate_api_key(self) -> ApiKey:
48+
async def validate_api_key(self, *, value: str) -> ApiKey:
5049
response = await self._http_client.request(
51-
"api_keys/validate",
52-
method=REQUEST_METHOD_POST,
50+
"api_keys/validations", method=REQUEST_METHOD_POST, json={
51+
"value": value}
5352
)
54-
55-
return ApiKey.model_validate(response)
53+
return ApiKey.model_validate(response["api_key"])

0 commit comments

Comments
 (0)