feat(api): OpenAPI spec update via Stainless API (#1123)

This commit is contained in:
stainless-app[bot] 2024-06-21 10:22:35 +00:00 committed by stainless-bot
parent 406cd14643
commit 4d07c9279f
6 changed files with 47 additions and 3 deletions

View file

@ -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

2
api.md
View file

@ -6447,7 +6447,7 @@ from cloudflare.types.url_scanner import (
Methods:
- <code title="post /accounts/{accountId}/urlscanner/scan">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">create</a>(account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_create_params.py">params</a>) -> <a href="./src/cloudflare/types/url_scanner/scan_create_response.py">ScanCreateResponse</a></code>
- <code title="get /accounts/{accountId}/urlscanner/scan/{scanId}">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">get</a>(scan_id, \*, account_id) -> <a href="./src/cloudflare/types/url_scanner/scan_get_response.py">ScanGetResponse</a></code>
- <code title="get /accounts/{accountId}/urlscanner/scan/{scanId}">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">get</a>(scan_id, \*, account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_get_params.py">params</a>) -> <a href="./src/cloudflare/types/url_scanner/scan_get_response.py">ScanGetResponse</a></code>
- <code title="get /accounts/{accountId}/urlscanner/scan/{scanId}/har">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">har</a>(scan_id, \*, account_id) -> <a href="./src/cloudflare/types/url_scanner/scan_har_response.py">ScanHarResponse</a></code>
- <code title="get /accounts/{accountId}/urlscanner/scan/{scanId}/screenshot">client.url_scanner.scans.<a href="./src/cloudflare/resources/url_scanner/scans.py">screenshot</a>(scan_id, \*, account_id, \*\*<a href="src/cloudflare/types/url_scanner/scan_screenshot_params.py">params</a>) -> BinaryAPIResponse</code>

View file

@ -32,7 +32,7 @@ from ..._wrappers import ResultWrapper
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 @@ class ScansResource(SyncAPIResource):
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 @@ class ScansResource(SyncAPIResource):
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 @@ class ScansResource(SyncAPIResource):
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 @@ class AsyncScansResource(AsyncAPIResource):
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 @@ class AsyncScansResource(AsyncAPIResource):
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 @@ class AsyncScansResource(AsyncAPIResource):
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]),

View file

@ -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

View file

@ -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)."""

View file

@ -90,6 +90,15 @@ class TestScans:
)
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 @@ class TestAsyncScans:
)
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(