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 #265

Merged
merged 1 commit into from
Apr 10, 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
431 changes: 301 additions & 130 deletions api.md

Large diffs are not rendered by default.

32 changes: 18 additions & 14 deletions src/cloudflare/resources/accounts/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
RolesWithStreamingResponse,
AsyncRolesWithStreamingResponse,
)
from ...types import account_list_params, account_update_params
from ...types import (
AccountGetResponse,
AccountUpdateResponse,
account_list_params,
account_update_params,
)
from .members import (
Members,
AsyncMembers,
Expand Down Expand Up @@ -43,7 +48,6 @@
AsyncPaginator,
make_request_options,
)
from ...types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a

__all__ = ["Accounts", "AsyncAccounts"]

Expand Down Expand Up @@ -77,7 +81,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> AccountUpdateResponse:
"""
Update an existing account.

Expand All @@ -95,7 +99,7 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
AccountUpdateResponse,
self._put(
f"/accounts/{account_id}",
body=maybe_transform(
Expand All @@ -113,7 +117,7 @@ def update(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[AccountUpdateResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down Expand Up @@ -183,7 +187,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> AccountGetResponse:
"""
Get information about a specific account that you are a member of.

Expand All @@ -197,7 +201,7 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
AccountGetResponse,
self._get(
f"/accounts/{account_id}",
options=make_request_options(
Expand All @@ -208,7 +212,7 @@ def get(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[AccountGetResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down Expand Up @@ -243,7 +247,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> AccountUpdateResponse:
"""
Update an existing account.

Expand All @@ -261,7 +265,7 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
AccountUpdateResponse,
await self._put(
f"/accounts/{account_id}",
body=await async_maybe_transform(
Expand All @@ -279,7 +283,7 @@ async def update(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[AccountUpdateResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down Expand Up @@ -349,7 +353,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> AccountGetResponse:
"""
Get information about a specific account that you are a member of.

Expand All @@ -363,7 +367,7 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
AccountGetResponse,
await self._get(
f"/accounts/{account_id}",
options=make_request_options(
Expand All @@ -374,7 +378,7 @@ async def get(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[AccountGetResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down
15 changes: 7 additions & 8 deletions src/cloudflare/resources/accounts/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
AsyncPaginator,
make_request_options,
)
from ...types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a
from ...types.accounts import RoleListResponse
from ...types.accounts import RoleGetResponse, RoleListResponse

__all__ = ["Roles", "AsyncRoles"]

Expand Down Expand Up @@ -79,7 +78,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> RoleGetResponse:
"""
Get information about a specific role for an account.

Expand All @@ -93,7 +92,7 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
RoleGetResponse,
self._get(
f"/accounts/{account_id}/roles/{role_id}",
options=make_request_options(
Expand All @@ -104,7 +103,7 @@ def get(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[RoleGetResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down Expand Up @@ -162,7 +161,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> RoleGetResponse:
"""
Get information about a specific role for an account.

Expand All @@ -176,7 +175,7 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
RoleGetResponse,
await self._get(
f"/accounts/{account_id}/roles/{role_id}",
options=make_request_options(
Expand All @@ -187,7 +186,7 @@ async def get(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[RoleGetResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down
27 changes: 13 additions & 14 deletions src/cloudflare/resources/argo/smart_routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,10 @@
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ...types.argo import smart_routing_edit_params
from ...types.argo import SmartRoutingGetResponse, SmartRoutingEditResponse, smart_routing_edit_params
from ..._base_client import (
make_request_options,
)
from ...types.shared import UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a

__all__ = ["SmartRouting", "AsyncSmartRouting"]

Expand All @@ -50,7 +49,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> SmartRoutingEditResponse:
"""
Updates enablement of Argo Smart Routing.

Expand All @@ -70,7 +69,7 @@ def edit(
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
SmartRoutingEditResponse,
self._patch(
f"/zones/{zone_id}/argo/smart_routing",
body=maybe_transform({"value": value}, smart_routing_edit_params.SmartRoutingEditParams),
Expand All @@ -82,7 +81,7 @@ def edit(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[SmartRoutingEditResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand All @@ -97,7 +96,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> SmartRoutingGetResponse:
"""
Get Argo Smart Routing setting

Expand All @@ -115,7 +114,7 @@ def get(
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
SmartRoutingGetResponse,
self._get(
f"/zones/{zone_id}/argo/smart_routing",
options=make_request_options(
Expand All @@ -126,7 +125,7 @@ def get(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[SmartRoutingGetResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand All @@ -152,7 +151,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> SmartRoutingEditResponse:
"""
Updates enablement of Argo Smart Routing.

Expand All @@ -172,7 +171,7 @@ async def edit(
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
SmartRoutingEditResponse,
await self._patch(
f"/zones/{zone_id}/argo/smart_routing",
body=await async_maybe_transform({"value": value}, smart_routing_edit_params.SmartRoutingEditParams),
Expand All @@ -184,7 +183,7 @@ async def edit(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[SmartRoutingEditResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand All @@ -199,7 +198,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a:
) -> SmartRoutingGetResponse:
"""
Get Argo Smart Routing setting

Expand All @@ -217,7 +216,7 @@ async def get(
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
return cast(
UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a,
SmartRoutingGetResponse,
await self._get(
f"/zones/{zone_id}/argo/smart_routing",
options=make_request_options(
Expand All @@ -228,7 +227,7 @@ async def get(
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(
Any, ResultWrapper[UnnamedSchemaRef9444735ca60712dbcf8afd832eb5716a]
Any, ResultWrapper[SmartRoutingGetResponse]
), # Union types cannot be passed in as arguments in the type system
),
)
Expand Down
Loading