From d5806a2fcb9fc77e8ccb6c9293ab891aa7d6fd2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 19:28:25 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- api.md | 9 +++- src/codex/resources/projects/clusters.py | 6 ++- src/codex/resources/projects/projects.py | 9 ++-- src/codex/types/__init__.py | 1 + src/codex/types/project_retrieve_response.py | 44 +++++++++++++++++++ .../types/projects/cluster_list_params.py | 2 +- tests/api_resources/test_projects.py | 13 +++--- 8 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 src/codex/types/project_retrieve_response.py diff --git a/.stats.yml b/.stats.yml index 69bb6fc..4500dc4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,3 +1,3 @@ configured_endpoints: 36 -openapi_spec_hash: 8ef89533cd58e3b2ceb53a877832f48b +openapi_spec_hash: ee7ad81c8308305b6a609a18615ae394 config_hash: adbedb6317fca6f566f54564cc341846 diff --git a/api.md b/api.md index b241c15..e9dd565 100644 --- a/api.md +++ b/api.md @@ -135,13 +135,18 @@ Methods: Types: ```python -from codex.types import ProjectReturnSchema, ProjectListResponse, ProjectExportResponse +from codex.types import ( + ProjectReturnSchema, + ProjectRetrieveResponse, + ProjectListResponse, + ProjectExportResponse, +) ``` Methods: - client.projects.create(\*\*params) -> ProjectReturnSchema -- client.projects.retrieve(project_id) -> ProjectReturnSchema +- client.projects.retrieve(project_id) -> ProjectRetrieveResponse - client.projects.update(project_id, \*\*params) -> ProjectReturnSchema - client.projects.list(\*\*params) -> ProjectListResponse - client.projects.delete(project_id) -> None diff --git a/src/codex/resources/projects/clusters.py b/src/codex/resources/projects/clusters.py index 2faed31..f376c0b 100644 --- a/src/codex/resources/projects/clusters.py +++ b/src/codex/resources/projects/clusters.py @@ -53,7 +53,8 @@ def list( limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count"]] | NotGiven = NOT_GIVEN, + sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count", "custom_rank"]] + | NotGiven = NOT_GIVEN, states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -164,7 +165,8 @@ def list( limit: int | NotGiven = NOT_GIVEN, offset: int | NotGiven = NOT_GIVEN, order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, - sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count"]] | NotGiven = NOT_GIVEN, + sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count", "custom_rank"]] + | NotGiven = NOT_GIVEN, states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] | NotGiven = NOT_GIVEN, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. diff --git a/src/codex/resources/projects/projects.py b/src/codex/resources/projects/projects.py index 8a7ff1b..ccc7726 100644 --- a/src/codex/resources/projects/projects.py +++ b/src/codex/resources/projects/projects.py @@ -48,6 +48,7 @@ from ..._base_client import make_request_options from ...types.project_list_response import ProjectListResponse from ...types.project_return_schema import ProjectReturnSchema +from ...types.project_retrieve_response import ProjectRetrieveResponse __all__ = ["ProjectsResource", "AsyncProjectsResource"] @@ -137,7 +138,7 @@ def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectReturnSchema: + ) -> ProjectRetrieveResponse: """ Get a single project. @@ -157,7 +158,7 @@ def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ProjectReturnSchema, + cast_to=ProjectRetrieveResponse, ) def update( @@ -409,7 +410,7 @@ async def retrieve( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProjectReturnSchema: + ) -> ProjectRetrieveResponse: """ Get a single project. @@ -429,7 +430,7 @@ async def retrieve( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=ProjectReturnSchema, + cast_to=ProjectRetrieveResponse, ) async def update( diff --git a/src/codex/types/__init__.py b/src/codex/types/__init__.py index 8f241bc..6c18437 100644 --- a/src/codex/types/__init__.py +++ b/src/codex/types/__init__.py @@ -13,5 +13,6 @@ from .project_list_response import ProjectListResponse as ProjectListResponse from .project_return_schema import ProjectReturnSchema as ProjectReturnSchema from .project_update_params import ProjectUpdateParams as ProjectUpdateParams +from .project_retrieve_response import ProjectRetrieveResponse as ProjectRetrieveResponse from .organization_schema_public import OrganizationSchemaPublic as OrganizationSchemaPublic from .user_activate_account_params import UserActivateAccountParams as UserActivateAccountParams diff --git a/src/codex/types/project_retrieve_response.py b/src/codex/types/project_retrieve_response.py new file mode 100644 index 0000000..62209d3 --- /dev/null +++ b/src/codex/types/project_retrieve_response.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime + +from .._models import BaseModel + +__all__ = ["ProjectRetrieveResponse", "Config"] + + +class Config(BaseModel): + clustering_use_llm_matching: Optional[bool] = None + + llm_matching_model: Optional[str] = None + + llm_matching_quality_preset: Optional[str] = None + + lower_llm_match_distance_threshold: Optional[float] = None + + max_distance: Optional[float] = None + + query_use_llm_matching: Optional[bool] = None + + upper_llm_match_distance_threshold: Optional[float] = None + + +class ProjectRetrieveResponse(BaseModel): + id: str + + config: Config + + created_at: datetime + + created_by_user_id: str + + name: str + + organization_id: str + + updated_at: datetime + + custom_rank_enabled: Optional[bool] = None + + description: Optional[str] = None diff --git a/src/codex/types/projects/cluster_list_params.py b/src/codex/types/projects/cluster_list_params.py index 4889324..b272d80 100644 --- a/src/codex/types/projects/cluster_list_params.py +++ b/src/codex/types/projects/cluster_list_params.py @@ -15,6 +15,6 @@ class ClusterListParams(TypedDict, total=False): order: Literal["asc", "desc"] - sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count"]] + sort: Optional[Literal["created_at", "answered_at", "cluster_frequency_count", "custom_rank"]] states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] diff --git a/tests/api_resources/test_projects.py b/tests/api_resources/test_projects.py index 210f4e1..1e2fccb 100644 --- a/tests/api_resources/test_projects.py +++ b/tests/api_resources/test_projects.py @@ -11,6 +11,7 @@ from codex.types import ( ProjectListResponse, ProjectReturnSchema, + ProjectRetrieveResponse, ) from tests.utils import assert_matches_type @@ -85,7 +86,7 @@ def test_method_retrieve(self, client: Codex) -> None: project = client.projects.retrieve( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(ProjectReturnSchema, project, path=["response"]) + assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -97,7 +98,7 @@ def test_raw_response_retrieve(self, client: Codex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectReturnSchema, project, path=["response"]) + assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -109,7 +110,7 @@ def test_streaming_response_retrieve(self, client: Codex) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = response.parse() - assert_matches_type(ProjectReturnSchema, project, path=["response"]) + assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True @@ -391,7 +392,7 @@ async def test_method_retrieve(self, async_client: AsyncCodex) -> None: project = await async_client.projects.retrieve( "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", ) - assert_matches_type(ProjectReturnSchema, project, path=["response"]) + assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -403,7 +404,7 @@ async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectReturnSchema, project, path=["response"]) + assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) @pytest.mark.skip() @parametrize @@ -415,7 +416,7 @@ async def test_streaming_response_retrieve(self, async_client: AsyncCodex) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" project = await response.parse() - assert_matches_type(ProjectReturnSchema, project, path=["response"]) + assert_matches_type(ProjectRetrieveResponse, project, path=["response"]) assert cast(Any, response.is_closed) is True