Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#970)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jun 14, 2024
1 parent b12cb36 commit 85d98da
Show file tree
Hide file tree
Showing 21 changed files with 453 additions and 252 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: 1343
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f5082157bb70165b34f3a552faa44b9693adacaa9613d4b887b251cd744d076f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-fea5e994c4346dfa223df3833cf88a978ab7df816a2a4e5718ec2ce40cd98ac0.yml
23 changes: 14 additions & 9 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3122,24 +3122,29 @@ from cloudflare.types.page_shield import Setting, PageShieldUpdateResponse

Methods:

- <code title="put /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/page_shield_update_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/page_shield_update_response.py">PageShieldUpdateResponse</a></code>
- <code title="get /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/page_shield/setting.py">Setting</a></code>
- <code title="put /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">update</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/page_shield_update_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/page_shield_update_response.py">Optional</a></code>
- <code title="get /zones/{zone_id}/page_shield">client.page_shield.<a href="./src/cloudflare/resources/page_shield/page_shield.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/page_shield/setting.py">Optional</a></code>

## Policies

Types:

```python
from cloudflare.types.page_shield import Policy
from cloudflare.types.page_shield import (
PolicyCreateResponse,
PolicyUpdateResponse,
PolicyListResponse,
PolicyGetResponse,
)
```

Methods:

- <code title="post /zones/{zone_id}/page_shield/policies">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/policy_create_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/policy.py">Policy</a></code>
- <code title="put /zones/{zone_id}/page_shield/policies/{policy_id}">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">update</a>(policy_id, \*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/policy_update_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/policy.py">Policy</a></code>
- <code title="get /zones/{zone_id}/page_shield/policies">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">list</a>(\*, zone_id) -> <a href="./src/cloudflare/types/page_shield/policy.py">SyncSinglePage[Policy]</a></code>
- <code title="post /zones/{zone_id}/page_shield/policies">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/policy_create_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/policy_create_response.py">Optional</a></code>
- <code title="put /zones/{zone_id}/page_shield/policies/{policy_id}">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">update</a>(policy_id, \*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/policy_update_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/policy_update_response.py">Optional</a></code>
- <code title="get /zones/{zone_id}/page_shield/policies">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">list</a>(\*, zone_id) -> <a href="./src/cloudflare/types/page_shield/policy_list_response.py">SyncSinglePage[PolicyListResponse]</a></code>
- <code title="delete /zones/{zone_id}/page_shield/policies/{policy_id}">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">delete</a>(policy_id, \*, zone_id) -> None</code>
- <code title="get /zones/{zone_id}/page_shield/policies/{policy_id}">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">get</a>(policy_id, \*, zone_id) -> <a href="./src/cloudflare/types/page_shield/policy.py">Policy</a></code>
- <code title="get /zones/{zone_id}/page_shield/policies/{policy_id}">client.page_shield.policies.<a href="./src/cloudflare/resources/page_shield/policies.py">get</a>(policy_id, \*, zone_id) -> <a href="./src/cloudflare/types/page_shield/policy_get_response.py">Optional</a></code>

## Connections

Expand All @@ -3152,7 +3157,7 @@ from cloudflare.types.page_shield import Connection
Methods:

- <code title="get /zones/{zone_id}/page_shield/connections">client.page_shield.connections.<a href="./src/cloudflare/resources/page_shield/connections.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/connection_list_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/connection.py">SyncSinglePage[Connection]</a></code>
- <code title="get /zones/{zone_id}/page_shield/connections/{connection_id}">client.page_shield.connections.<a href="./src/cloudflare/resources/page_shield/connections.py">get</a>(connection_id, \*, zone_id) -> <a href="./src/cloudflare/types/page_shield/connection.py">Connection</a></code>
- <code title="get /zones/{zone_id}/page_shield/connections/{connection_id}">client.page_shield.connections.<a href="./src/cloudflare/resources/page_shield/connections.py">get</a>(connection_id, \*, zone_id) -> <a href="./src/cloudflare/types/page_shield/connection.py">Optional</a></code>

## Scripts

Expand All @@ -3165,7 +3170,7 @@ from cloudflare.types.page_shield import Script, ScriptGetResponse
Methods:

