Skip to content

Commit

Permalink
feat(api): update api shield operation endpoint (#2348)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 9, 2025
1 parent 1d668f9 commit 61a852b
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 152 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: 1488
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8350198effca1ac1067d67fc3c45dce02b208c323d4be761050af7106222a01f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f9deb3d75633289ec284d1121ac14327582a8c5e8453fca7f8f5f1cdafb054c9.yml
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2699,7 +2699,7 @@ from cloudflare.types.api_gateway import (

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">OperationCreateResponse</a></code>
- <code title="post /zones/{zone_id}/api_gateway/operations/item">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="delete /zones/{zone_id}/api_gateway/operations">client.api_gateway.operations.<a href="./src/cloudflare/resources/api_gateway/operations/operations.py">bulk_delete</a>(\*, zone_id) -> <a href="./src/cloudflare/types/api_gateway/operation_bulk_delete_response.py">OperationBulkDeleteResponse</a></code>
Expand Down
74 changes: 55 additions & 19 deletions src/cloudflare/resources/api_gateway/operations/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from __future__ import annotations

from typing import List, Type, Iterable, cast
from typing import List, Type, cast
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -69,25 +69,36 @@ def create(
self,
*,
zone_id: str,
operations: Iterable[operation_create_params.Operation],
endpoint: str,
host: str,
method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"],
# 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,
) -> OperationCreateResponse:
"""Add one or more operations to a zone.
"""Add one operation to a zone.
Endpoints can contain path variables.
Host, method, endpoint will be normalized to a canoncial form when creating an
operation and must be unique on the zone. Inserting an operation that matches an
existing one will return the record of the already existing operation and update
its last_updated date.
Endpoints can contain path variables. Host, method,
endpoint will be normalized to a canoncial form when creating an operation and
must be unique on the zone. Inserting an operation that matches an existing one
will return the record of the already existing operation and update its
last_updated date.
Args:
zone_id: Identifier
endpoint: The endpoint which can contain path parameter templates in curly braces, each
will be replaced from left to right with {varN}, starting with {var1}, during
insertion. This will further be Cloudflare-normalized upon insertion. See:
https://developers.cloudflare.com/rules/normalization/how-it-works/.
host: RFC3986-compliant host.
method: The HTTP method used to access the endpoint.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -99,8 +110,15 @@ def create(
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._post(
f"/zones/{zone_id}/api_gateway/operations",
body=maybe_transform(operations, Iterable[operation_create_params.Operation]),
f"/zones/{zone_id}/api_gateway/operations/item",
body=maybe_transform(
{
"endpoint": endpoint,
"host": host,
"method": method,
},
operation_create_params.OperationCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down Expand Up @@ -344,25 +362,36 @@ async def create(
self,
*,
zone_id: str,
operations: Iterable[operation_create_params.Operation],
endpoint: str,
host: str,
method: Literal["GET", "POST", "HEAD", "OPTIONS", "PUT", "DELETE", "CONNECT", "PATCH", "TRACE"],
# 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,
) -> OperationCreateResponse:
"""Add one or more operations to a zone.
"""Add one operation to a zone.
Endpoints can contain path variables.
Host, method, endpoint will be normalized to a canoncial form when creating an
operation and must be unique on the zone. Inserting an operation that matches an
existing one will return the record of the already existing operation and update
its last_updated date.
Endpoints can contain path variables. Host, method,
endpoint will be normalized to a canoncial form when creating an operation and
must be unique on the zone. Inserting an operation that matches an existing one
will return the record of the already existing operation and update its
last_updated date.
Args:
zone_id: Identifier
endpoint: The endpoint which can contain path parameter templates in curly braces, each
will be replaced from left to right with {varN}, starting with {var1}, during
insertion. This will further be Cloudflare-normalized upon insertion. See:
https://developers.cloudflare.com/rules/normalization/how-it-works/.
host: RFC3986-compliant host.
method: The HTTP method used to access the endpoint.
extra_headers: Send extra headers
extra_query: Add additional query parameters to the request
Expand All @@ -374,8 +403,15 @@ async def create(
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return await self._post(
f"/zones/{zone_id}/api_gateway/operations",
body=await async_maybe_transform(operations, Iterable[operation_create_params.Operation]),
f"/zones/{zone_id}/api_gateway/operations/item",
body=await async_maybe_transform(
{
"endpoint": endpoint,
"host": host,
"method": method,
},
operation_create_params.OperationCreateParams,
),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand Down
7 changes: 1 addition & 6 deletions src/cloudflare/types/api_gateway/operation_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@

from __future__ import annotations

from typing import Iterable
from typing_extensions import Literal, Required, TypedDict

__all__ = ["OperationCreateParams", "Operation"]
__all__ = ["OperationCreateParams"]


class OperationCreateParams(TypedDict, total=False):
zone_id: Required[str]
"""Identifier"""

operations: Required[Iterable[Operation]]


class Operation(TypedDict, total=False):
endpoint: Required[str]
"""
The endpoint which can contain path parameter templates in curly braces, each
Expand Down
Loading

0 comments on commit 61a852b

Please sign in to comment.