Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent 9a2ec53 commit 70bd1e4
Show file tree
Hide file tree
Showing 25 changed files with 181 additions and 175 deletions.
30 changes: 9 additions & 21 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Types:
from cloudflare.types.accounts import (
Member,
MemberPermission,
MemberRole,
MemberWithCode,
MemberListResponse,
MemberDeleteResponse,
Expand All @@ -46,12 +45,12 @@ Methods:
Types:

```python
from cloudflare.types.accounts import PermissionGrant, Role, RoleGetResponse
from cloudflare.types.accounts import PermissionGrant, Role, RoleListResponse, RoleGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/roles">client.accounts.roles.<a href="./src/cloudflare/resources/accounts/roles.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/accounts/role.py">SyncSinglePage[Role]</a></code>
- <code title="get /accounts/{account_id}/roles">client.accounts.roles.<a href="./src/cloudflare/resources/accounts/roles.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/accounts/role_list_response.py">SyncSinglePage[RoleListResponse]</a></code>
- <code title="get /accounts/{account_id}/roles/{role_id}">client.accounts.roles.<a href="./src/cloudflare/resources/accounts/roles.py">get</a>(role_id, \*, account_id) -> <a href="./src/cloudflare/types/accounts/role_get_response.py">RoleGetResponse</a></code>

# OriginCACertificates
Expand Down Expand Up @@ -102,7 +101,7 @@ from cloudflare.types import (
Methods:

- <code title="put /memberships/{membership_id}">client.memberships.<a href="./src/cloudflare/resources/memberships.py">update</a>(membership_id, \*\*<a href="src/cloudflare/types/membership_update_params.py">params</a>) -> <a href="./src/cloudflare/types/membership_update_response.py">MembershipUpdateResponse</a></code>
- <code title="get /memberships">client.memberships.<a href="./src/cloudflare/resources/memberships.py">list</a>(\*\*<a href="src/cloudflare/types/membership_list_params.py">params</a>) -> <a href="./src/cloudflare/types/accounts/member_role.py">SyncV4PagePaginationArray[MemberRole]</a></code>
- <code title="get /memberships">client.memberships.<a href="./src/cloudflare/resources/memberships.py">list</a>(\*\*<a href="src/cloudflare/types/membership_list_params.py">params</a>) -> <a href="./src/cloudflare/types/membership.py">SyncV4PagePaginationArray[Membership]</a></code>
- <code title="delete /memberships/{membership_id}">client.memberships.<a href="./src/cloudflare/resources/memberships.py">delete</a>(membership_id) -> <a href="./src/cloudflare/types/membership_delete_response.py">MembershipDeleteResponse</a></code>
- <code title="get /memberships/{membership_id}">client.memberships.<a href="./src/cloudflare/resources/memberships.py">get</a>(membership_id) -> <a href="./src/cloudflare/types/membership_get_response.py">MembershipGetResponse</a></code>

Expand Down Expand Up @@ -179,12 +178,7 @@ Methods:
Types:

```python
from cloudflare.types.user import (
UserInvite,
InviteListResponse,
InviteEditResponse,
InviteGetResponse,
)
from cloudflare.types.user import Invite, InviteListResponse, InviteEditResponse, InviteGetResponse
```

Methods:
Expand Down Expand Up @@ -387,13 +381,13 @@ Methods:
Types:

```python
from cloudflare.types.zones import DNSSettingEditResponse, DNSSettingGetResponse
from cloudflare.types.zones import DNSSetting
```

Methods:

- <code title="patch /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/dns_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/dns_setting_edit_response.py">DNSSettingEditResponse</a></code>
- <code title="get /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/dns_setting_get_response.py">DNSSettingGetResponse</a></code>
- <code title="patch /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">edit</a>(\*, zone_id, \*\*<a href="src/cloudflare/types/zones/dns_setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/zones/dns_setting.py">DNSSetting</a></code>
- <code title="get /zones/{zone_id}/dns_settings">client.zones.dns_settings.<a href="./src/cloudflare/resources/zones/dns_settings.py">get</a>(\*, zone_id) -> <a href="./src/cloudflare/types/zones/dns_setting.py">DNSSetting</a></code>

## Settings

Expand Down Expand Up @@ -2966,7 +2960,7 @@ Methods:

- <code title="post /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">create</a>(\*, account_id, \*\*<a href="src/cloudflare/types/queue_create_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_create_response.py">Optional</a></code>
- <code title="put /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">update</a>(queue_id, \*, account_id, \*\*<a href="src/cloudflare/types/queue_update_params.py">params</a>) -> <a href="./src/cloudflare/types/queue_update_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/queue_list_response.py">SyncSinglePage[QueueListResponse]</a></code>
- <code title="get /accounts/{account_id}/queues">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">list</a>(\*, account_id) -> <a href="./src/cloudflare/types/queue_list_response.py">Optional</a></code>
- <code title="delete /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">delete</a>(queue_id, \*, account_id) -> <a href="./src/cloudflare/types/queue_delete_response.py">Optional</a></code>
- <code title="get /accounts/{account_id}/queues/{queue_id}">client.queues.<a href="./src/cloudflare/resources/queues/queues.py">get</a>(queue_id, \*, account_id) -> <a href="./src/cloudflare/types/queue_get_response.py">Optional</a></code>

Expand Down Expand Up @@ -2995,13 +2989,7 @@ Methods:
Types:

```python
from cloudflare.types.queues import (
QueueConsumer,
QueueConsumerCreated,
QueueConsumerUpdated,
MessageAckResponse,
MessagePullResponse,
)
from cloudflare.types.queues import QueueConsumer, MessageAckResponse, MessagePullResponse
```

Methods:
Expand Down
5 changes: 3 additions & 2 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
)
from ...types.accounts import (
Member,
RoleParam,
MemberWithCode,
MemberListResponse,
MemberDeleteResponse,
Expand Down Expand Up @@ -103,7 +104,7 @@ def update(
member_id: str,
*,
account_id: object,
roles: Iterable[member_update_params.Role],
roles: Iterable[RoleParam],
# 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 Down Expand Up @@ -347,7 +348,7 @@ async def update(
member_id: str,
*,
account_id: object,
roles: Iterable[member_update_params.Role],
roles: Iterable[RoleParam],
# 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 Down
14 changes: 7 additions & 7 deletions src/cloudflare/resources/accounts/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
AsyncPaginator,
make_request_options,
)
from ...types.accounts import Role, RoleGetResponse
from ...types.accounts import RoleGetResponse, RoleListResponse

__all__ = ["Roles", "AsyncRoles"]

Expand All @@ -45,7 +45,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Role]:
) -> SyncSinglePage[RoleListResponse]:
"""
Get all available roles for an account.
Expand All @@ -60,11 +60,11 @@ def list(
"""
return self._get_api_list(
f"/accounts/{account_id}/roles",
page=SyncSinglePage[Role],
page=SyncSinglePage[RoleListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Role,
model=RoleListResponse,
)

def get(
Expand Down Expand Up @@ -128,7 +128,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Role, AsyncSinglePage[Role]]:
) -> AsyncPaginator[RoleListResponse, AsyncSinglePage[RoleListResponse]]:
"""
Get all available roles for an account.
Expand All @@ -143,11 +143,11 @@ def list(
"""
return self._get_api_list(
f"/accounts/{account_id}/roles",
page=AsyncSinglePage[Role],
page=AsyncSinglePage[RoleListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Role,
model=RoleListResponse,
)

async def get(
Expand Down
14 changes: 7 additions & 7 deletions src/cloudflare/resources/memberships.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import httpx

from ..types import (
Membership,
MembershipGetResponse,
MembershipDeleteResponse,
MembershipUpdateResponse,
Expand All @@ -33,7 +34,6 @@
AsyncPaginator,
make_request_options,
)
from ..types.accounts import MemberRole

__all__ = ["Memberships", "AsyncMemberships"]

Expand Down Expand Up @@ -111,7 +111,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncV4PagePaginationArray[MemberRole]:
) -> SyncV4PagePaginationArray[Membership]:
"""
List memberships of accounts the user can access.
Expand All @@ -138,7 +138,7 @@ def list(
"""
return self._get_api_list(
"/memberships",
page=SyncV4PagePaginationArray[MemberRole],
page=SyncV4PagePaginationArray[Membership],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -157,7 +157,7 @@ def list(
membership_list_params.MembershipListParams,
),
),
model=MemberRole,
model=Membership,
)

def delete(
Expand Down Expand Up @@ -317,7 +317,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[MemberRole, AsyncV4PagePaginationArray[MemberRole]]:
) -> AsyncPaginator[Membership, AsyncV4PagePaginationArray[Membership]]:
"""
List memberships of accounts the user can access.
Expand All @@ -344,7 +344,7 @@ def list(
"""
return self._get_api_list(
"/memberships",
page=AsyncV4PagePaginationArray[MemberRole],
page=AsyncV4PagePaginationArray[Membership],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
Expand All @@ -363,7 +363,7 @@ def list(
membership_list_params.MembershipListParams,
),
),
model=MemberRole,
model=Membership,
)

async def delete(
Expand Down
30 changes: 17 additions & 13 deletions src/cloudflare/resources/queues/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ...pagination import SyncSinglePage, AsyncSinglePage
from ..._base_client import (
AsyncPaginator,
make_request_options,
)

Expand Down Expand Up @@ -168,7 +166,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[QueueListResponse]:
) -> Optional[QueueListResponse]:
"""
Returns the queues owned by an account.
Expand All @@ -185,13 +183,16 @@ def list(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
return self._get(
f"/accounts/{account_id}/queues",
page=SyncSinglePage[QueueListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
model=QueueListResponse,
cast_to=cast(Type[Optional[QueueListResponse]], ResultWrapper[QueueListResponse]),
)

def delete(
Expand Down Expand Up @@ -392,7 +393,7 @@ async def update(
cast_to=cast(Type[Optional[QueueUpdateResponse]], ResultWrapper[QueueUpdateResponse]),
)

def list(
async def list(
self,
*,
account_id: str,
Expand All @@ -402,7 +403,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[QueueListResponse, AsyncSinglePage[QueueListResponse]]:
) -> Optional[QueueListResponse]:
"""
Returns the queues owned by an account.
Expand All @@ -419,13 +420,16 @@ def list(
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._get_api_list(
return await self._get(
f"/accounts/{account_id}/queues",
page=AsyncSinglePage[QueueListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
model=QueueListResponse,
cast_to=cast(Type[Optional[QueueListResponse]], ResultWrapper[QueueListResponse]),
)

async def delete(
Expand Down
18 changes: 9 additions & 9 deletions src/cloudflare/resources/zones/dns_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
async_to_streamed_response_wrapper,
)
from ..._wrappers import ResultWrapper
from ...types.zones import DNSSettingGetResponse, DNSSettingEditResponse, dns_setting_edit_params
from ...types.zones import DNSSetting, dns_setting_edit_params
from ..._base_client import (
make_request_options,
)
Expand Down Expand Up @@ -48,7 +48,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSettingEditResponse:
) -> DNSSetting:
"""
Update DNS settings for a zone
Expand Down Expand Up @@ -77,7 +77,7 @@ def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSettingEditResponse], ResultWrapper[DNSSettingEditResponse]),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
)

def get(
Expand All @@ -90,7 +90,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSettingGetResponse:
) -> DNSSetting:
"""
Show DNS settings for a zone
Expand All @@ -116,7 +116,7 @@ def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSettingGetResponse], ResultWrapper[DNSSettingGetResponse]),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
)


Expand All @@ -140,7 +140,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSettingEditResponse:
) -> DNSSetting:
"""
Update DNS settings for a zone
Expand Down Expand Up @@ -171,7 +171,7 @@ async def edit(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSettingEditResponse], ResultWrapper[DNSSettingEditResponse]),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
)

async def get(
Expand All @@ -184,7 +184,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> DNSSettingGetResponse:
) -> DNSSetting:
"""
Show DNS settings for a zone
Expand All @@ -210,7 +210,7 @@ async def get(
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[DNSSettingGetResponse], ResultWrapper[DNSSettingGetResponse]),
cast_to=cast(Type[DNSSetting], ResultWrapper[DNSSetting]),
)


Expand Down
Loading

0 comments on commit 70bd1e4

Please sign in to comment.