- <code title="get /zones/{zone_id}/page_shield/scripts">client.page_shield.scripts.<a href="./src/cloudflare/resources/page_shield/scripts.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/page_shield/script_list_params.py">params</a>) -> <a href="./src/cloudflare/types/page_shield/script.py">SyncSinglePage[Script]</a></code>
- <code title="get /zones/{zone_id}/page_shield/scripts/{script_id}">client.page_shield.scripts.<a href="./src/cloudflare/resources/page_shield/scripts.py">get</a>(script_id, \*, zone_id) -> <a href="./src/cloudflare/types/page_shield/script_get_response.py">ScriptGetResponse</a></code>
- <code title="get /zones/{zone_id}/page_shield/scripts/{script_id}">client.page_shield.scripts.<a href="./src/cloudflare/resources/page_shield/scripts.py">get</a>(script_id, \*, zone_id) -> <a href="./src/cloudflare/types/page_shield/script_get_response.py">Optional</a></code>

# Rulesets

Expand Down
26 changes: 18 additions & 8 deletions src/cloudflare/resources/page_shield/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

from typing import Type, Optional, cast
from typing_extensions import Literal

import httpx
Expand All @@ -16,6 +17,7 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ...pagination import SyncSinglePage, AsyncSinglePage
from ..._base_client import (
AsyncPaginator,
Expand Down Expand Up @@ -161,14 +163,14 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Connection:
) -> Optional[Connection]:
"""
Fetches a connection detected by Page Shield by connection ID.
Args:
zone_id: Identifier
connection_id: The ID of the resource.
connection_id: Identifier
extra_headers: Send extra headers
Expand All @@ -185,9 +187,13 @@ def get(
return self._get(
f"/zones/{zone_id}/page_shield/connections/{connection_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Connection]]._unwrapper,
),
cast_to=Connection,
cast_to=cast(Type[Optional[Connection]], ResultWrapper[Connection]),
)


Expand Down Expand Up @@ -325,14 +331,14 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Connection:
) -> Optional[Connection]:
"""
Fetches a connection detected by Page Shield by connection ID.
Args:
zone_id: Identifier
connection_id: The ID of the resource.
connection_id: Identifier
extra_headers: Send extra headers
Expand All @@ -349,9 +355,13 @@ async def get(
return await self._get(
f"/zones/{zone_id}/page_shield/connections/{connection_id}",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[Connection]]._unwrapper,
),
cast_to=Connection,
cast_to=cast(Type[Optional[Connection]], ResultWrapper[Connection]),
)


Expand Down
26 changes: 13 additions & 13 deletions src/cloudflare/resources/page_shield/page_shield.py
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 @@ -88,7 +88,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> PageShieldUpdateResponse:
) -> Optional[PageShieldUpdateResponse]:
"""
Updates Page Shield settings.
Expand Down Expand Up @@ -127,9 +127,9 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[PageShieldUpdateResponse]._unwrapper,
post_parser=ResultWrapper[Optional[PageShieldUpdateResponse]]._unwrapper,
),
cast_to=cast(Type[PageShieldUpdateResponse], ResultWrapper[PageShieldUpdateResponse]),
cast_to=cast(Type[Optional[PageShieldUpdateResponse]], ResultWrapper[PageShieldUpdateResponse]),
)

def get(
Expand All @@ -142,7 +142,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Setting:
) -> Optional[Setting]:
"""
Fetches the Page Shield settings.
Expand All @@ -166,9 +166,9 @@ def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Setting]._unwrapper,
post_parser=ResultWrapper[Optional[Setting]]._unwrapper,
),
cast_to=cast(Type[Setting], ResultWrapper[Setting]),
cast_to=cast(Type[Optional[Setting]], ResultWrapper[Setting]),
)


Expand Down Expand Up @@ -206,7 +206,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> PageShieldUpdateResponse:
) -> Optional[PageShieldUpdateResponse]:
"""
Updates Page Shield settings.
Expand Down Expand Up @@ -245,9 +245,9 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[PageShieldUpdateResponse]._unwrapper,
post_parser=ResultWrapper[Optional[PageShieldUpdateResponse]]._unwrapper,
),
cast_to=cast(Type[PageShieldUpdateResponse], ResultWrapper[PageShieldUpdateResponse]),
cast_to=cast(Type[Optional[PageShieldUpdateResponse]], ResultWrapper[PageShieldUpdateResponse]),
)

async def get(
Expand All @@ -260,7 +260,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Setting:
) -> Optional[Setting]:
"""
Fetches the Page Shield settings.
Expand All @@ -284,9 +284,9 @@ async def get(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Setting]._unwrapper,
post_parser=ResultWrapper[Optional[Setting]]._unwrapper,
),
cast_to=cast(Type[Setting], ResultWrapper[Setting]),
cast_to=cast(Type[Optional[Setting]], ResultWrapper[Setting]),
)


Expand Down
Loading

0 comments on commit 85d98da

Please sign in to comment.