Skip to content

Commit f59a327

Browse files
chore(api): update composite API spec
1 parent 4146d0d commit f59a327

5 files changed

Lines changed: 32 additions & 68 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 2013
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e698017772b79ecded767e9d0c858d903bb6c0bdcb8d7f2d4e54d5a0a6da5490.yml
3-
openapi_spec_hash: 062323f5fc00ff86b482e98509a36b65
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-47182e36d18529e4e1ef4528a8357dd54320a127f8951bd59e65f0bfc644d087.yml
3+
openapi_spec_hash: bdb0da399347091b2e6c2a4e3b4a553c
44
config_hash: 0c792bb64d06ffbdec9629c954299519

src/cloudflare/resources/d1/database/database.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def query(
645645
database_id: str,
646646
*,
647647
account_id: str,
648-
batch: Iterable[database_query_params.MultipleQueriesBatch] | Omit = omit,
648+
batch: Iterable[database_query_params.MultipleQueriesBatch],
649649
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
650650
# The extra values given here take precedence over values defined on the client or passed to this method.
651651
extra_headers: Headers | None = None,
@@ -671,7 +671,7 @@ def query(
671671
"""
672672
...
673673

674-
@required_args(["account_id", "sql"], ["account_id"])
674+
@required_args(["account_id", "sql"], ["account_id", "batch"])
675675
def query(
676676
self,
677677
database_id: str,
@@ -753,7 +753,7 @@ def raw(
753753
database_id: str,
754754
*,
755755
account_id: str,
756-
batch: Iterable[database_raw_params.MultipleQueriesBatch] | Omit = omit,
756+
batch: Iterable[database_raw_params.MultipleQueriesBatch],
757757
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
758758
# The extra values given here take precedence over values defined on the client or passed to this method.
759759
extra_headers: Headers | None = None,
@@ -781,7 +781,7 @@ def raw(
781781
"""
782782
...
783783

784-
@required_args(["account_id", "sql"], ["account_id"])
784+
@required_args(["account_id", "sql"], ["account_id", "batch"])
785785
def raw(
786786
self,
787787
database_id: str,
@@ -1421,7 +1421,7 @@ def query(
14211421
database_id: str,
14221422
*,
14231423
account_id: str,
1424-
batch: Iterable[database_query_params.MultipleQueriesBatch] | Omit = omit,
1424+
batch: Iterable[database_query_params.MultipleQueriesBatch],
14251425
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14261426
# The extra values given here take precedence over values defined on the client or passed to this method.
14271427
extra_headers: Headers | None = None,
@@ -1447,7 +1447,7 @@ def query(
14471447
"""
14481448
...
14491449

1450-
@required_args(["account_id", "sql"], ["account_id"])
1450+
@required_args(["account_id", "sql"], ["account_id", "batch"])
14511451
def query(
14521452
self,
14531453
database_id: str,
@@ -1529,7 +1529,7 @@ def raw(
15291529
database_id: str,
15301530
*,
15311531
account_id: str,
1532-
batch: Iterable[database_raw_params.MultipleQueriesBatch] | Omit = omit,
1532+
batch: Iterable[database_raw_params.MultipleQueriesBatch],
15331533
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
15341534
# The extra values given here take precedence over values defined on the client or passed to this method.
15351535
extra_headers: Headers | None = None,
@@ -1557,7 +1557,7 @@ def raw(
15571557
"""
15581558
...
15591559

1560-
@required_args(["account_id", "sql"], ["account_id"])
1560+
@required_args(["account_id", "sql"], ["account_id", "batch"])
15611561
def raw(
15621562
self,
15631563
database_id: str,

src/cloudflare/types/d1/database_query_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MultipleQueries(TypedDict, total=False):
2828
account_id: Required[str]
2929
"""Account identifier tag."""
3030

31-
batch: Iterable[MultipleQueriesBatch]
31+
batch: Required[Iterable[MultipleQueriesBatch]]
3232

3333

3434
class MultipleQueriesBatch(TypedDict, total=False):

src/cloudflare/types/d1/database_raw_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MultipleQueries(TypedDict, total=False):
2828
account_id: Required[str]
2929
"""Account identifier tag."""
3030

31-
batch: Iterable[MultipleQueriesBatch]
31+
batch: Required[Iterable[MultipleQueriesBatch]]
3232

3333

3434
class MultipleQueriesBatch(TypedDict, total=False):

tests/api_resources/d1/test_database.py

Lines changed: 20 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -646,20 +646,7 @@ def test_method_query_overload_2(self, client: Cloudflare) -> None:
646646
database = client.d1.database.query(
647647
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
648648
account_id="023e105f4ecef8ad9ca31a8372d0c353",
649-
)
650-
assert_matches_type(SyncSinglePage[QueryResult], database, path=["response"])
651-
652-
@parametrize
653-
def test_method_query_with_all_params_overload_2(self, client: Cloudflare) -> None:
654-
database = client.d1.database.query(
655-
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
656-
account_id="023e105f4ecef8ad9ca31a8372d0c353",
657-
batch=[
658-
{
659-
"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;",
660-
"params": ["firstParam", "secondParam"],
661-
}
662-
],
649+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
663650
)
664651
assert_matches_type(SyncSinglePage[QueryResult], database, path=["response"])
665652

@@ -668,6 +655,7 @@ def test_raw_response_query_overload_2(self, client: Cloudflare) -> None:
668655
response = client.d1.database.with_raw_response.query(
669656
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
670657
account_id="023e105f4ecef8ad9ca31a8372d0c353",
658+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
671659
)
672660

673661
assert response.is_closed is True
@@ -680,6 +668,7 @@ def test_streaming_response_query_overload_2(self, client: Cloudflare) -> None:
680668
with client.d1.database.with_streaming_response.query(
681669
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
682670
account_id="023e105f4ecef8ad9ca31a8372d0c353",
671+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
683672
) as response:
684673
assert not response.is_closed
685674
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -695,12 +684,14 @@ def test_path_params_query_overload_2(self, client: Cloudflare) -> None:
695684
client.d1.database.with_raw_response.query(
696685
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
697686
account_id="",
687+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
698688
)
699689

700690
with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"):
701691
client.d1.database.with_raw_response.query(
702692
database_id="",
703693
account_id="023e105f4ecef8ad9ca31a8372d0c353",
694+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
704695
)
705696

706697
@parametrize
@@ -771,20 +762,7 @@ def test_method_raw_overload_2(self, client: Cloudflare) -> None:
771762
database = client.d1.database.raw(
772763
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
773764
account_id="023e105f4ecef8ad9ca31a8372d0c353",
774-
)
775-
assert_matches_type(SyncSinglePage[DatabaseRawResponse], database, path=["response"])
776-
777-
@parametrize
778-
def test_method_raw_with_all_params_overload_2(self, client: Cloudflare) -> None:
779-
database = client.d1.database.raw(
780-
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
781-
account_id="023e105f4ecef8ad9ca31a8372d0c353",
782-
batch=[
783-
{
784-
"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;",
785-
"params": ["firstParam", "secondParam"],
786-
}
787-
],
765+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
788766
)
789767
assert_matches_type(SyncSinglePage[DatabaseRawResponse], database, path=["response"])
790768

@@ -793,6 +771,7 @@ def test_raw_response_raw_overload_2(self, client: Cloudflare) -> None:
793771
response = client.d1.database.with_raw_response.raw(
794772
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
795773
account_id="023e105f4ecef8ad9ca31a8372d0c353",
774+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
796775
)
797776

798777
assert response.is_closed is True
@@ -805,6 +784,7 @@ def test_streaming_response_raw_overload_2(self, client: Cloudflare) -> None:
805784
with client.d1.database.with_streaming_response.raw(
806785
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
807786
account_id="023e105f4ecef8ad9ca31a8372d0c353",
787+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
808788
) as response:
809789
assert not response.is_closed
810790
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -820,12 +800,14 @@ def test_path_params_raw_overload_2(self, client: Cloudflare) -> None:
820800
client.d1.database.with_raw_response.raw(
821801
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
822802
account_id="",
803+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
823804
)
824805

825806
with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"):
826807
client.d1.database.with_raw_response.raw(
827808
database_id="",
828809
account_id="023e105f4ecef8ad9ca31a8372d0c353",
810+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
829811
)
830812

831813

@@ -1455,20 +1437,7 @@ async def test_method_query_overload_2(self, async_client: AsyncCloudflare) -> N
14551437
database = await async_client.d1.database.query(
14561438
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
14571439
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1458-
)
1459-
assert_matches_type(AsyncSinglePage[QueryResult], database, path=["response"])
1460-
1461-
@parametrize
1462-
async def test_method_query_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None:
1463-
database = await async_client.d1.database.query(
1464-
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
1465-
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1466-
batch=[
1467-
{
1468-
"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;",
1469-
"params": ["firstParam", "secondParam"],
1470-
}
1471-
],
1440+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
14721441
)
14731442
assert_matches_type(AsyncSinglePage[QueryResult], database, path=["response"])
14741443

@@ -1477,6 +1446,7 @@ async def test_raw_response_query_overload_2(self, async_client: AsyncCloudflare
14771446
response = await async_client.d1.database.with_raw_response.query(
14781447
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
14791448
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1449+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
14801450
)
14811451

14821452
assert response.is_closed is True
@@ -1489,6 +1459,7 @@ async def test_streaming_response_query_overload_2(self, async_client: AsyncClou
14891459
async with async_client.d1.database.with_streaming_response.query(
14901460
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
14911461
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1462+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
14921463
) as response:
14931464
assert not response.is_closed
14941465
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -1504,12 +1475,14 @@ async def test_path_params_query_overload_2(self, async_client: AsyncCloudflare)
15041475
await async_client.d1.database.with_raw_response.query(
15051476
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
15061477
account_id="",
1478+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
15071479
)
15081480

15091481
with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"):
15101482
await async_client.d1.database.with_raw_response.query(
15111483
database_id="",
15121484
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1485+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
15131486
)
15141487

15151488
@parametrize
@@ -1580,20 +1553,7 @@ async def test_method_raw_overload_2(self, async_client: AsyncCloudflare) -> Non
15801553
database = await async_client.d1.database.raw(
15811554
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
15821555
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1583-
)
1584-
assert_matches_type(AsyncSinglePage[DatabaseRawResponse], database, path=["response"])
1585-
1586-
@parametrize
1587-
async def test_method_raw_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None:
1588-
database = await async_client.d1.database.raw(
1589-
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
1590-
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1591-
batch=[
1592-
{
1593-
"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;",
1594-
"params": ["firstParam", "secondParam"],
1595-
}
1596-
],
1556+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
15971557
)
15981558
assert_matches_type(AsyncSinglePage[DatabaseRawResponse], database, path=["response"])
15991559

@@ -1602,6 +1562,7 @@ async def test_raw_response_raw_overload_2(self, async_client: AsyncCloudflare)
16021562
response = await async_client.d1.database.with_raw_response.raw(
16031563
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
16041564
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1565+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
16051566
)
16061567

16071568
assert response.is_closed is True
@@ -1614,6 +1575,7 @@ async def test_streaming_response_raw_overload_2(self, async_client: AsyncCloudf
16141575
async with async_client.d1.database.with_streaming_response.raw(
16151576
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
16161577
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1578+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
16171579
) as response:
16181580
assert not response.is_closed
16191581
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
@@ -1629,10 +1591,12 @@ async def test_path_params_raw_overload_2(self, async_client: AsyncCloudflare) -
16291591
await async_client.d1.database.with_raw_response.raw(
16301592
database_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
16311593
account_id="",
1594+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
16321595
)
16331596

16341597
with pytest.raises(ValueError, match=r"Expected a non-empty value for `database_id` but received ''"):
16351598
await async_client.d1.database.with_raw_response.raw(
16361599
database_id="",
16371600
account_id="023e105f4ecef8ad9ca31a8372d0c353",
1601+
batch=[{"sql": "SELECT * FROM myTable WHERE field = ? OR field = ?;"}],
16381602
)

0 commit comments

Comments
 (0)