Skip to content

Commit 0962510

Browse files
chore(api): upload stainless config from cloudflare-config
1 parent 4593272 commit 0962510

6 files changed

Lines changed: 206 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 1793
1+
configured_endpoints: 1794
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-bf6dcd562e592c1c6d992e04b39d5b372e2a7cb4d3fdcad23e483e21389bd3aa.yml
33
openapi_spec_hash: 8b8da2355d909906fe7af3bc6f507487
4-
config_hash: fbc4fd68812ca98330ce3b204d1d103b
4+
config_hash: 0057f65f1f8efd88feb20d082d893305

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3376,6 +3376,7 @@ Methods:
33763376

33773377
- <code title="post /accounts/{account_id}/brand-protection/queries">client.brand_protection.queries.<a href="./src/cloudflare/resources/brand_protection/queries.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/brand_protection/query_create_params.py">params</a>) -> None</code>
33783378
- <code title="delete /accounts/{account_id}/brand-protection/queries">client.brand_protection.queries.<a href="./src/cloudflare/resources/brand_protection/queries.py">delete</a>(\*, account_id, \*\*<a href="src/cloudflare/types/brand_protection/query_delete_params.py">params</a>) -> None</code>
3379+
- <code title="post /accounts/{account_id}/brand-protection/queries/bulk">client.brand_protection.queries.<a href="./src/cloudflare/resources/brand_protection/queries.py">bulk</a>(\*, account_id, \*\*<a href="src/cloudflare/types/brand_protection/query_bulk_params.py">params</a>) -> None</code>
33793380

33803381
## Matches
33813382

src/cloudflare/resources/brand_protection/queries.py

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Dict, Union, Iterable
66
from datetime import datetime
77

88
import httpx
@@ -18,7 +18,7 @@
1818
async_to_streamed_response_wrapper,
1919
)
2020
from ..._base_client import make_request_options
21-
from ...types.brand_protection import query_create_params, query_delete_params
21+
from ...types.brand_protection import query_bulk_params, query_create_params, query_delete_params
2222

2323
__all__ = ["QueriesResource", "AsyncQueriesResource"]
2424

@@ -154,6 +154,42 @@ def delete(
154154
cast_to=NoneType,
155155
)
156156

157+
def bulk(
158+
self,
159+
*,
160+
account_id: str,
161+
queries: Iterable[Dict[str, object]] | NotGiven = NOT_GIVEN,
162+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
163+
# The extra values given here take precedence over values defined on the client or passed to this method.
164+
extra_headers: Headers | None = None,
165+
extra_query: Query | None = None,
166+
extra_body: Body | None = None,
167+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
168+
) -> None:
169+
"""
170+
Return a success message after creating new saved string queries in bulk
171+
172+
Args:
173+
extra_headers: Send extra headers
174+
175+
extra_query: Add additional query parameters to the request
176+
177+
extra_body: Add additional JSON properties to the request
178+
179+
timeout: Override the client-level default timeout for this request, in seconds
180+
"""
181+
if not account_id:
182+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
183+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
184+
return self._post(
185+
f"/accounts/{account_id}/brand-protection/queries/bulk",
186+
body=maybe_transform({"queries": queries}, query_bulk_params.QueryBulkParams),
187+
options=make_request_options(
188+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
189+
),
190+
cast_to=NoneType,
191+
)
192+
157193

158194
class AsyncQueriesResource(AsyncAPIResource):
159195
@cached_property
@@ -286,6 +322,42 @@ async def delete(
286322
cast_to=NoneType,
287323
)
288324

325+
async def bulk(
326+
self,
327+
*,
328+
account_id: str,
329+
queries: Iterable[Dict[str, object]] | NotGiven = NOT_GIVEN,
330+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
331+
# The extra values given here take precedence over values defined on the client or passed to this method.
332+
extra_headers: Headers | None = None,
333+
extra_query: Query | None = None,
334+
extra_body: Body | None = None,
335+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
336+
) -> None:
337+
"""
338+
Return a success message after creating new saved string queries in bulk
339+
340+
Args:
341+
extra_headers: Send extra headers
342+
343+
extra_query: Add additional query parameters to the request
344+
345+
extra_body: Add additional JSON properties to the request
346+
347+
timeout: Override the client-level default timeout for this request, in seconds
348+
"""
349+
if not account_id:
350+
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
351+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
352+
return await self._post(
353+
f"/accounts/{account_id}/brand-protection/queries/bulk",
354+
body=await async_maybe_transform({"queries": queries}, query_bulk_params.QueryBulkParams),
355+
options=make_request_options(
356+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
357+
),
358+
cast_to=NoneType,
359+
)
360+
289361

290362
class QueriesResourceWithRawResponse:
291363
def __init__(self, queries: QueriesResource) -> None:
@@ -297,6 +369,9 @@ def __init__(self, queries: QueriesResource) -> None:
297369
self.delete = to_raw_response_wrapper(
298370
queries.delete,
299371
)
372+
self.bulk = to_raw_response_wrapper(
373+
queries.bulk,
374+
)
300375

301376

302377
class AsyncQueriesResourceWithRawResponse:
@@ -309,6 +384,9 @@ def __init__(self, queries: AsyncQueriesResource) -> None:
309384
self.delete = async_to_raw_response_wrapper(
310385
queries.delete,
311386
)
387+
self.bulk = async_to_raw_response_wrapper(
388+
queries.bulk,
389+
)
312390

