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): api update #2227

Merged
merged 1 commit into from
Nov 28, 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: 1451
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-c5682a28c312411d32f5a8447e4c50880eabf7d71415128758e7924dc434c4da.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-8c1088ba96368f5f19f6d33654ae76942cfd4f0e3b7f418add2c67b01a6085dc.yml
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ from cloudflare.types.dnssec import DNSSEC, DNSSECDeleteResponse

Methods:

- <code title="delete /zones/{zone_id}/dnssec">client.dnssec.<a href="./src/cloudflare/resources/dnssec.py">delete</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dnssec/dnssec_delete_response.py">Optional[DNSSECDeleteResponse]</a></code>
- <code title="delete /zones/{zone_id}/dnssec">client.dnssec.<a href="./src/cloudflare/resources/dnssec.py">delete</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dnssec/dnssec_delete_response.py">str</a></code>
- <code title="patch /zones/{zone_id}/dnssec">client.dnssec.<a href="./src/cloudflare/resources/dnssec.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/dnssec/dnssec_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/dnssec/dnssec.py">Optional[DNSSEC]</a></code>
- <code title="get /zones/{zone_id}/dnssec">client.dnssec.<a href="./src/cloudflare/resources/dnssec.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/dnssec/dnssec.py">Optional[DNSSEC]</a></code>

Expand Down
8 changes: 8 additions & 0 deletions src/cloudflare/resources/ai_gateway/ai_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ def list(
order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
page: int | NotGiven = NOT_GIVEN,
per_page: int | NotGiven = NOT_GIVEN,
search: str | 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 @@ -249,6 +250,8 @@ def list(

order_by_direction: Order By Direction

search: Search by id

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -273,6 +276,7 @@ def list(
"order_by_direction": order_by_direction,
"page": page,
"per_page": per_page,
"search": search,
},
ai_gateway_list_params.AIGatewayListParams,
),
Expand Down Expand Up @@ -534,6 +538,7 @@ def list(
order_by_direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
page: int | NotGiven = NOT_GIVEN,
per_page: int | NotGiven = NOT_GIVEN,
search: str | 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 @@ -549,6 +554,8 @@ def list(

order_by_direction: Order By Direction

search: Search by id

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request
Expand All @@ -573,6 +580,7 @@ def list(
"order_by_direction": order_by_direction,
"page": page,
"per_page": per_page,
"search": search,
},
ai_gateway_list_params.AIGatewayListParams,
),
Expand Down
52 changes: 21 additions & 31 deletions src/cloudflare/resources/dnssec.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, Type, Optional, cast
from typing import Type, Optional, cast
from typing_extensions import Literal

import httpx
Expand Down Expand Up @@ -59,7 +59,7 @@ def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[DNSSECDeleteResponse]:
) -> str:
"""
Delete DNSSEC.

Expand All @@ -76,21 +76,16 @@ def delete(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
Optional[DNSSECDeleteResponse],
self._delete(
f"/zones/{zone_id}/dnssec",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[DNSSECDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return self._delete(
f"/zones/{zone_id}/dnssec",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)

def edit(
Expand Down Expand Up @@ -232,7 +227,7 @@ async def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Optional[DNSSECDeleteResponse]:
) -> str:
"""
Delete DNSSEC.

Expand All @@ -249,21 +244,16 @@ async def delete(
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
Optional[DNSSECDeleteResponse],
await self._delete(
f"/zones/{zone_id}/dnssec",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[DNSSECDeleteResponse]
), # Union types cannot be passed in as arguments in the type system
return await self._delete(
f"/zones/{zone_id}/dnssec",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper[Optional[DNSSECDeleteResponse]]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)

async def edit(
Expand Down
3 changes: 3 additions & 0 deletions src/cloudflare/types/ai_gateway/ai_gateway_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ class AIGatewayListParams(TypedDict, total=False):
page: int

per_page: int

search: str
"""Search by id"""
3 changes: 1 addition & 2 deletions src/cloudflare/types/dnssec/dnssec_delete_response.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Union
from typing_extensions import TypeAlias

__all__ = ["DNSSECDeleteResponse"]

DNSSECDeleteResponse: TypeAlias = Union[str, object]
DNSSECDeleteResponse: TypeAlias = str
2 changes: 2 additions & 0 deletions tests/api_resources/test_ai_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
order_by_direction="asc",
page=1,
per_page=1,
search="search",
)
assert_matches_type(SyncV4PagePaginationArray[AIGatewayListResponse], ai_gateway, path=["response"])

Expand Down Expand Up @@ -540,6 +541,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
order_by_direction="asc",
page=1,
per_page=1,
search="search",
)
assert_matches_type(AsyncV4PagePaginationArray[AIGatewayListResponse], ai_gateway, path=["response"])

Expand Down
14 changes: 7 additions & 7 deletions tests/api_resources/test_dnssec.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.types.dnssec import DNSSEC, DNSSECDeleteResponse
from cloudflare.types.dnssec import DNSSEC

base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")

Expand All @@ -22,7 +22,7 @@ def test_method_delete(self, client: Cloudflare) -> None:
dnssec = client.dnssec.delete(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"])
assert_matches_type(str, dnssec, path=["response"])

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

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

dnssec = response.parse()
assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"])
assert_matches_type(str, dnssec, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down Expand Up @@ -150,7 +150,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
dnssec = await async_client.dnssec.delete(
zone_id="023e105f4ecef8ad9ca31a8372d0c353",
)
assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"])
assert_matches_type(str, dnssec, path=["response"])

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

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

dnssec = await response.parse()
assert_matches_type(Optional[DNSSECDeleteResponse], dnssec, path=["response"])
assert_matches_type(str, dnssec, path=["response"])

assert cast(Any, response.is_closed) is True

Expand Down