Skip to content

Commit a91d91e

Browse files
feat(api): api update (#107)
1 parent ae147ae commit a91d91e

File tree

8 files changed

+70
-16
lines changed

8 files changed

+70
-16
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
configured_endpoints: 36
2-
openapi_spec_hash: 8ef89533cd58e3b2ceb53a877832f48b
2+
openapi_spec_hash: ee7ad81c8308305b6a609a18615ae394
33
config_hash: adbedb6317fca6f566f54564cc341846

api.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,18 @@ Methods:
135135
Types:
136136

137137
```python
138-
from codex.types import ProjectReturnSchema, ProjectListResponse, ProjectExportResponse
138+
from codex.types import (
139+
ProjectReturnSchema,
140+
ProjectRetrieveResponse,
141+
ProjectListResponse,
142+
ProjectExportResponse,
143+
)
139144
```
140145

141146
Methods:
142147

143148
- <code title="post /api/projects/">client.projects.<a href="./src/codex/resources/projects/projects.py">create</a>(\*\*<a href="src/codex/types/project_create_params.py">params</a>) -> <a href="./src/codex/types/project_return_schema.py">ProjectReturnSchema</a></code>
144-
- <code title="get /api/projects/{project_id}">client.projects.<a href="./src/codex/resources/projects/projects.py">retrieve</a>(project_id) -> <a href="./src/codex/types/project_return_schema.py">ProjectReturnSchema</a></code>
149+
- <code title="get /api/projects/{project_id}">client.projects.<a href="./src/codex/resources/projects/projects.py">retrieve</a>(project_id) -> <a href="./src/codex/types/project_retrieve_response.py">ProjectRetrieveResponse</a></code>
145150
- <code title="put /api/projects/{project_id}">client.projects.<a href="./src/codex/resources/projects/projects.py">update</a>(project_id, \*\*<a href="src/codex/types/project_update_params.py">params</a>) -> <a href="./src/codex/types/project_return_schema.py">ProjectReturnSchema</a></code>
146151
- <code title="get /api/projects/">client.projects.<a href="./src/codex/resources/projects/projects.py">list</a>(\*\*<a href="src/codex/types/project_list_params.py">params</a>) -> <a href="./src/codex/types/project_list_response.py">ProjectListResponse</a></code>
147152
- <code title="delete /api/projects/{project_id}">client.projects.<a href="./src/codex/resources/projects/projects.py">delete</a>(project_id) -> None</code>

src/codex/resources/projects/clusters.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ def list(
5353
limit: int | NotGiven = NOT_GIVEN,
5454
offset: int | NotGiven = NOT_GIVEN,
5555
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
56-
sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count"]] | NotGiven = NOT_GIVEN,
56+
sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count", "custom_rank"]]
57+
| NotGiven = NOT_GIVEN,
5758
states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] | NotGiven = NOT_GIVEN,
5859
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5960
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -164,7 +165,8 @@ def list(
164165
limit: int | NotGiven = NOT_GIVEN,
165166
offset: int | NotGiven = NOT_GIVEN,
166167
order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
167-
sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count"]] | NotGiven = NOT_GIVEN,
168+
sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count", "custom_rank"]]
169+
| NotGiven = NOT_GIVEN,
168170
states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] | NotGiven = NOT_GIVEN,
169171
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
170172
# The extra values given here take precedence over values defined on the client or passed to this method.

src/codex/resources/projects/projects.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from ..._base_client import make_request_options
4949
from ...types.project_list_response import ProjectListResponse
5050
from ...types.project_return_schema import ProjectReturnSchema
51+
from ...types.project_retrieve_response import ProjectRetrieveResponse
5152

5253
__all__ = ["ProjectsResource", "AsyncProjectsResource"]
5354

@@ -137,7 +138,7 @@ def retrieve(
137138
extra_query: Query | None = None,
138139
extra_body: Body | None = None,
139140
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
140-
) -> ProjectReturnSchema:
141+
) -> ProjectRetrieveResponse:
141142
"""
142143
Get a single project.
143144
@@ -157,7 +158,7 @@ def retrieve(
157158
options=make_request_options(
158159
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
159160
),
160-
cast_to=ProjectReturnSchema,
161+
cast_to=ProjectRetrieveResponse,
161162
)
162163

163164
def update(
@@ -409,7 +410,7 @@ async def retrieve(
409410
extra_query: Query | None = None,
410411
extra_body: Body | None = None,
411412
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
412-
) -> ProjectReturnSchema:
413+
) -> ProjectRetrieveResponse:
413414
"""
414415
Get a single project.
415416
@@ -429,7 +430,7 @@ async def retrieve(
429430
options=make_request_options(
430431
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
431432
),
432-
cast_to=ProjectReturnSchema,
433+
cast_to=ProjectRetrieveResponse,
433434
)
434435

