Skip to content

Commit 64bc54f

Browse files
chore(api): update composite API spec
1 parent ebb9060 commit 64bc54f

File tree

5 files changed

+533
-29
lines changed

5 files changed

+533
-29
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1891
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f28fbb1a0c731820e25e5f357a4b5cfb1f047c34e3143d3d822a6e8c01d72c27.yml
3-
openapi_spec_hash: d1177ac271608ae36d73ab114c33f8d8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-7e4d0f06a14e00e1fded122c6e363b955753c19f529887d691584630b9625544.yml
3+
openapi_spec_hash: f04905b36443a3e136496c9dc28ea51d
44
config_hash: f8ad41a1e87119e46c6452f8f1ea0440

src/cloudflare/resources/d1/database.py

Lines changed: 213 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Type, Optional, cast
5+
from typing import Type, Iterable, Optional, cast
66
from typing_extensions import Literal, overload
77

88
import httpx
@@ -591,6 +591,7 @@ def import_(
591591
cast_to=cast(Type[DatabaseImportResponse], ResultWrapper[DatabaseImportResponse]),
592592
)
593593

594+
@overload
594595
def query(
595596
self,
596597
database_id: str,
@@ -624,6 +625,56 @@ def query(
624625
625626
timeout: Override the client-level default timeout for this request, in seconds
626627
"""
628+
...
629+
630+
@overload
631+
def query(
632+
self,
633+
database_id: str,
634+
*,
635+
account_id: str,
636+
batch: Iterable[database_query_params.MultipleQueriesBatch] | Omit = omit,
637+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
638+
# The extra values given here take precedence over values defined on the client or passed to this method.
639+
extra_headers: Headers | None = None,
640+
extra_query: Query | None = None,
641+
extra_body: Body | None = None,
642+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
643+
) -> SyncSinglePage[QueryResult]:
644+
"""
645+
Returns the query result as an object.
646+
647+
Args:
648+
account_id: Account identifier tag.
649+
650+
database_id: D1 database identifier (UUID).
651+
652+
extra_headers: Send extra headers
653+
654+
extra_query: Add additional query parameters to the request
655+
656+
extra_body: Add additional JSON properties to the request
657+
658+
timeout: Override the client-level default timeout for this request, in seconds
659+
"""
660+
...
661+
662+
@required_args(["account_id", "sql"], ["account_id"])
663+
def query(
664+
self,
665+
database_id: str,
666+
*,
667+
account_id: str,
668+
sql: str | Omit = omit,
669+
params: SequenceNotStr[str] | Omit = omit,
670+
batch: Iterable[database_query_params.MultipleQueriesBatch] | Omit = omit,
671+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
672+
# The extra values given here take precedence over values defined on the client or passed to this method.
673+
extra_headers: Headers | None = None,
674+
extra_query: Query | None = None,
675+
extra_body: Body | None = None,
676+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
677+
) -> SyncSinglePage[QueryResult]:
627678
if not account_id:
628679
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
629680
if not database_id:
@@ -635,6 +686,7 @@ def query(
635686
{
636687
"sql": sql,
637688
"params": params,
689+
"batch": batch,
638690
},
639691
database_query_params.DatabaseQueryParams,
640692
),
@@ -645,6 +697,7 @@ def query(
645697
method="post",
646698
)
647699

700+
@overload
648701
def raw(
649702
self,
650703
database_id: str,
@@ -680,6 +733,58 @@ def raw(
680733
681734
timeout: Override the client-level default timeout for this request, in seconds
682735
"""
736+
...
737+
738+
@overload
739+
def raw(
740+
self,
741+
database_id: str,
742+
*,
743+
account_id: str,
744+
batch: Iterable[database_raw_params.MultipleQueriesBatch] | Omit = omit,
745+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
746+
# The extra values given here take precedence over values defined on the client or passed to this method.
747+
extra_headers: Headers | None = None,
748+
extra_query: Query | None = None,
749+
extra_body: Body | None = None,
750+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
751+
) -> SyncSinglePage[DatabaseRawResponse]:
752+
"""Returns the query result rows as arrays rather than objects.
753+
754+
This is a
755+
performance-optimized version of the /query endpoint.
756+
757+
Args:
758+
account_id: Account identifier tag.
759+
760+
database_id: D1 database identifier (UUID).
761+
762+
extra_headers: Send extra headers
763+
764+
extra_query: Add additional query parameters to the request
765+
766+
extra_body: Add additional JSON properties to the request
767+
768+
timeout: Override the client-level default timeout for this request, in seconds
769+
"""
770+
...
771+
772+
@required_args(["account_id", "sql"], ["account_id"])
773+
def raw(
774+
self,
775+
database_id: str,
776+
*,
777+
account_id: str,
778+
sql: str | Omit = omit,
779+
params: SequenceNotStr[str] | Omit = omit,
780+
batch: Iterable[database_raw_params.MultipleQueriesBatch] | Omit = omit,
781+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
782+
# The extra values given here take precedence over values defined on the client or passed to this method.
783+
extra_headers: Headers | None = None,
784+
extra_query: Query | None = None,
785+
extra_body: Body | None = None,
786+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
787+
) -> SyncSinglePage[DatabaseRawResponse]:
683788
if not account_id:
684789
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
685790
if not database_id:
@@ -691,6 +796,7 @@ def raw(
691796
{
692797
"sql": sql,
693798
"params": params,
799+
"batch": batch,
694800
},
695801
database_raw_params.DatabaseRawParams,
696802
),
@@ -1257,6 +1363,7 @@ async def import_(
12571363
cast_to=cast(Type[DatabaseImportResponse], ResultWrapper[DatabaseImportResponse]),
12581364
)
12591365

1366+
@overload
12601367
def query(
12611368
self,
12621369
database_id: str,
@@ -1290,6 +1397,56 @@ def query(
12901397
12911398
timeout: Override the client-level default timeout for this request, in seconds
12921399
"""
1400+
...
1401+
1402+
@overload
1403+
def query(
1404+
self,
1405+
database_id: str,
1406+
*,
1407+
account_id: str,
1408+
batch: Iterable[database_query_params.MultipleQueriesBatch] | Omit = omit,
1409+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1410+
# The extra values given here take precedence over values defined on the client or passed to this method.
1411+
extra_headers: Headers | None = None,
1412+
extra_query: Query | None = None,
1413+
extra_body: Body | None = None,
1414+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1415+
) -> AsyncPaginator[QueryResult, AsyncSinglePage[QueryResult]]:
1416+
"""
1417+
Returns the query result as an object.
1418+
1419+
Args:
1420+
account_id: Account identifier tag.
1421+
1422+
database_id: D1 database identifier (UUID).
1423+
1424+
extra_headers: Send extra headers
1425+
1426+
extra_query: Add additional query parameters to the request
1427+
1428+
extra_body: Add additional JSON properties to the request
1429+
1430+
timeout: Override the client-level default timeout for this request, in seconds
1431+
"""
1432+
...
1433+
1434+
@required_args(["account_id", "sql"], ["account_id"])
1435+
def query(
1436+
self,
1437+
database_id: str,
1438+
*,
1439+
account_id: str,
1440+
sql: str | Omit = omit,
1441+
params: SequenceNotStr[str] | Omit = omit,
1442+
batch: Iterable[database_query_params.MultipleQueriesBatch] | Omit = omit,
1443+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1444+
# The extra values given here take precedence over values defined on the client or passed to this method.
1445+
extra_headers: Headers | None = None,
1446+
extra_query: Query | None = None,
1447+
extra_body: Body | None = None,
1448+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1449+
) -> AsyncPaginator[QueryResult, AsyncSinglePage[QueryResult]]:
12931450
if not account_id:
12941451
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
12951452
if not database_id:
@@ -1301,6 +1458,7 @@ def query(
13011458
{
13021459
"sql": sql,
13031460
"params": params,
1461+
"batch": batch,
13041462
},
13051463
database_query_params.DatabaseQueryParams,
13061464
),
@@ -1311,6 +1469,7 @@ def query(
13111469
method="post",
13121470
)
13131471

1472+
@overload
13141473
def raw(
13151474
self,
13161475
database_id: str,
@@ -1346,6 +1505,58 @@ def raw(
13461505
13471506
timeout: Override the client-level default timeout for this request, in seconds
13481507
"""
1508+
...
1509+
1510+
@overload
1511+
def raw(
1512+
self,
1513+
database_id: str,
1514+
*,
1515+
account_id: str,
1516+
batch: Iterable[database_raw_params.MultipleQueriesBatch] | Omit = omit,
1517+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1518+
# The extra values given here take precedence over values defined on the client or passed to this method.
1519+
extra_headers: Headers | None = None,
1520+
extra_query: Query | None = None,
1521+
extra_body: Body | None = None,
1522+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1523+
) -> AsyncPaginator[DatabaseRawResponse, AsyncSinglePage[DatabaseRawResponse]]:
1524+
"""Returns the query result rows as arrays rather than objects.
1525+
1526+
This is a
1527+
performance-optimized version of the /query endpoint.
1528+
1529+
Args:
1530+
account_id: Account identifier tag.
1531+
1532+
database_id: D1 database identifier (UUID).
1533+
1534+
extra_headers: Send extra headers
1535+
1536+
extra_query: Add additional query parameters to the request
1537+
1538+
extra_body: Add additional JSON properties to the request
1539+
1540+
timeout: Override the client-level default timeout for this request, in seconds
1541+
"""
1542+
...
1543+
1544+
@required_args(["account_id", "sql"], ["account_id"])
1545+
def raw(
1546+
self,
1547+
database_id: str,
1548+
*,
1549+
account_id: str,
1550+
sql: str | Omit = omit,
1551+
params: SequenceNotStr[str] | Omit = omit,
1552+
batch: Iterable[database_raw_params.MultipleQueriesBatch] | Omit = omit,
1553+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1554+
# The extra values given here take precedence over values defined on the client or passed to this method.
1555+
extra_headers: Headers | None = None,
1556+
extra_query: Query | None = None,
1557+
extra_body: Body | None = None,
1558+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
1559+
) -> AsyncPaginator[DatabaseRawResponse, AsyncSinglePage[DatabaseRawResponse]]:
13491560
if not account_id:
13501561
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
13511562
if not database_id:
@@ -1357,6 +1568,7 @@ def raw(
13571568
{
13581569
"sql": sql,
13591570
"params": params,
1571+
"batch": batch,
13601572
},
13611573
database_raw_params.DatabaseRawParams,
13621574
),

src/cloudflare/types/d1/database_query_params.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing import Union, Iterable
6+
from typing_extensions import Required, TypeAlias, TypedDict
67

78
from ..._types import SequenceNotStr
89

9-
__all__ = ["DatabaseQueryParams"]
10+
__all__ = ["DatabaseQueryParams", "D1SingleQuery", "MultipleQueries", "MultipleQueriesBatch"]
1011

1112

12-
class DatabaseQueryParams(TypedDict, total=False):
13+
class D1SingleQuery(TypedDict, total=False):
1314
account_id: Required[str]
1415
"""Account identifier tag."""
1516

@@ -21,3 +22,24 @@ class DatabaseQueryParams(TypedDict, total=False):
2122
"""
2223

2324
params: SequenceNotStr[str]
25+
26+
27+
class MultipleQueries(TypedDict, total=False):
28+
account_id: Required[str]
29+
"""Account identifier tag."""
30+
31+
batch: Iterable[MultipleQueriesBatch]
32+
33+
34+
class MultipleQueriesBatch(TypedDict, total=False):
35+
sql: Required[str]
36+
"""Your SQL query.
37+
38+
Supports multiple statements, joined by semicolons, which will be executed as a
39+
batch.
40+
"""
41+
42+
params: SequenceNotStr[str]
43+
44+
45+
DatabaseQueryParams: TypeAlias = Union[D1SingleQuery, MultipleQueries]

src/cloudflare/types/d1/database_raw_params.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing import Union, Iterable
6+
from typing_extensions import Required, TypeAlias, TypedDict
67

78
from ..._types import SequenceNotStr
89

9-
__all__ = ["DatabaseRawParams"]
10+
__all__ = ["DatabaseRawParams", "D1SingleQuery", "MultipleQueries", "MultipleQueriesBatch"]
1011

1112

12-
class DatabaseRawParams(TypedDict, total=False):
13+
class D1SingleQuery(TypedDict, total=False):
1314
account_id: Required[str]
1415
"""Account identifier tag."""
1516

@@ -21,3 +22,24 @@ class DatabaseRawParams(TypedDict, total=False):
2122
"""
2223

2324
params: SequenceNotStr[str]
25+
26+
27+
class MultipleQueries(TypedDict, total=False):
28+
account_id: Required[str]
29+
"""Account identifier tag."""
30+
31+
batch: Iterable[MultipleQueriesBatch]
32+
33+
34+
class MultipleQueriesBatch(TypedDict, total=False):
35+
sql: Required[str]
36+
"""Your SQL query.
37+
38+
Supports multiple statements, joined by semicolons, which will be executed as a
39+
batch.
40+
"""
41+
42+
params: SequenceNotStr[str]
43+
44+
45+
DatabaseRawParams: TypeAlias = Union[D1SingleQuery, MultipleQueries]

0 commit comments

Comments
 (0)