Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -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 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
10 changes: 9 additions & 1 deletion src/cloudflare/resources/url_scanner/scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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]),
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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]),
Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/url_scanner/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions src/cloudflare/types/url_scanner/scan_get_params.py
Original file line number Diff line number Diff line change
@@ -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)."""
18 changes: 18 additions & 0 deletions tests/api_resources/url_scanner/test_scans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down