diff --git a/src/codex/resources/projects/entries.py b/src/codex/resources/projects/entries.py index 2fcc8e0..e2c1654 100644 --- a/src/codex/resources/projects/entries.py +++ b/src/codex/resources/projects/entries.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Optional +from typing import List, Optional from typing_extensions import Literal import httpx @@ -60,6 +60,7 @@ def create( *, question: str, answer: Optional[str] | NotGiven = NOT_GIVEN, + draft_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, @@ -89,6 +90,7 @@ def create( { "question": question, "answer": answer, + "draft_answer": draft_answer, }, entry_create_params.EntryCreateParams, ), @@ -140,6 +142,7 @@ def update( *, project_id: str, answer: Optional[str] | NotGiven = NOT_GIVEN, + draft_answer: Optional[str] | NotGiven = NOT_GIVEN, frequency_count: Optional[int] | 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. @@ -170,6 +173,7 @@ def update( body=maybe_transform( { "answer": answer, + "draft_answer": draft_answer, "frequency_count": frequency_count, "question": question, }, @@ -190,6 +194,7 @@ def list( offset: int | NotGiven = NOT_GIVEN, order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, sort: Literal["created_at", "answered_at"] | NotGiven = NOT_GIVEN, + states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] | 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. @@ -227,6 +232,7 @@ def list( "offset": offset, "order": order, "sort": sort, + "states": states, "unanswered_only": unanswered_only, }, entry_list_params.EntryListParams, @@ -379,6 +385,7 @@ async def create( *, question: str, answer: Optional[str] | NotGiven = NOT_GIVEN, + draft_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, @@ -408,6 +415,7 @@ async def create( { "question": question, "answer": answer, + "draft_answer": draft_answer, }, entry_create_params.EntryCreateParams, ), @@ -459,6 +467,7 @@ async def update( *, project_id: str, answer: Optional[str] | NotGiven = NOT_GIVEN, + draft_answer: Optional[str] | NotGiven = NOT_GIVEN, frequency_count: Optional[int] | 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. @@ -489,6 +498,7 @@ async def update( body=await async_maybe_transform( { "answer": answer, + "draft_answer": draft_answer, "frequency_count": frequency_count, "question": question, }, @@ -509,6 +519,7 @@ def list( offset: int | NotGiven = NOT_GIVEN, order: Literal["asc", "desc"] | NotGiven = NOT_GIVEN, sort: Literal["created_at", "answered_at"] | NotGiven = NOT_GIVEN, + states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] | 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. @@ -546,6 +557,7 @@ def list( "offset": offset, "order": order, "sort": sort, + "states": states, "unanswered_only": unanswered_only, }, entry_list_params.EntryListParams, diff --git a/src/codex/types/projects/entry.py b/src/codex/types/projects/entry.py index 4621cc4..7a2c450 100644 --- a/src/codex/types/projects/entry.py +++ b/src/codex/types/projects/entry.py @@ -2,6 +2,7 @@ from typing import Optional from datetime import datetime +from typing_extensions import Literal from ..._models import BaseModel @@ -13,10 +14,16 @@ class Entry(BaseModel): question: str + state: Literal["unanswered", "draft", "published", "published_with_draft"] + id: Optional[str] = None answer: Optional[str] = None answered_at: Optional[datetime] = None + draft_answer: Optional[str] = None + + draft_answer_last_edited: Optional[datetime] = None + frequency_count: Optional[int] = None diff --git a/src/codex/types/projects/entry_create_params.py b/src/codex/types/projects/entry_create_params.py index 1ac23dd..daf3089 100644 --- a/src/codex/types/projects/entry_create_params.py +++ b/src/codex/types/projects/entry_create_params.py @@ -12,3 +12,5 @@ class EntryCreateParams(TypedDict, total=False): question: Required[str] answer: Optional[str] + + draft_answer: Optional[str] diff --git a/src/codex/types/projects/entry_list_params.py b/src/codex/types/projects/entry_list_params.py index b50181f..605ea48 100644 --- a/src/codex/types/projects/entry_list_params.py +++ b/src/codex/types/projects/entry_list_params.py @@ -2,6 +2,7 @@ from __future__ import annotations +from typing import List from typing_extensions import Literal, TypedDict __all__ = ["EntryListParams"] @@ -18,4 +19,6 @@ class EntryListParams(TypedDict, total=False): sort: Literal["created_at", "answered_at"] + states: List[Literal["unanswered", "draft", "published", "published_with_draft"]] + unanswered_only: bool diff --git a/src/codex/types/projects/entry_update_params.py b/src/codex/types/projects/entry_update_params.py index ba10549..05a6332 100644 --- a/src/codex/types/projects/entry_update_params.py +++ b/src/codex/types/projects/entry_update_params.py @@ -13,6 +13,8 @@ class EntryUpdateParams(TypedDict, total=False): answer: Optional[str] + draft_answer: Optional[str] + frequency_count: Optional[int] question: Optional[str] diff --git a/tests/api_resources/projects/test_entries.py b/tests/api_resources/projects/test_entries.py index 026add4..fbbf6f2 100644 --- a/tests/api_resources/projects/test_entries.py +++ b/tests/api_resources/projects/test_entries.py @@ -36,6 +36,7 @@ def test_method_create_with_all_params(self, client: Codex) -> None: project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", question="question", answer="answer", + draft_answer="draft_answer", ) assert_matches_type(Entry, entry, path=["response"]) @@ -144,6 +145,7 @@ def test_method_update_with_all_params(self, client: Codex) -> None: entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", answer="answer", + draft_answer="draft_answer", frequency_count=0, question="question", ) @@ -210,6 +212,7 @@ def test_method_list_with_all_params(self, client: Codex) -> None: offset=0, order="asc", sort="created_at", + states=["unanswered"], unanswered_only=True, ) assert_matches_type(SyncOffsetPageEntries[Entry], entry, path=["response"]) @@ -412,6 +415,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCodex) -> project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", question="question", answer="answer", + draft_answer="draft_answer", ) assert_matches_type(Entry, entry, path=["response"]) @@ -520,6 +524,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCodex) -> entry_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", project_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", answer="answer", + draft_answer="draft_answer", frequency_count=0, question="question", ) @@ -586,6 +591,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCodex) -> No offset=0, order="asc", sort="created_at", + states=["unanswered"], unanswered_only=True, ) assert_matches_type(AsyncOffsetPageEntries[Entry], entry, path=["response"])