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): update via SDK Studio #223

Merged
merged 1 commit into from
Apr 4, 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 +1 @@
configured_endpoints: 1299
configured_endpoints: 1297
11 changes: 0 additions & 11 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,17 +394,6 @@ Methods:

## Settings

Types:

```python
from cloudflare.types.zones import SettingEditResponse, SettingGetResponse
```

Methods:

- <code title="patch /zones/{zone_id}/settings">client.zones.settings.<a href="./src/cloudflare/resources/zones/settings/settings.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/setting_edit_response.py">Optional</a></code>
- <code title="get /zones/{zone_id}/settings">client.zones.settings.<a href="./src/cloudflare/resources/zones/settings/settings.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/setting_get_response.py">Optional</a></code>

### ZeroRTT

Types:
Expand Down
212 changes: 0 additions & 212 deletions src/cloudflare/resources/zones/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

from __future__ import annotations

from typing import Type, Iterable, Optional, cast

import httpx

from .nel import (
NEL,
AsyncNEL,
Expand Down Expand Up @@ -118,11 +114,6 @@
ZeroRTTWithStreamingResponse,
AsyncZeroRTTWithStreamingResponse,
)
from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ...._utils import (
maybe_transform,
async_maybe_transform,
)
from .websocket import (
Websocket,
AsyncWebsocket,
Expand Down Expand Up @@ -157,13 +148,6 @@
AsyncPseudoIPV4WithStreamingResponse,
)
from ...._resource import SyncAPIResource, AsyncAPIResource
from ...._response import (
to_raw_response_wrapper,
to_streamed_response_wrapper,
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ...._wrappers import ResultWrapper
from .advanced_ddos import (
AdvancedDDoS,
AsyncAdvancedDDoS,
Expand Down Expand Up @@ -212,7 +196,6 @@
RocketLoaderWithStreamingResponse,
AsyncRocketLoaderWithStreamingResponse,
)
from ....types.zones import SettingGetResponse, SettingEditResponse, setting_edit_params
from .image_resizing import (
ImageResizing,
AsyncImageResizing,
Expand All @@ -237,9 +220,6 @@
SecurityLevelWithStreamingResponse,
AsyncSecurityLevelWithStreamingResponse,
)
from ...._base_client import (
make_request_options,
)
from .min_tls_version import (
MinTLSVersion,
AsyncMinTLSVersion,
Expand Down Expand Up @@ -649,88 +629,6 @@ def with_raw_response(self) -> SettingsWithRawResponse:
def with_streaming_response(self) -> SettingsWithStreamingResponse:
return SettingsWithStreamingResponse(self)

def edit(
self,
*,
zone_id: str,
items: Iterable[setting_edit_params.Item],
# 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,
) -> Optional[SettingEditResponse]:
"""
Edit settings for a zone.

Args:
zone_id: Identifier

items: One or more zone setting objects. Must contain an ID and a value.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._patch(
f"/zones/{zone_id}/settings",
body=maybe_transform({"items": items}, setting_edit_params.SettingEditParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]),
)

def get(
self,
*,
zone_id: str,
# 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,
) -> Optional[SettingGetResponse]:
"""
Available settings for your user in relation to a zone.

Args:
zone_id: Identifier

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return self._get(
f"/zones/{zone_id}/settings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]),
)


class AsyncSettings(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -945,100 +843,11 @@ def with_raw_response(self) -> AsyncSettingsWithRawResponse:
def with_streaming_response(self) -> AsyncSettingsWithStreamingResponse:
return AsyncSettingsWithStreamingResponse(self)

async def edit(
self,
*,
zone_id: str,
items: Iterable[setting_edit_params.Item],
# 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,
) -> Optional[SettingEditResponse]:
"""
Edit settings for a zone.

Args:
zone_id: Identifier

items: One or more zone setting objects. Must contain an ID and a value.

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return await self._patch(
f"/zones/{zone_id}/settings",
body=await async_maybe_transform({"items": items}, setting_edit_params.SettingEditParams),
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[SettingEditResponse]], ResultWrapper[SettingEditResponse]),
)

async def get(
self,
*,
zone_id: str,
# 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,
) -> Optional[SettingGetResponse]:
"""
Available settings for your user in relation to a zone.

Args:
zone_id: Identifier

extra_headers: Send extra headers

extra_query: Add additional query parameters to the request

extra_body: Add additional JSON properties to the request

timeout: Override the client-level default timeout for this request, in seconds
"""
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return await self._get(
f"/zones/{zone_id}/settings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[Optional[SettingGetResponse]], ResultWrapper[SettingGetResponse]),
)


class SettingsWithRawResponse:
def __init__(self, settings: Settings) -> None:
self._settings = settings

self.edit = to_raw_response_wrapper(
settings.edit,
)
self.get = to_raw_response_wrapper(
settings.get,
)

@cached_property
def zero_rtt(self) -> ZeroRTTWithRawResponse:
return ZeroRTTWithRawResponse(self._settings.zero_rtt)
Expand Down Expand Up @@ -1248,13 +1057,6 @@ class AsyncSettingsWithRawResponse:
def __init__(self, settings: AsyncSettings) -> None:
self._settings = settings

self.edit = async_to_raw_response_wrapper(
settings.edit,
)
self.get = async_to_raw_response_wrapper(
settings.get,
)

@cached_property
def zero_rtt(self) -> AsyncZeroRTTWithRawResponse:
return AsyncZeroRTTWithRawResponse(self._settings.zero_rtt)
Expand Down Expand Up @@ -1464,13 +1266,6 @@ class SettingsWithStreamingResponse:
def __init__(self, settings: Settings) -> None:
self._settings = settings

self.edit = to_streamed_response_wrapper(
settings.edit,
)
self.get = to_streamed_response_wrapper(
settings.get,
)

@cached_property
def zero_rtt(self) -> ZeroRTTWithStreamingResponse:
return ZeroRTTWithStreamingResponse(self._settings.zero_rtt)
Expand Down Expand Up @@ -1680,13 +1475,6 @@ class AsyncSettingsWithStreamingResponse:
def __init__(self, settings: AsyncSettings) -> None:
self._settings = settings

self.edit = async_to_streamed_response_wrapper(
settings.edit,
)
self.get = async_to_streamed_response_wrapper(
settings.get,
)

@cached_property
def zero_rtt(self) -> AsyncZeroRTTWithStreamingResponse:
return AsyncZeroRTTWithStreamingResponse(self._settings.zero_rtt)
Expand Down
3 changes: 0 additions & 3 deletions src/cloudflare/types/zones/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
from .dns_setting import DNSSetting as DNSSetting
from .hold_create_params import HoldCreateParams as HoldCreateParams
from .hold_delete_params import HoldDeleteParams as HoldDeleteParams
from .setting_edit_params import SettingEditParams as SettingEditParams
from .setting_get_response import SettingGetResponse as SettingGetResponse
from .setting_edit_response import SettingEditResponse as SettingEditResponse
from .dns_setting_edit_params import DNSSettingEditParams as DNSSettingEditParams
from .subscription_create_params import SubscriptionCreateParams as SubscriptionCreateParams
from .subscription_list_response import SubscriptionListResponse as SubscriptionListResponse
Expand Down
Loading