Skip to content

Commit efdf866

Browse files
feat(api): api update (#33)
1 parent 62b77b8 commit efdf866

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Methods:
108108
- <code title="put /api/projects/{project_id}/access_keys/{access_key_id}">client.projects.access_keys.<a href="./src/codex/resources/projects/access_keys.py">update</a>(access_key_id, \*, project_id, \*\*<a href="src/codex/types/projects/access_key_update_params.py">params</a>) -> <a href="./src/codex/types/projects/access_key_schema.py">AccessKeySchema</a></code>
109109
- <code title="get /api/projects/{project_id}/access_keys/">client.projects.access_keys.<a href="./src/codex/resources/projects/access_keys.py">list</a>(project_id) -> <a href="./src/codex/types/projects/access_key_list_response.py">AccessKeyListResponse</a></code>
110110
- <code title="delete /api/projects/{project_id}/access_keys/{access_key_id}">client.projects.access_keys.<a href="./src/codex/resources/projects/access_keys.py">delete</a>(access_key_id, \*, project_id) -> None</code>
111-
- <code title="get /api/projects/id_from_access_key">client.projects.access_keys.<a href="./src/codex/resources/projects/access_keys.py">retrieve_project_id</a>() -> str</code>
111+
- <code title="get /api/projects/id_from_access_key">client.projects.access_keys.<a href="./src/codex/resources/projects/access_keys.py">retrieve_project_id</a>() -> <a href="./src/codex/types/projects/access_key_retrieve_project_id_response.py">AccessKeyRetrieveProjectIDResponse</a></code>
112112
- <code title="post /api/projects/{project_id}/access_keys/{access_key_id}/revoke">client.projects.access_keys.<a href="./src/codex/resources/projects/access_keys.py">revoke</a>(access_key_id, \*, project_id) -> None</code>
113113

114114
## Entries

src/codex/resources/projects/access_keys.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from ...types.projects import access_key_create_params, access_key_update_params
2525
from ...types.projects.access_key_schema import AccessKeySchema
2626
from ...types.projects.access_key_list_response import AccessKeyListResponse
27+
from ...types.projects.access_key_retrieve_project_id_response import AccessKeyRetrieveProjectIDResponse
2728

2829
__all__ = ["AccessKeysResource", "AsyncAccessKeysResource"]
2930

@@ -254,14 +255,14 @@ def retrieve_project_id(
254255
extra_query: Query | None = None,
255256
extra_body: Body | None = None,
256257
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
257-
) -> str:
258+
) -> AccessKeyRetrieveProjectIDResponse:
258259
"""Get the project ID from an access key."""
259260
return self._get(
260261
"/api/projects/id_from_access_key",
261262
options=make_request_options(
262263
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
263264
),
264-
cast_to=str,
265+
cast_to=AccessKeyRetrieveProjectIDResponse,
265266
)
266267

267268
def revoke(
@@ -528,14 +529,14 @@ async def retrieve_project_id(
528529
extra_query: Query | None = None,
529530
extra_body: Body | None = None,
530531
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
531-
) -> str:
532+
) -> AccessKeyRetrieveProjectIDResponse:
532533
"""Get the project ID from an access key."""
533534
return await self._get(
534535
"/api/projects/id_from_access_key",
535536
options=make_request_options(
536537
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
537538
),
538-
cast_to=str,
539+
cast_to=AccessKeyRetrieveProjectIDResponse,
539540
)
540541

541542
async def revoke(
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing_extensions import TypeAlias
3+
4+
from ..._models import BaseModel
45

56
__all__ = ["AccessKeyRetrieveProjectIDResponse"]
67

7-
AccessKeyRetrieveProjectIDResponse: TypeAlias = str
8+
9+
class AccessKeyRetrieveProjectIDResponse(BaseModel):
10+
project_id: str

tests/api_resources/projects/test_access_keys.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from codex.types.projects import (
1414
AccessKeySchema,
1515
AccessKeyListResponse,
16+
AccessKeyRetrieveProjectIDResponse,
1617
)
1718

1819
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -297,7 +298,7 @@ def test_path_params_delete(self, client: Codex) -> None:
297298
@parametrize
298299
def test_method_retrieve_project_id(self, client: Codex) -> None:
299300
access_key = client.projects.access_keys.retrieve_project_id()
300-
assert_matches_type(str, access_key, path=["response"])
301+
assert_matches_type(AccessKeyRetrieveProjectIDResponse, access_key, path=["response"])
301302

302303
@pytest.mark.skip()
303304
@parametrize
@@ -307,7 +308,7 @@ def test_raw_response_retrieve_project_id(self, client: Codex) -> None:
307308
assert response.is_closed is True
308309
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
309310
access_key = response.parse()
310-
assert_matches_type(str, access_key, path=["response"])
311+
assert_matches_type(AccessKeyRetrieveProjectIDResponse, access_key, path=["response"])
311312

312313
@pytest.mark.skip()
313314
@parametrize
@@ -317,7 +318,7 @@ def test_streaming_response_retrieve_project_id(self, client: Codex) -> None:
317318
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
318319

319320
access_key = response.parse()
320-
assert_matches_type(str, access_key, path=["response"])
321+
assert_matches_type(AccessKeyRetrieveProjectIDResponse, access_key, path=["response"])
321322

322323
assert cast(Any, response.is_closed) is True
323324

@@ -653,7 +654,7 @@ async def test_path_params_delete(self, async_client: AsyncCodex) -> None:
653654
@parametrize
654655
async def test_method_retrieve_project_id(self, async_client: AsyncCodex) -> None:
655656
access_key = await async_client.projects.access_keys.retrieve_project_id()
656-
assert_matches_type(str, access_key, path=["response"])
657+
assert_matches_type(AccessKeyRetrieveProjectIDResponse, access_key, path=["response"])
657658

658659
@pytest.mark.skip()
659660
@parametrize
@@ -663,7 +664,7 @@ async def test_raw_response_retrieve_project_id(self, async_client: AsyncCodex)
663664
assert response.is_closed is True
664665
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
665666
access_key = await response.parse()
666-
assert_matches_type(str, access_key, path=["response"])
667+
assert_matches_type(AccessKeyRetrieveProjectIDResponse, access_key, path=["response"])
667668

668669
@pytest.mark.skip()
669670
@parametrize
@@ -673,7 +674,7 @@ async def test_streaming_response_retrieve_project_id(self, async_client: AsyncC
673674
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
674675

675676
access_key = await response.parse()
676-
assert_matches_type(str, access_key, path=["response"])
677+
assert_matches_type(AccessKeyRetrieveProjectIDResponse, access_key, path=["response"])
677678

678679
assert cast(Any, response.is_closed) is True
679680

0 commit comments

Comments
 (0)