Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): OpenAPI spec update via Stainless API #314

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 30 additions & 60 deletions src/cloudflare/resources/firewall/access_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,19 +91,16 @@ def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Expand Down Expand Up @@ -176,19 +173,16 @@ def list(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get_api_list(
Expand Down Expand Up @@ -246,19 +240,16 @@ def delete(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return self._delete(
Expand Down Expand Up @@ -314,19 +305,16 @@ def edit(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Expand Down Expand Up @@ -383,19 +371,16 @@ def get(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Expand Down Expand Up @@ -467,19 +452,16 @@ async def create(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Expand Down Expand Up @@ -552,19 +534,16 @@ def list(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get_api_list(
Expand Down Expand Up @@ -622,19 +601,16 @@ async def delete(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._delete(
Expand Down Expand Up @@ -690,19 +666,16 @@ async def edit(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Expand Down Expand Up @@ -759,19 +732,16 @@ async def get(

timeout: Override the client-level default timeout for this request, in seconds
"""
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return cast(
Expand Down
18 changes: 6 additions & 12 deletions src/cloudflare/resources/logpush/datasets/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,16 @@ def get(
"""
if not dataset_id:
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get(
Expand Down Expand Up @@ -139,19 +136,16 @@ async def get(
"""
if not dataset_id:
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._get(
Expand Down
18 changes: 6 additions & 12 deletions src/cloudflare/resources/logpush/datasets/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,16 @@ def get(
"""
if not dataset_id:
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return self._get(
Expand Down Expand Up @@ -136,19 +133,16 @@ async def get(
"""
if not dataset_id:
raise ValueError(f"Expected a non-empty value for `dataset_id` but received {dataset_id!r}")
if not account_id:
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
if not zone_id:
raise ValueError(f"Expected a non-empty value for `zone_id` but received {zone_id!r}")
if not account_id and not zone_id:
raise ValueError("You must provide either account_id or zone_id")
if account_id and zone_id:
raise ValueError("You cannot provide both account_id and zone_id")

if account_id:
account_or_zone = "accounts"
account_or_zone_id = account_id
else:
if not zone_id:
raise ValueError("You must provide either account_id or zone_id")

account_or_zone = "zones"
account_or_zone_id = zone_id
return await self._get(
Expand Down
Loading