From 79f883058cacdd7d63b1878f0630ffedb99c7f40 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Tue, 14 Jan 2025 21:13:59 +0000
Subject: [PATCH] feat: update openapi spec
---
.stats.yml | 2 +-
api.md | 14 +-
src/codex/resources/projects/__init__.py | 14 +
src/codex/resources/projects/entries.py | 738 ++++++++++++++++++
src/codex/resources/projects/projects.py | 32 +
src/codex/types/projects/__init__.py | 7 +
src/codex/types/projects/entry.py | 20 +
.../projects/entry_add_question_params.py | 11 +
.../types/projects/entry_create_params.py | 14 +
src/codex/types/projects/entry_list_params.py | 21 +
.../types/projects/entry_list_response.py | 14 +
.../types/projects/entry_query_params.py | 11 +
.../types/projects/entry_update_params.py | 16 +
tests/api_resources/projects/test_entries.py | 661 ++++++++++++++++
14 files changed, 1572 insertions(+), 3 deletions(-)
create mode 100644 src/codex/resources/projects/entries.py
create mode 100644 src/codex/types/projects/entry.py
create mode 100644 src/codex/types/projects/entry_add_question_params.py
create mode 100644 src/codex/types/projects/entry_create_params.py
create mode 100644 src/codex/types/projects/entry_list_params.py
create mode 100644 src/codex/types/projects/entry_list_response.py
create mode 100644 src/codex/types/projects/entry_query_params.py
create mode 100644 src/codex/types/projects/entry_update_params.py
create mode 100644 tests/api_resources/projects/test_entries.py
diff --git a/.stats.yml b/.stats.yml
index f56fed6..66033eb 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
-configured_endpoints: 22
+configured_endpoints: 29
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cleanlab%2Fcodex-b706b59cb40e75ffd920fc42483227383f9ef24ecb1cb1eb5f9424b388997444.yml
diff --git a/api.md b/api.md
index ff5b8fd..3665b5b 100644
--- a/api.md
+++ b/api.md
@@ -111,10 +111,20 @@ Methods:
- client.projects.access_keys.retrieve_project_id() -> AccessKeyRetrieveProjectIDResponse
- client.projects.access_keys.revoke(access_key_id, \*, project_id) -> None
-## Knowledge
+## Entries
Types:
```python
-from codex.types.projects import Entry
+from codex.types.projects import Entry, EntryListResponse
```
+
+Methods:
+
+- client.projects.entries.create(project_id, \*\*params) -> Entry
+- client.projects.entries.retrieve(entry_id, \*, project_id) -> Entry
+- client.projects.entries.update(entry_id, \*, project_id, \*\*params) -> Entry
+- client.projects.entries.list(project_id, \*\*params) -> EntryListResponse
+- client.projects.entries.delete(entry_id, \*, project_id) -> None
+- client.projects.entries.add_question(project_id, \*\*params) -> Entry
+- client.projects.entries.query(project_id, \*\*params) -> Optional[Entry]
diff --git a/src/codex/resources/projects/__init__.py b/src/codex/resources/projects/__init__.py
index 9c31620..0159985 100644
--- a/src/codex/resources/projects/__init__.py
+++ b/src/codex/resources/projects/__init__.py
@@ -1,5 +1,13 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+from .entries import (
+ EntriesResource,
+ AsyncEntriesResource,
+ EntriesResourceWithRawResponse,
+ AsyncEntriesResourceWithRawResponse,
+ EntriesResourceWithStreamingResponse,
+ AsyncEntriesResourceWithStreamingResponse,
+)
from .projects import (
ProjectsResource,
AsyncProjectsResource,
@@ -24,6 +32,12 @@
"AsyncAccessKeysResourceWithRawResponse",
"AccessKeysResourceWithStreamingResponse",
"AsyncAccessKeysResourceWithStreamingResponse",
+ "EntriesResource",
+ "AsyncEntriesResource",
+ "EntriesResourceWithRawResponse",
+ "AsyncEntriesResourceWithRawResponse",
+ "EntriesResourceWithStreamingResponse",
+ "AsyncEntriesResourceWithStreamingResponse",
"ProjectsResource",
"AsyncProjectsResource",
"ProjectsResourceWithRawResponse",
diff --git a/src/codex/resources/projects/entries.py b/src/codex/resources/projects/entries.py
new file mode 100644
index 0000000..6121842
--- /dev/null
+++ b/src/codex/resources/projects/entries.py
@@ -0,0 +1,738 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Literal
+
+import httpx
+
+from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
+from ..._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._base_client import make_request_options
+from ...types.projects import (
+ entry_list_params,
+ entry_query_params,
+ entry_create_params,
+ entry_update_params,
+ entry_add_question_params,
+)
+from ...types.projects.entry import Entry
+from ...types.projects.entry_list_response import EntryListResponse
+
+__all__ = ["EntriesResource", "AsyncEntriesResource"]
+
+
+class EntriesResource(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> EntriesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cleanlab/codex-python#accessing-raw-response-data-eg-headers
+ """
+ return EntriesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> EntriesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cleanlab/codex-python#with_streaming_response
+ """
+ return EntriesResourceWithStreamingResponse(self)
+
+ def create(
+ self,
+ project_id: int,
+ *,
+ question: str,
+ answer: Optional[str] | 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Create a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ f"/api/projects/{project_id}/entries/",
+ body=maybe_transform(
+ {
+ "question": question,
+ "answer": answer,
+ },
+ entry_create_params.EntryCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ def retrieve(
+ self,
+ entry_id: str,
+ *,
+ project_id: int,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Get a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return self._get(
+ f"/api/projects/{project_id}/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ def update(
+ self,
+ entry_id: str,
+ *,
+ project_id: int,
+ answer: Optional[str] | NotGiven = NOT_GIVEN,
+ question: Optional[str] | 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Update a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return self._put(
+ f"/api/projects/{project_id}/entries/{entry_id}",
+ body=maybe_transform(
+ {
+ "answer": answer,
+ "question": question,
+ },
+ entry_update_params.EntryUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ def list(
+ self,
+ project_id: int,
+ *,
+ answered_only: bool | NotGiven = NOT_GIVEN,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: int | NotGiven = NOT_GIVEN,
+ order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
+ sort: Literal["created_at", "answered_at"] | NotGiven = NOT_GIVEN,
+ unanswered_only: bool | 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> EntryListResponse:
+ """
+ List knowledge entries for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._get(
+ f"/api/projects/{project_id}/entries/",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=maybe_transform(
+ {
+ "answered_only": answered_only,
+ "limit": limit,
+ "offset": offset,
+ "order": order,
+ "sort": sort,
+ "unanswered_only": unanswered_only,
+ },
+ entry_list_params.EntryListParams,
+ ),
+ ),
+ cast_to=EntryListResponse,
+ )
+
+ def delete(
+ self,
+ entry_id: str,
+ *,
+ project_id: int,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> None:
+ """
+ Delete a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return self._delete(
+ f"/api/projects/{project_id}/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+ def add_question(
+ self,
+ project_id: int,
+ *,
+ question: str,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Add a question to a project.
+
+ Returns: 201 Created if a new question was added 200 OK if the question already
+ existed
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ f"/api/projects/{project_id}/entries/add_question",
+ body=maybe_transform({"question": question}, entry_add_question_params.EntryAddQuestionParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ def query(
+ self,
+ project_id: int,
+ *,
+ question: str,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Optional[Entry]:
+ """
+ Query knowledge for a project.
+
+ Returns the matching entry if found and answered, otherwise returns None. This
+ allows the client to distinguish between: (1) no matching question found
+ (returns None), and (2) matching question found but not yet answered (returns
+ Entry with answer=None).
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return self._post(
+ f"/api/projects/{project_id}/entries/query",
+ body=maybe_transform({"question": question}, entry_query_params.EntryQueryParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+
+class AsyncEntriesResource(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncEntriesResourceWithRawResponse:
+ """
+ This property can be used as a prefix for any HTTP method call to return the
+ the raw response object instead of the parsed content.
+
+ For more information, see https://www.github.com/cleanlab/codex-python#accessing-raw-response-data-eg-headers
+ """
+ return AsyncEntriesResourceWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncEntriesResourceWithStreamingResponse:
+ """
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
+
+ For more information, see https://www.github.com/cleanlab/codex-python#with_streaming_response
+ """
+ return AsyncEntriesResourceWithStreamingResponse(self)
+
+ async def create(
+ self,
+ project_id: int,
+ *,
+ question: str,
+ answer: Optional[str] | 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Create a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ f"/api/projects/{project_id}/entries/",
+ body=await async_maybe_transform(
+ {
+ "question": question,
+ "answer": answer,
+ },
+ entry_create_params.EntryCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ async def retrieve(
+ self,
+ entry_id: str,
+ *,
+ project_id: int,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Get a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return await self._get(
+ f"/api/projects/{project_id}/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ async def update(
+ self,
+ entry_id: str,
+ *,
+ project_id: int,
+ answer: Optional[str] | NotGiven = NOT_GIVEN,
+ question: Optional[str] | 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Update a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ return await self._put(
+ f"/api/projects/{project_id}/entries/{entry_id}",
+ body=await async_maybe_transform(
+ {
+ "answer": answer,
+ "question": question,
+ },
+ entry_update_params.EntryUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ async def list(
+ self,
+ project_id: int,
+ *,
+ answered_only: bool | NotGiven = NOT_GIVEN,
+ limit: int | NotGiven = NOT_GIVEN,
+ offset: int | NotGiven = NOT_GIVEN,
+ order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
+ sort: Literal["created_at", "answered_at"] | NotGiven = NOT_GIVEN,
+ unanswered_only: bool | 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> EntryListResponse:
+ """
+ List knowledge entries for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._get(
+ f"/api/projects/{project_id}/entries/",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ query=await async_maybe_transform(
+ {
+ "answered_only": answered_only,
+ "limit": limit,
+ "offset": offset,
+ "order": order,
+ "sort": sort,
+ "unanswered_only": unanswered_only,
+ },
+ entry_list_params.EntryListParams,
+ ),
+ ),
+ cast_to=EntryListResponse,
+ )
+
+ async def delete(
+ self,
+ entry_id: str,
+ *,
+ project_id: int,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> None:
+ """
+ Delete a knowledge entry for a project.
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not entry_id:
+ raise ValueError(f"Expected a non-empty value for `entry_id` but received {entry_id!r}")
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
+ return await self._delete(
+ f"/api/projects/{project_id}/entries/{entry_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=NoneType,
+ )
+
+ async def add_question(
+ self,
+ project_id: int,
+ *,
+ question: str,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Entry:
+ """
+ Add a question to a project.
+
+ Returns: 201 Created if a new question was added 200 OK if the question already
+ existed
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ f"/api/projects/{project_id}/entries/add_question",
+ body=await async_maybe_transform({"question": question}, entry_add_question_params.EntryAddQuestionParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+ async def query(
+ self,
+ project_id: int,
+ *,
+ question: str,
+ # 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> Optional[Entry]:
+ """
+ Query knowledge for a project.
+
+ Returns the matching entry if found and answered, otherwise returns None. This
+ allows the client to distinguish between: (1) no matching question found
+ (returns None), and (2) matching question found but not yet answered (returns
+ Entry with answer=None).
+
+ Args:
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ return await self._post(
+ f"/api/projects/{project_id}/entries/query",
+ body=await async_maybe_transform({"question": question}, entry_query_params.EntryQueryParams),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=Entry,
+ )
+
+
+class EntriesResourceWithRawResponse:
+ def __init__(self, entries: EntriesResource) -> None:
+ self._entries = entries
+
+ self.create = to_raw_response_wrapper(
+ entries.create,
+ )
+ self.retrieve = to_raw_response_wrapper(
+ entries.retrieve,
+ )
+ self.update = to_raw_response_wrapper(
+ entries.update,
+ )
+ self.list = to_raw_response_wrapper(
+ entries.list,
+ )
+ self.delete = to_raw_response_wrapper(
+ entries.delete,
+ )
+ self.add_question = to_raw_response_wrapper(
+ entries.add_question,
+ )
+ self.query = to_raw_response_wrapper(
+ entries.query,
+ )
+
+
+class AsyncEntriesResourceWithRawResponse:
+ def __init__(self, entries: AsyncEntriesResource) -> None:
+ self._entries = entries
+
+ self.create = async_to_raw_response_wrapper(
+ entries.create,
+ )
+ self.retrieve = async_to_raw_response_wrapper(
+ entries.retrieve,
+ )
+ self.update = async_to_raw_response_wrapper(
+ entries.update,
+ )
+ self.list = async_to_raw_response_wrapper(
+ entries.list,
+ )
+ self.delete = async_to_raw_response_wrapper(
+ entries.delete,
+ )
+ self.add_question = async_to_raw_response_wrapper(
+ entries.add_question,
+ )
+ self.query = async_to_raw_response_wrapper(
+ entries.query,
+ )
+
+
+class EntriesResourceWithStreamingResponse:
+ def __init__(self, entries: EntriesResource) -> None:
+ self._entries = entries
+
+ self.create = to_streamed_response_wrapper(
+ entries.create,
+ )
+ self.retrieve = to_streamed_response_wrapper(
+ entries.retrieve,
+ )
+ self.update = to_streamed_response_wrapper(
+ entries.update,
+ )
+ self.list = to_streamed_response_wrapper(
+ entries.list,
+ )
+ self.delete = to_streamed_response_wrapper(
+ entries.delete,
+ )
+ self.add_question = to_streamed_response_wrapper(
+ entries.add_question,
+ )
+ self.query = to_streamed_response_wrapper(
+ entries.query,
+ )
+
+
+class AsyncEntriesResourceWithStreamingResponse:
+ def __init__(self, entries: AsyncEntriesResource) -> None:
+ self._entries = entries
+
+ self.create = async_to_streamed_response_wrapper(
+ entries.create,
+ )
+ self.retrieve = async_to_streamed_response_wrapper(
+ entries.retrieve,
+ )
+ self.update = async_to_streamed_response_wrapper(
+ entries.update,
+ )
+ self.list = async_to_streamed_response_wrapper(
+ entries.list,
+ )
+ self.delete = async_to_streamed_response_wrapper(
+ entries.delete,
+ )
+ self.add_question = async_to_streamed_response_wrapper(
+ entries.add_question,
+ )
+ self.query = async_to_streamed_response_wrapper(
+ entries.query,
+ )
diff --git a/src/codex/resources/projects/projects.py b/src/codex/resources/projects/projects.py
index a7bea41..d77e63a 100644
--- a/src/codex/resources/projects/projects.py
+++ b/src/codex/resources/projects/projects.py
@@ -7,6 +7,14 @@
import httpx
from ...types import project_list_params, project_create_params, project_update_params
+from .entries import (
+ EntriesResource,
+ AsyncEntriesResource,
+ EntriesResourceWithRawResponse,
+ AsyncEntriesResourceWithRawResponse,
+ EntriesResourceWithStreamingResponse,
+ AsyncEntriesResourceWithStreamingResponse,
+)
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
from ..._utils import (
maybe_transform,
@@ -40,6 +48,10 @@ class ProjectsResource(SyncAPIResource):
def access_keys(self) -> AccessKeysResource:
return AccessKeysResource(self._client)
+ @cached_property
+ def entries(self) -> EntriesResource:
+ return EntriesResource(self._client)
+
@cached_property
def with_raw_response(self) -> ProjectsResourceWithRawResponse:
"""
@@ -279,6 +291,10 @@ class AsyncProjectsResource(AsyncAPIResource):
def access_keys(self) -> AsyncAccessKeysResource:
return AsyncAccessKeysResource(self._client)
+ @cached_property
+ def entries(self) -> AsyncEntriesResource:
+ return AsyncEntriesResource(self._client)
+
@cached_property
def with_raw_response(self) -> AsyncProjectsResourceWithRawResponse:
"""
@@ -542,6 +558,10 @@ def __init__(self, projects: ProjectsResource) -> None:
def access_keys(self) -> AccessKeysResourceWithRawResponse:
return AccessKeysResourceWithRawResponse(self._projects.access_keys)
+ @cached_property
+ def entries(self) -> EntriesResourceWithRawResponse:
+ return EntriesResourceWithRawResponse(self._projects.entries)
+
class AsyncProjectsResourceWithRawResponse:
def __init__(self, projects: AsyncProjectsResource) -> None:
@@ -570,6 +590,10 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
def access_keys(self) -> AsyncAccessKeysResourceWithRawResponse:
return AsyncAccessKeysResourceWithRawResponse(self._projects.access_keys)
+ @cached_property
+ def entries(self) -> AsyncEntriesResourceWithRawResponse:
+ return AsyncEntriesResourceWithRawResponse(self._projects.entries)
+
class ProjectsResourceWithStreamingResponse:
def __init__(self, projects: ProjectsResource) -> None:
@@ -598,6 +622,10 @@ def __init__(self, projects: ProjectsResource) -> None:
def access_keys(self) -> AccessKeysResourceWithStreamingResponse:
return AccessKeysResourceWithStreamingResponse(self._projects.access_keys)
+ @cached_property
+ def entries(self) -> EntriesResourceWithStreamingResponse:
+ return EntriesResourceWithStreamingResponse(self._projects.entries)
+
class AsyncProjectsResourceWithStreamingResponse:
def __init__(self, projects: AsyncProjectsResource) -> None:
@@ -625,3 +653,7 @@ def __init__(self, projects: AsyncProjectsResource) -> None:
@cached_property
def access_keys(self) -> AsyncAccessKeysResourceWithStreamingResponse:
return AsyncAccessKeysResourceWithStreamingResponse(self._projects.access_keys)
+
+ @cached_property
+ def entries(self) -> AsyncEntriesResourceWithStreamingResponse:
+ return AsyncEntriesResourceWithStreamingResponse(self._projects.entries)
diff --git a/src/codex/types/projects/__init__.py b/src/codex/types/projects/__init__.py
index 7aadc5f..b79e23f 100644
--- a/src/codex/types/projects/__init__.py
+++ b/src/codex/types/projects/__init__.py
@@ -2,10 +2,17 @@
from __future__ import annotations
+from .entry import Entry as Entry
from .access_key_schema import AccessKeySchema as AccessKeySchema
+from .entry_list_params import EntryListParams as EntryListParams
+from .entry_query_params import EntryQueryParams as EntryQueryParams
+from .entry_create_params import EntryCreateParams as EntryCreateParams
+from .entry_list_response import EntryListResponse as EntryListResponse
+from .entry_update_params import EntryUpdateParams as EntryUpdateParams
from .access_key_create_params import AccessKeyCreateParams as AccessKeyCreateParams
from .access_key_list_response import AccessKeyListResponse as AccessKeyListResponse
from .access_key_update_params import AccessKeyUpdateParams as AccessKeyUpdateParams
+from .entry_add_question_params import EntryAddQuestionParams as EntryAddQuestionParams
from .access_key_retrieve_project_id_response import (
AccessKeyRetrieveProjectIDResponse as AccessKeyRetrieveProjectIDResponse,
)
diff --git a/src/codex/types/projects/entry.py b/src/codex/types/projects/entry.py
new file mode 100644
index 0000000..bfa7d27
--- /dev/null
+++ b/src/codex/types/projects/entry.py
@@ -0,0 +1,20 @@
+# 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__ = ["Entry"]
+
+
+class Entry(BaseModel):
+ id: str
+
+ created_at: datetime
+
+ question: str
+
+ answer: Optional[str] = None
+
+ answered_at: Optional[datetime] = None
diff --git a/src/codex/types/projects/entry_add_question_params.py b/src/codex/types/projects/entry_add_question_params.py
new file mode 100644
index 0000000..e2d009b
--- /dev/null
+++ b/src/codex/types/projects/entry_add_question_params.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["EntryAddQuestionParams"]
+
+
+class EntryAddQuestionParams(TypedDict, total=False):
+ question: Required[str]
diff --git a/src/codex/types/projects/entry_create_params.py b/src/codex/types/projects/entry_create_params.py
new file mode 100644
index 0000000..1ac23dd
--- /dev/null
+++ b/src/codex/types/projects/entry_create_params.py
@@ -0,0 +1,14 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Required, TypedDict
+
+__all__ = ["EntryCreateParams"]
+
+
+class EntryCreateParams(TypedDict, total=False):
+ question: Required[str]
+
+ answer: Optional[str]
diff --git a/src/codex/types/projects/entry_list_params.py b/src/codex/types/projects/entry_list_params.py
new file mode 100644
index 0000000..b50181f
--- /dev/null
+++ b/src/codex/types/projects/entry_list_params.py
@@ -0,0 +1,21 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Literal, TypedDict
+
+__all__ = ["EntryListParams"]
+
+
+class EntryListParams(TypedDict, total=False):
+ answered_only: bool
+
+ limit: int
+
+ offset: int
+
+ order: Literal["asc", "desc"]
+
+ sort: Literal["created_at", "answered_at"]
+
+ unanswered_only: bool
diff --git a/src/codex/types/projects/entry_list_response.py b/src/codex/types/projects/entry_list_response.py
new file mode 100644
index 0000000..f415058
--- /dev/null
+++ b/src/codex/types/projects/entry_list_response.py
@@ -0,0 +1,14 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import List
+
+from .entry import Entry
+from ..._models import BaseModel
+
+__all__ = ["EntryListResponse"]
+
+
+class EntryListResponse(BaseModel):
+ entries: List[Entry]
+
+ total_count: int
diff --git a/src/codex/types/projects/entry_query_params.py b/src/codex/types/projects/entry_query_params.py
new file mode 100644
index 0000000..b6fbc43
--- /dev/null
+++ b/src/codex/types/projects/entry_query_params.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing_extensions import Required, TypedDict
+
+__all__ = ["EntryQueryParams"]
+
+
+class EntryQueryParams(TypedDict, total=False):
+ question: Required[str]
diff --git a/src/codex/types/projects/entry_update_params.py b/src/codex/types/projects/entry_update_params.py
new file mode 100644
index 0000000..4a7c652
--- /dev/null
+++ b/src/codex/types/projects/entry_update_params.py
@@ -0,0 +1,16 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+from typing_extensions import Required, TypedDict
+
+__all__ = ["EntryUpdateParams"]
+
+
+class EntryUpdateParams(TypedDict, total=False):
+ project_id: Required[int]
+
+ answer: Optional[str]
+
+ question: Optional[str]
diff --git a/tests/api_resources/projects/test_entries.py b/tests/api_resources/projects/test_entries.py
new file mode 100644
index 0000000..32f55fd
--- /dev/null
+++ b/tests/api_resources/projects/test_entries.py
@@ -0,0 +1,661 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, Optional, cast
+
+import pytest
+
+from codex import Codex, AsyncCodex
+from tests.utils import assert_matches_type
+from codex.types.projects import (
+ Entry,
+ EntryListResponse,
+)
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestEntries:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create(self, client: Codex) -> None:
+ entry = client.projects.entries.create(
+ project_id=0,
+ question="question",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create_with_all_params(self, client: Codex) -> None:
+ entry = client.projects.entries.create(
+ project_id=0,
+ question="question",
+ answer="answer",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_create(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.create(
+ project_id=0,
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_create(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.create(
+ project_id=0,
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_retrieve(self, client: Codex) -> None:
+ entry = client.projects.entries.retrieve(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_retrieve(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.retrieve(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_retrieve(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.retrieve(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_retrieve(self, client: Codex) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.projects.entries.with_raw_response.retrieve(
+ entry_id="",
+ project_id=0,
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_update(self, client: Codex) -> None:
+ entry = client.projects.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_update_with_all_params(self, client: Codex) -> None:
+ entry = client.projects.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ answer="answer",
+ question="question",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_update(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_update(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_update(self, client: Codex) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.projects.entries.with_raw_response.update(
+ entry_id="",
+ project_id=0,
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_list(self, client: Codex) -> None:
+ entry = client.projects.entries.list(
+ project_id=0,
+ )
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_list_with_all_params(self, client: Codex) -> None:
+ entry = client.projects.entries.list(
+ project_id=0,
+ answered_only=True,
+ limit=1,
+ offset=0,
+ order="asc",
+ sort="created_at",
+ unanswered_only=True,
+ )
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_list(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.list(
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_list(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.list(
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_delete(self, client: Codex) -> None:
+ entry = client.projects.entries.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+ assert entry is None
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_delete(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert entry is None
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_delete(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert entry is None
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_delete(self, client: Codex) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ client.projects.entries.with_raw_response.delete(
+ entry_id="",
+ project_id=0,
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_add_question(self, client: Codex) -> None:
+ entry = client.projects.entries.add_question(
+ project_id=0,
+ question="question",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_add_question(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.add_question(
+ project_id=0,
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_add_question(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.add_question(
+ project_id=0,
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_query(self, client: Codex) -> None:
+ entry = client.projects.entries.query(
+ project_id=0,
+ question="question",
+ )
+ assert_matches_type(Optional[Entry], entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_query(self, client: Codex) -> None:
+ response = client.projects.entries.with_raw_response.query(
+ project_id=0,
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = response.parse()
+ assert_matches_type(Optional[Entry], entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_query(self, client: Codex) -> None:
+ with client.projects.entries.with_streaming_response.query(
+ project_id=0,
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = response.parse()
+ assert_matches_type(Optional[Entry], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+
+class TestAsyncEntries:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.create(
+ project_id=0,
+ question="question",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.create(
+ project_id=0,
+ question="question",
+ answer="answer",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.create(
+ project_id=0,
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.create(
+ project_id=0,
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_retrieve(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.retrieve(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_retrieve(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.retrieve(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_retrieve(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.retrieve(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_retrieve(self, async_client: AsyncCodex) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.projects.entries.with_raw_response.retrieve(
+ entry_id="",
+ project_id=0,
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_update(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_update_with_all_params(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ answer="answer",
+ question="question",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_update(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_update(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.update(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_update(self, async_client: AsyncCodex) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.projects.entries.with_raw_response.update(
+ entry_id="",
+ project_id=0,
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_list(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.list(
+ project_id=0,
+ )
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_list_with_all_params(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.list(
+ project_id=0,
+ answered_only=True,
+ limit=1,
+ offset=0,
+ order="asc",
+ sort="created_at",
+ unanswered_only=True,
+ )
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_list(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.list(
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_list(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.list(
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(EntryListResponse, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_delete(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+ assert entry is None
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_delete(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert entry is None
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_delete(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.delete(
+ entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
+ project_id=0,
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert entry is None
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_delete(self, async_client: AsyncCodex) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `entry_id` but received ''"):
+ await async_client.projects.entries.with_raw_response.delete(
+ entry_id="",
+ project_id=0,
+ )
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_add_question(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.add_question(
+ project_id=0,
+ question="question",
+ )
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_add_question(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.add_question(
+ project_id=0,
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_add_question(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.add_question(
+ project_id=0,
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Entry, entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_query(self, async_client: AsyncCodex) -> None:
+ entry = await async_client.projects.entries.query(
+ project_id=0,
+ question="question",
+ )
+ assert_matches_type(Optional[Entry], entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_query(self, async_client: AsyncCodex) -> None:
+ response = await async_client.projects.entries.with_raw_response.query(
+ project_id=0,
+ question="question",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ entry = await response.parse()
+ assert_matches_type(Optional[Entry], entry, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_query(self, async_client: AsyncCodex) -> None:
+ async with async_client.projects.entries.with_streaming_response.query(
+ project_id=0,
+ question="question",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ entry = await response.parse()
+ assert_matches_type(Optional[Entry], entry, path=["response"])
+
+ assert cast(Any, response.is_closed) is True