Skip to content

Commit 52933f2

Browse files
feat(api): api update (#90)
1 parent 674c661 commit 52933f2

File tree

8 files changed

+231
-3
lines changed

8 files changed

+231
-3
lines changed

src/codex/resources/projects/access_keys.py

+31
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
1111
from ..._utils import (
1212
maybe_transform,
13+
strip_not_given,
1314
async_maybe_transform,
1415
)
1516
from ..._compat import cached_property
@@ -56,6 +57,10 @@ def create(
5657
name: str,
5758
description: Optional[str] | NotGiven = NOT_GIVEN,
5859
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
60+
x_client_library_version: str | NotGiven = NOT_GIVEN,
61+
x_integration_type: str | NotGiven = NOT_GIVEN,
62+
x_source: str | NotGiven = NOT_GIVEN,
63+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
5964
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6065
# The extra values given here take precedence over values defined on the client or passed to this method.
6166
extra_headers: Headers | None = None,
@@ -77,6 +82,17 @@ def create(
7782
"""
7883
if not project_id:
7984
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
85+
extra_headers = {
86+
**strip_not_given(
87+
{
88+
"x-client-library-version": x_client_library_version,
89+
"x-integration-type": x_integration_type,
90+
"x-source": x_source,
91+
"x-stainless-package-version": x_stainless_package_version,
92+
}
93+
),
94+
**(extra_headers or {}),
95+
}
8096
return self._post(
8197
f"/api/projects/{project_id}/access_keys/",
8298
body=maybe_transform(
@@ -330,6 +346,10 @@ async def create(
330346
name: str,
331347
description: Optional[str] | NotGiven = NOT_GIVEN,
332348
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
349+
x_client_library_version: str | NotGiven = NOT_GIVEN,
350+
x_integration_type: str | NotGiven = NOT_GIVEN,
351+
x_source: str | NotGiven = NOT_GIVEN,
352+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
333353
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
334354
# The extra values given here take precedence over values defined on the client or passed to this method.
335355
extra_headers: Headers | None = None,
@@ -351,6 +371,17 @@ async def create(
351371
"""
352372
if not project_id:
353373
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
374+
extra_headers = {
375+
**strip_not_given(
376+
{
377+
"x-client-library-version": x_client_library_version,
378+
"x-integration-type": x_integration_type,
379+
"x-source": x_source,
380+
"x-stainless-package-version": x_stainless_package_version,
381+
}
382+
),
383+
**(extra_headers or {}),
384+
}
354385
return await self._post(
355386
f"/api/projects/{project_id}/access_keys/",
356387
body=await async_maybe_transform(

src/codex/resources/projects/entries.py

+91
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
1111
from ..._utils import (
1212
maybe_transform,
13+
strip_not_given,
1314
async_maybe_transform,
1415
)
1516
from ..._compat import cached_property
@@ -61,6 +62,10 @@ def create(
6162
question: str,
6263
answer: Optional[str] | NotGiven = NOT_GIVEN,
6364
draft_answer: Optional[str] | NotGiven = NOT_GIVEN,
65+
x_client_library_version: str | NotGiven = NOT_GIVEN,
66+
x_integration_type: str | NotGiven = NOT_GIVEN,
67+
x_source: str | NotGiven = NOT_GIVEN,
68+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
6469
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6570
# The extra values given here take precedence over values defined on the client or passed to this method.
6671
extra_headers: Headers | None = None,
@@ -84,6 +89,17 @@ def create(
8489
"""
8590
if not project_id:
8691
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
92+
extra_headers = {
93+
**strip_not_given(
94+
{
95+
"x-client-library-version": x_client_library_version,
96+
"x-integration-type": x_integration_type,
97+
"x-source": x_source,
98+
"x-stainless-package-version": x_stainless_package_version,
99+
}
100+
),
101+
**(extra_headers or {}),
102+
}
87103
return self._post(
88104
f"/api/projects/{project_id}/entries/",
89105
body=maybe_transform(
@@ -283,6 +299,10 @@ def add_question(
283299
project_id: str,
284300
*,
285301
question: str,
302+
x_client_library_version: str | NotGiven = NOT_GIVEN,
303+
x_integration_type: str | NotGiven = NOT_GIVEN,
304+
x_source: str | NotGiven = NOT_GIVEN,
305+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
286306
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
287307
# The extra values given here take precedence over values defined on the client or passed to this method.
288308
extra_headers: Headers | None = None,
@@ -307,6 +327,17 @@ def add_question(
307327
"""
308328
if not project_id:
309329
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
330+
extra_headers = {
331+
**strip_not_given(
332+
{
333+
"x-client-library-version": x_client_library_version,
334+
"x-integration-type": x_integration_type,
335+
"x-source": x_source,
336+
"x-stainless-package-version": x_stainless_package_version,
337+
}
338+
),
339+
**(extra_headers or {}),
340+
}
310341
return self._post(
311342
f"/api/projects/{project_id}/entries/add_question",
312343
body=maybe_transform({"question": question}, entry_add_question_params.EntryAddQuestionParams),
@@ -321,6 +352,10 @@ def query(
321352
project_id: str,
322353
*,
323354
question: str,
355+
x_client_library_version: str | NotGiven = NOT_GIVEN,
356+
x_integration_type: str | NotGiven = NOT_GIVEN,
357+
x_source: str | NotGiven = NOT_GIVEN,
358+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
324359
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
325360
# The extra values given here take precedence over values defined on the client or passed to this method.
326361
extra_headers: Headers | None = None,
@@ -349,6 +384,17 @@ def query(
349384
"""
350385
if not project_id:
351386
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
387+
extra_headers = {
388+
**strip_not_given(
389+
{
390+
"x-client-library-version": x_client_library_version,
391+
"x-integration-type": x_integration_type,
392+
"x-source": x_source,
393+
"x-stainless-package-version": x_stainless_package_version,
394+
}
395+
),
396+
**(extra_headers or {}),
397+
}
352398
return self._post(
353399
f"/api/projects/{project_id}/entries/query",
354400
body=maybe_transform({"question": question}, entry_query_params.EntryQueryParams),
@@ -386,6 +432,10 @@ async def create(
386432
question: str,
387433
answer: Optional[str] | NotGiven = NOT_GIVEN,
388434
draft_answer: Optional[str] | NotGiven = NOT_GIVEN,
435+
x_client_library_version: str | NotGiven = NOT_GIVEN,
436+
x_integration_type: str | NotGiven = NOT_GIVEN,
437+
x_source: str | NotGiven = NOT_GIVEN,
438+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
389439
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
390440
# The extra values given here take precedence over values defined on the client or passed to this method.
391441
extra_headers: Headers | None = None,
@@ -409,6 +459,17 @@ async def create(
409459
"""
410460
if not project_id:
411461
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
462+
extra_headers = {
463+
**strip_not_given(
464+
{
465+
"x-client-library-version": x_client_library_version,
466+
"x-integration-type": x_integration_type,
467+
"x-source": x_source,
468+
"x-stainless-package-version": x_stainless_package_version,
469+
}
470+
),
471+
**(extra_headers or {}),
472+
}
412473
return await self._post(
413474
f"/api/projects/{project_id}/entries/",
414475
body=await async_maybe_transform(
@@ -608,6 +669,10 @@ async def add_question(
608669
project_id: str,
609670
*,
610671
question: str,
672+
x_client_library_version: str | NotGiven = NOT_GIVEN,
673+
x_integration_type: str | NotGiven = NOT_GIVEN,
674+
x_source: str | NotGiven = NOT_GIVEN,
675+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
611676
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
612677
# The extra values given here take precedence over values defined on the client or passed to this method.
613678
extra_headers: Headers | None = None,
@@ -632,6 +697,17 @@ async def add_question(
632697
"""
633698
if not project_id:
634699
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
700+
extra_headers = {
701+
**strip_not_given(
702+
{
703+
"x-client-library-version": x_client_library_version,
704+
"x-integration-type": x_integration_type,
705+
"x-source": x_source,
706+
"x-stainless-package-version": x_stainless_package_version,
707+
}
708+
),
709+
**(extra_headers or {}),
710+
}
635711
return await self._post(
636712
f"/api/projects/{project_id}/entries/add_question",
637713
body=await async_maybe_transform({"question": question}, entry_add_question_params.EntryAddQuestionParams),
@@ -646,6 +722,10 @@ async def query(
646722
project_id: str,
647723
*,
648724
question: str,
725+
x_client_library_version: str | NotGiven = NOT_GIVEN,
726+
x_integration_type: str | NotGiven = NOT_GIVEN,
727+
x_source: str | NotGiven = NOT_GIVEN,
728+
x_stainless_package_version: str | NotGiven = NOT_GIVEN,
649729
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
650730
# The extra values given here take precedence over values defined on the client or passed to this method.
651731
extra_headers: Headers | None = None,
@@ -674,6 +754,17 @@ async def query(
674754
"""
675755
if not project_id:
676756
raise ValueError(f"Expected a non-empty value for `project_id` but received {project_id!r}")
757+
extra_headers = {
758+
**strip_not_given(
759+
{
760+
"x-client-library-version": x_client_library_version,
761+
"x-integration-type": x_integration_type,
762+
"x-source": x_source,
763+
"x-stainless-package-version": x_stainless_package_version,
764+
}
765+
),
766+
**(extra_headers or {}),
767+
}
677768
return await self._post(
678769
f"/api/projects/{project_id}/entries/query",
679770
body=await async_maybe_transform({"question": question}, entry_query_params.EntryQueryParams),

src/codex/types/projects/access_key_create_params.py

+8
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,11 @@ class AccessKeyCreateParams(TypedDict, total=False):
1717
description: Optional[str]
1818

1919
expires_at: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")]
20+
21+
x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
22+
23+
x_integration_type: Annotated[str, PropertyInfo(alias="x-integration-type")]
24+
25+
x_source: Annotated[str, PropertyInfo(alias="x-source")]
26+
27+
x_stainless_package_version: Annotated[str, PropertyInfo(alias="x-stainless-package-version")]

src/codex/types/projects/entry_add_question_params.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Required, Annotated, TypedDict
6+
7+
from ..._utils import PropertyInfo
68

79
__all__ = ["EntryAddQuestionParams"]
810

911

1012
class EntryAddQuestionParams(TypedDict, total=False):
1113
question: Required[str]
14+
15+
x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
16+
17+
x_integration_type: Annotated[str, PropertyInfo(alias="x-integration-type")]
18+
19+
x_source: Annotated[str, PropertyInfo(alias="x-source")]
20+
21+
x_stainless_package_version: Annotated[str, PropertyInfo(alias="x-stainless-package-version")]

src/codex/types/projects/entry_create_params.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from __future__ import annotations
44

55
from typing import Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Required, Annotated, TypedDict
7+
8+
from ..._utils import PropertyInfo
79

810
__all__ = ["EntryCreateParams"]
911

@@ -14,3 +16,11 @@ class EntryCreateParams(TypedDict, total=False):
1416
answer: Optional[str]
1517

1618
draft_answer: Optional[str]
19+
20+
x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
21+
22+
x_integration_type: Annotated[str, PropertyInfo(alias="x-integration-type")]
23+
24+
x_source: Annotated[str, PropertyInfo(alias="x-source")]
25+
26+
x_stainless_package_version: Annotated[str, PropertyInfo(alias="x-stainless-package-version")]

src/codex/types/projects/entry_query_params.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Required, Annotated, TypedDict
6+
7+
from ..._utils import PropertyInfo
68

79
__all__ = ["EntryQueryParams"]
810

911

1012
class EntryQueryParams(TypedDict, total=False):
1113
question: Required[str]
14+
15+
x_client_library_version: Annotated[str, PropertyInfo(alias="x-client-library-version")]
16+
17+
x_integration_type: Annotated[str, PropertyInfo(alias="x-integration-type")]
18+
19+
x_source: Annotated[str, PropertyInfo(alias="x-source")]
20+
21+
x_stainless_package_version: Annotated[str, PropertyInfo(alias="x-stainless-package-version")]

tests/api_resources/projects/test_access_keys.py

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def test_method_create_with_all_params(self, client: Codex) -> None:
3939
name="name",
4040
description="description",
4141
expires_at=parse_datetime("2019-12-27T18:11:19.117Z"),
42+
x_client_library_version="x-client-library-version",
43+
x_integration_type="x-integration-type",
44+
x_source="x-source",
45+
x_stainless_package_version="x-stainless-package-version",
4246
)
4347
assert_matches_type(AccessKeySchema, access_key, path=["response"])
4448

@@ -395,6 +399,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncCodex) ->
395399
name="name",
396400
description="description",
397401
expires_at=parse_datetime("2019-12-27T18:11:19.117Z"),
402+
x_client_library_version="x-client-library-version",
403+
x_integration_type="x-integration-type",
404+
x_source="x-source",
405+
x_stainless_package_version="x-stainless-package-version",
398406
)
399407
assert_matches_type(AccessKeySchema, access_key, path=["response"])
400408

0 commit comments

Comments
 (0)