Skip to content

Commit

Permalink
feat(api): OpenAPI spec update via Stainless API (#314)
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 df9cab4 commit 51169d3
Show file tree
Hide file tree
Showing 21 changed files with 432 additions and 864 deletions.
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

0 comments on commit 51169d3

Please sign in to comment.