Skip to content

feat(api): api update #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
configured_endpoints: 36
openapi_spec_hash: 8ef89533cd58e3b2ceb53a877832f48b
openapi_spec_hash: ee7ad81c8308305b6a609a18615ae394
config_hash: adbedb6317fca6f566f54564cc341846
9 changes: 7 additions & 2 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,18 @@ Methods:
Types:

```python
from codex.types import ProjectReturnSchema, ProjectListResponse, ProjectExportResponse
from codex.types import (
ProjectReturnSchema,
ProjectRetrieveResponse,
ProjectListResponse,
ProjectExportResponse,
)
```

Methods:

- <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>
- <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>
- <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>
- <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>
- <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>
- <code title="delete /api/projects/{project_id}">client.projects.<a href="./src/codex/resources/projects/projects.py">delete</a>(project_id) -> None</code>
Expand Down
6 changes: 4 additions & 2 deletions src/codex/resources/projects/clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
9 changes: 5 additions & 4 deletions src/codex/resources/projects/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down Expand Up @@ -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.

Expand All @@ -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(
Expand Down Expand Up @@ -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.

Expand All @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/codex/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
44 changes: 44 additions & 0 deletions src/codex/types/project_retrieve_response.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion src/codex/types/projects/cluster_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]]
13 changes: 7 additions & 6 deletions tests/api_resources/test_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from codex.types import (
ProjectListResponse,
ProjectReturnSchema,
ProjectRetrieveResponse,
)
from tests.utils import assert_matches_type

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down