Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Apr 22, 2024
1 parent 4783b91 commit f06e49c
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/cloudflare/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ class Cloudflare(SyncAPIClient):
with_streaming_response: CloudflareWithStreamedResponse

# client options
api_token: str | None
api_key: str | None
api_email: str | None
api_token: str | None
user_service_key: str | None

def __init__(
self,
*,
api_token: str | None = None,
api_key: str | None = None,
api_email: str | None = None,
api_token: str | None = None,
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
Expand All @@ -165,11 +165,15 @@ def __init__(
"""Construct a new synchronous cloudflare client instance.
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `api_token` from `CLOUDFLARE_API_TOKEN`
- `api_key` from `CLOUDFLARE_API_KEY`
- `api_email` from `CLOUDFLARE_EMAIL`
- `api_token` from `CLOUDFLARE_API_TOKEN`
- `user_service_key` from `CLOUDFLARE_API_USER_SERVICE_KEY`
"""
if api_token is None:
api_token = os.environ.get("CLOUDFLARE_API_TOKEN")
self.api_token = api_token

if api_key is None:
api_key = os.environ.get("CLOUDFLARE_API_KEY")
self.api_key = api_key
Expand All @@ -178,10 +182,6 @@ def __init__(
api_email = os.environ.get("CLOUDFLARE_EMAIL")
self.api_email = api_email

if api_token is None:
api_token = os.environ.get("CLOUDFLARE_API_TOKEN")
self.api_token = api_token

if user_service_key is None:
user_service_key = os.environ.get("CLOUDFLARE_API_USER_SERVICE_KEY")
self.user_service_key = user_service_key
Expand Down Expand Up @@ -371,9 +371,9 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
def copy(
self,
*,
api_token: str | None = None,
api_key: str | None = None,
api_email: str | None = None,
api_token: str | None = None,
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -408,9 +408,9 @@ def copy(

http_client = http_client or self._client
return self.__class__(
api_token=api_token or self.api_token,
api_key=api_key or self.api_key,
api_email=api_email or self.api_email,
api_token=api_token or self.api_token,
user_service_key=user_service_key or self.user_service_key,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
Expand Down Expand Up @@ -544,17 +544,17 @@ class AsyncCloudflare(AsyncAPIClient):
with_streaming_response: AsyncCloudflareWithStreamedResponse

# client options
api_token: str | None
api_key: str | None
api_email: str | None
api_token: str | None
user_service_key: str | None

def __init__(
self,
*,
api_token: str | None = None,
api_key: str | None = None,
api_email: str | None = None,
api_token: str | None = None,
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN,
Expand All @@ -578,11 +578,15 @@ def __init__(
"""Construct a new async cloudflare client instance.
This automatically infers the following arguments from their corresponding environment variables if they are not provided:
- `api_token` from `CLOUDFLARE_API_TOKEN`
- `api_key` from `CLOUDFLARE_API_KEY`
- `api_email` from `CLOUDFLARE_EMAIL`
- `api_token` from `CLOUDFLARE_API_TOKEN`
- `user_service_key` from `CLOUDFLARE_API_USER_SERVICE_KEY`
"""
if api_token is None:
api_token = os.environ.get("CLOUDFLARE_API_TOKEN")
self.api_token = api_token

if api_key is None:
api_key = os.environ.get("CLOUDFLARE_API_KEY")
self.api_key = api_key
Expand All @@ -591,10 +595,6 @@ def __init__(
api_email = os.environ.get("CLOUDFLARE_EMAIL")
self.api_email = api_email

if api_token is None:
api_token = os.environ.get("CLOUDFLARE_API_TOKEN")
self.api_token = api_token

if user_service_key is None:
user_service_key = os.environ.get("CLOUDFLARE_API_USER_SERVICE_KEY")
self.user_service_key = user_service_key
Expand Down Expand Up @@ -784,9 +784,9 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
def copy(
self,
*,
api_token: str | None = None,
api_key: str | None = None,
api_email: str | None = None,
api_token: str | None = None,
user_service_key: str | None = None,
base_url: str | httpx.URL | None = None,
timeout: float | Timeout | None | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -821,9 +821,9 @@ def copy(

http_client = http_client or self._client
return self.__class__(
api_token=api_token or self.api_token,
api_key=api_key or self.api_key,
api_email=api_email or self.api_email,
api_token=api_token or self.api_token,
user_service_key=user_service_key or self.user_service_key,
base_url=base_url or self.base_url,
timeout=self.timeout if isinstance(timeout, NotGiven) else timeout,
Expand Down

0 comments on commit f06e49c

Please sign in to comment.