Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jul 10, 2024
1 parent 95d1aef commit ba4ef78
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1254
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e14edb011f329e0b47ce2b207acc1a5b84a48c3eace9ea30600bb4d5d745eaef.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c06ed89df76febdc32fc835c9d37220c0400821d24f9707c3484054e78e1d94e.yml
10 changes: 5 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,7 @@ from cloudflare.types.intel.attack_surface_report import IssueTypeGetResponse

Methods:

- <code title="get /accounts/{account_id}/intel/attack-surface-report/issue-types">client.intel.attack_surface_report.issue_types.<a href="./src/cloudflare/resources/intel/attack_surface_report/issue_types.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_type_get_response.py">IssueTypeGetResponse</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issue-types">client.intel.attack_surface_report.issue_types.<a href="./src/cloudflare/resources/intel/attack_surface_report/issue_types.py">get</a>(\*, account_id) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_type_get_response.py">Optional</a></code>

### Issues

Expand All @@ -3349,10 +3349,10 @@ from cloudflare.types.intel.attack_surface_report import (
Methods:

- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">list</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_list_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_list_response.py">SyncV4PagePagination[IssueListResponse]</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/class">client.intel.attack*surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">class*</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_class_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_class_response.py">IssueClassResponse</a></code>
- <code title="put /accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">dismiss</a>(issue_id, \*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_dismiss_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_dismiss_response.py">IssueDismissResponse</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/severity">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">severity</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_severity_response.py">IssueSeverityResponse</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/type">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">type</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_type_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_type_response.py">IssueTypeResponse</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/class">client.intel.attack*surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">class*</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_class_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_class_response.py">Optional</a></code>
- <code title="put /accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">dismiss</a>(issue_id, \*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_dismiss_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_dismiss_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/severity">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">severity</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_severity_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_severity_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/intel/attack-surface-report/issues/type">client.intel.attack_surface_report.issues.<a href="./src/cloudflare/resources/intel/attack_surface_report/issues.py">type</a>(\*, account_id, \*\*<a href="src/cloudflare/types/intel/attack_surface_report/issue_type_params.py">params</a>) -> <a href="./src/cloudflare/types/intel/attack_surface_report/issue_type_response.py">Optional</a></code>

# MagicTransit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

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

import httpx

Expand Down Expand Up @@ -43,7 +43,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueTypeGetResponse:
) -> Optional[IssueTypeGetResponse]:
"""
Get Security Center Issues Types
Expand All @@ -67,9 +67,9 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[IssueTypeGetResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueTypeGetResponse]]._unwrapper,
),
cast_to=cast(Type[IssueTypeGetResponse], ResultWrapper[IssueTypeGetResponse]),
cast_to=cast(Type[Optional[IssueTypeGetResponse]], ResultWrapper[IssueTypeGetResponse]),
)


Expand All @@ -92,7 +92,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueTypeGetResponse:
) -> Optional[IssueTypeGetResponse]:
"""
Get Security Center Issues Types
Expand All @@ -116,9 +116,9 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[IssueTypeGetResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueTypeGetResponse]]._unwrapper,
),
cast_to=cast(Type[IssueTypeGetResponse], ResultWrapper[IssueTypeGetResponse]),
cast_to=cast(Type[Optional[IssueTypeGetResponse]], ResultWrapper[IssueTypeGetResponse]),
)


Expand Down
50 changes: 25 additions & 25 deletions src/cloudflare/resources/intel/attack_surface_report/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import Any, List, Type, cast
from typing import Any, List, Type, Optional, cast

import httpx

