From 192ef64dcf6dc38f2ea250ef31e907860fce5d9d Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Wed, 10 Apr 2024 20:39:37 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#278)
---
.stats.yml | 2 +-
api.md | 26 +-
src/cloudflare/_client.py | 8 +
src/cloudflare/resources/__init__.py | 14 ++
src/cloudflare/resources/queues/queues.py | 43 ++--
.../resources/request_tracers/__init__.py | 33 +++
.../request_tracers/request_tracers.py | 80 ++++++
.../resources/request_tracers/traces.py | 232 ++++++++++++++++++
src/cloudflare/types/__init__.py | 7 +-
.../types/{queue_get_response.py => queue.py} | 4 +-
...ue_create_response.py => queue_created.py} | 4 +-
src/cloudflare/types/queue_list_response.py | 25 --
...ue_update_response.py => queue_updated.py} | 4 +-
src/cloudflare/types/queues/__init__.py | 1 +
src/cloudflare/types/queues/consumer.py | 28 +++
.../types/queues/consumer_get_response.py | 30 +--
.../types/request_tracers/__init__.py | 5 +
src/cloudflare/types/request_tracers/trace.py | 11 +
.../request_tracers/trace_create_params.py | 83 +++++++
.../request_tracers/trace_create_response.py | 25 ++
.../types/request_tracers/trace_item.py | 49 ++++
.../request_tracers/test_traces.py | 206 ++++++++++++++++
tests/api_resources/test_queues.py | 55 ++---
23 files changed, 847 insertions(+), 128 deletions(-)
create mode 100644 src/cloudflare/resources/request_tracers/__init__.py
create mode 100644 src/cloudflare/resources/request_tracers/request_tracers.py
create mode 100644 src/cloudflare/resources/request_tracers/traces.py
rename src/cloudflare/types/{queue_get_response.py => queue.py} (88%)
rename src/cloudflare/types/{queue_create_response.py => queue_created.py} (81%)
delete mode 100644 src/cloudflare/types/queue_list_response.py
rename src/cloudflare/types/{queue_update_response.py => queue_updated.py} (81%)
create mode 100644 src/cloudflare/types/queues/consumer.py
create mode 100644 src/cloudflare/types/request_tracers/trace.py
create mode 100644 src/cloudflare/types/request_tracers/trace_create_params.py
create mode 100644 src/cloudflare/types/request_tracers/trace_create_response.py
create mode 100644 src/cloudflare/types/request_tracers/trace_item.py
create mode 100644 tests/api_resources/request_tracers/test_traces.py
diff --git a/.stats.yml b/.stats.yml
index a9d90133735..0818ecbb822 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1 +1 @@
-configured_endpoints: 1250
+configured_endpoints: 1251
diff --git a/api.md b/api.md
index 97a4a41bf3c..d32be78a0d9 100644
--- a/api.md
+++ b/api.md
@@ -2900,26 +2900,16 @@ Methods:
Types:
```python
-from cloudflare.types import (
- Queue,
- QueueCreated,
- QueueSettings,
- QueueUpdated,
- QueueCreateResponse,
- QueueUpdateResponse,
- QueueListResponse,
- QueueDeleteResponse,
- QueueGetResponse,
-)
+from cloudflare.types import Queue, QueueCreated, QueueUpdated, QueueDeleteResponse
```
Methods:
-- client.queues.create(\*, account_id, \*\*params) -> Optional
-- client.queues.update(queue_id, \*, account_id, \*\*params) -> Optional
-- client.queues.list(\*, account_id) -> SyncSinglePage[QueueListResponse]
+- client.queues.create(\*, account_id, \*\*params) -> Optional
+- client.queues.update(queue_id, \*, account_id, \*\*params) -> Optional
+- client.queues.list(\*, account_id) -> SyncSinglePage[Queue]
- client.queues.delete(queue_id, \*, account_id, \*\*params) -> Optional
-- client.queues.get(queue_id, \*, account_id) -> Optional
+- client.queues.get(queue_id, \*, account_id) -> Optional
## Consumers
@@ -4174,9 +4164,13 @@ Methods:
Types:
```python
-from cloudflare.types.request_tracers import Trace, TraceItem
+from cloudflare.types.request_tracers import Trace, TraceItem, TraceCreateResponse
```
+Methods:
+
+- client.request_tracers.traces.create(\*, account_id, \*\*params) -> TraceCreateResponse
+
# Rules
## Lists
diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py
index dfd01609e7c..d85574035e0 100644
--- a/src/cloudflare/_client.py
+++ b/src/cloudflare/_client.py
@@ -103,6 +103,7 @@ class Cloudflare(SyncAPIClient):
pages: resources.Pages
pcaps: resources.PCAPs
registrar: resources.Registrar
+ request_tracers: resources.RequestTracers
rules: resources.Rules
storage: resources.Storage
stream: resources.Stream
@@ -257,6 +258,7 @@ def __init__(
self.pages = resources.Pages(self)
self.pcaps = resources.PCAPs(self)
self.registrar = resources.Registrar(self)
+ self.request_tracers = resources.RequestTracers(self)
self.rules = resources.Rules(self)
self.storage = resources.Storage(self)
self.stream = resources.Stream(self)
@@ -514,6 +516,7 @@ class AsyncCloudflare(AsyncAPIClient):
pages: resources.AsyncPages
pcaps: resources.AsyncPCAPs
registrar: resources.AsyncRegistrar
+ request_tracers: resources.AsyncRequestTracers
rules: resources.AsyncRules
storage: resources.AsyncStorage
stream: resources.AsyncStream
@@ -668,6 +671,7 @@ def __init__(
self.pages = resources.AsyncPages(self)
self.pcaps = resources.AsyncPCAPs(self)
self.registrar = resources.AsyncRegistrar(self)
+ self.request_tracers = resources.AsyncRequestTracers(self)
self.rules = resources.AsyncRules(self)
self.storage = resources.AsyncStorage(self)
self.stream = resources.AsyncStream(self)
@@ -926,6 +930,7 @@ def __init__(self, client: Cloudflare) -> None:
self.pages = resources.PagesWithRawResponse(client.pages)
self.pcaps = resources.PCAPsWithRawResponse(client.pcaps)
self.registrar = resources.RegistrarWithRawResponse(client.registrar)
+ self.request_tracers = resources.RequestTracersWithRawResponse(client.request_tracers)
self.rules = resources.RulesWithRawResponse(client.rules)
self.storage = resources.StorageWithRawResponse(client.storage)
self.stream = resources.StreamWithRawResponse(client.stream)
@@ -1015,6 +1020,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.pages = resources.AsyncPagesWithRawResponse(client.pages)
self.pcaps = resources.AsyncPCAPsWithRawResponse(client.pcaps)
self.registrar = resources.AsyncRegistrarWithRawResponse(client.registrar)
+ self.request_tracers = resources.AsyncRequestTracersWithRawResponse(client.request_tracers)
self.rules = resources.AsyncRulesWithRawResponse(client.rules)
self.storage = resources.AsyncStorageWithRawResponse(client.storage)
self.stream = resources.AsyncStreamWithRawResponse(client.stream)
@@ -1104,6 +1110,7 @@ def __init__(self, client: Cloudflare) -> None:
self.pages = resources.PagesWithStreamingResponse(client.pages)
self.pcaps = resources.PCAPsWithStreamingResponse(client.pcaps)
self.registrar = resources.RegistrarWithStreamingResponse(client.registrar)
+ self.request_tracers = resources.RequestTracersWithStreamingResponse(client.request_tracers)
self.rules = resources.RulesWithStreamingResponse(client.rules)
self.storage = resources.StorageWithStreamingResponse(client.storage)
self.stream = resources.StreamWithStreamingResponse(client.stream)
@@ -1197,6 +1204,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.pages = resources.AsyncPagesWithStreamingResponse(client.pages)
self.pcaps = resources.AsyncPCAPsWithStreamingResponse(client.pcaps)
self.registrar = resources.AsyncRegistrarWithStreamingResponse(client.registrar)
+ self.request_tracers = resources.AsyncRequestTracersWithStreamingResponse(client.request_tracers)
self.rules = resources.AsyncRulesWithStreamingResponse(client.rules)
self.storage = resources.AsyncStorageWithStreamingResponse(client.storage)
self.stream = resources.AsyncStreamWithStreamingResponse(client.stream)
diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py
index 19790921911..096d7cfd8ea 100644
--- a/src/cloudflare/resources/__init__.py
+++ b/src/cloudflare/resources/__init__.py
@@ -520,6 +520,14 @@
ManagedHeadersWithStreamingResponse,
AsyncManagedHeadersWithStreamingResponse,
)
+from .request_tracers import (
+ RequestTracers,
+ AsyncRequestTracers,
+ RequestTracersWithRawResponse,
+ AsyncRequestTracersWithRawResponse,
+ RequestTracersWithStreamingResponse,
+ AsyncRequestTracersWithStreamingResponse,
+)
from .brand_protection import (
BrandProtection,
AsyncBrandProtection,
@@ -970,6 +978,12 @@
"AsyncRegistrarWithRawResponse",
"RegistrarWithStreamingResponse",
"AsyncRegistrarWithStreamingResponse",
+ "RequestTracers",
+ "AsyncRequestTracers",
+ "RequestTracersWithRawResponse",
+ "AsyncRequestTracersWithRawResponse",
+ "RequestTracersWithStreamingResponse",
+ "AsyncRequestTracersWithStreamingResponse",
"Rules",
"AsyncRules",
"RulesWithRawResponse",
diff --git a/src/cloudflare/resources/queues/queues.py b/src/cloudflare/resources/queues/queues.py
index f96cb24fdb8..a77bb705534 100644
--- a/src/cloudflare/resources/queues/queues.py
+++ b/src/cloudflare/resources/queues/queues.py
@@ -7,11 +7,10 @@
import httpx
from ...types import (
- QueueGetResponse,
- QueueListResponse,
- QueueCreateResponse,
+ Queue,
+ QueueCreated,
+ QueueUpdated,
QueueDeleteResponse,
- QueueUpdateResponse,
queue_create_params,
queue_delete_params,
queue_update_params,
@@ -83,7 +82,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[QueueCreateResponse]:
+ ) -> Optional[QueueCreated]:
"""
Creates a new queue.
@@ -110,7 +109,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Optional[QueueCreateResponse]], ResultWrapper[QueueCreateResponse]),
+ cast_to=cast(Type[Optional[QueueCreated]], ResultWrapper[QueueCreated]),
)
def update(
@@ -125,7 +124,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[QueueUpdateResponse]:
+ ) -> Optional[QueueUpdated]:
"""
Updates a queue.
@@ -156,7 +155,7 @@ def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]),
+ cast_to=cast(Type[Optional[QueueUpdated]], ResultWrapper[QueueUpdated]),
)
def list(
@@ -169,7 +168,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncSinglePage[QueueListResponse]:
+ ) -> SyncSinglePage[Queue]:
"""
Returns the queues owned by an account.
@@ -188,11 +187,11 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/queues",
- page=SyncSinglePage[QueueListResponse],
+ page=SyncSinglePage[Queue],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=QueueListResponse,
+ model=Queue,
)
def delete(
@@ -257,7 +256,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[QueueGetResponse]:
+ ) -> Optional[Queue]:
"""
Get information about a specific queue.
@@ -287,7 +286,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Optional[QueueGetResponse]], ResultWrapper[QueueGetResponse]),
+ cast_to=cast(Type[Optional[Queue]], ResultWrapper[Queue]),
)
@@ -319,7 +318,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[QueueCreateResponse]:
+ ) -> Optional[QueueCreated]:
"""
Creates a new queue.
@@ -346,7 +345,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Optional[QueueCreateResponse]], ResultWrapper[QueueCreateResponse]),
+ cast_to=cast(Type[Optional[QueueCreated]], ResultWrapper[QueueCreated]),
)
async def update(
@@ -361,7 +360,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[QueueUpdateResponse]:
+ ) -> Optional[QueueUpdated]:
"""
Updates a queue.
@@ -392,7 +391,7 @@ async def update(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]),
+ cast_to=cast(Type[Optional[QueueUpdated]], ResultWrapper[QueueUpdated]),
)
def list(
@@ -405,7 +404,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[QueueListResponse, AsyncSinglePage[QueueListResponse]]:
+ ) -> AsyncPaginator[Queue, AsyncSinglePage[Queue]]:
"""
Returns the queues owned by an account.
@@ -424,11 +423,11 @@ def list(
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
f"/accounts/{account_id}/queues",
- page=AsyncSinglePage[QueueListResponse],
+ page=AsyncSinglePage[Queue],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
- model=QueueListResponse,
+ model=Queue,
)
async def delete(
@@ -493,7 +492,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Optional[QueueGetResponse]:
+ ) -> Optional[Queue]:
"""
Get information about a specific queue.
@@ -523,7 +522,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[Optional[QueueGetResponse]], ResultWrapper[QueueGetResponse]),
+ cast_to=cast(Type[Optional[Queue]], ResultWrapper[Queue]),
)
diff --git a/src/cloudflare/resources/request_tracers/__init__.py b/src/cloudflare/resources/request_tracers/__init__.py
new file mode 100644
index 00000000000..f19a11ba800
--- /dev/null
+++ b/src/cloudflare/resources/request_tracers/__init__.py
@@ -0,0 +1,33 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from .traces import (
+ Traces,
+ AsyncTraces,
+ TracesWithRawResponse,
+ AsyncTracesWithRawResponse,
+ TracesWithStreamingResponse,
+ AsyncTracesWithStreamingResponse,
+)
+from .request_tracers import (
+ RequestTracers,
+ AsyncRequestTracers,
+ RequestTracersWithRawResponse,
+ AsyncRequestTracersWithRawResponse,
+ RequestTracersWithStreamingResponse,
+ AsyncRequestTracersWithStreamingResponse,
+)
+
+__all__ = [
+ "Traces",
+ "AsyncTraces",
+ "TracesWithRawResponse",
+ "AsyncTracesWithRawResponse",
+ "TracesWithStreamingResponse",
+ "AsyncTracesWithStreamingResponse",
+ "RequestTracers",
+ "AsyncRequestTracers",
+ "RequestTracersWithRawResponse",
+ "AsyncRequestTracersWithRawResponse",
+ "RequestTracersWithStreamingResponse",
+ "AsyncRequestTracersWithStreamingResponse",
+]
diff --git a/src/cloudflare/resources/request_tracers/request_tracers.py b/src/cloudflare/resources/request_tracers/request_tracers.py
new file mode 100644
index 00000000000..bf03ddeaa5e
--- /dev/null
+++ b/src/cloudflare/resources/request_tracers/request_tracers.py
@@ -0,0 +1,80 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from .traces import (
+ Traces,
+ AsyncTraces,
+ TracesWithRawResponse,
+ AsyncTracesWithRawResponse,
+ TracesWithStreamingResponse,
+ AsyncTracesWithStreamingResponse,
+)
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+
+__all__ = ["RequestTracers", "AsyncRequestTracers"]
+
+
+class RequestTracers(SyncAPIResource):
+ @cached_property
+ def traces(self) -> Traces:
+ return Traces(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> RequestTracersWithRawResponse:
+ return RequestTracersWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> RequestTracersWithStreamingResponse:
+ return RequestTracersWithStreamingResponse(self)
+
+
+class AsyncRequestTracers(AsyncAPIResource):
+ @cached_property
+ def traces(self) -> AsyncTraces:
+ return AsyncTraces(self._client)
+
+ @cached_property
+ def with_raw_response(self) -> AsyncRequestTracersWithRawResponse:
+ return AsyncRequestTracersWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncRequestTracersWithStreamingResponse:
+ return AsyncRequestTracersWithStreamingResponse(self)
+
+
+class RequestTracersWithRawResponse:
+ def __init__(self, request_tracers: RequestTracers) -> None:
+ self._request_tracers = request_tracers
+
+ @cached_property
+ def traces(self) -> TracesWithRawResponse:
+ return TracesWithRawResponse(self._request_tracers.traces)
+
+
+class AsyncRequestTracersWithRawResponse:
+ def __init__(self, request_tracers: AsyncRequestTracers) -> None:
+ self._request_tracers = request_tracers
+
+ @cached_property
+ def traces(self) -> AsyncTracesWithRawResponse:
+ return AsyncTracesWithRawResponse(self._request_tracers.traces)
+
+
+class RequestTracersWithStreamingResponse:
+ def __init__(self, request_tracers: RequestTracers) -> None:
+ self._request_tracers = request_tracers
+
+ @cached_property
+ def traces(self) -> TracesWithStreamingResponse:
+ return TracesWithStreamingResponse(self._request_tracers.traces)
+
+
+class AsyncRequestTracersWithStreamingResponse:
+ def __init__(self, request_tracers: AsyncRequestTracers) -> None:
+ self._request_tracers = request_tracers
+
+ @cached_property
+ def traces(self) -> AsyncTracesWithStreamingResponse:
+ return AsyncTracesWithStreamingResponse(self._request_tracers.traces)
diff --git a/src/cloudflare/resources/request_tracers/traces.py b/src/cloudflare/resources/request_tracers/traces.py
new file mode 100644
index 00000000000..f59ade0342e
--- /dev/null
+++ b/src/cloudflare/resources/request_tracers/traces.py
@@ -0,0 +1,232 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict, Type, cast
+
+import httpx
+
+from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
+from ..._utils import (
+ maybe_transform,
+ async_maybe_transform,
+)
+from ..._compat import cached_property
+from ..._resource import SyncAPIResource, AsyncAPIResource
+from ..._response import (
+ to_raw_response_wrapper,
+ to_streamed_response_wrapper,
+ async_to_raw_response_wrapper,
+ async_to_streamed_response_wrapper,
+)
+from ..._wrappers import ResultWrapper
+from ..._base_client import (
+ make_request_options,
+)
+from ...types.request_tracers import TraceCreateResponse, trace_create_params
+
+__all__ = ["Traces", "AsyncTraces"]
+
+
+class Traces(SyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> TracesWithRawResponse:
+ return TracesWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> TracesWithStreamingResponse:
+ return TracesWithStreamingResponse(self)
+
+ def create(
+ self,
+ *,
+ account_id: str,
+ method: str,
+ url: str,
+ body: trace_create_params.Body | NotGiven = NOT_GIVEN,
+ context: trace_create_params.Context | NotGiven = NOT_GIVEN,
+ cookies: Dict[str, str] | NotGiven = NOT_GIVEN,
+ headers: Dict[str, str] | NotGiven = NOT_GIVEN,
+ protocol: str | NotGiven = NOT_GIVEN,
+ skip_response: 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> TraceCreateResponse:
+ """
+ Request Trace
+
+ Args:
+ account_id: Identifier
+
+ method: HTTP Method of tracing request
+
+ url: URL to which perform tracing request
+
+ context: Additional request parameters
+
+ cookies: Cookies added to tracing request
+
+ headers: Headers added to tracing request
+
+ protocol: HTTP Protocol of tracing request
+
+ skip_response: Skip sending the request to the Origin server after all rules evaluation
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return self._post(
+ f"/accounts/{account_id}/request-tracer/trace",
+ body=maybe_transform(
+ {
+ "method": method,
+ "url": url,
+ "body": body,
+ "context": context,
+ "cookies": cookies,
+ "headers": headers,
+ "protocol": protocol,
+ "skip_response": skip_response,
+ },
+ trace_create_params.TraceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]),
+ )
+
+
+class AsyncTraces(AsyncAPIResource):
+ @cached_property
+ def with_raw_response(self) -> AsyncTracesWithRawResponse:
+ return AsyncTracesWithRawResponse(self)
+
+ @cached_property
+ def with_streaming_response(self) -> AsyncTracesWithStreamingResponse:
+ return AsyncTracesWithStreamingResponse(self)
+
+ async def create(
+ self,
+ *,
+ account_id: str,
+ method: str,
+ url: str,
+ body: trace_create_params.Body | NotGiven = NOT_GIVEN,
+ context: trace_create_params.Context | NotGiven = NOT_GIVEN,
+ cookies: Dict[str, str] | NotGiven = NOT_GIVEN,
+ headers: Dict[str, str] | NotGiven = NOT_GIVEN,
+ protocol: str | NotGiven = NOT_GIVEN,
+ skip_response: 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.
+ extra_headers: Headers | None = None,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> TraceCreateResponse:
+ """
+ Request Trace
+
+ Args:
+ account_id: Identifier
+
+ method: HTTP Method of tracing request
+
+ url: URL to which perform tracing request
+
+ context: Additional request parameters
+
+ cookies: Cookies added to tracing request
+
+ headers: Headers added to tracing request
+
+ protocol: HTTP Protocol of tracing request
+
+ skip_response: Skip sending the request to the Origin server after all rules evaluation
+
+ extra_headers: Send extra headers
+
+ extra_query: Add additional query parameters to the request
+
+ extra_body: Add additional JSON properties to the request
+
+ timeout: Override the client-level default timeout for this request, in seconds
+ """
+ if not account_id:
+ raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
+ return await self._post(
+ f"/accounts/{account_id}/request-tracer/trace",
+ body=await async_maybe_transform(
+ {
+ "method": method,
+ "url": url,
+ "body": body,
+ "context": context,
+ "cookies": cookies,
+ "headers": headers,
+ "protocol": protocol,
+ "skip_response": skip_response,
+ },
+ trace_create_params.TraceCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper._unwrapper,
+ ),
+ cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]),
+ )
+
+
+class TracesWithRawResponse:
+ def __init__(self, traces: Traces) -> None:
+ self._traces = traces
+
+ self.create = to_raw_response_wrapper(
+ traces.create,
+ )
+
+
+class AsyncTracesWithRawResponse:
+ def __init__(self, traces: AsyncTraces) -> None:
+ self._traces = traces
+
+ self.create = async_to_raw_response_wrapper(
+ traces.create,
+ )
+
+
+class TracesWithStreamingResponse:
+ def __init__(self, traces: Traces) -> None:
+ self._traces = traces
+
+ self.create = to_streamed_response_wrapper(
+ traces.create,
+ )
+
+
+class AsyncTracesWithStreamingResponse:
+ def __init__(self, traces: AsyncTraces) -> None:
+ self._traces = traces
+
+ self.create = async_to_streamed_response_wrapper(
+ traces.create,
+ )
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index 85ef8bae595..2c4533ea5a0 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -9,6 +9,7 @@
from .info import Info as Info
from .pcap import PCAP as PCAP
from .zone import Zone as Zone
+from .queue import Queue as Queue
from .route import Route as Route
from .rules import Rules as Rules
from .trend import Trend as Trend
@@ -69,6 +70,8 @@
from .default_pools import DefaultPools as DefaultPools
from .load_balancer import LoadBalancer as LoadBalancer
from .load_shedding import LoadShedding as LoadShedding
+from .queue_created import QueueCreated as QueueCreated
+from .queue_updated import QueueUpdated as QueueUpdated
from .request_model import RequestModel as RequestModel
from .edge_ips_param import EdgeIPsParam as EdgeIPsParam
from .filter_options import FilterOptions as FilterOptions
@@ -113,7 +116,6 @@
from .http_configuration import HTTPConfiguration as HTTPConfiguration
from .pcap_create_params import PCAPCreateParams as PCAPCreateParams
from .pcap_list_response import PCAPListResponse as PCAPListResponse
-from .queue_get_response import QueueGetResponse as QueueGetResponse
from .stream_list_params import StreamListParams as StreamListParams
from .user_edit_response import UserEditResponse as UserEditResponse
from .zone_create_params import ZoneCreateParams as ZoneCreateParams
@@ -126,7 +128,6 @@
from .notification_filter import NotificationFilter as NotificationFilter
from .queue_create_params import QueueCreateParams as QueueCreateParams
from .queue_delete_params import QueueDeleteParams as QueueDeleteParams
-from .queue_list_response import QueueListResponse as QueueListResponse
from .queue_update_params import QueueUpdateParams as QueueUpdateParams
from .request_model_param import RequestModelParam as RequestModelParam
from .speed_delete_params import SpeedDeleteParams as SpeedDeleteParams
@@ -152,9 +153,7 @@
from .origin_ca_certificate import OriginCACertificate as OriginCACertificate
from .origin_steering_param import OriginSteeringParam as OriginSteeringParam
from .pagerule_get_response import PageruleGetResponse as PageruleGetResponse
-from .queue_create_response import QueueCreateResponse as QueueCreateResponse
from .queue_delete_response import QueueDeleteResponse as QueueDeleteResponse
-from .queue_update_response import QueueUpdateResponse as QueueUpdateResponse
from .random_steering_param import RandomSteeringParam as RandomSteeringParam
from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams
from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams
diff --git a/src/cloudflare/types/queue_get_response.py b/src/cloudflare/types/queue.py
similarity index 88%
rename from src/cloudflare/types/queue_get_response.py
rename to src/cloudflare/types/queue.py
index c7b3d43ad11..6ba9cf7141e 100644
--- a/src/cloudflare/types/queue_get_response.py
+++ b/src/cloudflare/types/queue.py
@@ -4,10 +4,10 @@
from .._models import BaseModel
-__all__ = ["QueueGetResponse"]
+__all__ = ["Queue"]
-class QueueGetResponse(BaseModel):
+class Queue(BaseModel):
consumers: Optional[object] = None
consumers_total_count: Optional[object] = None
diff --git a/src/cloudflare/types/queue_create_response.py b/src/cloudflare/types/queue_created.py
similarity index 81%
rename from src/cloudflare/types/queue_create_response.py
rename to src/cloudflare/types/queue_created.py
index 1a1c3b8d771..6bcbffe0360 100644
--- a/src/cloudflare/types/queue_create_response.py
+++ b/src/cloudflare/types/queue_created.py
@@ -4,10 +4,10 @@
from .._models import BaseModel
-__all__ = ["QueueCreateResponse"]
+__all__ = ["QueueCreated"]
-class QueueCreateResponse(BaseModel):
+class QueueCreated(BaseModel):
created_on: Optional[object] = None
modified_on: Optional[object] = None
diff --git a/src/cloudflare/types/queue_list_response.py b/src/cloudflare/types/queue_list_response.py
deleted file mode 100644
index 1ccfe1e6e71..00000000000
--- a/src/cloudflare/types/queue_list_response.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Optional
-
-from .._models import BaseModel
-
-__all__ = ["QueueListResponse"]
-
-
-class QueueListResponse(BaseModel):
- consumers: Optional[object] = None
-
- consumers_total_count: Optional[object] = None
-
- created_on: Optional[object] = None
-
- modified_on: Optional[object] = None
-
- producers: Optional[object] = None
-
- producers_total_count: Optional[object] = None
-
- queue_id: Optional[str] = None
-
- queue_name: Optional[str] = None
diff --git a/src/cloudflare/types/queue_update_response.py b/src/cloudflare/types/queue_updated.py
similarity index 81%
rename from src/cloudflare/types/queue_update_response.py
rename to src/cloudflare/types/queue_updated.py
index 032b4f22b2d..9192a21863b 100644
--- a/src/cloudflare/types/queue_update_response.py
+++ b/src/cloudflare/types/queue_updated.py
@@ -4,10 +4,10 @@
from .._models import BaseModel
-__all__ = ["QueueUpdateResponse"]
+__all__ = ["QueueUpdated"]
-class QueueUpdateResponse(BaseModel):
+class QueueUpdated(BaseModel):
created_on: Optional[object] = None
modified_on: Optional[object] = None
diff --git a/src/cloudflare/types/queues/__init__.py b/src/cloudflare/types/queues/__init__.py
index fa5698295b9..f8ec018f5b0 100644
--- a/src/cloudflare/types/queues/__init__.py
+++ b/src/cloudflare/types/queues/__init__.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+from .consumer import Consumer as Consumer
from .message_ack_params import MessageAckParams as MessageAckParams
from .message_pull_params import MessagePullParams as MessagePullParams
from .message_ack_response import MessageAckResponse as MessageAckResponse
diff --git a/src/cloudflare/types/queues/consumer.py b/src/cloudflare/types/queues/consumer.py
new file mode 100644
index 00000000000..86bd8eefd02
--- /dev/null
+++ b/src/cloudflare/types/queues/consumer.py
@@ -0,0 +1,28 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Optional
+
+from ..._models import BaseModel
+
+__all__ = ["Consumer", "Settings"]
+
+
+class Settings(BaseModel):
+ batch_size: Optional[float] = None
+ """The maximum number of messages to include in a batch"""
+
+ max_retries: Optional[float] = None
+
+ max_wait_time_ms: Optional[float] = None
+
+
+class Consumer(BaseModel):
+ created_on: Optional[object] = None
+
+ environment: Optional[object] = None
+
+ queue_name: Optional[object] = None
+
+ service: Optional[object] = None
+
+ settings: Optional[Settings] = None
diff --git a/src/cloudflare/types/queues/consumer_get_response.py b/src/cloudflare/types/queues/consumer_get_response.py
index 8a00b17a127..a812d05b30b 100644
--- a/src/cloudflare/types/queues/consumer_get_response.py
+++ b/src/cloudflare/types/queues/consumer_get_response.py
@@ -1,31 +1,9 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-from typing import List, Optional
+from typing import List
-from ..._models import BaseModel
+from .consumer import Consumer
-__all__ = ["ConsumerGetResponse", "ConsumerGetResponseItem", "ConsumerGetResponseItemSettings"]
+__all__ = ["ConsumerGetResponse"]
-
-class ConsumerGetResponseItemSettings(BaseModel):
- batch_size: Optional[float] = None
- """The maximum number of messages to include in a batch"""
-
- max_retries: Optional[float] = None
-
- max_wait_time_ms: Optional[float] = None
-
-
-class ConsumerGetResponseItem(BaseModel):
- created_on: Optional[object] = None
-
- environment: Optional[object] = None
-
- queue_name: Optional[object] = None
-
- service: Optional[object] = None
-
- settings: Optional[ConsumerGetResponseItemSettings] = None
-
-
-ConsumerGetResponse = List[ConsumerGetResponseItem]
+ConsumerGetResponse = List[Consumer]
diff --git a/src/cloudflare/types/request_tracers/__init__.py b/src/cloudflare/types/request_tracers/__init__.py
index f8ee8b14b1c..40a59470259 100644
--- a/src/cloudflare/types/request_tracers/__init__.py
+++ b/src/cloudflare/types/request_tracers/__init__.py
@@ -1,3 +1,8 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from __future__ import annotations
+
+from .trace import Trace as Trace
+from .trace_item import TraceItem as TraceItem
+from .trace_create_params import TraceCreateParams as TraceCreateParams
+from .trace_create_response import TraceCreateResponse as TraceCreateResponse
diff --git a/src/cloudflare/types/request_tracers/trace.py b/src/cloudflare/types/request_tracers/trace.py
new file mode 100644
index 00000000000..4687762c7f8
--- /dev/null
+++ b/src/cloudflare/types/request_tracers/trace.py
@@ -0,0 +1,11 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import List
+
+__all__ = ["Trace"]
+
+Trace = List["TraceItem"]
+
+from .trace_item import TraceItem
diff --git a/src/cloudflare/types/request_tracers/trace_create_params.py b/src/cloudflare/types/request_tracers/trace_create_params.py
new file mode 100644
index 00000000000..6acca264b84
--- /dev/null
+++ b/src/cloudflare/types/request_tracers/trace_create_params.py
@@ -0,0 +1,83 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Dict
+from typing_extensions import Required, TypedDict
+
+__all__ = ["TraceCreateParams", "Body", "Context", "ContextGeoloc"]
+
+
+class TraceCreateParams(TypedDict, total=False):
+ account_id: Required[str]
+ """Identifier"""
+
+ method: Required[str]
+ """HTTP Method of tracing request"""
+
+ url: Required[str]
+ """URL to which perform tracing request"""
+
+ body: Body
+
+ context: Context
+ """Additional request parameters"""
+
+ cookies: Dict[str, str]
+ """Cookies added to tracing request"""
+
+ headers: Dict[str, str]
+ """Headers added to tracing request"""
+
+ protocol: str
+ """HTTP Protocol of tracing request"""
+
+ skip_response: bool
+ """Skip sending the request to the Origin server after all rules evaluation"""
+
+
+class Body(TypedDict, total=False):
+ base64: str
+ """Base64 encoded request body"""
+
+ json: object
+ """Arbitrary json as request body"""
+
+ plain_text: str
+ """Request body as plain text"""
+
+
+class ContextGeoloc(TypedDict, total=False):
+ city: str
+
+ continent: str
+
+ is_eu_country: bool
+
+ iso_code: str
+
+ latitude: float
+
+ longitude: float
+
+ postal_code: str
+
+ region_code: str
+
+ subdivision_2_iso_code: str
+
+ timezone: str
+
+
+class Context(TypedDict, total=False):
+ bot_score: int
+ """Bot score used for evaluating tracing request processing"""
+
+ geoloc: ContextGeoloc
+ """Geodata for tracing request"""
+
+ skip_challenge: bool
+ """Whether to skip any challenges for tracing request (e.g.: captcha)"""
+
+ threat_score: int
+ """Threat score used for evaluating tracing request processing"""
diff --git a/src/cloudflare/types/request_tracers/trace_create_response.py b/src/cloudflare/types/request_tracers/trace_create_response.py
new file mode 100644
index 00000000000..3e72c080e9a
--- /dev/null
+++ b/src/cloudflare/types/request_tracers/trace_create_response.py
@@ -0,0 +1,25 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+
+from ..._compat import PYDANTIC_V2
+from ..._models import BaseModel
+
+__all__ = ["TraceCreateResponse"]
+
+
+class TraceCreateResponse(BaseModel):
+ status_code: Optional[int] = None
+ """HTTP Status code of zone response"""
+
+ trace: Optional["Trace"] = None
+
+
+from .trace import Trace
+
+if PYDANTIC_V2:
+ TraceCreateResponse.model_rebuild()
+else:
+ TraceCreateResponse.update_forward_refs() # type: ignore
diff --git a/src/cloudflare/types/request_tracers/trace_item.py b/src/cloudflare/types/request_tracers/trace_item.py
new file mode 100644
index 00000000000..2830764115e
--- /dev/null
+++ b/src/cloudflare/types/request_tracers/trace_item.py
@@ -0,0 +1,49 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+from typing import Optional
+
+from ..._compat import PYDANTIC_V2
+from ..._models import BaseModel
+
+__all__ = ["TraceItem"]
+
+
+class TraceItem(BaseModel):
+ action: Optional[str] = None
+ """If step type is rule, then action performed by this rule"""
+
+ action_parameters: Optional[object] = None
+ """If step type is rule, then action parameters of this rule as JSON"""
+
+ description: Optional[str] = None
+ """If step type is rule or ruleset, the description of this entity"""
+
+ expression: Optional[str] = None
+ """If step type is rule, then expression used to match for this rule"""
+
+ kind: Optional[str] = None
+ """If step type is ruleset, then kind of this ruleset"""
+
+ matched: Optional[bool] = None
+ """Whether tracing step affected tracing request/response"""
+
+ name: Optional[str] = None
+ """If step type is ruleset, then name of this ruleset"""
+
+ step_name: Optional[str] = None
+ """Tracing step identifying name"""
+
+ trace: Optional["Trace"] = None
+
+ type: Optional[str] = None
+ """Tracing step type"""
+
+
+from .trace import Trace
+
+if PYDANTIC_V2:
+ TraceItem.model_rebuild()
+else:
+ TraceItem.update_forward_refs() # type: ignore
diff --git a/tests/api_resources/request_tracers/test_traces.py b/tests/api_resources/request_tracers/test_traces.py
new file mode 100644
index 00000000000..75041e3023e
--- /dev/null
+++ b/tests/api_resources/request_tracers/test_traces.py
@@ -0,0 +1,206 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from __future__ import annotations
+
+import os
+from typing import Any, cast
+
+import pytest
+
+from cloudflare import Cloudflare, AsyncCloudflare
+from tests.utils import assert_matches_type
+from cloudflare.types.request_tracers import TraceCreateResponse
+
+base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
+
+
+class TestTraces:
+ parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create(self, client: Cloudflare) -> None:
+ trace = client.request_tracers.traces.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ )
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ trace = client.request_tracers.traces.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ body={
+ "base64": "c29tZV9yZXF1ZXN0X2JvZHk=",
+ "json": {},
+ "plain_text": "string",
+ },
+ context={
+ "bot_score": 0,
+ "geoloc": {
+ "city": "London",
+ "continent": "string",
+ "is_eu_country": True,
+ "iso_code": "string",
+ "latitude": 0,
+ "longitude": 0,
+ "postal_code": "string",
+ "region_code": "string",
+ "subdivision_2_iso_code": "string",
+ "timezone": "string",
+ },
+ "skip_challenge": True,
+ "threat_score": 0,
+ },
+ cookies={
+ "cookie_name_1": "cookie_value_1",
+ "cookie_name_2": "cookie_value_2",
+ },
+ headers={
+ "header_name_1": "header_value_1",
+ "header_name_2": "header_value_2",
+ },
+ protocol="HTTP/1.1",
+ skip_response=True,
+ )
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_raw_response_create(self, client: Cloudflare) -> None:
+ response = client.request_tracers.traces.with_raw_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ trace = response.parse()
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_streaming_response_create(self, client: Cloudflare) -> None:
+ with client.request_tracers.traces.with_streaming_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ trace = response.parse()
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ def test_path_params_create(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.request_tracers.traces.with_raw_response.create(
+ account_id="",
+ method="PUT",
+ url="https://some.zone/some_path",
+ )
+
+
+class TestAsyncTraces:
+ parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ trace = await async_client.request_tracers.traces.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ )
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ trace = await async_client.request_tracers.traces.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ body={
+ "base64": "c29tZV9yZXF1ZXN0X2JvZHk=",
+ "json": {},
+ "plain_text": "string",
+ },
+ context={
+ "bot_score": 0,
+ "geoloc": {
+ "city": "London",
+ "continent": "string",
+ "is_eu_country": True,
+ "iso_code": "string",
+ "latitude": 0,
+ "longitude": 0,
+ "postal_code": "string",
+ "region_code": "string",
+ "subdivision_2_iso_code": "string",
+ "timezone": "string",
+ },
+ "skip_challenge": True,
+ "threat_score": 0,
+ },
+ cookies={
+ "cookie_name_1": "cookie_value_1",
+ "cookie_name_2": "cookie_value_2",
+ },
+ headers={
+ "header_name_1": "header_value_1",
+ "header_name_2": "header_value_2",
+ },
+ protocol="HTTP/1.1",
+ skip_response=True,
+ )
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.request_tracers.traces.with_raw_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ trace = await response.parse()
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.request_tracers.traces.with_streaming_response.create(
+ account_id="023e105f4ecef8ad9ca31a8372d0c353",
+ method="PUT",
+ url="https://some.zone/some_path",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ trace = await response.parse()
+ assert_matches_type(TraceCreateResponse, trace, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip()
+ @parametrize
+ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.request_tracers.traces.with_raw_response.create(
+ account_id="",
+ method="PUT",
+ url="https://some.zone/some_path",
+ )
diff --git a/tests/api_resources/test_queues.py b/tests/api_resources/test_queues.py
index 4040aa3ca7e..470a8ada8e7 100644
--- a/tests/api_resources/test_queues.py
+++ b/tests/api_resources/test_queues.py
@@ -10,11 +10,10 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.types import (
- QueueGetResponse,
- QueueListResponse,
- QueueCreateResponse,
+ Queue,
+ QueueCreated,
+ QueueUpdated,
QueueDeleteResponse,
- QueueUpdateResponse,
)
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
@@ -31,7 +30,7 @@ def test_method_create(self, client: Cloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={"queue_name": "example-queue"},
)
- assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueCreated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -44,7 +43,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueCreated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -57,7 +56,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueCreated], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -78,7 +77,7 @@ def test_method_update(self, client: Cloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={"queue_name": "renamed-example-queue"},
)
- assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueUpdated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -92,7 +91,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueUpdated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -106,7 +105,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueUpdated], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -133,7 +132,7 @@ def test_method_list(self, client: Cloudflare) -> None:
queue = client.queues.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"])
+ assert_matches_type(SyncSinglePage[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -145,7 +144,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"])
+ assert_matches_type(SyncSinglePage[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -157,7 +156,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(SyncSinglePage[QueueListResponse], queue, path=["response"])
+ assert_matches_type(SyncSinglePage[Queue], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -233,7 +232,7 @@ def test_method_get(self, client: Cloudflare) -> None:
"023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(Optional[QueueGetResponse], queue, path=["response"])
+ assert_matches_type(Optional[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -246,7 +245,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(Optional[QueueGetResponse], queue, path=["response"])
+ assert_matches_type(Optional[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -259,7 +258,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = response.parse()
- assert_matches_type(Optional[QueueGetResponse], queue, path=["response"])
+ assert_matches_type(Optional[Queue], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -289,7 +288,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={"queue_name": "example-queue"},
)
- assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueCreated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -302,7 +301,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueCreated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -315,7 +314,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(Optional[QueueCreateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueCreated], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -336,7 +335,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body={"queue_name": "renamed-example-queue"},
)
- assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueUpdated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -350,7 +349,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueUpdated], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -364,7 +363,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(Optional[QueueUpdateResponse], queue, path=["response"])
+ assert_matches_type(Optional[QueueUpdated], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -391,7 +390,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
queue = await async_client.queues.list(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"])
+ assert_matches_type(AsyncSinglePage[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -403,7 +402,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"])
+ assert_matches_type(AsyncSinglePage[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -415,7 +414,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(AsyncSinglePage[QueueListResponse], queue, path=["response"])
+ assert_matches_type(AsyncSinglePage[Queue], queue, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -491,7 +490,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
"023e105f4ecef8ad9ca31a8372d0c353",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(Optional[QueueGetResponse], queue, path=["response"])
+ assert_matches_type(Optional[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -504,7 +503,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(Optional[QueueGetResponse], queue, path=["response"])
+ assert_matches_type(Optional[Queue], queue, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -517,7 +516,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
queue = await response.parse()
- assert_matches_type(Optional[QueueGetResponse], queue, path=["response"])
+ assert_matches_type(Optional[Queue], queue, path=["response"])
assert cast(Any, response.is_closed) is True