Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 15, 2024
1 parent 94e1f32 commit 9ac2674
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4139,7 +4139,7 @@ from cloudflare.types.request_tracers import Trace, TraceItem, TraceCreateRespon

Methods:

- <code title="post /accounts/{account_id}/request-tracer/trace">client.request_tracers.traces.<a href="./src/cloudflare/resources/request_tracers/traces.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/request_tracers/trace_create_params.py">params</a>) -> <a href="./src/cloudflare/types/request_tracers/trace_create_response.py">TraceCreateResponse</a></code>
- <code title="post /accounts/{account_id}/request-tracer/trace">client.request_tracers.traces.<a href="./src/cloudflare/resources/request_tracers/traces.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/request_tracers/trace_create_params.py">params</a>) -> <a href="./src/cloudflare/types/request_tracers/trace_create_response.py">Optional</a></code>

# Rules

Expand Down
10 changes: 5 additions & 5 deletions src/cloudflare/resources/request_tracers/traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Dict, Type, cast
from typing import Dict, Type, Optional, cast

import httpx

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]),
)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]),
)


Expand Down
18 changes: 9 additions & 9 deletions tests/api_resources/request_tracers/test_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from __future__ import annotations

import os
from typing import Any, cast
from typing import Any, Optional, cast

import pytest

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 9ac2674

Please sign in to comment.