Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#1191)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored Jul 16, 2024
1 parent 4138481 commit f11a669
Show file tree
Hide file tree
Showing 29 changed files with 747 additions and 261 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: 1256
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-74d68374448e03b29a39bb6cdf6c39cdeaaaa691dd9c38f46a26a1d562c8ee37.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b116e60da4a69a05bc8823c2397e4a33d111c82a6b458ea4f480d0ba52ea8de0.yml
22 changes: 14 additions & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2392,23 +2392,29 @@ from cloudflare.types.api_gateway.discovery import OperationEditResponse

Methods:

- <code title="get /zones/{zone_id}/api_gateway/discovery/operations">client.api_gateway.discovery.operations.<a href="./src/cloudflare/resources/api_gateway/discovery/operations.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/discovery/operation_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/discovery_operation.py">SyncSinglePage[DiscoveryOperation]</a></code>
- <code title="get /zones/{zone_id}/api_gateway/discovery/operations">client.api_gateway.discovery.operations.<a href="./src/cloudflare/resources/api_gateway/discovery/operations.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/discovery/operation_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/discovery_operation.py">SyncV4PagePaginationArray[DiscoveryOperation]</a></code>
- <code title="patch /zones/{zone_id}/api_gateway/discovery/operations/{operation_id}">client.api_gateway.discovery.operations.<a href="./src/cloudflare/resources/api_gateway/discovery/operations.py">edit</a>(operation_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/discovery/operation_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/discovery/operation_edit_response.py">OperationEditResponse</a></code>

## Operations

Types:

```python
from cloudflare.types.api_gateway import APIShield, OperationCreateResponse, OperationDeleteResponse
from cloudflare.types.api_gateway import (
APIShield,
OperationCreateResponse,
OperationListResponse,
OperationDeleteResponse,
OperationGetResponse,
)
```

Methods:

- <code title="post /zones/{zone_id}/api_gateway/operations">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/operation_create_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/operation_create_response.py">Optional</a></code>
- <code title="get /zones/{zone_id}/api_gateway/operations">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/operation_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/api_shield.py">SyncSinglePage[APIShield]</a></code>
- <code title="post /zones/{zone_id}/api_gateway/operations">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/operation_create_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/operation_create_response.py">OperationCreateResponse</a></code>
- <code title="get /zones/{zone_id}/api_gateway/operations">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/operation_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/operation_list_response.py">SyncV4PagePaginationArray[OperationListResponse]</a></code>
- <code title="delete /zones/{zone_id}/api_gateway/operations/{operation_id}">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">delete</a>(operation_id, \*, zone_id) -> <a href="./src/cloudflare/types/api_gateway/operation_delete_response.py">OperationDeleteResponse</a></code>
- <code title="get /zones/{zone_id}/api_gateway/operations/{operation_id}">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">get</a>(operation_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/operation_get_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/api_shield.py">APIShield</a></code>
- <code title="get /zones/{zone_id}/api_gateway/operations/{operation_id}">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">get</a>(operation_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/operation_get_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/operation_get_response.py">OperationGetResponse</a></code>

### SchemaValidation

Expand Down Expand Up @@ -2472,8 +2478,8 @@ from cloudflare.types.api_gateway import (
Methods:

- <code title="post /zones/{zone_id}/api_gateway/user_schemas">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">create</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schema_create_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/schema_upload.py">SchemaUpload</a></code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schema_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/public_schema.py">SyncSinglePage[PublicSchema]</a></code>
- <code title="delete /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">delete</a>(schema_id, \*, zone_id) -> <a href="./src/cloudflare/types/api_gateway/user_schema_delete_response.py">UserSchemaDeleteResponse</a></code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">list</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schema_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/public_schema.py">SyncV4PagePaginationArray[PublicSchema]</a></code>
- <code title="delete /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">delete</a>(schema_id, \*, zone_id) -> <a href="./src/cloudflare/types/api_gateway/user_schema_delete_response.py">Optional</a></code>
- <code title="patch /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">edit</a>(schema_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schema_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/public_schema.py">PublicSchema</a></code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas/{schema_id}">client.api_gateway.user_schemas.<a href="./src/cloudflare/resources/api_gateway/user_schemas/user_schemas.py">get</a>(schema_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schema_get_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/public_schema.py">PublicSchema</a></code>

Expand All @@ -2487,7 +2493,7 @@ from cloudflare.types.api_gateway.user_schemas import OperationListResponse

Methods:

- <code title="get /zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations">client.api_gateway.user_schemas.operations.<a href="./src/cloudflare/resources/api_gateway/user_schemas/operations.py">list</a>(schema_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py">SyncSinglePage[OperationListResponse]</a></code>
- <code title="get /zones/{zone_id}/api_gateway/user_schemas/{schema_id}/operations">client.api_gateway.user_schemas.operations.<a href="./src/cloudflare/resources/api_gateway/user_schemas/operations.py">list</a>(schema_id, \*, zone_id, \*\*<a href="src/cloudflare/types/api_gateway/user_schemas/operation_list_params.py">params</a>) -> <a href="./src/cloudflare/types/api_gateway/user_schemas/operation_list_response.py">SyncV4PagePaginationArray[OperationListResponse]</a></code>

# ManagedHeaders

Expand Down
60 changes: 21 additions & 39 deletions src/cloudflare/resources/api_gateway/configurations.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, Iterable, cast
from typing import List, Type, Iterable, cast
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -42,7 +42,7 @@ def update(
self,
*,
zone_id: str,
auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic] | NotGiven = NOT_GIVEN,
auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic],
# 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 @@ -66,25 +66,16 @@ def update(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
ConfigurationUpdateResponse,
self._put(
f"/zones/{zone_id}/api_gateway/configuration",
body=maybe_transform(
{"auth_id_characteristics": auth_id_characteristics},
configuration_update_params.ConfigurationUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[ConfigurationUpdateResponse]
), # Union types cannot be passed in as arguments in the type system
return self._put(
f"/zones/{zone_id}/api_gateway/configuration",
body=maybe_transform(
{"auth_id_characteristics": auth_id_characteristics},
configuration_update_params.ConfigurationUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ConfigurationUpdateResponse,
)

def get(
Expand Down Expand Up @@ -144,7 +135,7 @@ async def update(
self,
*,
zone_id: str,
auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic] | NotGiven = NOT_GIVEN,
auth_id_characteristics: Iterable[configuration_update_params.AuthIDCharacteristic],
# 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 @@ -168,25 +159,16 @@ async def update(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
ConfigurationUpdateResponse,
await self._put(
f"/zones/{zone_id}/api_gateway/configuration",
body=await async_maybe_transform(
{"auth_id_characteristics": auth_id_characteristics},
configuration_update_params.ConfigurationUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[ConfigurationUpdateResponse]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[ConfigurationUpdateResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._put(
f"/zones/{zone_id}/api_gateway/configuration",
body=await async_maybe_transform(
{"auth_id_characteristics": auth_id_characteristics},
configuration_update_params.ConfigurationUpdateParams,
),
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=ConfigurationUpdateResponse,
)

async def get(
Expand Down
22 changes: 11 additions & 11 deletions src/cloudflare/resources/api_gateway/discovery/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
from ....pagination import SyncSinglePage, AsyncSinglePage
from ....pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from ...._base_client import AsyncPaginator, make_request_options
from ....types.api_gateway.discovery import operation_edit_params, operation_list_params
from ....types.api_gateway.discovery_operation import DiscoveryOperation
Expand Down Expand Up @@ -51,16 +51,16 @@ def list(
order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"]
| NotGiven = NOT_GIVEN,
origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN,
page: object | NotGiven = NOT_GIVEN,
per_page: object | NotGiven = NOT_GIVEN,
page: int | NotGiven = NOT_GIVEN,
per_page: int | NotGiven = NOT_GIVEN,
state: Literal["review", "saved", "ignored"] | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[DiscoveryOperation]:
) -> SyncV4PagePaginationArray[DiscoveryOperation]:
"""
Retrieve the most up to date view of discovered operations
Expand Down Expand Up @@ -112,7 +112,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
f"/zones/{zone_id}/api_gateway/discovery/operations",
page=SyncSinglePage[DiscoveryOperation],
page=SyncV4PagePaginationArray[DiscoveryOperation],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -156,7 +156,7 @@ def edit(
Args:
zone_id: Identifier
operation_id: UUID identifier
operation_id: UUID
state: Mark state of operation in API Discovery
Expand Down Expand Up @@ -210,16 +210,16 @@ def list(
order: Literal["host", "method", "endpoint", "traffic_stats.requests", "traffic_stats.last_updated"]
| NotGiven = NOT_GIVEN,
origin: Literal["ML", "SessionIdentifier"] | NotGiven = NOT_GIVEN,
page: object | NotGiven = NOT_GIVEN,
per_page: object | NotGiven = NOT_GIVEN,
page: int | NotGiven = NOT_GIVEN,
per_page: int | NotGiven = NOT_GIVEN,
state: Literal["review", "saved", "ignored"] | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[DiscoveryOperation, AsyncSinglePage[DiscoveryOperation]]:
) -> AsyncPaginator[DiscoveryOperation, AsyncV4PagePaginationArray[DiscoveryOperation]]:
"""
Retrieve the most up to date view of discovered operations
Expand Down Expand Up @@ -271,7 +271,7 @@ def list(
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get_api_list(
f"/zones/{zone_id}/api_gateway/discovery/operations",
page=AsyncSinglePage[DiscoveryOperation],
page=AsyncV4PagePaginationArray[DiscoveryOperation],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -315,7 +315,7 @@ async def edit(
Args:
zone_id: Identifier
operation_id: UUID identifier
operation_id: UUID
state: Mark state of operation in API Discovery
Expand Down
Loading

0 comments on commit f11a669

Please sign in to comment.