From 9ac2674696f607c2f45e3970cd9c21efb452a8a0 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Mon, 15 Apr 2024 10:29:49 +0000
Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#311)
---
api.md | 2 +-
.../resources/request_tracers/traces.py | 10 +++++-----
.../request_tracers/test_traces.py | 18 +++++++++---------
3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/api.md b/api.md
index b476b3327d69..a01312f95530 100644
--- a/api.md
+++ b/api.md
@@ -4139,7 +4139,7 @@ from cloudflare.types.request_tracers import Trace, TraceItem, TraceCreateRespon
Methods:
-- client.request_tracers.traces.create(\*, account_id, \*\*params) -> TraceCreateResponse
+- client.request_tracers.traces.create(\*, account_id, \*\*params) -> Optional
# Rules
diff --git a/src/cloudflare/resources/request_tracers/traces.py b/src/cloudflare/resources/request_tracers/traces.py
index f59ade0342ea..da61c598bfa5 100644
--- a/src/cloudflare/resources/request_tracers/traces.py
+++ b/src/cloudflare/resources/request_tracers/traces.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Dict, Type, cast
+from typing import Dict, Type, Optional, cast
import httpx
@@ -55,7 +55,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TraceCreateResponse:
+ ) -> Optional[TraceCreateResponse]:
"""
Request Trace
@@ -108,7 +108,7 @@ def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]),
+ cast_to=cast(Type[Optional[TraceCreateResponse]], ResultWrapper[TraceCreateResponse]),
)
@@ -139,7 +139,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TraceCreateResponse:
+ ) -> Optional[TraceCreateResponse]:
"""
Request Trace
@@ -192,7 +192,7 @@ async def create(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
- cast_to=cast(Type[TraceCreateResponse], ResultWrapper[TraceCreateResponse]),
+ cast_to=cast(Type[Optional[TraceCreateResponse]], ResultWrapper[TraceCreateResponse]),
)
diff --git a/tests/api_resources/request_tracers/test_traces.py b/tests/api_resources/request_tracers/test_traces.py
index 75041e3023e5..ebd56a1359ac 100644
--- a/tests/api_resources/request_tracers/test_traces.py
+++ b/tests/api_resources/request_tracers/test_traces.py
@@ -3,7 +3,7 @@
from __future__ import annotations
import os
-from typing import Any, cast
+from typing import Any, Optional, cast
import pytest
@@ -25,7 +25,7 @@ def test_method_create(self, client: Cloudflare) -> None:
method="PUT",
url="https://some.zone/some_path",
)
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -67,7 +67,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
protocol="HTTP/1.1",
skip_response=True,
)
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -81,7 +81,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"
trace = response.parse()
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -95,7 +95,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
trace = response.parse()
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -121,7 +121,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
method="PUT",
url="https://some.zone/some_path",
)
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -163,7 +163,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
protocol="HTTP/1.1",
skip_response=True,
)
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -177,7 +177,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"
trace = await response.parse()
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
@pytest.mark.skip()
@parametrize
@@ -191,7 +191,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
trace = await response.parse()
- assert_matches_type(TraceCreateResponse, trace, path=["response"])
+ assert_matches_type(Optional[TraceCreateResponse], trace, path=["response"])
assert cast(Any, response.is_closed) is True