435436
async def update(

src/codex/types/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
from .project_list_response import ProjectListResponse as ProjectListResponse
1414
from .project_return_schema import ProjectReturnSchema as ProjectReturnSchema
1515
from .project_update_params import ProjectUpdateParams as ProjectUpdateParams
16+
from .project_retrieve_response import ProjectRetrieveResponse as ProjectRetrieveResponse
1617
from .organization_schema_public import OrganizationSchemaPublic as OrganizationSchemaPublic
1718
from .user_activate_account_params import UserActivateAccountParams as UserActivateAccountParams
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from datetime import datetime
5+
6+
from .._models import BaseModel
7+
8+
__all__ = ["ProjectRetrieveResponse", "Config"]
9+
10+
11+
class Config(BaseModel):
12+
clustering_use_llm_matching: Optional[bool] = None
13+
14+
llm_matching_model: Optional[str] = None
15+
16+
llm_matching_quality_preset: Optional[str] = None
17+
18+
lower_llm_match_distance_threshold: Optional[float] = None
19+
20+
max_distance: Optional[float] = None
21+
22+
query_use_llm_matching: Optional[bool] = None
23+
24+
upper_llm_match_distance_threshold: Optional[float] = None
25+
26+
27+
class ProjectRetrieveResponse(BaseModel):
28+
id: str
29+
30+
config: Config
31+
32+
created_at: datetime
33+
34+
created_by_user_id: str
35+
36+
name: str
37+
38+
organization_id: str
39+
40+
updated_at: datetime
41+
42+
custom_rank_enabled: Optional[bool] = None
43+
44+
description: Optional[str] = None

src/codex/types/projects/cluster_list_params.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ class ClusterListParams(TypedDict, total=False):
1515

1616
order: Literal["asc", "desc"]
1717

18-
sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count"]]
18+
sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count", "custom_rank"]]
1919

2020
states: List[Literal["unanswered", "draft", "published", "published_with_draft"]]

tests/api_resources/test_projects.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from codex.types import (
1212
ProjectListResponse,
1313
ProjectReturnSchema,
14+
ProjectRetrieveResponse,
1415
)
1516
from tests.utils import assert_matches_type
1617

@@ -85,7 +86,7 @@ def test_method_retrieve(self, client: Codex) -> None:
8586
project = client.projects.retrieve(
8687
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
8788
)
88-
assert_matches_type(ProjectReturnSchema, project, path=["response"])
89+
assert_matches_type(ProjectRetrieveResponse, project, path=["response"])
8990

9091
@pytest.mark.skip()
9192
@parametrize
@@ -97,7 +98,7 @@ def test_raw_response_retrieve(self, client: Codex) -> None:
9798
assert response.is_closed is True
9899
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
99100
project = response.parse()
100-
assert_matches_type(ProjectReturnSchema, project, path=["response"])
101+
assert_matches_type(ProjectRetrieveResponse, project, path=["response"])
101102

102103
@pytest.mark.skip()
103104
@parametrize
@@ -109,7 +110,7 @@ def test_streaming_response_retrieve(self, client: Codex) -> None:
109110
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
110111

111112
project = response.parse()
112-
assert_matches_type(ProjectReturnSchema, project, path=["response"])
113+
assert_matches_type(ProjectRetrieveResponse, project, path=["response"])
113114

114115
assert cast(Any, response.is_closed) is True
115116

@@ -391,7 +392,7 @@ async def test_method_retrieve(self, async_client: AsyncCodex) -> None:
391392
project = await async_client.projects.retrieve(
392393
"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
393394
)
394-
assert_matches_type(ProjectReturnSchema, project, path=["response"])
395+
assert_matches_type(ProjectRetrieveResponse, project, path=["response"])
395396

396397
@pytest.mark.skip()
397398
@parametrize
@@ -403,7 +404,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None:
403404
assert response.is_closed is True
404405
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
405406
project = await response.parse()
406-
assert_matches_type(ProjectReturnSchema, project, path=["response"])
407+
assert_matches_type(ProjectRetrieveResponse, project, path=["response"])
407408

408409
@pytest.mark.skip()
409410
@parametrize
@@ -415,7 +416,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncCodex) -> No
415416
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
416417

417418
project = await response.parse()
418-
assert_matches_type(ProjectReturnSchema, project, path=["response"])
419+
assert_matches_type(ProjectRetrieveResponse, project, path=["response"])
419420

420421
assert cast(Any, response.is_closed) is True
421422

0 commit comments

Comments
 (0)