Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed May 7, 2024
1 parent f07a5ed commit 14b7e5f
Show file tree
Hide file tree
Showing 29 changed files with 237 additions and 1,936 deletions.
40 changes: 30 additions & 10 deletions src/cloudflare/resources/accounts/members.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def with_streaming_response(self) -> MembersResourceWithStreamingResponse:
def create(
self,
*,
account_id: object,
account_id: str,
email: str,
roles: List[str],
status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
Expand All @@ -74,6 +74,8 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return self._post(
f"/accounts/{account_id}/members",
body=maybe_transform(
Expand All @@ -98,7 +100,7 @@ def update(
self,
member_id: str,
*,
account_id: object,
account_id: str,
roles: Iterable[member_update_params.Role],
# 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.
Expand All @@ -123,6 +125,8 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not member_id:
raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}")
return self._put(
Expand All @@ -141,7 +145,7 @@ def update(
def list(
self,
*,
account_id: object,
account_id: str,
direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
order: Literal["user.first_name", "user.last_name", "user.email", "status"] | NotGiven = NOT_GIVEN,
page: float | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -176,6 +180,8 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
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(
f"/accounts/{account_id}/members",
page=SyncV4PagePaginationArray[MemberListResponse],
Expand All @@ -202,7 +208,7 @@ def delete(
self,
member_id: str,
*,
account_id: object,
account_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,
Expand All @@ -224,6 +230,8 @@ def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not member_id:
raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}")
return self._delete(
Expand All @@ -242,7 +250,7 @@ def get(
self,
member_id: str,
*,
account_id: object,
account_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,
Expand All @@ -264,6 +272,8 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not member_id:
raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}")
return self._get(
Expand Down Expand Up @@ -291,7 +301,7 @@ def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse:
async def create(
self,
*,
account_id: object,
account_id: str,
email: str,
roles: List[str],
status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
Expand All @@ -318,6 +328,8 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return await self._post(
f"/accounts/{account_id}/members",
body=await async_maybe_transform(
Expand All @@ -342,7 +354,7 @@ async def update(
self,
member_id: str,
*,
account_id: object,
account_id: str,
roles: Iterable[member_update_params.Role],
# 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.
Expand All @@ -367,6 +379,8 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not member_id:
raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}")
return await self._put(
Expand All @@ -385,7 +399,7 @@ async def update(
def list(
self,
*,
account_id: object,
account_id: str,
direction: Literal["asc", "desc"] | NotGiven = NOT_GIVEN,
order: Literal["user.first_name", "user.last_name", "user.email", "status"] | NotGiven = NOT_GIVEN,
page: float | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -420,6 +434,8 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
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(
f"/accounts/{account_id}/members",
page=AsyncV4PagePaginationArray[MemberListResponse],
Expand All @@ -446,7 +462,7 @@ async def delete(
self,
member_id: str,
*,
account_id: object,
account_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,
Expand All @@ -468,6 +484,8 @@ async def delete(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not member_id:
raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}")
return await self._delete(
Expand All @@ -486,7 +504,7 @@ async def get(
self,
member_id: str,
*,
account_id: object,
account_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,
Expand All @@ -508,6 +526,8 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not member_id:
raise ValueError(f"Expected a non-empty value for `member_id` but received {member_id!r}")
return await self._get(
Expand Down
16 changes: 12 additions & 4 deletions src/cloudflare/resources/accounts/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def with_streaming_response(self) -> RolesResourceWithStreamingResponse:
def list(
self,
*,
account_id: object,
account_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,
Expand All @@ -59,6 +59,8 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
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(
f"/accounts/{account_id}/roles",
page=SyncSinglePage[Role],
Expand All @@ -72,7 +74,7 @@ def get(
self,
role_id: object,
*,
account_id: object,
account_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,
Expand All @@ -92,6 +94,8 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return cast(
RoleGetResponse,
self._get(
Expand Down Expand Up @@ -122,7 +126,7 @@ def with_streaming_response(self) -> AsyncRolesResourceWithStreamingResponse:
def list(
self,
*,
account_id: object,
account_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,
Expand All @@ -142,6 +146,8 @@ def list(
timeout: Override the client-level default timeout for this request, in seconds
"""
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(
f"/accounts/{account_id}/roles",
page=AsyncSinglePage[Role],
Expand All @@ -155,7 +161,7 @@ async def get(
self,
role_id: object,
*,
account_id: object,
account_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,
Expand All @@ -175,6 +181,8 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
return cast(
RoleGetResponse,
await self._get(
Expand Down
2 changes: 1 addition & 1 deletion src/cloudflare/types/accounts/member_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class MemberCreateParams(TypedDict, total=False):
account_id: Required[object]
account_id: Required[str]

email: Required[str]
"""The contact email address of the user."""
Expand Down
2 changes: 1 addition & 1 deletion src/cloudflare/types/accounts/member_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class MemberListParams(TypedDict, total=False):
account_id: Required[object]
account_id: Required[str]

direction: Literal["asc", "desc"]
"""Direction to order results."""
Expand Down
2 changes: 1 addition & 1 deletion src/cloudflare/types/accounts/member_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


class MemberUpdateParams(TypedDict, total=False):
account_id: Required[object]
account_id: Required[str]

roles: Required[Iterable[Role]]
"""Roles assigned to this member."""
Expand Down
Loading

0 comments on commit 14b7e5f

Please sign in to comment.