From fbf88e1115389e63b1a3869320cca85c09400543 Mon Sep 17 00:00:00 2001
From: "stainless-app[bot]"
<142633134+stainless-app[bot]@users.noreply.github.com>
Date: Fri, 12 Apr 2024 02:15:39 +0000
Subject: [PATCH] feat(api): update via SDK Studio (#304)
---
api.md | 15 ++------
src/cloudflare/_client.py | 16 ++++----
src/cloudflare/resources/__init__.py | 24 ++++++------
src/cloudflare/resources/user/__init__.py | 24 ++++++------
src/cloudflare/resources/user/user.py | 38 +++++++++----------
src/cloudflare/types/__init__.py | 1 +
.../types/{user/tokens => }/permission.py | 0
src/cloudflare/types/role.py | 2 +-
src/cloudflare/types/user/__init__.py | 1 +
src/cloudflare/types/user/organization.py | 2 +-
src/cloudflare/types/user/tokens/__init__.py | 1 -
src/cloudflare/types/{ => user}/user.py | 4 +-
12 files changed, 61 insertions(+), 67 deletions(-)
rename src/cloudflare/types/{user/tokens => }/permission.py (100%)
rename src/cloudflare/types/{ => user}/user.py (94%)
diff --git a/api.md b/api.md
index 0e8cce382be..09df6c50c00 100644
--- a/api.md
+++ b/api.md
@@ -18,14 +18,7 @@ from cloudflare.types import (
Types:
```python
-from cloudflare.types import (
- Account,
- Role,
- User,
- AccountUpdateResponse,
- AccountListResponse,
- AccountGetResponse,
-)
+from cloudflare.types import Account, AccountUpdateResponse, AccountListResponse, AccountGetResponse
```
Methods:
@@ -115,12 +108,12 @@ Methods:
- client.memberships.delete(membership_id, \*\*params) -> MembershipDeleteResponse
- client.memberships.get(membership_id) -> MembershipGetResponse
-# User
+# UserResource
Types:
```python
-from cloudflare.types import UserEditResponse, UserGetResponse
+from cloudflare.types import Permission, Role, User, UserEditResponse, UserGetResponse
```
Methods:
@@ -244,7 +237,7 @@ Methods:
Types:
```python
-from cloudflare.types.user.tokens import Permission, PermissionGroupListResponse
+from cloudflare.types.user.tokens import PermissionGroupListResponse
```
Methods:
diff --git a/src/cloudflare/_client.py b/src/cloudflare/_client.py
index 000dc7fe45a..2eec1da5f0c 100644
--- a/src/cloudflare/_client.py
+++ b/src/cloudflare/_client.py
@@ -51,7 +51,7 @@ class Cloudflare(SyncAPIClient):
origin_ca_certificates: resources.OriginCACertificates
ips: resources.IPs
memberships: resources.Memberships
- user: resources.User
+ user: resources.UserResource
zones: resources.Zones
load_balancers: resources.LoadBalancers
cache: resources.Cache
@@ -206,7 +206,7 @@ def __init__(
self.origin_ca_certificates = resources.OriginCACertificates(self)
self.ips = resources.IPs(self)
self.memberships = resources.Memberships(self)
- self.user = resources.User(self)
+ self.user = resources.UserResource(self)
self.zones = resources.Zones(self)
self.load_balancers = resources.LoadBalancers(self)
self.cache = resources.Cache(self)
@@ -464,7 +464,7 @@ class AsyncCloudflare(AsyncAPIClient):
origin_ca_certificates: resources.AsyncOriginCACertificates
ips: resources.AsyncIPs
memberships: resources.AsyncMemberships
- user: resources.AsyncUser
+ user: resources.AsyncUserResource
zones: resources.AsyncZones
load_balancers: resources.AsyncLoadBalancers
cache: resources.AsyncCache
@@ -619,7 +619,7 @@ def __init__(
self.origin_ca_certificates = resources.AsyncOriginCACertificates(self)
self.ips = resources.AsyncIPs(self)
self.memberships = resources.AsyncMemberships(self)
- self.user = resources.AsyncUser(self)
+ self.user = resources.AsyncUserResource(self)
self.zones = resources.AsyncZones(self)
self.load_balancers = resources.AsyncLoadBalancers(self)
self.cache = resources.AsyncCache(self)
@@ -878,7 +878,7 @@ def __init__(self, client: Cloudflare) -> None:
self.origin_ca_certificates = resources.OriginCACertificatesWithRawResponse(client.origin_ca_certificates)
self.ips = resources.IPsWithRawResponse(client.ips)
self.memberships = resources.MembershipsWithRawResponse(client.memberships)
- self.user = resources.UserWithRawResponse(client.user)
+ self.user = resources.UserResourceWithRawResponse(client.user)
self.zones = resources.ZonesWithRawResponse(client.zones)
self.load_balancers = resources.LoadBalancersWithRawResponse(client.load_balancers)
self.cache = resources.CacheWithRawResponse(client.cache)
@@ -964,7 +964,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
self.origin_ca_certificates = resources.AsyncOriginCACertificatesWithRawResponse(client.origin_ca_certificates)
self.ips = resources.AsyncIPsWithRawResponse(client.ips)
self.memberships = resources.AsyncMembershipsWithRawResponse(client.memberships)
- self.user = resources.AsyncUserWithRawResponse(client.user)
+ self.user = resources.AsyncUserResourceWithRawResponse(client.user)
self.zones = resources.AsyncZonesWithRawResponse(client.zones)
self.load_balancers = resources.AsyncLoadBalancersWithRawResponse(client.load_balancers)
self.cache = resources.AsyncCacheWithRawResponse(client.cache)
@@ -1054,7 +1054,7 @@ def __init__(self, client: Cloudflare) -> None:
self.origin_ca_certificates = resources.OriginCACertificatesWithStreamingResponse(client.origin_ca_certificates)
self.ips = resources.IPsWithStreamingResponse(client.ips)
self.memberships = resources.MembershipsWithStreamingResponse(client.memberships)
- self.user = resources.UserWithStreamingResponse(client.user)
+ self.user = resources.UserResourceWithStreamingResponse(client.user)
self.zones = resources.ZonesWithStreamingResponse(client.zones)
self.load_balancers = resources.LoadBalancersWithStreamingResponse(client.load_balancers)
self.cache = resources.CacheWithStreamingResponse(client.cache)
@@ -1146,7 +1146,7 @@ def __init__(self, client: AsyncCloudflare) -> None:
)
self.ips = resources.AsyncIPsWithStreamingResponse(client.ips)
self.memberships = resources.AsyncMembershipsWithStreamingResponse(client.memberships)
- self.user = resources.AsyncUserWithStreamingResponse(client.user)
+ self.user = resources.AsyncUserResourceWithStreamingResponse(client.user)
self.zones = resources.AsyncZonesWithStreamingResponse(client.zones)
self.load_balancers = resources.AsyncLoadBalancersWithStreamingResponse(client.load_balancers)
self.cache = resources.AsyncCacheWithStreamingResponse(client.cache)
diff --git a/src/cloudflare/resources/__init__.py b/src/cloudflare/resources/__init__.py
index 22875e389ef..7f3257e6d92 100644
--- a/src/cloudflare/resources/__init__.py
+++ b/src/cloudflare/resources/__init__.py
@@ -81,12 +81,12 @@
AsyncLogsWithStreamingResponse,
)
from .user import (
- User,
- AsyncUser,
- UserWithRawResponse,
- AsyncUserWithRawResponse,
- UserWithStreamingResponse,
- AsyncUserWithStreamingResponse,
+ UserResource,
+ AsyncUserResource,
+ UserResourceWithRawResponse,
+ AsyncUserResourceWithRawResponse,
+ UserResourceWithStreamingResponse,
+ AsyncUserResourceWithStreamingResponse,
)
from .web3 import (
Web3,
@@ -666,12 +666,12 @@
"AsyncMembershipsWithRawResponse",
"MembershipsWithStreamingResponse",
"AsyncMembershipsWithStreamingResponse",
- "User",
- "AsyncUser",
- "UserWithRawResponse",
- "AsyncUserWithRawResponse",
- "UserWithStreamingResponse",
- "AsyncUserWithStreamingResponse",
+ "UserResource",
+ "AsyncUserResource",
+ "UserResourceWithRawResponse",
+ "AsyncUserResourceWithRawResponse",
+ "UserResourceWithStreamingResponse",
+ "AsyncUserResourceWithStreamingResponse",
"Zones",
"AsyncZones",
"ZonesWithRawResponse",
diff --git a/src/cloudflare/resources/user/__init__.py b/src/cloudflare/resources/user/__init__.py
index ff166570765..edfb81c9e9e 100644
--- a/src/cloudflare/resources/user/__init__.py
+++ b/src/cloudflare/resources/user/__init__.py
@@ -1,12 +1,12 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
from .user import (
- User,
- AsyncUser,
- UserWithRawResponse,
- AsyncUserWithRawResponse,
- UserWithStreamingResponse,
- AsyncUserWithStreamingResponse,
+ UserResource,
+ AsyncUserResource,
+ UserResourceWithRawResponse,
+ AsyncUserResourceWithRawResponse,
+ UserResourceWithStreamingResponse,
+ AsyncUserResourceWithStreamingResponse,
)
from .tokens import (
Tokens,
@@ -94,10 +94,10 @@
"AsyncTokensWithRawResponse",
"TokensWithStreamingResponse",
"AsyncTokensWithStreamingResponse",
- "User",
- "AsyncUser",
- "UserWithRawResponse",
- "AsyncUserWithRawResponse",
- "UserWithStreamingResponse",
- "AsyncUserWithStreamingResponse",
+ "UserResource",
+ "AsyncUserResource",
+ "UserResourceWithRawResponse",
+ "AsyncUserResourceWithRawResponse",
+ "UserResourceWithStreamingResponse",
+ "AsyncUserResourceWithStreamingResponse",
]
diff --git a/src/cloudflare/resources/user/user.py b/src/cloudflare/resources/user/user.py
index 659324ac2fe..59a87052725 100644
--- a/src/cloudflare/resources/user/user.py
+++ b/src/cloudflare/resources/user/user.py
@@ -75,10 +75,10 @@
)
from .billing.billing import Billing, AsyncBilling
-__all__ = ["User", "AsyncUser"]
+__all__ = ["UserResource", "AsyncUserResource"]
-class User(SyncAPIResource):
+class UserResource(SyncAPIResource):
@cached_property
def audit_logs(self) -> AuditLogs:
return AuditLogs(self._client)
@@ -104,12 +104,12 @@ def tokens(self) -> Tokens:
return Tokens(self._client)
@cached_property
- def with_raw_response(self) -> UserWithRawResponse:
- return UserWithRawResponse(self)
+ def with_raw_response(self) -> UserResourceWithRawResponse:
+ return UserResourceWithRawResponse(self)
@cached_property
- def with_streaming_response(self) -> UserWithStreamingResponse:
- return UserWithStreamingResponse(self)
+ def with_streaming_response(self) -> UserResourceWithStreamingResponse:
+ return UserResourceWithStreamingResponse(self)
def edit(
self,
@@ -204,7 +204,7 @@ def get(
)
-class AsyncUser(AsyncAPIResource):
+class AsyncUserResource(AsyncAPIResource):
@cached_property
def audit_logs(self) -> AsyncAuditLogs:
return AsyncAuditLogs(self._client)
@@ -230,12 +230,12 @@ def tokens(self) -> AsyncTokens:
return AsyncTokens(self._client)
@cached_property
- def with_raw_response(self) -> AsyncUserWithRawResponse:
- return AsyncUserWithRawResponse(self)
+ def with_raw_response(self) -> AsyncUserResourceWithRawResponse:
+ return AsyncUserResourceWithRawResponse(self)
@cached_property
- def with_streaming_response(self) -> AsyncUserWithStreamingResponse:
- return AsyncUserWithStreamingResponse(self)
+ def with_streaming_response(self) -> AsyncUserResourceWithStreamingResponse:
+ return AsyncUserResourceWithStreamingResponse(self)
async def edit(
self,
@@ -330,8 +330,8 @@ async def get(
)
-class UserWithRawResponse:
- def __init__(self, user: User) -> None:
+class UserResourceWithRawResponse:
+ def __init__(self, user: UserResource) -> None:
self._user = user
self.edit = to_raw_response_wrapper(
@@ -366,8 +366,8 @@ def tokens(self) -> TokensWithRawResponse:
return TokensWithRawResponse(self._user.tokens)
-class AsyncUserWithRawResponse:
- def __init__(self, user: AsyncUser) -> None:
+class AsyncUserResourceWithRawResponse:
+ def __init__(self, user: AsyncUserResource) -> None:
self._user = user
self.edit = async_to_raw_response_wrapper(
@@ -402,8 +402,8 @@ def tokens(self) -> AsyncTokensWithRawResponse:
return AsyncTokensWithRawResponse(self._user.tokens)
-class UserWithStreamingResponse:
- def __init__(self, user: User) -> None:
+class UserResourceWithStreamingResponse:
+ def __init__(self, user: UserResource) -> None:
self._user = user
self.edit = to_streamed_response_wrapper(
@@ -438,8 +438,8 @@ def tokens(self) -> TokensWithStreamingResponse:
return TokensWithStreamingResponse(self._user.tokens)
-class AsyncUserWithStreamingResponse:
- def __init__(self, user: AsyncUser) -> None:
+class AsyncUserResourceWithStreamingResponse:
+ def __init__(self, user: AsyncUserResource) -> None:
self._user = user
self.edit = async_to_streamed_response_wrapper(
diff --git a/src/cloudflare/types/__init__.py b/src/cloudflare/types/__init__.py
index 8434e540549..18ccbc14520 100644
--- a/src/cloudflare/types/__init__.py
+++ b/src/cloudflare/types/__init__.py
@@ -50,6 +50,7 @@
from .hyperdrive import Hyperdrive as Hyperdrive
from .membership import Membership as Membership
from .origin_dns import OriginDNS as OriginDNS
+from .permission import Permission as Permission
from .r2_binding import R2Binding as R2Binding
from .rate_limit import RateLimit as RateLimit
from .rule_match import RuleMatch as RuleMatch
diff --git a/src/cloudflare/types/user/tokens/permission.py b/src/cloudflare/types/permission.py
similarity index 100%
rename from src/cloudflare/types/user/tokens/permission.py
rename to src/cloudflare/types/permission.py
diff --git a/src/cloudflare/types/role.py b/src/cloudflare/types/role.py
index ff30e675f69..7c1c6bca407 100644
--- a/src/cloudflare/types/role.py
+++ b/src/cloudflare/types/role.py
@@ -3,7 +3,7 @@
from typing import List
from .._models import BaseModel
-from .user.tokens import Permission
+from .permission import Permission
__all__ = ["Role"]
diff --git a/src/cloudflare/types/user/__init__.py b/src/cloudflare/types/user/__init__.py
index 5cf8009e08a..1b08cd94127 100644
--- a/src/cloudflare/types/user/__init__.py
+++ b/src/cloudflare/types/user/__init__.py
@@ -2,6 +2,7 @@
from __future__ import annotations
+from .user import User as User
from .invite import Invite as Invite
from .policy import Policy as Policy
from .cidr_list import CIDRList as CIDRList
diff --git a/src/cloudflare/types/user/organization.py b/src/cloudflare/types/user/organization.py
index 4e14c4e6549..83c181d4dcc 100644
--- a/src/cloudflare/types/user/organization.py
+++ b/src/cloudflare/types/user/organization.py
@@ -3,8 +3,8 @@
from typing import List, Optional
from typing_extensions import Literal
-from .tokens import Permission
from ..._models import BaseModel
+from ..permission import Permission
__all__ = ["Organization"]
diff --git a/src/cloudflare/types/user/tokens/__init__.py b/src/cloudflare/types/user/tokens/__init__.py
index 109cc63943f..b2609995ed7 100644
--- a/src/cloudflare/types/user/tokens/__init__.py
+++ b/src/cloudflare/types/user/tokens/__init__.py
@@ -3,5 +3,4 @@
from __future__ import annotations
from .value import Value as Value
-from .permission import Permission as Permission
from .value_update_params import ValueUpdateParams as ValueUpdateParams
diff --git a/src/cloudflare/types/user.py b/src/cloudflare/types/user/user.py
similarity index 94%
rename from src/cloudflare/types/user.py
rename to src/cloudflare/types/user/user.py
index 5224ee9c5e5..5e40ed59c40 100644
--- a/src/cloudflare/types/user.py
+++ b/src/cloudflare/types/user/user.py
@@ -2,8 +2,8 @@
from typing import List, Optional
-from .._models import BaseModel
-from .accounts import PermissionGrant
+from ..._models import BaseModel
+from ..accounts import PermissionGrant
__all__ = ["User", "Role", "RolePermissions"]