diff --git a/.stats.yml b/.stats.yml
index 5aa7311c5e6..43ab45243cb 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,2 +1,2 @@
configured_endpoints: 1336
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-2a8a1caa6fe5f9470abfecdc44bec05bf438fd7e4a4a8278d5f262dabed78c3a.yml
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-dae61c40e8505c826e518a64122325c0e12c78fe44961c1ff6a1e281b7095be3.yml
diff --git a/api.md b/api.md
index 5020de58c34..c514a7f3a0a 100644
--- a/api.md
+++ b/api.md
@@ -36,9 +36,9 @@ from cloudflare.types.accounts import (
Methods:
-- client.accounts.update(\*, account_id, \*\*params) -> AccountUpdateResponse
+- client.accounts.update(\*, account_id, \*\*params) -> object
- client.accounts.list(\*\*params) -> SyncV4PagePaginationArray[object]
-- client.accounts.get(\*, account_id) -> AccountGetResponse
+- client.accounts.get(\*, account_id) -> object
## Members
@@ -48,18 +48,20 @@ Types:
from cloudflare.types.accounts import (
Status,
UserWithInviteCode,
- MemberListResponse,
+ MemberCreateResponse,
+ MemberUpdateResponse,
MemberDeleteResponse,
+ MemberGetResponse,
)
```
Methods:
-- client.accounts.members.create(\*, account_id, \*\*params) -> UserWithInviteCode
-- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> Member
-- client.accounts.members.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[MemberListResponse]
+- client.accounts.members.create(\*, account_id, \*\*params) -> MemberCreateResponse
+- client.accounts.members.update(member_id, \*, account_id, \*\*params) -> MemberUpdateResponse
+- client.accounts.members.list(\*, account_id, \*\*params) -> SyncV4PagePaginationArray[Member]
- client.accounts.members.delete(member_id, \*, account_id) -> Optional
-- client.accounts.members.get(member_id, \*, account_id) -> Member
+- client.accounts.members.get(member_id, \*, account_id) -> MemberGetResponse
## Roles
@@ -72,7 +74,7 @@ from cloudflare.types.accounts import RoleGetResponse
Methods:
- client.accounts.roles.list(\*, account_id) -> SyncSinglePage[Role]
-- client.accounts.roles.get(role_id, \*, account_id) -> RoleGetResponse
+- client.accounts.roles.get(role_id, \*, account_id) -> object
# OriginCACertificates
@@ -123,7 +125,7 @@ Methods:
- client.memberships.update(membership_id, \*\*params) -> MembershipUpdateResponse
- client.memberships.list(\*\*params) -> SyncV4PagePaginationArray[Membership]
-- client.memberships.delete(membership_id) -> MembershipDeleteResponse
+- client.memberships.delete(membership_id) -> Optional
- client.memberships.get(membership_id) -> MembershipGetResponse
# User
@@ -136,8 +138,8 @@ from cloudflare.types.user import UserEditResponse, UserGetResponse
Methods:
-- client.user.edit(\*\*params) -> UserEditResponse
-- client.user.get() -> UserGetResponse
+- client.user.edit(\*\*params) -> object
+- client.user.get() -> object
## AuditLogs
@@ -182,8 +184,8 @@ from cloudflare.types.user import Invite, InviteEditResponse, InviteGetResponse
Methods:
- client.user.invites.list() -> SyncSinglePage[Invite]
-- client.user.invites.edit(invite_id, \*\*params) -> InviteEditResponse
-- client.user.invites.get(invite_id) -> InviteGetResponse
+- client.user.invites.edit(invite_id, \*\*params) -> object
+- client.user.invites.get(invite_id) -> object
## Organizations
@@ -197,7 +199,7 @@ Methods:
- client.user.organizations.list(\*\*params) -> SyncV4PagePaginationArray[Organization]
- client.user.organizations.delete(organization_id) -> OrganizationDeleteResponse
-- client.user.organizations.get(organization_id) -> OrganizationGetResponse
+- client.user.organizations.get(organization_id) -> object
## Subscriptions
@@ -230,7 +232,6 @@ Types:
```python
from cloudflare.types.user import (
CIDRList,
- Policy,
Token,
TokenCreateResponse,
TokenUpdateResponse,
@@ -243,12 +244,12 @@ from cloudflare.types.user import (
Methods:
-- client.user.tokens.create(\*\*params) -> TokenCreateResponse
-- client.user.tokens.update(token_id, \*\*params) -> TokenUpdateResponse
+- client.user.tokens.create(\*\*params) -> Optional
+- client.user.tokens.update(token_id, \*\*params) -> object
- client.user.tokens.list(\*\*params) -> SyncV4PagePaginationArray[object]
- client.user.tokens.delete(token_id) -> Optional
-- client.user.tokens.get(token_id) -> TokenGetResponse
-- client.user.tokens.verify() -> TokenVerifyResponse
+- client.user.tokens.get(token_id) -> object
+- client.user.tokens.verify() -> Optional
### PermissionGroups
diff --git a/src/cloudflare/resources/accounts/accounts.py b/src/cloudflare/resources/accounts/accounts.py
index f2778f600c0..75b2a0e8fbe 100644
--- a/src/cloudflare/resources/accounts/accounts.py
+++ b/src/cloudflare/resources/accounts/accounts.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, cast
+from typing import Type, Optional, cast
from typing_extensions import Literal
import httpx
@@ -43,8 +43,6 @@
make_request_options,
)
from ...types.accounts import account_list_params, account_update_params
-from ...types.accounts.account_get_response import AccountGetResponse
-from ...types.accounts.account_update_response import AccountUpdateResponse
__all__ = ["AccountsResource", "AsyncAccountsResource"]
@@ -78,7 +76,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AccountUpdateResponse:
+ ) -> object:
"""
Update an existing account.
@@ -95,28 +93,23 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- AccountUpdateResponse,
- self._put(
- f"/accounts/{account_id}",
- body=maybe_transform(
- {
- "name": name,
- "settings": settings,
- },
- account_update_params.AccountUpdateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AccountUpdateResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[AccountUpdateResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._put(
+ f"/accounts/{account_id}",
+ body=maybe_transform(
+ {
+ "name": name,
+ "settings": settings,
+ },
+ account_update_params.AccountUpdateParams,
),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def list(
@@ -184,7 +177,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AccountGetResponse:
+ ) -> object:
"""
Get information about a specific account that you are a member of.
@@ -197,21 +190,16 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- AccountGetResponse,
- self._get(
- f"/accounts/{account_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AccountGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[AccountGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ f"/accounts/{account_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
@@ -244,7 +232,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AccountUpdateResponse:
+ ) -> object:
"""
Update an existing account.
@@ -261,28 +249,23 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- AccountUpdateResponse,
- await self._put(
- f"/accounts/{account_id}",
- body=await async_maybe_transform(
- {
- "name": name,
- "settings": settings,
- },
- account_update_params.AccountUpdateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AccountUpdateResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[AccountUpdateResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._put(
+ f"/accounts/{account_id}",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "settings": settings,
+ },
+ account_update_params.AccountUpdateParams,
),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def list(
@@ -350,7 +333,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AccountGetResponse:
+ ) -> object:
"""
Get information about a specific account that you are a member of.
@@ -363,21 +346,16 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- AccountGetResponse,
- await self._get(
- f"/accounts/{account_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[AccountGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[AccountGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ f"/accounts/{account_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
diff --git a/src/cloudflare/resources/accounts/members.py b/src/cloudflare/resources/accounts/members.py
index 602ab0f69d7..a36881ed695 100644
--- a/src/cloudflare/resources/accounts/members.py
+++ b/src/cloudflare/resources/accounts/members.py
@@ -2,13 +2,14 @@
from __future__ import annotations
-from typing import List, Type, Iterable, Optional, cast
+from typing import Any, List, Type, Iterable, Optional, cast, overload
from typing_extensions import Literal
import httpx
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ..._utils import (
+ required_args,
maybe_transform,
async_maybe_transform,
)
@@ -28,9 +29,10 @@
)
from ...types.accounts import member_list_params, member_create_params, member_update_params
from ...types.shared.member import Member
-from ...types.accounts.member_list_response import MemberListResponse
-from ...types.accounts.user_with_invite_code import UserWithInviteCode
+from ...types.accounts.member_get_response import MemberGetResponse
+from ...types.accounts.member_create_response import MemberCreateResponse
from ...types.accounts.member_delete_response import MemberDeleteResponse
+from ...types.accounts.member_update_response import MemberUpdateResponse
__all__ = ["MembersResource", "AsyncMembersResource"]
@@ -44,6 +46,7 @@ def with_raw_response(self) -> MembersResourceWithRawResponse:
def with_streaming_response(self) -> MembersResourceWithStreamingResponse:
return MembersResourceWithStreamingResponse(self)
+ @overload
def create(
self,
*,
@@ -57,7 +60,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> UserWithInviteCode:
+ ) -> MemberCreateResponse:
"""
Add a user to the list of members for this account.
@@ -74,41 +77,95 @@ def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ ...
+
+ @overload
+ def create(
+ self,
+ *,
+ account_id: str,
+ email: str,
+ policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy],
+ status: Literal["accepted", "pending"] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> MemberCreateResponse:
+ """
+ Add a user to the list of members for this account.
+
+ Args:
+ email: The contact email address of the user.
+
+ policies: Array of policies associated with this member.
+
+ 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
+ """
+ ...
+
+ @required_args(["account_id", "email", "roles"], ["account_id", "email", "policies"])
+ def create(
+ self,
+ *,
+ account_id: str,
+ email: str,
+ roles: List[str] | NotGiven = NOT_GIVEN,
+ status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
+ policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> MemberCreateResponse:
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(
- {
- "email": email,
- "roles": roles,
- "status": status,
- },
- member_create_params.MemberCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[UserWithInviteCode]._unwrapper,
+ return cast(
+ MemberCreateResponse,
+ self._post(
+ f"/accounts/{account_id}/members",
+ body=maybe_transform(
+ {
+ "email": email,
+ "roles": roles,
+ "status": status,
+ "policies": policies,
+ },
+ member_create_params.MemberCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(
+ Any, MemberCreateResponse
+ ), # Union types cannot be passed in as arguments in the type system
),
- cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]),
)
+ @overload
def update(
self,
member_id: str,
*,
account_id: str,
- roles: Iterable[member_update_params.Role],
+ roles: Iterable[member_update_params.MemberRole] | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Member:
+ ) -> MemberUpdateResponse:
"""
Modify an account member.
@@ -125,21 +182,77 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ ...
+
+ @overload
+ def update(
+ self,
+ member_id: str,
+ *,
+ account_id: str,
+ policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy],
+ # 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,
+ ) -> MemberUpdateResponse:
+ """
+ Modify an account member.
+
+ Args:
+ member_id: Membership identifier tag.
+
+ policies: Array of policies associated with this member.
+
+ 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
+ """
+ ...
+
+ @required_args(["account_id"], ["account_id", "policies"])
+ def update(
+ self,
+ member_id: str,
+ *,
+ account_id: str,
+ roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
+ policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> MemberUpdateResponse:
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(
- f"/accounts/{account_id}/members/{member_id}",
- body=maybe_transform({"roles": roles}, member_update_params.MemberUpdateParams),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[Member]._unwrapper,
+ return cast(
+ MemberUpdateResponse,
+ self._put(
+ f"/accounts/{account_id}/members/{member_id}",
+ body=maybe_transform(
+ {
+ "roles": roles,
+ "policies": policies,
+ },
+ member_update_params.MemberUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(
+ Any, MemberUpdateResponse
+ ), # Union types cannot be passed in as arguments in the type system
),
- cast_to=cast(Type[Member], ResultWrapper[Member]),
)
def list(
@@ -157,7 +270,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> SyncV4PagePaginationArray[MemberListResponse]:
+ ) -> SyncV4PagePaginationArray[Member]:
"""
List all members of an account.
@@ -184,7 +297,7 @@ def list(
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],
+ page=SyncV4PagePaginationArray[Member],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -201,7 +314,7 @@ def list(
member_list_params.MemberListParams,
),
),
- model=MemberListResponse,
+ model=Member,
)
def delete(
@@ -257,7 +370,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Member:
+ ) -> MemberGetResponse:
"""
Get information about a specific member of an account.
@@ -276,16 +389,15 @@ def get(
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(
- f"/accounts/{account_id}/members/{member_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[Member]._unwrapper,
+ return cast(
+ MemberGetResponse,
+ self._get(
+ f"/accounts/{account_id}/members/{member_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(Any, MemberGetResponse), # Union types cannot be passed in as arguments in the type system
),
- cast_to=cast(Type[Member], ResultWrapper[Member]),
)
@@ -298,6 +410,7 @@ def with_raw_response(self) -> AsyncMembersResourceWithRawResponse:
def with_streaming_response(self) -> AsyncMembersResourceWithStreamingResponse:
return AsyncMembersResourceWithStreamingResponse(self)
+ @overload
async def create(
self,
*,
@@ -311,7 +424,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> UserWithInviteCode:
+ ) -> MemberCreateResponse:
"""
Add a user to the list of members for this account.
@@ -328,41 +441,95 @@ async def create(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ ...
+
+ @overload
+ async def create(
+ self,
+ *,
+ account_id: str,
+ email: str,
+ policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy],
+ status: Literal["accepted", "pending"] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> MemberCreateResponse:
+ """
+ Add a user to the list of members for this account.
+
+ Args:
+ email: The contact email address of the user.
+
+ policies: Array of policies associated with this member.
+
+ 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
+ """
+ ...
+
+ @required_args(["account_id", "email", "roles"], ["account_id", "email", "policies"])
+ async def create(
+ self,
+ *,
+ account_id: str,
+ email: str,
+ roles: List[str] | NotGiven = NOT_GIVEN,
+ status: Literal["accepted", "pending"] | NotGiven = NOT_GIVEN,
+ policies: Iterable[member_create_params.IamCreateMemberWithPoliciesPolicy] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> MemberCreateResponse:
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(
- {
- "email": email,
- "roles": roles,
- "status": status,
- },
- member_create_params.MemberCreateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[UserWithInviteCode]._unwrapper,
+ return cast(
+ MemberCreateResponse,
+ await self._post(
+ f"/accounts/{account_id}/members",
+ body=await async_maybe_transform(
+ {
+ "email": email,
+ "roles": roles,
+ "status": status,
+ "policies": policies,
+ },
+ member_create_params.MemberCreateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(
+ Any, MemberCreateResponse
+ ), # Union types cannot be passed in as arguments in the type system
),
- cast_to=cast(Type[UserWithInviteCode], ResultWrapper[UserWithInviteCode]),
)
+ @overload
async def update(
self,
member_id: str,
*,
account_id: str,
- roles: Iterable[member_update_params.Role],
+ roles: Iterable[member_update_params.MemberRole] | 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,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Member:
+ ) -> MemberUpdateResponse:
"""
Modify an account member.
@@ -379,21 +546,77 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
+ ...
+
+ @overload
+ async def update(
+ self,
+ member_id: str,
+ *,
+ account_id: str,
+ policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy],
+ # 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,
+ ) -> MemberUpdateResponse:
+ """
+ Modify an account member.
+
+ Args:
+ member_id: Membership identifier tag.
+
+ policies: Array of policies associated with this member.
+
+ 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
+ """
+ ...
+
+ @required_args(["account_id"], ["account_id", "policies"])
+ async def update(
+ self,
+ member_id: str,
+ *,
+ account_id: str,
+ roles: Iterable[member_update_params.MemberRole] | NotGiven = NOT_GIVEN,
+ policies: Iterable[member_update_params.IamUpdateMemberWithPoliciesPolicy] | 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,
+ extra_query: Query | None = None,
+ extra_body: Body | None = None,
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
+ ) -> MemberUpdateResponse:
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(
- f"/accounts/{account_id}/members/{member_id}",
- body=await async_maybe_transform({"roles": roles}, member_update_params.MemberUpdateParams),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[Member]._unwrapper,
+ return cast(
+ MemberUpdateResponse,
+ await self._put(
+ f"/accounts/{account_id}/members/{member_id}",
+ body=await async_maybe_transform(
+ {
+ "roles": roles,
+ "policies": policies,
+ },
+ member_update_params.MemberUpdateParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(
+ Any, MemberUpdateResponse
+ ), # Union types cannot be passed in as arguments in the type system
),
- cast_to=cast(Type[Member], ResultWrapper[Member]),
)
def list(
@@ -411,7 +634,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> AsyncPaginator[MemberListResponse, AsyncV4PagePaginationArray[MemberListResponse]]:
+ ) -> AsyncPaginator[Member, AsyncV4PagePaginationArray[Member]]:
"""
List all members of an account.
@@ -438,7 +661,7 @@ def list(
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],
+ page=AsyncV4PagePaginationArray[Member],
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
@@ -455,7 +678,7 @@ def list(
member_list_params.MemberListParams,
),
),
- model=MemberListResponse,
+ model=Member,
)
async def delete(
@@ -511,7 +734,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> Member:
+ ) -> MemberGetResponse:
"""
Get information about a specific member of an account.
@@ -530,16 +753,15 @@ async def get(
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(
- f"/accounts/{account_id}/members/{member_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[Member]._unwrapper,
+ return cast(
+ MemberGetResponse,
+ await self._get(
+ f"/accounts/{account_id}/members/{member_id}",
+ options=make_request_options(
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
+ ),
+ cast_to=cast(Any, MemberGetResponse), # Union types cannot be passed in as arguments in the type system
),
- cast_to=cast(Type[Member], ResultWrapper[Member]),
)
diff --git a/src/cloudflare/resources/accounts/roles.py b/src/cloudflare/resources/accounts/roles.py
index f316a2caa9a..2cb8405d641 100644
--- a/src/cloudflare/resources/accounts/roles.py
+++ b/src/cloudflare/resources/accounts/roles.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, cast
+from typing import Type, Optional, cast
import httpx
@@ -22,7 +22,6 @@
make_request_options,
)
from ...types.shared.role import Role
-from ...types.accounts.role_get_response import RoleGetResponse
__all__ = ["RolesResource", "AsyncRolesResource"]
@@ -81,7 +80,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> RoleGetResponse:
+ ) -> object:
"""
Get information about a specific role for an account.
@@ -96,21 +95,16 @@ def get(
"""
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(
- f"/accounts/{account_id}/roles/{role_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[RoleGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[RoleGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ f"/accounts/{account_id}/roles/{role_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
@@ -168,7 +162,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> RoleGetResponse:
+ ) -> object:
"""
Get information about a specific role for an account.
@@ -183,21 +177,16 @@ async def get(
"""
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(
- f"/accounts/{account_id}/roles/{role_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[RoleGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[RoleGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ f"/accounts/{account_id}/roles/{role_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
diff --git a/src/cloudflare/resources/memberships.py b/src/cloudflare/resources/memberships.py
index aac512175a7..0884e4c7e8b 100644
--- a/src/cloudflare/resources/memberships.py
+++ b/src/cloudflare/resources/memberships.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, Type, cast
+from typing import Any, Type, Optional, cast
from typing_extensions import Literal
import httpx
@@ -80,14 +80,10 @@ def update(
f"/memberships/{membership_id}",
body=maybe_transform({"status": status}, membership_update_params.MembershipUpdateParams),
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[MembershipUpdateResponse]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
- Any, ResultWrapper[MembershipUpdateResponse]
+ Any, MembershipUpdateResponse
), # Union types cannot be passed in as arguments in the type system
),
)
@@ -167,7 +163,7 @@ def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> MembershipDeleteResponse:
+ ) -> Optional[MembershipDeleteResponse]:
"""
Remove the associated member from an account.
@@ -191,9 +187,9 @@ def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[MembershipDeleteResponse]._unwrapper,
+ post_parser=ResultWrapper[Optional[MembershipDeleteResponse]]._unwrapper,
),
- cast_to=cast(Type[MembershipDeleteResponse], ResultWrapper[MembershipDeleteResponse]),
+ cast_to=cast(Type[Optional[MembershipDeleteResponse]], ResultWrapper[MembershipDeleteResponse]),
)
def get(
@@ -228,14 +224,10 @@ def get(
self._get(
f"/memberships/{membership_id}",
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[MembershipGetResponse]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
- Any, ResultWrapper[MembershipGetResponse]
+ Any, MembershipGetResponse
), # Union types cannot be passed in as arguments in the type system
),
)
@@ -286,14 +278,10 @@ async def update(
f"/memberships/{membership_id}",
body=await async_maybe_transform({"status": status}, membership_update_params.MembershipUpdateParams),
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[MembershipUpdateResponse]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
- Any, ResultWrapper[MembershipUpdateResponse]
+ Any, MembershipUpdateResponse
), # Union types cannot be passed in as arguments in the type system
),
)
@@ -373,7 +361,7 @@ async def delete(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> MembershipDeleteResponse:
+ ) -> Optional[MembershipDeleteResponse]:
"""
Remove the associated member from an account.
@@ -397,9 +385,9 @@ async def delete(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[MembershipDeleteResponse]._unwrapper,
+ post_parser=ResultWrapper[Optional[MembershipDeleteResponse]]._unwrapper,
),
- cast_to=cast(Type[MembershipDeleteResponse], ResultWrapper[MembershipDeleteResponse]),
+ cast_to=cast(Type[Optional[MembershipDeleteResponse]], ResultWrapper[MembershipDeleteResponse]),
)
async def get(
@@ -434,14 +422,10 @@ async def get(
await self._get(
f"/memberships/{membership_id}",
options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[MembershipGetResponse]._unwrapper,
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(
- Any, ResultWrapper[MembershipGetResponse]
+ Any, MembershipGetResponse
), # Union types cannot be passed in as arguments in the type system
),
)
diff --git a/src/cloudflare/resources/user/invites.py b/src/cloudflare/resources/user/invites.py
index 197fa07e530..84d658ed708 100644
--- a/src/cloudflare/resources/user/invites.py
+++ b/src/cloudflare/resources/user/invites.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, cast
+from typing import Type, Optional, cast
from typing_extensions import Literal
import httpx
@@ -28,8 +28,6 @@
make_request_options,
)
from ...types.user.invite import Invite
-from ...types.user.invite_get_response import InviteGetResponse
-from ...types.user.invite_edit_response import InviteEditResponse
__all__ = ["InvitesResource", "AsyncInvitesResource"]
@@ -74,7 +72,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> InviteEditResponse:
+ ) -> object:
"""
Responds to an invitation.
@@ -93,22 +91,17 @@ def edit(
"""
if not invite_id:
raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}")
- return cast(
- InviteEditResponse,
- self._patch(
- f"/user/invites/{invite_id}",
- body=maybe_transform({"status": status}, invite_edit_params.InviteEditParams),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InviteEditResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[InviteEditResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._patch(
+ f"/user/invites/{invite_id}",
+ body=maybe_transform({"status": status}, invite_edit_params.InviteEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def get(
@@ -121,7 +114,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> InviteGetResponse:
+ ) -> object:
"""
Gets the details of an invitation.
@@ -138,21 +131,16 @@ def get(
"""
if not invite_id:
raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}")
- return cast(
- InviteGetResponse,
- self._get(
- f"/user/invites/{invite_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InviteGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[InviteGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ f"/user/invites/{invite_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
@@ -196,7 +184,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> InviteEditResponse:
+ ) -> object:
"""
Responds to an invitation.
@@ -215,22 +203,17 @@ async def edit(
"""
if not invite_id:
raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}")
- return cast(
- InviteEditResponse,
- await self._patch(
- f"/user/invites/{invite_id}",
- body=await async_maybe_transform({"status": status}, invite_edit_params.InviteEditParams),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InviteEditResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[InviteEditResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._patch(
+ f"/user/invites/{invite_id}",
+ body=await async_maybe_transform({"status": status}, invite_edit_params.InviteEditParams),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
async def get(
@@ -243,7 +226,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> InviteGetResponse:
+ ) -> object:
"""
Gets the details of an invitation.
@@ -260,21 +243,16 @@ async def get(
"""
if not invite_id:
raise ValueError(f"Expected a non-empty value for `invite_id` but received {invite_id!r}")
- return cast(
- InviteGetResponse,
- await self._get(
- f"/user/invites/{invite_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[InviteGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[InviteGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ f"/user/invites/{invite_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
diff --git a/src/cloudflare/resources/user/organizations.py b/src/cloudflare/resources/user/organizations.py
index daf90da2aed..be94b8acb6a 100644
--- a/src/cloudflare/resources/user/organizations.py
+++ b/src/cloudflare/resources/user/organizations.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, cast
+from typing import Type, Optional, cast
from typing_extensions import Literal
import httpx
@@ -25,7 +25,6 @@
make_request_options,
)
from ...types.user.organization import Organization
-from ...types.user.organization_get_response import OrganizationGetResponse
from ...types.user.organization_delete_response import OrganizationDeleteResponse
__all__ = ["OrganizationsResource", "AsyncOrganizationsResource"]
@@ -152,7 +151,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> OrganizationGetResponse:
+ ) -> object:
"""
Gets a specific organization the user is associated with.
@@ -169,21 +168,16 @@ def get(
"""
if not organization_id:
raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}")
- return cast(
- OrganizationGetResponse,
- self._get(
- f"/user/organizations/{organization_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[OrganizationGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[OrganizationGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ f"/user/organizations/{organization_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
@@ -308,7 +302,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> OrganizationGetResponse:
+ ) -> object:
"""
Gets a specific organization the user is associated with.
@@ -325,21 +319,16 @@ async def get(
"""
if not organization_id:
raise ValueError(f"Expected a non-empty value for `organization_id` but received {organization_id!r}")
- return cast(
- OrganizationGetResponse,
- await self._get(
- f"/user/organizations/{organization_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[OrganizationGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[OrganizationGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ f"/user/organizations/{organization_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
diff --git a/src/cloudflare/resources/user/tokens/tokens.py b/src/cloudflare/resources/user/tokens/tokens.py
index 5a71d4cfdb1..4b3f1a41c26 100644
--- a/src/cloudflare/resources/user/tokens/tokens.py
+++ b/src/cloudflare/resources/user/tokens/tokens.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, Type, Union, Iterable, Optional, cast
+from typing import Type, Union, Iterable, Optional, cast
from datetime import datetime
from typing_extensions import Literal
@@ -44,11 +44,8 @@
PermissionGroupsResourceWithStreamingResponse,
AsyncPermissionGroupsResourceWithStreamingResponse,
)
-from ....types.user.policy_param import PolicyParam
-from ....types.user.token_get_response import TokenGetResponse
from ....types.user.token_create_response import TokenCreateResponse
from ....types.user.token_delete_response import TokenDeleteResponse
-from ....types.user.token_update_response import TokenUpdateResponse
from ....types.user.token_verify_response import TokenVerifyResponse
__all__ = ["TokensResource", "AsyncTokensResource"]
@@ -75,7 +72,7 @@ def create(
self,
*,
name: str,
- policies: Iterable[PolicyParam],
+ policies: Iterable[token_create_params.Policy],
condition: token_create_params.Condition | NotGiven = NOT_GIVEN,
expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
not_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
@@ -85,7 +82,7 @@ def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenCreateResponse:
+ ) -> Optional[TokenCreateResponse]:
"""
Create a new access token.
@@ -124,9 +121,9 @@ def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[TokenCreateResponse]._unwrapper,
+ post_parser=ResultWrapper[Optional[TokenCreateResponse]]._unwrapper,
),
- cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]),
+ cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]),
)
def update(
@@ -134,7 +131,7 @@ def update(
token_id: object,
*,
name: str,
- policies: Iterable[PolicyParam],
+ policies: Iterable[token_update_params.Policy],
status: Literal["active", "disabled", "expired"],
condition: token_update_params.Condition | NotGiven = NOT_GIVEN,
expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
@@ -145,7 +142,7 @@ def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenUpdateResponse:
+ ) -> object:
"""
Update an existing token.
@@ -169,32 +166,27 @@ def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- TokenUpdateResponse,
- self._put(
- f"/user/tokens/{token_id}",
- body=maybe_transform(
- {
- "name": name,
- "policies": policies,
- "status": status,
- "condition": condition,
- "expires_on": expires_on,
- "not_before": not_before,
- },
- token_update_params.TokenUpdateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[TokenUpdateResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._put(
+ f"/user/tokens/{token_id}",
+ body=maybe_transform(
+ {
+ "name": name,
+ "policies": policies,
+ "status": status,
+ "condition": condition,
+ "expires_on": expires_on,
+ "not_before": not_before,
+ },
+ token_update_params.TokenUpdateParams,
),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def list(
@@ -293,7 +285,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenGetResponse:
+ ) -> object:
"""
Get information about a specific token.
@@ -306,21 +298,16 @@ def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- TokenGetResponse,
- self._get(
- f"/user/tokens/{token_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[TokenGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[TokenGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ f"/user/tokens/{token_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def verify(
@@ -332,7 +319,7 @@ def verify(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenVerifyResponse:
+ ) -> Optional[TokenVerifyResponse]:
"""Test whether a token works."""
return self._get(
"/user/tokens/verify",
@@ -341,9 +328,9 @@ def verify(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[TokenVerifyResponse]._unwrapper,
+ post_parser=ResultWrapper[Optional[TokenVerifyResponse]]._unwrapper,
),
- cast_to=cast(Type[TokenVerifyResponse], ResultWrapper[TokenVerifyResponse]),
+ cast_to=cast(Type[Optional[TokenVerifyResponse]], ResultWrapper[TokenVerifyResponse]),
)
@@ -368,7 +355,7 @@ async def create(
self,
*,
name: str,
- policies: Iterable[PolicyParam],
+ policies: Iterable[token_create_params.Policy],
condition: token_create_params.Condition | NotGiven = NOT_GIVEN,
expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
not_before: Union[str, datetime] | NotGiven = NOT_GIVEN,
@@ -378,7 +365,7 @@ async def create(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenCreateResponse:
+ ) -> Optional[TokenCreateResponse]:
"""
Create a new access token.
@@ -417,9 +404,9 @@ async def create(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[TokenCreateResponse]._unwrapper,
+ post_parser=ResultWrapper[Optional[TokenCreateResponse]]._unwrapper,
),
- cast_to=cast(Type[TokenCreateResponse], ResultWrapper[TokenCreateResponse]),
+ cast_to=cast(Type[Optional[TokenCreateResponse]], ResultWrapper[TokenCreateResponse]),
)
async def update(
@@ -427,7 +414,7 @@ async def update(
token_id: object,
*,
name: str,
- policies: Iterable[PolicyParam],
+ policies: Iterable[token_update_params.Policy],
status: Literal["active", "disabled", "expired"],
condition: token_update_params.Condition | NotGiven = NOT_GIVEN,
expires_on: Union[str, datetime] | NotGiven = NOT_GIVEN,
@@ -438,7 +425,7 @@ async def update(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenUpdateResponse:
+ ) -> object:
"""
Update an existing token.
@@ -462,32 +449,27 @@ async def update(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- TokenUpdateResponse,
- await self._put(
- f"/user/tokens/{token_id}",
- body=await async_maybe_transform(
- {
- "name": name,
- "policies": policies,
- "status": status,
- "condition": condition,
- "expires_on": expires_on,
- "not_before": not_before,
- },
- token_update_params.TokenUpdateParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[TokenUpdateResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[TokenUpdateResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._put(
+ f"/user/tokens/{token_id}",
+ body=await async_maybe_transform(
+ {
+ "name": name,
+ "policies": policies,
+ "status": status,
+ "condition": condition,
+ "expires_on": expires_on,
+ "not_before": not_before,
+ },
+ token_update_params.TokenUpdateParams,
),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def list(
@@ -586,7 +568,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenGetResponse:
+ ) -> object:
"""
Get information about a specific token.
@@ -599,21 +581,16 @@ async def get(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- TokenGetResponse,
- await self._get(
- f"/user/tokens/{token_id}",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[TokenGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[TokenGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ f"/user/tokens/{token_id}",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
async def verify(
@@ -625,7 +602,7 @@ async def verify(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> TokenVerifyResponse:
+ ) -> Optional[TokenVerifyResponse]:
"""Test whether a token works."""
return await self._get(
"/user/tokens/verify",
@@ -634,9 +611,9 @@ async def verify(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[TokenVerifyResponse]._unwrapper,
+ post_parser=ResultWrapper[Optional[TokenVerifyResponse]]._unwrapper,
),
- cast_to=cast(Type[TokenVerifyResponse], ResultWrapper[TokenVerifyResponse]),
+ cast_to=cast(Type[Optional[TokenVerifyResponse]], ResultWrapper[TokenVerifyResponse]),
)
diff --git a/src/cloudflare/resources/user/tokens/value.py b/src/cloudflare/resources/user/tokens/value.py
index 1a35ddc543e..90195f2c4d2 100644
--- a/src/cloudflare/resources/user/tokens/value.py
+++ b/src/cloudflare/resources/user/tokens/value.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Type, cast
+from typing import Type, Optional, cast
import httpx
@@ -70,7 +70,7 @@ def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[Value]._unwrapper,
+ post_parser=ResultWrapper[Optional[Value]]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)
@@ -117,7 +117,7 @@ async def update(
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
- post_parser=ResultWrapper[Value]._unwrapper,
+ post_parser=ResultWrapper[Optional[Value]]._unwrapper,
),
cast_to=cast(Type[str], ResultWrapper[str]),
)
diff --git a/src/cloudflare/resources/user/user.py b/src/cloudflare/resources/user/user.py
index 3e9117a3321..083b24efdb0 100644
--- a/src/cloudflare/resources/user/user.py
+++ b/src/cloudflare/resources/user/user.py
@@ -2,7 +2,7 @@
from __future__ import annotations
-from typing import Any, Optional, cast
+from typing import Type, Optional, cast
import httpx
@@ -74,8 +74,6 @@
make_request_options,
)
from .billing.billing import BillingResource, AsyncBillingResource
-from ...types.user.user_get_response import UserGetResponse
-from ...types.user.user_edit_response import UserEditResponse
__all__ = ["UserResource", "AsyncUserResource"]
@@ -127,7 +125,7 @@ def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> UserEditResponse:
+ ) -> object:
"""
Edit part of your user details.
@@ -150,31 +148,26 @@ def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- UserEditResponse,
- self._patch(
- "/user",
- body=maybe_transform(
- {
- "country": country,
- "first_name": first_name,
- "last_name": last_name,
- "telephone": telephone,
- "zipcode": zipcode,
- },
- user_edit_params.UserEditParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[UserEditResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[UserEditResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._patch(
+ "/user",
+ body=maybe_transform(
+ {
+ "country": country,
+ "first_name": first_name,
+ "last_name": last_name,
+ "telephone": telephone,
+ "zipcode": zipcode,
+ },
+ user_edit_params.UserEditParams,
),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
+ ),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
def get(
@@ -186,23 +179,18 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> UserGetResponse:
+ ) -> object:
"""User Details"""
- return cast(
- UserGetResponse,
- self._get(
- "/user",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[UserGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[UserGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return self._get(
+ "/user",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
@@ -253,7 +241,7 @@ async def edit(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> UserEditResponse:
+ ) -> object:
"""
Edit part of your user details.
@@ -276,31 +264,26 @@ async def edit(
timeout: Override the client-level default timeout for this request, in seconds
"""
- return cast(
- UserEditResponse,
- await self._patch(
- "/user",
- body=await async_maybe_transform(
- {
- "country": country,
- "first_name": first_name,
- "last_name": last_name,
- "telephone": telephone,
- "zipcode": zipcode,
- },
- user_edit_params.UserEditParams,
- ),
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[UserEditResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[UserEditResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._patch(
+ "/user",
+ body=await async_maybe_transform(
+ {
+ "country": country,
+ "first_name": first_name,
+ "last_name": last_name,
+ "telephone": telephone,
+ "zipcode": zipcode,
+ },
+ user_edit_params.UserEditParams,
+ ),
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
async def get(
@@ -312,23 +295,18 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
- ) -> UserGetResponse:
+ ) -> object:
"""User Details"""
- return cast(
- UserGetResponse,
- await self._get(
- "/user",
- options=make_request_options(
- extra_headers=extra_headers,
- extra_query=extra_query,
- extra_body=extra_body,
- timeout=timeout,
- post_parser=ResultWrapper[UserGetResponse]._unwrapper,
- ),
- cast_to=cast(
- Any, ResultWrapper[UserGetResponse]
- ), # Union types cannot be passed in as arguments in the type system
+ return await self._get(
+ "/user",
+ options=make_request_options(
+ extra_headers=extra_headers,
+ extra_query=extra_query,
+ extra_body=extra_body,
+ timeout=timeout,
+ post_parser=ResultWrapper[Optional[object]]._unwrapper,
),
+ cast_to=cast(Type[object], ResultWrapper[object]),
)
diff --git a/src/cloudflare/types/accounts/__init__.py b/src/cloudflare/types/accounts/__init__.py
index 71487082562..5b4a4199ba4 100644
--- a/src/cloudflare/types/accounts/__init__.py
+++ b/src/cloudflare/types/accounts/__init__.py
@@ -4,14 +4,12 @@
from .status import Status as Status
from .account import Account as Account
-from .role_get_response import RoleGetResponse as RoleGetResponse
from .member_list_params import MemberListParams as MemberListParams
from .account_list_params import AccountListParams as AccountListParams
-from .account_get_response import AccountGetResponse as AccountGetResponse
+from .member_get_response import MemberGetResponse as MemberGetResponse
from .member_create_params import MemberCreateParams as MemberCreateParams
-from .member_list_response import MemberListResponse as MemberListResponse
from .member_update_params import MemberUpdateParams as MemberUpdateParams
from .account_update_params import AccountUpdateParams as AccountUpdateParams
-from .user_with_invite_code import UserWithInviteCode as UserWithInviteCode
+from .member_create_response import MemberCreateResponse as MemberCreateResponse
from .member_delete_response import MemberDeleteResponse as MemberDeleteResponse
-from .account_update_response import AccountUpdateResponse as AccountUpdateResponse
+from .member_update_response import MemberUpdateResponse as MemberUpdateResponse
diff --git a/src/cloudflare/types/accounts/account_get_response.py b/src/cloudflare/types/accounts/account_get_response.py
deleted file mode 100644
index 90ec592d62b..00000000000
--- a/src/cloudflare/types/accounts/account_get_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["AccountGetResponse"]
-
-AccountGetResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/accounts/account_update_response.py b/src/cloudflare/types/accounts/account_update_response.py
deleted file mode 100644
index a10025d46aa..00000000000
--- a/src/cloudflare/types/accounts/account_update_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["AccountUpdateResponse"]
-
-AccountUpdateResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/accounts/member_create_params.py b/src/cloudflare/types/accounts/member_create_params.py
index 69acda8f5da..8706522e855 100644
--- a/src/cloudflare/types/accounts/member_create_params.py
+++ b/src/cloudflare/types/accounts/member_create_params.py
@@ -2,13 +2,20 @@
from __future__ import annotations
-from typing import List
+from typing import List, Union, Iterable
from typing_extensions import Literal, Required, TypedDict
-__all__ = ["MemberCreateParams"]
+__all__ = [
+ "MemberCreateParams",
+ "IamCreateMemberWithRoles",
+ "IamCreateMemberWithPolicies",
+ "IamCreateMemberWithPoliciesPolicy",
+ "IamCreateMemberWithPoliciesPolicyPermissionGroup",
+ "IamCreateMemberWithPoliciesPolicyResourceGroup",
+]
-class MemberCreateParams(TypedDict, total=False):
+class IamCreateMemberWithRoles(TypedDict, total=False):
account_id: Required[str]
email: Required[str]
@@ -18,3 +25,39 @@ class MemberCreateParams(TypedDict, total=False):
"""Array of roles associated with this member."""
status: Literal["accepted", "pending"]
+
+
+class IamCreateMemberWithPolicies(TypedDict, total=False):
+ account_id: Required[str]
+
+ email: Required[str]
+ """The contact email address of the user."""
+
+ policies: Required[Iterable[IamCreateMemberWithPoliciesPolicy]]
+ """Array of policies associated with this member."""
+
+ status: Literal["accepted", "pending"]
+
+
+class IamCreateMemberWithPoliciesPolicyPermissionGroup(TypedDict, total=False):
+ id: Required[str]
+ """Identifier of the group."""
+
+
+class IamCreateMemberWithPoliciesPolicyResourceGroup(TypedDict, total=False):
+ id: Required[str]
+ """Identifier of the group."""
+
+
+class IamCreateMemberWithPoliciesPolicy(TypedDict, total=False):
+ access: Required[Literal["allow", "deny"]]
+ """Allow or deny operations against the resources."""
+
+ permission_groups: Required[Iterable[IamCreateMemberWithPoliciesPolicyPermissionGroup]]
+ """A set of permission groups that are specified to the policy."""
+
+ resource_groups: Required[Iterable[IamCreateMemberWithPoliciesPolicyResourceGroup]]
+ """A list of resource groups that the policy applies to."""
+
+
+MemberCreateParams = Union[IamCreateMemberWithRoles, IamCreateMemberWithPolicies]
diff --git a/src/cloudflare/types/accounts/member_create_response.py b/src/cloudflare/types/accounts/member_create_response.py
new file mode 100644
index 00000000000..02ed65d99c8
--- /dev/null
+++ b/src/cloudflare/types/accounts/member_create_response.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+
+from ..._models import BaseModel
+from ..shared.member import Member
+
+__all__ = ["MemberCreateResponse", "IamAPIResponseCommon"]
+
+
+class IamAPIResponseCommon(BaseModel):
+ result: Optional[Member] = None
+
+
+MemberCreateResponse = Union[IamAPIResponseCommon, IamAPIResponseCommon]
diff --git a/src/cloudflare/types/accounts/member_get_response.py b/src/cloudflare/types/accounts/member_get_response.py
new file mode 100644
index 00000000000..b4ff99e9597
--- /dev/null
+++ b/src/cloudflare/types/accounts/member_get_response.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+
+from ..._models import BaseModel
+from ..shared.member import Member
+
+__all__ = ["MemberGetResponse", "IamAPIResponseCommon"]
+
+
+class IamAPIResponseCommon(BaseModel):
+ result: Optional[Member] = None
+
+
+MemberGetResponse = Union[IamAPIResponseCommon, IamAPIResponseCommon]
diff --git a/src/cloudflare/types/accounts/member_list_response.py b/src/cloudflare/types/accounts/member_list_response.py
deleted file mode 100644
index ca5c995cf44..00000000000
--- a/src/cloudflare/types/accounts/member_list_response.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import List, Optional
-from typing_extensions import Literal
-
-from ..._models import BaseModel
-from ..shared.role import Role
-
-__all__ = ["MemberListResponse"]
-
-
-class MemberListResponse(BaseModel):
- id: str
- """Identifier"""
-
- email: str
- """The contact email address of the user."""
-
- name: Optional[str] = None
- """Member Name."""
-
- roles: List[Role]
- """Roles assigned to this Member."""
-
- status: Literal["accepted", "invited"]
- """A member's status in the organization."""
diff --git a/src/cloudflare/types/accounts/member_update_params.py b/src/cloudflare/types/accounts/member_update_params.py
index 48139d2a39b..851713903c8 100644
--- a/src/cloudflare/types/accounts/member_update_params.py
+++ b/src/cloudflare/types/accounts/member_update_params.py
@@ -2,19 +2,58 @@
from __future__ import annotations
-from typing import Iterable
-from typing_extensions import Required, TypedDict
+from typing import Union, Iterable
+from typing_extensions import Literal, Required, TypedDict
-__all__ = ["MemberUpdateParams", "Role"]
+__all__ = [
+ "MemberUpdateParams",
+ "Member",
+ "MemberRole",
+ "IamUpdateMemberWithPolicies",
+ "IamUpdateMemberWithPoliciesPolicy",
+ "IamUpdateMemberWithPoliciesPolicyPermissionGroup",
+ "IamUpdateMemberWithPoliciesPolicyResourceGroup",
+]
-class MemberUpdateParams(TypedDict, total=False):
+class Member(TypedDict, total=False):
account_id: Required[str]
- roles: Required[Iterable[Role]]
+ roles: Iterable[MemberRole]
"""Roles assigned to this member."""
-class Role(TypedDict, total=False):
+class MemberRole(TypedDict, total=False):
id: Required[str]
"""Role identifier tag."""
+
+
+class IamUpdateMemberWithPolicies(TypedDict, total=False):
+ account_id: Required[str]
+
+ policies: Required[Iterable[IamUpdateMemberWithPoliciesPolicy]]
+ """Array of policies associated with this member."""
+
+
+class IamUpdateMemberWithPoliciesPolicyPermissionGroup(TypedDict, total=False):
+ id: Required[str]
+ """Identifier of the group."""
+
+
+class IamUpdateMemberWithPoliciesPolicyResourceGroup(TypedDict, total=False):
+ id: Required[str]
+ """Identifier of the group."""
+
+
+class IamUpdateMemberWithPoliciesPolicy(TypedDict, total=False):
+ access: Required[Literal["allow", "deny"]]
+ """Allow or deny operations against the resources."""
+
+ permission_groups: Required[Iterable[IamUpdateMemberWithPoliciesPolicyPermissionGroup]]
+ """A set of permission groups that are specified to the policy."""
+
+ resource_groups: Required[Iterable[IamUpdateMemberWithPoliciesPolicyResourceGroup]]
+ """A list of resource groups that the policy applies to."""
+
+
+MemberUpdateParams = Union[Member, IamUpdateMemberWithPolicies]
diff --git a/src/cloudflare/types/accounts/member_update_response.py b/src/cloudflare/types/accounts/member_update_response.py
new file mode 100644
index 00000000000..47de5ca79fe
--- /dev/null
+++ b/src/cloudflare/types/accounts/member_update_response.py
@@ -0,0 +1,15 @@
+# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+from typing import Union, Optional
+
+from ..._models import BaseModel
+from ..shared.member import Member
+
+__all__ = ["MemberUpdateResponse", "IamAPIResponseCommon"]
+
+
+class IamAPIResponseCommon(BaseModel):
+ result: Optional[Member] = None
+
+
+MemberUpdateResponse = Union[IamAPIResponseCommon, IamAPIResponseCommon]
diff --git a/src/cloudflare/types/accounts/role_get_response.py b/src/cloudflare/types/accounts/role_get_response.py
deleted file mode 100644
index 50bca84535e..00000000000
--- a/src/cloudflare/types/accounts/role_get_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["RoleGetResponse"]
-
-RoleGetResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/accounts/user_with_invite_code.py b/src/cloudflare/types/accounts/user_with_invite_code.py
deleted file mode 100644
index ab928845355..00000000000
--- a/src/cloudflare/types/accounts/user_with_invite_code.py
+++ /dev/null
@@ -1,82 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import List, Optional
-
-from ..._models import BaseModel
-from ..shared.permission_grant import PermissionGrant
-
-__all__ = ["UserWithInviteCode", "Role", "RolePermissions", "User"]
-
-
-class RolePermissions(BaseModel):
- analytics: Optional[PermissionGrant] = None
-
- billing: Optional[PermissionGrant] = None
-
- cache_purge: Optional[PermissionGrant] = None
-
- dns: Optional[PermissionGrant] = None
-
- dns_records: Optional[PermissionGrant] = None
-
- lb: Optional[PermissionGrant] = None
-
- logs: Optional[PermissionGrant] = None
-
- organization: Optional[PermissionGrant] = None
-
- ssl: Optional[PermissionGrant] = None
-
- waf: Optional[PermissionGrant] = None
-
- zone_settings: Optional[PermissionGrant] = None
-
- zones: Optional[PermissionGrant] = None
-
-
-class Role(BaseModel):
- id: str
- """Role identifier tag."""
-
- description: str
- """Description of role's permissions."""
-
- name: str
- """Role name."""
-
- permissions: RolePermissions
-
-
-class User(BaseModel):
- email: str
- """The contact email address of the user."""
-
- id: Optional[str] = None
- """Identifier"""
-
- first_name: Optional[str] = None
- """User's first name"""
-
- last_name: Optional[str] = None
- """User's last name"""
-
- two_factor_authentication_enabled: Optional[bool] = None
- """Indicates whether two-factor authentication is enabled for the user account.
-
- Does not apply to API authentication.
- """
-
-
-class UserWithInviteCode(BaseModel):
- id: str
- """Membership identifier tag."""
-
- roles: List[Role]
- """Roles assigned to this member."""
-
- status: object
-
- user: User
-
- code: Optional[str] = None
- """The unique activation code for the account membership."""
diff --git a/src/cloudflare/types/memberships/membership.py b/src/cloudflare/types/memberships/membership.py
index a820bdcb233..a7fb6720539 100644
--- a/src/cloudflare/types/memberships/membership.py
+++ b/src/cloudflare/types/memberships/membership.py
@@ -49,9 +49,6 @@ class Membership(BaseModel):
given account.
"""
- code: Optional[str] = None
- """The unique activation code for the account membership."""
-
permissions: Optional[Permissions] = None
"""All access permissions for the user at the account."""
diff --git a/src/cloudflare/types/memberships/membership_get_response.py b/src/cloudflare/types/memberships/membership_get_response.py
index 58aa5f5943b..e586b51180f 100644
--- a/src/cloudflare/types/memberships/membership_get_response.py
+++ b/src/cloudflare/types/memberships/membership_get_response.py
@@ -2,6 +2,14 @@
from typing import Union, Optional
-__all__ = ["MembershipGetResponse"]
+from ..._models import BaseModel
+from .membership import Membership
-MembershipGetResponse = Union[Optional[str], Optional[object]]
+__all__ = ["MembershipGetResponse", "IamAPIResponseCommon"]
+
+
+class IamAPIResponseCommon(BaseModel):
+ result: Optional[Membership] = None
+
+
+MembershipGetResponse = Union[IamAPIResponseCommon, IamAPIResponseCommon]
diff --git a/src/cloudflare/types/memberships/membership_update_response.py b/src/cloudflare/types/memberships/membership_update_response.py
index adcc658f350..6aa89e9311b 100644
--- a/src/cloudflare/types/memberships/membership_update_response.py
+++ b/src/cloudflare/types/memberships/membership_update_response.py
@@ -2,6 +2,14 @@
from typing import Union, Optional
-__all__ = ["MembershipUpdateResponse"]
+from ..._models import BaseModel
+from .membership import Membership
-MembershipUpdateResponse = Union[Optional[str], Optional[object]]
+__all__ = ["MembershipUpdateResponse", "IamAPIResponseCommon"]
+
+
+class IamAPIResponseCommon(BaseModel):
+ result: Optional[Membership] = None
+
+
+MembershipUpdateResponse = Union[IamAPIResponseCommon, IamAPIResponseCommon]
diff --git a/src/cloudflare/types/shared/member.py b/src/cloudflare/types/shared/member.py
index 101555dd229..c4282582d50 100644
--- a/src/cloudflare/types/shared/member.py
+++ b/src/cloudflare/types/shared/member.py
@@ -1,6 +1,7 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from typing import List, Optional
+from typing_extensions import Literal
from ..._models import BaseModel
from .permission_grant import PermissionGrant
@@ -68,12 +69,14 @@ class User(BaseModel):
class Member(BaseModel):
- id: str
+ id: Optional[str] = None
"""Membership identifier tag."""
- roles: List[Role]
+ roles: Optional[List[Role]] = None
"""Roles assigned to this member."""
- status: object
+ status: Optional[Literal["accepted", "pending"]] = None
+ """A member's status in the account."""
- user: User
+ user: Optional[User] = None
+ """Details of the user associated to the membership."""
diff --git a/src/cloudflare/types/user/__init__.py b/src/cloudflare/types/user/__init__.py
index 986ee04d241..5b1b8c37ba1 100644
--- a/src/cloudflare/types/user/__init__.py
+++ b/src/cloudflare/types/user/__init__.py
@@ -6,30 +6,22 @@
from .cidr_list import CIDRList as CIDRList
from .rate_plan import RatePlan as RatePlan
from .organization import Organization as Organization
-from .policy_param import PolicyParam as PolicyParam
from .subscription import Subscription as Subscription
from .rate_plan_param import RatePlanParam as RatePlanParam
from .user_edit_params import UserEditParams as UserEditParams
from .subscription_zone import SubscriptionZone as SubscriptionZone
from .token_list_params import TokenListParams as TokenListParams
-from .user_get_response import UserGetResponse as UserGetResponse
from .invite_edit_params import InviteEditParams as InviteEditParams
-from .token_get_response import TokenGetResponse as TokenGetResponse
-from .user_edit_response import UserEditResponse as UserEditResponse
-from .invite_get_response import InviteGetResponse as InviteGetResponse
from .token_create_params import TokenCreateParams as TokenCreateParams
from .token_update_params import TokenUpdateParams as TokenUpdateParams
-from .invite_edit_response import InviteEditResponse as InviteEditResponse
from .audit_log_list_params import AuditLogListParams as AuditLogListParams
from .token_create_response import TokenCreateResponse as TokenCreateResponse
from .token_delete_response import TokenDeleteResponse as TokenDeleteResponse
-from .token_update_response import TokenUpdateResponse as TokenUpdateResponse
from .token_verify_response import TokenVerifyResponse as TokenVerifyResponse
from .subscription_component import SubscriptionComponent as SubscriptionComponent
from .subscription_zone_param import SubscriptionZoneParam as SubscriptionZoneParam
from .organization_list_params import OrganizationListParams as OrganizationListParams
from .subscription_edit_params import SubscriptionEditParams as SubscriptionEditParams
-from .organization_get_response import OrganizationGetResponse as OrganizationGetResponse
from .subscription_get_response import SubscriptionGetResponse as SubscriptionGetResponse
from .subscription_edit_response import SubscriptionEditResponse as SubscriptionEditResponse
from .subscription_update_params import SubscriptionUpdateParams as SubscriptionUpdateParams
diff --git a/src/cloudflare/types/user/invite_edit_response.py b/src/cloudflare/types/user/invite_edit_response.py
deleted file mode 100644
index 646377ca831..00000000000
--- a/src/cloudflare/types/user/invite_edit_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["InviteEditResponse"]
-
-InviteEditResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/user/invite_get_response.py b/src/cloudflare/types/user/invite_get_response.py
deleted file mode 100644
index 27a15f71311..00000000000
--- a/src/cloudflare/types/user/invite_get_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["InviteGetResponse"]
-
-InviteGetResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/user/organization.py b/src/cloudflare/types/user/organization.py
index 6c1aa83f02d..3a690386174 100644
--- a/src/cloudflare/types/user/organization.py
+++ b/src/cloudflare/types/user/organization.py
@@ -23,4 +23,4 @@ class Organization(BaseModel):
"""List of roles that a user has within an organization."""
status: Optional[Status] = None
- """Whether the user is a member of the organization or has an inivitation pending."""
+ """Whether the user is a member of the organization or has an invitation pending."""
diff --git a/src/cloudflare/types/user/organization_get_response.py b/src/cloudflare/types/user/organization_get_response.py
deleted file mode 100644
index 4ba74b46f85..00000000000
--- a/src/cloudflare/types/user/organization_get_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["OrganizationGetResponse"]
-
-OrganizationGetResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/user/policy_param.py b/src/cloudflare/types/user/policy_param.py
deleted file mode 100644
index d9f62820fe7..00000000000
--- a/src/cloudflare/types/user/policy_param.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from __future__ import annotations
-
-from typing import Iterable
-from typing_extensions import Literal, Required, TypedDict
-
-__all__ = ["PolicyParam", "PermissionGroup"]
-
-
-class PermissionGroup(TypedDict, total=False):
- pass
-
-
-class PolicyParam(TypedDict, total=False):
- effect: Required[Literal["allow", "deny"]]
- """Allow or deny operations against the resources."""
-
- permission_groups: Required[Iterable[PermissionGroup]]
- """A set of permission groups that are specified to the policy."""
-
- resources: Required[object]
- """A list of resource names that the policy applies to."""
diff --git a/src/cloudflare/types/user/token_create_params.py b/src/cloudflare/types/user/token_create_params.py
index 4ab228c06c6..842eed61529 100644
--- a/src/cloudflare/types/user/token_create_params.py
+++ b/src/cloudflare/types/user/token_create_params.py
@@ -4,20 +4,19 @@
from typing import List, Union, Iterable
from datetime import datetime
-from typing_extensions import Required, Annotated, TypedDict
+from typing_extensions import Literal, Required, Annotated, TypedDict
from ..._utils import PropertyInfo
from .cidr_list import CIDRList
-from .policy_param import PolicyParam
-__all__ = ["TokenCreateParams", "Condition", "ConditionRequestIP"]
+__all__ = ["TokenCreateParams", "Policy", "PolicyPermissionGroup", "Condition", "ConditionRequestIP"]
class TokenCreateParams(TypedDict, total=False):
name: Required[str]
"""Token name."""
- policies: Required[Iterable[PolicyParam]]
+ policies: Required[Iterable[Policy]]
"""List of access policies assigned to the token."""
condition: Condition
@@ -32,6 +31,21 @@ class TokenCreateParams(TypedDict, total=False):
"""The time before which the token MUST NOT be accepted for processing."""
+class PolicyPermissionGroup(TypedDict, total=False):
+ pass
+
+
+class Policy(TypedDict, total=False):
+ effect: Required[Literal["allow", "deny"]]
+ """Allow or deny operations against the resources."""
+
+ permission_groups: Required[Iterable[PolicyPermissionGroup]]
+ """A set of permission groups that are specified to the policy."""
+
+ resources: Required[object]
+ """A list of resource names that the policy applies to."""
+
+
_ConditionRequestIPReservedKeywords = TypedDict(
"_ConditionRequestIPReservedKeywords",
{
diff --git a/src/cloudflare/types/user/token_get_response.py b/src/cloudflare/types/user/token_get_response.py
deleted file mode 100644
index a45eff43263..00000000000
--- a/src/cloudflare/types/user/token_get_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["TokenGetResponse"]
-
-TokenGetResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/user/token_update_params.py b/src/cloudflare/types/user/token_update_params.py
index d564213465b..9299975073e 100644
--- a/src/cloudflare/types/user/token_update_params.py
+++ b/src/cloudflare/types/user/token_update_params.py
@@ -8,16 +8,15 @@
from ..._utils import PropertyInfo
from .cidr_list import CIDRList
-from .policy_param import PolicyParam
-__all__ = ["TokenUpdateParams", "Condition", "ConditionRequestIP"]
+__all__ = ["TokenUpdateParams", "Policy", "PolicyPermissionGroup", "Condition", "ConditionRequestIP"]
class TokenUpdateParams(TypedDict, total=False):
name: Required[str]
"""Token name."""
- policies: Required[Iterable[PolicyParam]]
+ policies: Required[Iterable[Policy]]
"""List of access policies assigned to the token."""
status: Required[Literal["active", "disabled", "expired"]]
@@ -35,6 +34,21 @@ class TokenUpdateParams(TypedDict, total=False):
"""The time before which the token MUST NOT be accepted for processing."""
+class PolicyPermissionGroup(TypedDict, total=False):
+ pass
+
+
+class Policy(TypedDict, total=False):
+ effect: Required[Literal["allow", "deny"]]
+ """Allow or deny operations against the resources."""
+
+ permission_groups: Required[Iterable[PolicyPermissionGroup]]
+ """A set of permission groups that are specified to the policy."""
+
+ resources: Required[object]
+ """A list of resource names that the policy applies to."""
+
+
_ConditionRequestIPReservedKeywords = TypedDict(
"_ConditionRequestIPReservedKeywords",
{
diff --git a/src/cloudflare/types/user/token_update_response.py b/src/cloudflare/types/user/token_update_response.py
deleted file mode 100644
index 4600c9aba02..00000000000
--- a/src/cloudflare/types/user/token_update_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["TokenUpdateResponse"]
-
-TokenUpdateResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/user/user_edit_response.py b/src/cloudflare/types/user/user_edit_response.py
deleted file mode 100644
index e2077cf822d..00000000000
--- a/src/cloudflare/types/user/user_edit_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["UserEditResponse"]
-
-UserEditResponse = Union[Optional[str], Optional[object]]
diff --git a/src/cloudflare/types/user/user_get_response.py b/src/cloudflare/types/user/user_get_response.py
deleted file mode 100644
index 7a0f59652a5..00000000000
--- a/src/cloudflare/types/user/user_get_response.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-
-from typing import Union, Optional
-
-__all__ = ["UserGetResponse"]
-
-UserGetResponse = Union[Optional[str], Optional[object]]
diff --git a/tests/api_resources/accounts/test_members.py b/tests/api_resources/accounts/test_members.py
index 4b8885d1efd..05cb40faa08 100644
--- a/tests/api_resources/accounts/test_members.py
+++ b/tests/api_resources/accounts/test_members.py
@@ -12,9 +12,10 @@
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from cloudflare.types.shared import Member
from cloudflare.types.accounts import (
- MemberListResponse,
- UserWithInviteCode,
+ MemberGetResponse,
+ MemberCreateResponse,
MemberDeleteResponse,
+ MemberUpdateResponse,
)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -24,7 +25,7 @@ class TestMembers:
parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
- def test_method_create(self, client: Cloudflare) -> None:
+ def test_method_create_overload_1(self, client: Cloudflare) -> None:
member = client.accounts.members.create(
account_id="string",
email="user@example.com",
@@ -34,10 +35,10 @@ def test_method_create(self, client: Cloudflare) -> None:
"3536bcfad5faccb999b47003c79917fb",
],
)
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
@parametrize
- def test_method_create_with_all_params(self, client: Cloudflare) -> None:
+ def test_method_create_with_all_params_overload_1(self, client: Cloudflare) -> None:
member = client.accounts.members.create(
account_id="string",
email="user@example.com",
@@ -48,10 +49,10 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
],
status="accepted",
)
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
@parametrize
- def test_raw_response_create(self, client: Cloudflare) -> None:
+ def test_raw_response_create_overload_1(self, client: Cloudflare) -> None:
response = client.accounts.members.with_raw_response.create(
account_id="string",
email="user@example.com",
@@ -65,10 +66,10 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
@parametrize
- def test_streaming_response_create(self, client: Cloudflare) -> None:
+ def test_streaming_response_create_overload_1(self, client: Cloudflare) -> None:
with client.accounts.members.with_streaming_response.create(
account_id="string",
email="user@example.com",
@@ -82,12 +83,12 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
- def test_path_params_create(self, client: Cloudflare) -> None:
+ def test_path_params_create_overload_1(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.accounts.members.with_raw_response.create(
account_id="",
@@ -99,9 +100,259 @@ def test_path_params_create(self, client: Cloudflare) -> None:
],
)
+ @parametrize
+ def test_method_create_overload_2(self, client: Cloudflare) -> None:
+ member = client.accounts.members.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ @parametrize
+ def test_method_create_with_all_params_overload_2(self, client: Cloudflare) -> None:
+ member = client.accounts.members.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ status="accepted",
+ )
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ @parametrize
+ def test_raw_response_create_overload_2(self, client: Cloudflare) -> None:
+ response = client.accounts.members.with_raw_response.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ member = response.parse()
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ @parametrize
+ def test_streaming_response_create_overload_2(self, client: Cloudflare) -> None:
+ with client.accounts.members.with_streaming_response.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ member = response.parse()
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ def test_path_params_create_overload_2(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.accounts.members.with_raw_response.create(
+ account_id="",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_method_update(self, client: Cloudflare) -> None:
+ def test_method_update_overload_1(self, client: Cloudflare) -> None:
+ member = client.accounts.members.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ )
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_method_update_with_all_params_overload_1(self, client: Cloudflare) -> None:
member = client.accounts.members.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
@@ -111,57 +362,246 @@ def test_method_update(self, client: Cloudflare) -> None:
{"id": "3536bcfad5faccb999b47003c79917fb"},
],
)
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_raw_response_update(self, client: Cloudflare) -> None:
+ def test_raw_response_update_overload_1(self, client: Cloudflare) -> None:
response = client.accounts.members.with_raw_response.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ member = response.parse()
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_streaming_response_update_overload_1(self, client: Cloudflare) -> None:
+ with client.accounts.members.with_streaming_response.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ member = response.parse()
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_path_params_update_overload_1(self, client: Cloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ client.accounts.members.with_raw_response.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"):
+ client.accounts.members.with_raw_response.update(
+ "",
+ account_id="string",
+ )
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_method_update_overload_2(self, client: Cloudflare) -> None:
+ member = client.accounts.members.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ def test_raw_response_update_overload_2(self, client: Cloudflare) -> None:
+ response = client.accounts.members.with_raw_response.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_streaming_response_update(self, client: Cloudflare) -> None:
+ def test_streaming_response_update_overload_2(self, client: Cloudflare) -> None:
with client.accounts.members.with_streaming_response.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
assert cast(Any, response.is_closed) is True
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- def test_path_params_update(self, client: Cloudflare) -> None:
+ def test_path_params_update_overload_2(self, client: Cloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
client.accounts.members.with_raw_response.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
)
@@ -169,10 +609,43 @@ def test_path_params_update(self, client: Cloudflare) -> None:
client.accounts.members.with_raw_response.update(
"",
account_id="string",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
)
@@ -181,7 +654,7 @@ def test_method_list(self, client: Cloudflare) -> None:
member = client.accounts.members.list(
account_id="string",
)
- assert_matches_type(SyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[Member], member, path=["response"])
@parametrize
def test_method_list_with_all_params(self, client: Cloudflare) -> None:
@@ -193,7 +666,7 @@ def test_method_list_with_all_params(self, client: Cloudflare) -> None:
per_page=5,
status="accepted",
)
- assert_matches_type(SyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[Member], member, path=["response"])
@parametrize
def test_raw_response_list(self, client: Cloudflare) -> None:
@@ -204,7 +677,7 @@ def test_raw_response_list(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(SyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[Member], member, path=["response"])
@parametrize
def test_streaming_response_list(self, client: Cloudflare) -> None:
@@ -215,7 +688,7 @@ def test_streaming_response_list(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(SyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(SyncV4PagePaginationArray[Member], member, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -280,7 +753,7 @@ def test_method_get(self, client: Cloudflare) -> None:
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
)
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberGetResponse, member, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -292,7 +765,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberGetResponse, member, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -304,7 +777,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberGetResponse, member, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -327,7 +800,7 @@ class TestAsyncMembers:
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@parametrize
- async def test_method_create(self, async_client: AsyncCloudflare) -> None:
+ async def test_method_create_overload_1(self, async_client: AsyncCloudflare) -> None:
member = await async_client.accounts.members.create(
account_id="string",
email="user@example.com",
@@ -337,10 +810,10 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
"3536bcfad5faccb999b47003c79917fb",
],
)
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
@parametrize
- async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
+ async def test_method_create_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None:
member = await async_client.accounts.members.create(
account_id="string",
email="user@example.com",
@@ -351,10 +824,10 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
],
status="accepted",
)
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
@parametrize
- async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
+ async def test_raw_response_create_overload_1(self, async_client: AsyncCloudflare) -> None:
response = await async_client.accounts.members.with_raw_response.create(
account_id="string",
email="user@example.com",
@@ -368,10 +841,10 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
@parametrize
- async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
+ async def test_streaming_response_create_overload_1(self, async_client: AsyncCloudflare) -> None:
async with async_client.accounts.members.with_streaming_response.create(
account_id="string",
email="user@example.com",
@@ -385,12 +858,12 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(UserWithInviteCode, member, path=["response"])
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
- async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
+ async def test_path_params_create_overload_1(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.accounts.members.with_raw_response.create(
account_id="",
@@ -402,9 +875,259 @@ async def test_path_params_create(self, async_client: AsyncCloudflare) -> None:
],
)
+ @parametrize
+ async def test_method_create_overload_2(self, async_client: AsyncCloudflare) -> None:
+ member = await async_client.accounts.members.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ @parametrize
+ async def test_method_create_with_all_params_overload_2(self, async_client: AsyncCloudflare) -> None:
+ member = await async_client.accounts.members.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ status="accepted",
+ )
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ @parametrize
+ async def test_raw_response_create_overload_2(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.accounts.members.with_raw_response.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ member = await response.parse()
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ @parametrize
+ async def test_streaming_response_create_overload_2(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.accounts.members.with_streaming_response.create(
+ account_id="string",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ member = await response.parse()
+ assert_matches_type(MemberCreateResponse, member, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @parametrize
+ async def test_path_params_create_overload_2(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.accounts.members.with_raw_response.create(
+ account_id="",
+ email="user@example.com",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_method_update(self, async_client: AsyncCloudflare) -> None:
+ async def test_method_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ member = await async_client.accounts.members.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ )
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_method_update_with_all_params_overload_1(self, async_client: AsyncCloudflare) -> None:
member = await async_client.accounts.members.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
@@ -414,57 +1137,246 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
{"id": "3536bcfad5faccb999b47003c79917fb"},
],
)
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
+ async def test_raw_response_update_overload_1(self, async_client: AsyncCloudflare) -> None:
response = await async_client.accounts.members.with_raw_response.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ )
+
+ assert response.is_closed is True
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+ member = await response.parse()
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_streaming_response_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ async with async_client.accounts.members.with_streaming_response.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ ) as response:
+ assert not response.is_closed
+ assert response.http_request.headers.get("X-Stainless-Lang") == "python"
+
+ member = await response.parse()
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ assert cast(Any, response.is_closed) is True
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_path_params_update_overload_1(self, async_client: AsyncCloudflare) -> None:
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
+ await async_client.accounts.members.with_raw_response.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="",
+ )
+
+ with pytest.raises(ValueError, match=r"Expected a non-empty value for `member_id` but received ''"):
+ await async_client.accounts.members.with_raw_response.update(
+ "",
+ account_id="string",
+ )
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_method_update_overload_2(self, async_client: AsyncCloudflare) -> None:
+ member = await async_client.accounts.members.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ ],
+ )
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
+
+ @pytest.mark.skip(reason="TODO: investigate broken test")
+ @parametrize
+ async def test_raw_response_update_overload_2(self, async_client: AsyncCloudflare) -> None:
+ response = await async_client.accounts.members.with_raw_response.update(
+ "4536bcfad5faccb111b47003c79917fa",
+ account_id="string",
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
)
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
+ async def test_streaming_response_update_overload_2(self, async_client: AsyncCloudflare) -> None:
async with async_client.accounts.members.with_streaming_response.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
) as response:
assert not response.is_closed
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberUpdateResponse, member, path=["response"])
assert cast(Any, response.is_closed) is True
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
- async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
+ async def test_path_params_update_overload_2(self, async_client: AsyncCloudflare) -> None:
with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"):
await async_client.accounts.members.with_raw_response.update(
"4536bcfad5faccb111b47003c79917fa",
account_id="",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
)
@@ -472,10 +1384,43 @@ async def test_path_params_update(self, async_client: AsyncCloudflare) -> None:
await async_client.accounts.members.with_raw_response.update(
"",
account_id="string",
- roles=[
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
- {"id": "3536bcfad5faccb999b47003c79917fb"},
+ policies=[
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
+ {
+ "access": "allow",
+ "permission_groups": [
+ {"id": "c8fed203ed3043cba015a93ad1616f1f"},
+ {"id": "82e64a83756745bbbb1c9c2701bf816b"},
+ ],
+ "resource_groups": [
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ {"id": "6d7f2f5f5b1d4a0e9081fdc98d432fd1"},
+ ],
+ },
],
)
@@ -484,7 +1429,7 @@ async def test_method_list(self, async_client: AsyncCloudflare) -> None:
member = await async_client.accounts.members.list(
account_id="string",
)
- assert_matches_type(AsyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[Member], member, path=["response"])
@parametrize
async def test_method_list_with_all_params(self, async_client: AsyncCloudflare) -> None:
@@ -496,7 +1441,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncCloudflare)
per_page=5,
status="accepted",
)
- assert_matches_type(AsyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[Member], member, path=["response"])
@parametrize
async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -507,7 +1452,7 @@ async def test_raw_response_list(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(AsyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[Member], member, path=["response"])
@parametrize
async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> None:
@@ -518,7 +1463,7 @@ async def test_streaming_response_list(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(AsyncV4PagePaginationArray[MemberListResponse], member, path=["response"])
+ assert_matches_type(AsyncV4PagePaginationArray[Member], member, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -583,7 +1528,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
"4536bcfad5faccb111b47003c79917fa",
account_id="string",
)
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberGetResponse, member, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -595,7 +1540,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberGetResponse, member, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -607,7 +1552,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
member = await response.parse()
- assert_matches_type(Member, member, path=["response"])
+ assert_matches_type(MemberGetResponse, member, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/accounts/test_roles.py b/tests/api_resources/accounts/test_roles.py
index 8da99847106..768327bb0a6 100644
--- a/tests/api_resources/accounts/test_roles.py
+++ b/tests/api_resources/accounts/test_roles.py
@@ -11,7 +11,6 @@
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
from cloudflare.types.shared import Role
-from cloudflare.types.accounts import RoleGetResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -63,7 +62,7 @@ def test_method_get(self, client: Cloudflare) -> None:
{},
account_id="string",
)
- assert_matches_type(RoleGetResponse, role, path=["response"])
+ assert_matches_type(object, role, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -75,7 +74,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
role = response.parse()
- assert_matches_type(RoleGetResponse, role, path=["response"])
+ assert_matches_type(object, role, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -87,7 +86,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
role = response.parse()
- assert_matches_type(RoleGetResponse, role, path=["response"])
+ assert_matches_type(object, role, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -147,7 +146,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
{},
account_id="string",
)
- assert_matches_type(RoleGetResponse, role, path=["response"])
+ assert_matches_type(object, role, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -159,7 +158,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
role = await response.parse()
- assert_matches_type(RoleGetResponse, role, path=["response"])
+ assert_matches_type(object, role, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -171,7 +170,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
role = await response.parse()
- assert_matches_type(RoleGetResponse, role, path=["response"])
+ assert_matches_type(object, role, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py
index 19d397230d3..501299704c4 100644
--- a/tests/api_resources/test_accounts.py
+++ b/tests/api_resources/test_accounts.py
@@ -10,10 +10,6 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
-from cloudflare.types.accounts import (
- AccountGetResponse,
- AccountUpdateResponse,
-)
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -27,7 +23,7 @@ def test_method_update(self, client: Cloudflare) -> None:
account_id={},
name="Demo Account",
)
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
def test_method_update_with_all_params(self, client: Cloudflare) -> None:
@@ -40,7 +36,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
"use_account_custom_ns_by_default": True,
},
)
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
def test_raw_response_update(self, client: Cloudflare) -> None:
@@ -52,7 +48,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = response.parse()
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
def test_streaming_response_update(self, client: Cloudflare) -> None:
@@ -64,7 +60,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = response.parse()
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -108,7 +104,7 @@ def test_method_get(self, client: Cloudflare) -> None:
account = client.accounts.get(
account_id={},
)
- assert_matches_type(AccountGetResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -119,7 +115,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = response.parse()
- assert_matches_type(AccountGetResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -130,7 +126,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = response.parse()
- assert_matches_type(AccountGetResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -144,7 +140,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
account_id={},
name="Demo Account",
)
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
async def test_method_update_with_all_params(self, async_client: AsyncCloudflare) -> None:
@@ -157,7 +153,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
"use_account_custom_ns_by_default": True,
},
)
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
@@ -169,7 +165,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = await response.parse()
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
async def test_streaming_response_update(self, async_client: AsyncCloudflare) -> None:
@@ -181,7 +177,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = await response.parse()
- assert_matches_type(AccountUpdateResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -225,7 +221,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
account = await async_client.accounts.get(
account_id={},
)
- assert_matches_type(AccountGetResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -236,7 +232,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = await response.parse()
- assert_matches_type(AccountGetResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -247,6 +243,6 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
account = await response.parse()
- assert_matches_type(AccountGetResponse, account, path=["response"])
+ assert_matches_type(object, account, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_memberships.py b/tests/api_resources/test_memberships.py
index c833239e35c..f476c5a8e2f 100644
--- a/tests/api_resources/test_memberships.py
+++ b/tests/api_resources/test_memberships.py
@@ -3,7 +3,7 @@
from __future__ import annotations
import os
-from typing import Any, cast
+from typing import Any, Optional, cast
import pytest
@@ -108,7 +108,7 @@ def test_method_delete(self, client: Cloudflare) -> None:
membership = client.memberships.delete(
"4536bcfad5faccb111b47003c79917fa",
)
- assert_matches_type(MembershipDeleteResponse, membership, path=["response"])
+ assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"])
@parametrize
def test_raw_response_delete(self, client: Cloudflare) -> None:
@@ -119,7 +119,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"
membership = response.parse()
- assert_matches_type(MembershipDeleteResponse, membership, path=["response"])
+ assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"])
@parametrize
def test_streaming_response_delete(self, client: Cloudflare) -> None:
@@ -130,7 +130,7 @@ def test_streaming_response_delete(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
membership = response.parse()
- assert_matches_type(MembershipDeleteResponse, membership, path=["response"])
+ assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -268,7 +268,7 @@ async def test_method_delete(self, async_client: AsyncCloudflare) -> None:
membership = await async_client.memberships.delete(
"4536bcfad5faccb111b47003c79917fa",
)
- assert_matches_type(MembershipDeleteResponse, membership, path=["response"])
+ assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"])
@parametrize
async def test_raw_response_delete(self, async_client: AsyncCloudflare) -> None:
@@ -279,7 +279,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"
membership = await response.parse()
- assert_matches_type(MembershipDeleteResponse, membership, path=["response"])
+ assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"])
@parametrize
async def test_streaming_response_delete(self, async_client: AsyncCloudflare) -> None:
@@ -290,7 +290,7 @@ async def test_streaming_response_delete(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
membership = await response.parse()
- assert_matches_type(MembershipDeleteResponse, membership, path=["response"])
+ assert_matches_type(Optional[MembershipDeleteResponse], membership, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/test_user.py b/tests/api_resources/test_user.py
index b8fc2776d01..1ffbb87e386 100644
--- a/tests/api_resources/test_user.py
+++ b/tests/api_resources/test_user.py
@@ -9,7 +9,6 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
-from cloudflare.types.user import UserGetResponse, UserEditResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -20,7 +19,7 @@ class TestUser:
@parametrize
def test_method_edit(self, client: Cloudflare) -> None:
user = client.user.edit()
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
@@ -31,7 +30,7 @@ def test_method_edit_with_all_params(self, client: Cloudflare) -> None:
telephone="+1 123-123-1234",
zipcode="12345",
)
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
def test_raw_response_edit(self, client: Cloudflare) -> None:
@@ -40,7 +39,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = response.parse()
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
def test_streaming_response_edit(self, client: Cloudflare) -> None:
@@ -49,14 +48,14 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = response.parse()
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
def test_method_get(self, client: Cloudflare) -> None:
user = client.user.get()
- assert_matches_type(UserGetResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -65,7 +64,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = response.parse()
- assert_matches_type(UserGetResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -74,7 +73,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = response.parse()
- assert_matches_type(UserGetResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -85,7 +84,7 @@ class TestAsyncUser:
@parametrize
async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
user = await async_client.user.edit()
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare) -> None:
@@ -96,7 +95,7 @@ async def test_method_edit_with_all_params(self, async_client: AsyncCloudflare)
telephone="+1 123-123-1234",
zipcode="12345",
)
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
@@ -105,7 +104,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = await response.parse()
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
@@ -114,14 +113,14 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = await response.parse()
- assert_matches_type(UserEditResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
async def test_method_get(self, async_client: AsyncCloudflare) -> None:
user = await async_client.user.get()
- assert_matches_type(UserGetResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -130,7 +129,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = await response.parse()
- assert_matches_type(UserGetResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -139,6 +138,6 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
user = await response.parse()
- assert_matches_type(UserGetResponse, user, path=["response"])
+ assert_matches_type(object, user, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/user/test_invites.py b/tests/api_resources/user/test_invites.py
index 73926fbc056..a428b30e8f9 100644
--- a/tests/api_resources/user/test_invites.py
+++ b/tests/api_resources/user/test_invites.py
@@ -10,7 +10,7 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncSinglePage, AsyncSinglePage
-from cloudflare.types.user import Invite, InviteGetResponse, InviteEditResponse
+from cloudflare.types.user import Invite
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -49,7 +49,7 @@ def test_method_edit(self, client: Cloudflare) -> None:
"4f5f0c14a2a41d5063dd301b2f829f04",
status="accepted",
)
- assert_matches_type(InviteEditResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
def test_raw_response_edit(self, client: Cloudflare) -> None:
@@ -61,7 +61,7 @@ def test_raw_response_edit(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = response.parse()
- assert_matches_type(InviteEditResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
def test_streaming_response_edit(self, client: Cloudflare) -> None:
@@ -73,7 +73,7 @@ def test_streaming_response_edit(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = response.parse()
- assert_matches_type(InviteEditResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -90,7 +90,7 @@ def test_method_get(self, client: Cloudflare) -> None:
invite = client.user.invites.get(
"4f5f0c14a2a41d5063dd301b2f829f04",
)
- assert_matches_type(InviteGetResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -101,7 +101,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = response.parse()
- assert_matches_type(InviteGetResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -112,7 +112,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = response.parse()
- assert_matches_type(InviteGetResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -158,7 +158,7 @@ async def test_method_edit(self, async_client: AsyncCloudflare) -> None:
"4f5f0c14a2a41d5063dd301b2f829f04",
status="accepted",
)
- assert_matches_type(InviteEditResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
@@ -170,7 +170,7 @@ async def test_raw_response_edit(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = await response.parse()
- assert_matches_type(InviteEditResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> None:
@@ -182,7 +182,7 @@ async def test_streaming_response_edit(self, async_client: AsyncCloudflare) -> N
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = await response.parse()
- assert_matches_type(InviteEditResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -199,7 +199,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
invite = await async_client.user.invites.get(
"4f5f0c14a2a41d5063dd301b2f829f04",
)
- assert_matches_type(InviteGetResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -210,7 +210,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = await response.parse()
- assert_matches_type(InviteGetResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -221,7 +221,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
invite = await response.parse()
- assert_matches_type(InviteGetResponse, invite, path=["response"])
+ assert_matches_type(object, invite, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/user/test_organizations.py b/tests/api_resources/user/test_organizations.py
index 336fa525726..c129ec550be 100644
--- a/tests/api_resources/user/test_organizations.py
+++ b/tests/api_resources/user/test_organizations.py
@@ -10,11 +10,7 @@
from cloudflare import Cloudflare, AsyncCloudflare
from tests.utils import assert_matches_type
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
-from cloudflare.types.user import (
- Organization,
- OrganizationGetResponse,
- OrganizationDeleteResponse,
-)
+from cloudflare.types.user import Organization, OrganizationDeleteResponse
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
@@ -103,7 +99,7 @@ def test_method_get(self, client: Cloudflare) -> None:
organization = client.user.organizations.get(
"023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(OrganizationGetResponse, organization, path=["response"])
+ assert_matches_type(object, organization, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -114,7 +110,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
organization = response.parse()
- assert_matches_type(OrganizationGetResponse, organization, path=["response"])
+ assert_matches_type(object, organization, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -125,7 +121,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
organization = response.parse()
- assert_matches_type(OrganizationGetResponse, organization, path=["response"])
+ assert_matches_type(object, organization, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -221,7 +217,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
organization = await async_client.user.organizations.get(
"023e105f4ecef8ad9ca31a8372d0c353",
)
- assert_matches_type(OrganizationGetResponse, organization, path=["response"])
+ assert_matches_type(object, organization, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -232,7 +228,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
organization = await response.parse()
- assert_matches_type(OrganizationGetResponse, organization, path=["response"])
+ assert_matches_type(object, organization, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -243,7 +239,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
organization = await response.parse()
- assert_matches_type(OrganizationGetResponse, organization, path=["response"])
+ assert_matches_type(object, organization, path=["response"])
assert cast(Any, response.is_closed) is True
diff --git a/tests/api_resources/user/test_tokens.py b/tests/api_resources/user/test_tokens.py
index 608a7beeb51..c91fbe44f60 100644
--- a/tests/api_resources/user/test_tokens.py
+++ b/tests/api_resources/user/test_tokens.py
@@ -12,10 +12,8 @@
from cloudflare._utils import parse_datetime
from cloudflare.pagination import SyncV4PagePaginationArray, AsyncV4PagePaginationArray
from cloudflare.types.user import (
- TokenGetResponse,
TokenCreateResponse,
TokenDeleteResponse,
- TokenUpdateResponse,
TokenVerifyResponse,
)
@@ -57,7 +55,7 @@ def test_method_create(self, client: Cloudflare) -> None:
},
],
)
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -99,7 +97,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
expires_on=parse_datetime("2020-01-01T00:00:00Z"),
not_before=parse_datetime("2018-07-01T05:20:00Z"),
)
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -137,7 +135,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -175,7 +173,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -213,7 +211,7 @@ def test_method_update(self, client: Cloudflare) -> None:
],
status="active",
)
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -257,7 +255,7 @@ def test_method_update_with_all_params(self, client: Cloudflare) -> None:
expires_on=parse_datetime("2020-01-01T00:00:00Z"),
not_before=parse_datetime("2018-07-01T05:20:00Z"),
)
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -297,7 +295,7 @@ def test_raw_response_update(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -337,7 +335,7 @@ def test_streaming_response_update(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -411,7 +409,7 @@ def test_method_get(self, client: Cloudflare) -> None:
token = client.user.tokens.get(
{},
)
- assert_matches_type(TokenGetResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@parametrize
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -422,7 +420,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenGetResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@parametrize
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -433,14 +431,14 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenGetResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
def test_method_verify(self, client: Cloudflare) -> None:
token = client.user.tokens.verify()
- assert_matches_type(TokenVerifyResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"])
@parametrize
def test_raw_response_verify(self, client: Cloudflare) -> None:
@@ -449,7 +447,7 @@ def test_raw_response_verify(self, client: Cloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenVerifyResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"])
@parametrize
def test_streaming_response_verify(self, client: Cloudflare) -> None:
@@ -458,7 +456,7 @@ def test_streaming_response_verify(self, client: Cloudflare) -> None:
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = response.parse()
- assert_matches_type(TokenVerifyResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -498,7 +496,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
},
],
)
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -540,7 +538,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
expires_on=parse_datetime("2020-01-01T00:00:00Z"),
not_before=parse_datetime("2018-07-01T05:20:00Z"),
)
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -578,7 +576,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -616,7 +614,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenCreateResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenCreateResponse], token, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -654,7 +652,7 @@ async def test_method_update(self, async_client: AsyncCloudflare) -> None:
],
status="active",
)
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -698,7 +696,7 @@ async def test_method_update_with_all_params(self, async_client: AsyncCloudflare
expires_on=parse_datetime("2020-01-01T00:00:00Z"),
not_before=parse_datetime("2018-07-01T05:20:00Z"),
)
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -738,7 +736,7 @@ async def test_raw_response_update(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@pytest.mark.skip(reason="TODO: investigate broken test")
@parametrize
@@ -778,7 +776,7 @@ async def test_streaming_response_update(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenUpdateResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
assert cast(Any, response.is_closed) is True
@@ -852,7 +850,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
token = await async_client.user.tokens.get(
{},
)
- assert_matches_type(TokenGetResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@parametrize
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -863,7 +861,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenGetResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
@parametrize
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -874,14 +872,14 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenGetResponse, token, path=["response"])
+ assert_matches_type(object, token, path=["response"])
assert cast(Any, response.is_closed) is True
@parametrize
async def test_method_verify(self, async_client: AsyncCloudflare) -> None:
token = await async_client.user.tokens.verify()
- assert_matches_type(TokenVerifyResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"])
@parametrize
async def test_raw_response_verify(self, async_client: AsyncCloudflare) -> None:
@@ -890,7 +888,7 @@ async def test_raw_response_verify(self, async_client: AsyncCloudflare) -> None:
assert response.is_closed is True
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenVerifyResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"])
@parametrize
async def test_streaming_response_verify(self, async_client: AsyncCloudflare) -> None:
@@ -899,6 +897,6 @@ async def test_streaming_response_verify(self, async_client: AsyncCloudflare) ->
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
token = await response.parse()
- assert_matches_type(TokenVerifyResponse, token, path=["response"])
+ assert_matches_type(Optional[TokenVerifyResponse], token, path=["response"])
assert cast(Any, response.is_closed) is True