Expand Down Expand Up @@ -147,7 +147,7 @@ def class_(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueClassResponse:
) -> Optional[IssueClassResponse]:
"""
Get Security Center Issue Counts by Class
Expand Down Expand Up @@ -187,9 +187,9 @@ def class_(
},
issue_class_params.IssueClassParams,
),
post_parser=ResultWrapper[IssueClassResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueClassResponse]]._unwrapper,
),
cast_to=cast(Type[IssueClassResponse], ResultWrapper[IssueClassResponse]),
cast_to=cast(Type[Optional[IssueClassResponse]], ResultWrapper[IssueClassResponse]),
)

def dismiss(
Expand All @@ -204,7 +204,7 @@ def dismiss(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueDismissResponse:
) -> Optional[IssueDismissResponse]:
"""
Archive Security Center Insight
Expand All @@ -224,7 +224,7 @@ def dismiss(
if not issue_id:
raise ValueError(f"Expected a non-empty value for `issue_id` but received {issue_id!r}")
return cast(
IssueDismissResponse,
Optional[IssueDismissResponse],
self._put(
f"/accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss",
body=maybe_transform({"dismiss": dismiss}, issue_dismiss_params.IssueDismissParams),
Expand All @@ -233,7 +233,7 @@ def dismiss(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[IssueDismissResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueDismissResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[IssueDismissResponse]
Expand Down Expand Up @@ -262,7 +262,7 @@ def severity(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueSeverityResponse:
) -> Optional[IssueSeverityResponse]:
"""
Get Security Center Issue Counts by Severity
Expand Down Expand Up @@ -302,9 +302,9 @@ def severity(
},
issue_severity_params.IssueSeverityParams,
),
post_parser=ResultWrapper[IssueSeverityResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueSeverityResponse]]._unwrapper,
),
cast_to=cast(Type[IssueSeverityResponse], ResultWrapper[IssueSeverityResponse]),
cast_to=cast(Type[Optional[IssueSeverityResponse]], ResultWrapper[IssueSeverityResponse]),
)

def type(
Expand All @@ -328,7 +328,7 @@ def type(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueTypeResponse:
) -> Optional[IssueTypeResponse]:
"""
Get Security Center Issue Counts by Type
Expand Down Expand Up @@ -368,9 +368,9 @@ def type(
},
issue_type_params.IssueTypeParams,
),
post_parser=ResultWrapper[IssueTypeResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueTypeResponse]]._unwrapper,
),
cast_to=cast(Type[IssueTypeResponse], ResultWrapper[IssueTypeResponse]),
cast_to=cast(Type[Optional[IssueTypeResponse]], ResultWrapper[IssueTypeResponse]),
)


Expand Down Expand Up @@ -478,7 +478,7 @@ async def class_(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueClassResponse:
) -> Optional[IssueClassResponse]:
"""
Get Security Center Issue Counts by Class
Expand Down Expand Up @@ -518,9 +518,9 @@ async def class_(
},
issue_class_params.IssueClassParams,
),
post_parser=ResultWrapper[IssueClassResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueClassResponse]]._unwrapper,
),
cast_to=cast(Type[IssueClassResponse], ResultWrapper[IssueClassResponse]),
cast_to=cast(Type[Optional[IssueClassResponse]], ResultWrapper[IssueClassResponse]),
)

async def dismiss(
Expand All @@ -535,7 +535,7 @@ async def dismiss(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueDismissResponse:
) -> Optional[IssueDismissResponse]:
"""
Archive Security Center Insight
Expand All @@ -555,7 +555,7 @@ async def dismiss(
if not issue_id:
raise ValueError(f"Expected a non-empty value for `issue_id` but received {issue_id!r}")
return cast(
IssueDismissResponse,
Optional[IssueDismissResponse],
await self._put(
f"/accounts/{account_id}/intel/attack-surface-report/{issue_id}/dismiss",
body=await async_maybe_transform({"dismiss": dismiss}, issue_dismiss_params.IssueDismissParams),
Expand All @@ -564,7 +564,7 @@ async def dismiss(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[IssueDismissResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueDismissResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[IssueDismissResponse]
Expand Down Expand Up @@ -593,7 +593,7 @@ async def severity(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueSeverityResponse:
) -> Optional[IssueSeverityResponse]:
"""
Get Security Center Issue Counts by Severity
Expand Down Expand Up @@ -633,9 +633,9 @@ async def severity(
},
issue_severity_params.IssueSeverityParams,
),
post_parser=ResultWrapper[IssueSeverityResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueSeverityResponse]]._unwrapper,
),
cast_to=cast(Type[IssueSeverityResponse], ResultWrapper[IssueSeverityResponse]),
cast_to=cast(Type[Optional[IssueSeverityResponse]], ResultWrapper[IssueSeverityResponse]),
)

async def type(
Expand All @@ -659,7 +659,7 @@ async def type(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> IssueTypeResponse:
) -> Optional[IssueTypeResponse]:
"""
Get Security Center Issue Counts by Type
Expand Down Expand Up @@ -699,9 +699,9 @@ async def type(
},
issue_type_params.IssueTypeParams,
),
post_parser=ResultWrapper[IssueTypeResponse]._unwrapper,
post_parser=ResultWrapper[Optional[IssueTypeResponse]]._unwrapper,
),
cast_to=cast(Type[IssueTypeResponse], ResultWrapper[IssueTypeResponse]),
cast_to=cast(Type[Optional[IssueTypeResponse]], ResultWrapper[IssueTypeResponse]),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class IssueListResponse(BaseModel):

messages: List[ResponseInfo]

result: Result

success: Literal[True]
"""Whether the API call was successful"""

result: Optional[Result] = None
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 @@ -22,7 +22,7 @@ def test_method_get(self, client: Cloudflare) -> None:
issue_type = client.intel.attack_surface_report.issue_types.get(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
assert_matches_type(Optional[IssueTypeGetResponse], issue_type, path=["response"])

@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
Expand All @@ -33,7 +33,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
issue_type = response.parse()
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
assert_matches_type(Optional[IssueTypeGetResponse], issue_type, path=["response"])

@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
Expand All @@ -44,7 +44,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

issue_type = response.parse()
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
assert_matches_type(Optional[IssueTypeGetResponse], issue_type, path=["response"])

assert cast(Any, response.is_closed) is True

Expand All @@ -64,7 +64,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
issue_type = await async_client.intel.attack_surface_report.issue_types.get(
account_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
assert_matches_type(Optional[IssueTypeGetResponse], issue_type, path=["response"])

@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
Expand All @@ -75,7 +75,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
issue_type = await response.parse()
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
assert_matches_type(Optional[IssueTypeGetResponse], issue_type, path=["response"])

@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
Expand All @@ -86,7 +86,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"

issue_type = await response.parse()
assert_matches_type(IssueTypeGetResponse, issue_type, path=["response"])
assert_matches_type(Optional[IssueTypeGetResponse], issue_type, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down
Loading

0 comments on commit ba4ef78

Please sign in to comment.