313391

314392
class QueriesResourceWithStreamingResponse:
@@ -321,6 +399,9 @@ def __init__(self, queries: QueriesResource) -> None:
321399
self.delete = to_streamed_response_wrapper(
322400
queries.delete,
323401
)
402+
self.bulk = to_streamed_response_wrapper(
403+
queries.bulk,
404+
)
324405

325406

326407
class AsyncQueriesResourceWithStreamingResponse:
@@ -333,3 +414,6 @@ def __init__(self, queries: AsyncQueriesResource) -> None:
333414
self.delete = async_to_streamed_response_wrapper(
334415
queries.delete,
335416
)
417+
self.bulk = async_to_streamed_response_wrapper(
418+
queries.bulk,
419+
)

src/cloudflare/types/brand_protection/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from __future__ import annotations
44

55
from .match_get_params import MatchGetParams as MatchGetParams
6+
from .query_bulk_params import QueryBulkParams as QueryBulkParams
67
from .logo_create_params import LogoCreateParams as LogoCreateParams
78
from .match_get_response import MatchGetResponse as MatchGetResponse
89
from .query_create_params import QueryCreateParams as QueryCreateParams
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing import Dict, Iterable
6+
from typing_extensions import Required, TypedDict
7+
8+
__all__ = ["QueryBulkParams"]
9+
10+
11+
class QueryBulkParams(TypedDict, total=False):
12+
account_id: Required[str]
13+
14+
queries: Iterable[Dict[str, object]]

tests/api_resources/brand_protection/test_queries.py

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,57 @@ def test_path_params_delete(self, client: Cloudflare) -> None:
127127
account_id="",
128128
)
129129

130+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
131+
@parametrize
132+
def test_method_bulk(self, client: Cloudflare) -> None:
133+
query = client.brand_protection.queries.bulk(
134+
account_id="x",
135+
)
136+
assert query is None
137+
138+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
139+
@parametrize
140+
def test_method_bulk_with_all_params(self, client: Cloudflare) -> None:
141+
query = client.brand_protection.queries.bulk(
142+
account_id="x",
143+
queries=[{"foo": "bar"}],
144+
)
145+
assert query is None
146+
147+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
148+
@parametrize
149+
def test_raw_response_bulk(self, client: Cloudflare) -> None:
150+
response = client.brand_protection.queries.with_raw_response.bulk(
151+
account_id="x",
152+
)
153+
154+
assert response.is_closed is True
155+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
156+
query = response.parse()
157+
assert query is None
158+
159+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
160+
@parametrize
161+
def test_streaming_response_bulk(self, client: Cloudflare) -> None:
162+
with client.brand_protection.queries.with_streaming_response.bulk(
163+
account_id="x",
164+
) as response:
165+
assert not response.is_closed
166+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
167+
168+
query = response.parse()
169+
assert query is None
170+
171+
assert cast(Any, response.is_closed) is True
172+
173+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
174+
@parametrize
175+
def test_path_params_bulk(self, client: Cloudflare) -> None:
176+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
177+
client.brand_protection.queries.with_raw_response.bulk(
178+
account_id="",
179+
)
180+
130181

131182
class TestAsyncQueries:
132183
parametrize = pytest.mark.parametrize(
@@ -243,3 +294,54 @@ async def test_path_params_delete(self, async_client: AsyncCloudflare) -> None:
243294
await async_client.brand_protection.queries.with_raw_response.delete(
244295
account_id="",
245296
)
297+
298+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
299+
@parametrize
300+
async def test_method_bulk(self, async_client: AsyncCloudflare) -> None:
301+
query = await async_client.brand_protection.queries.bulk(
302+
account_id="x",
303+
)
304+
assert query is None
305+
306+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
307+
@parametrize
308+
async def test_method_bulk_with_all_params(self, async_client: AsyncCloudflare) -> None:
309+
query = await async_client.brand_protection.queries.bulk(
310+
account_id="x",
311+
queries=[{"foo": "bar"}],
312+
)
313+
assert query is None
314+
315+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
316+
@parametrize
317+
async def test_raw_response_bulk(self, async_client: AsyncCloudflare) -> None:
318+
response = await async_client.brand_protection.queries.with_raw_response.bulk(
319+
account_id="x",
320+
)
321+
322+
assert response.is_closed is True
323+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
324+
query = await response.parse()
325+
assert query is None
326+
327+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
328+
@parametrize
329+
async def test_streaming_response_bulk(self, async_client: AsyncCloudflare) -> None:
330+
async with async_client.brand_protection.queries.with_streaming_response.bulk(
331+
account_id="x",
332+
) as response:
333+
assert not response.is_closed
334+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
335+
336+
query = await response.parse()
337+
assert query is None
338+
339+
assert cast(Any, response.is_closed) is True
340+
341+
@pytest.mark.skip(reason="TODO: investigate broken test, 401 Unauthorized")
342+
@parametrize
343+
async def test_path_params_bulk(self, async_client: AsyncCloudflare) -> None:
344+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
345+
await async_client.brand_protection.queries.with_raw_response.bulk(
346+
account_id="",
347+
)

0 commit comments

Comments
 (0)