From 4d07c9279f476bd900fa730e714116d07eef7302 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Jun 2024 10:22:35 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API (#1123) --- .stats.yml | 2 +- api.md | 2 +- src/cloudflare/resources/url_scanner/scans.py | 10 +++++++++- src/cloudflare/types/url_scanner/__init__.py | 1 + .../types/url_scanner/scan_get_params.py | 17 +++++++++++++++++ tests/api_resources/url_scanner/test_scans.py | 18 ++++++++++++++++++ 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 src/cloudflare/types/url_scanner/scan_get_params.py diff --git a/.stats.yml b/.stats.yml index ea1127a060c..8ba209714d5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 1353 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b08744cc72a6a0538b81cebc0779ae8bcad774e16194cfad3050d741995479a5.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e3d243830285383252b295328e3dd96610460dd746c9a668c767961bebe05156.yml diff --git a/api.md b/api.md index 5cf9fd9a98e..1a3f90bc81a 100644 --- a/api.md +++ b/api.md @@ -6447,7 +6447,7 @@ from cloudflare.types.url_scanner import ( Methods: - client.url_scanner.scans.create(account_id, \*\*params) -> ScanCreateResponse -- client.url_scanner.scans.get(scan_id, \*, account_id) -> ScanGetResponse +- client.url_scanner.scans.get(scan_id, \*, account_id, \*\*params) -> ScanGetResponse - client.url_scanner.scans.har(scan_id, \*, account_id) -> ScanHarResponse - client.url_scanner.scans.screenshot(scan_id, \*, account_id, \*\*params) -> BinaryAPIResponse diff --git a/src/cloudflare/resources/url_scanner/scans.py b/src/cloudflare/resources/url_scanner/scans.py index 5708cfda794..54764c566f1 100644 --- a/src/cloudflare/resources/url_scanner/scans.py +++ b/src/cloudflare/resources/url_scanner/scans.py @@ -32,7 +32,7 @@ from ..._base_client import ( make_request_options, ) -from ...types.url_scanner import scan_create_params, scan_screenshot_params +from ...types.url_scanner import scan_get_params, scan_create_params, scan_screenshot_params from ...types.url_scanner.scan_get_response import ScanGetResponse from ...types.url_scanner.scan_har_response import ScanHarResponse from ...types.url_scanner.scan_create_response import ScanCreateResponse @@ -119,6 +119,7 @@ def get( scan_id: str, *, account_id: str, + full: 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, @@ -134,6 +135,8 @@ def get( scan_id: Scan uuid + full: Whether to return full report (scan summary and network log). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -153,6 +156,7 @@ def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, + query=maybe_transform({"full": full}, scan_get_params.ScanGetParams), post_parser=ResultWrapper[ScanGetResponse]._unwrapper, ), cast_to=cast(Type[ScanGetResponse], ResultWrapper[ScanGetResponse]), @@ -332,6 +336,7 @@ async def get( scan_id: str, *, account_id: str, + full: 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, @@ -347,6 +352,8 @@ async def get( scan_id: Scan uuid + full: Whether to return full report (scan summary and network log). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -366,6 +373,7 @@ async def get( extra_query=extra_query, extra_body=extra_body, timeout=timeout, + query=await async_maybe_transform({"full": full}, scan_get_params.ScanGetParams), post_parser=ResultWrapper[ScanGetResponse]._unwrapper, ), cast_to=cast(Type[ScanGetResponse], ResultWrapper[ScanGetResponse]), diff --git a/src/cloudflare/types/url_scanner/__init__.py b/src/cloudflare/types/url_scanner/__init__.py index dc7c82ec8f9..a533b1cdeb9 100644 --- a/src/cloudflare/types/url_scanner/__init__.py +++ b/src/cloudflare/types/url_scanner/__init__.py @@ -2,6 +2,7 @@ from __future__ import annotations +from .scan_get_params import ScanGetParams as ScanGetParams from .scan_get_response import ScanGetResponse as ScanGetResponse from .scan_har_response import ScanHarResponse as ScanHarResponse from .scan_create_params import ScanCreateParams as ScanCreateParams diff --git a/src/cloudflare/types/url_scanner/scan_get_params.py b/src/cloudflare/types/url_scanner/scan_get_params.py new file mode 100644 index 00000000000..3e19b2920f1 --- /dev/null +++ b/src/cloudflare/types/url_scanner/scan_get_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["ScanGetParams"] + + +class ScanGetParams(TypedDict, total=False): + account_id: Required[Annotated[str, PropertyInfo(alias="accountId")]] + """Account Id""" + + full: bool + """Whether to return full report (scan summary and network log).""" diff --git a/tests/api_resources/url_scanner/test_scans.py b/tests/api_resources/url_scanner/test_scans.py index f58a63f883e..8a33a5f10ce 100644 --- a/tests/api_resources/url_scanner/test_scans.py +++ b/tests/api_resources/url_scanner/test_scans.py @@ -90,6 +90,15 @@ def test_method_get(self, client: Cloudflare) -> None: ) assert_matches_type(ScanGetResponse, scan, path=["response"]) + @parametrize + def test_method_get_with_all_params(self, client: Cloudflare) -> None: + scan = client.url_scanner.scans.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + full=True, + ) + assert_matches_type(ScanGetResponse, scan, path=["response"]) + @parametrize def test_raw_response_get(self, client: Cloudflare) -> None: response = client.url_scanner.scans.with_raw_response.get( @@ -325,6 +334,15 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None: ) assert_matches_type(ScanGetResponse, scan, path=["response"]) + @parametrize + async def test_method_get_with_all_params(self, async_client: AsyncCloudflare) -> None: + scan = await async_client.url_scanner.scans.get( + "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + account_id="string", + full=True, + ) + assert_matches_type(ScanGetResponse, scan, path=["response"]) + @parametrize async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None: response = await async_client.url_scanner.scans.with_raw_response.get(