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 #788

Merged
merged 1 commit into from
Jun 4, 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
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 1335
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-e83b5eb5706ca8b525141f506338cd1d465eb133815b9ddc53df612ea4a2ecef.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-0be7a22d1cc24a2a63cf7c7d9324fa078990d35e80629e2cbd28b9838940d75d.yml
11 changes: 6 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3165,6 +3165,7 @@ from cloudflare.types.rulesets import (
Ruleset,
RulesetCreateResponse,
RulesetUpdateResponse,
RulesetListResponse,
RulesetGetResponse,
)
```
Expand All @@ -3173,7 +3174,7 @@ Methods:

- <code title="post /{account_or_zone}/{account_or_zone_id}/rulesets">client.rulesets.<a href="./src/cloudflare/resources/rulesets/rulesets.py">create</a>(\*, account_id, zone_id, \*\*<a href="src/cloudflare/types/rulesets/ruleset_create_params.py">params</a>) -> <a href="./src/cloudflare/types/rulesets/ruleset_create_response.py">RulesetCreateResponse</a></code>
- <code title="put /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}">client.rulesets.<a href="./src/cloudflare/resources/rulesets/rulesets.py">update</a>(ruleset_id, \*, account_id, zone_id, \*\*<a href="src/cloudflare/types/rulesets/ruleset_update_params.py">params</a>) -> <a href="./src/cloudflare/types/rulesets/ruleset_update_response.py">RulesetUpdateResponse</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets">client.rulesets.<a href="./src/cloudflare/resources/rulesets/rulesets.py">list</a>(\*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/ruleset.py">SyncSinglePage[Ruleset]</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets">client.rulesets.<a href="./src/cloudflare/resources/rulesets/rulesets.py">list</a>(\*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/ruleset_list_response.py">SyncSinglePage[RulesetListResponse]</a></code>
- <code title="delete /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}">client.rulesets.<a href="./src/cloudflare/resources/rulesets/rulesets.py">delete</a>(ruleset_id, \*, account_id, zone_id) -> None</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}">client.rulesets.<a href="./src/cloudflare/resources/rulesets/rulesets.py">get</a>(ruleset_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/ruleset_get_response.py">RulesetGetResponse</a></code>

Expand All @@ -3195,12 +3196,12 @@ Methods:
Types:

```python
from cloudflare.types.rulesets.phases import VersionGetResponse
from cloudflare.types.rulesets.phases import VersionListResponse, VersionGetResponse
```

Methods:

- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions">client.rulesets.phases.versions.<a href="./src/cloudflare/resources/rulesets/phases/versions.py">list</a>(ruleset_phase, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/ruleset.py">SyncSinglePage[Ruleset]</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions">client.rulesets.phases.versions.<a href="./src/cloudflare/resources/rulesets/phases/versions.py">list</a>(ruleset_phase, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/phases/version_list_response.py">SyncSinglePage[VersionListResponse]</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions/{ruleset_version}">client.rulesets.phases.versions.<a href="./src/cloudflare/resources/rulesets/phases/versions.py">get</a>(ruleset_version, \*, ruleset_phase, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/phases/version_get_response.py">VersionGetResponse</a></code>

## Rules
Expand Down Expand Up @@ -3244,12 +3245,12 @@ Methods:
Types:

```python
from cloudflare.types.rulesets import VersionGetResponse
from cloudflare.types.rulesets import VersionListResponse, VersionGetResponse
```

Methods:

- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions">client.rulesets.versions.<a href="./src/cloudflare/resources/rulesets/versions/versions.py">list</a>(ruleset_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/ruleset.py">SyncSinglePage[Ruleset]</a></code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions">client.rulesets.versions.<a href="./src/cloudflare/resources/rulesets/versions/versions.py">list</a>(ruleset_id, \*, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/version_list_response.py">SyncSinglePage[VersionListResponse]</a></code>
- <code title="delete /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions/{ruleset_version}">client.rulesets.versions.<a href="./src/cloudflare/resources/rulesets/versions/versions.py">delete</a>(ruleset_version, \*, ruleset_id, account_id, zone_id) -> None</code>
- <code title="get /{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions/{ruleset_version}">client.rulesets.versions.<a href="./src/cloudflare/resources/rulesets/versions/versions.py">get</a>(ruleset_version, \*, ruleset_id, account_id, zone_id) -> <a href="./src/cloudflare/types/rulesets/version_get_response.py">VersionGetResponse</a></code>

Expand Down
11 changes: 1 addition & 10 deletions src/cloudflare/resources/rulesets/phases/phases.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
from ...._base_client import (
make_request_options,
)
from ....types.rulesets import Kind, Phase, phase_update_params
from ....types.rulesets.kind import Kind
from ....types.rulesets import Phase, phase_update_params
from ....types.rulesets.phase import Phase
from ....types.rulesets.phase_get_response import PhaseGetResponse
from ....types.rulesets.phase_update_response import PhaseUpdateResponse
Expand Down Expand Up @@ -61,7 +60,6 @@ def update(
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
kind: Kind | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
phase: Phase | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -85,8 +83,6 @@ def update(

description: An informative description of the ruleset.

kind: The kind of the ruleset.

name: The human-readable name of the ruleset.

phase: The phase of the ruleset.
Expand Down Expand Up @@ -119,7 +115,6 @@ def update(
{
"rules": rules,
"description": description,
"kind": kind,
"name": name,
"phase": phase,
},
Expand Down Expand Up @@ -215,7 +210,6 @@ async def update(
account_id: str | NotGiven = NOT_GIVEN,
zone_id: str | NotGiven = NOT_GIVEN,
description: str | NotGiven = NOT_GIVEN,
kind: Kind | NotGiven = NOT_GIVEN,
name: str | NotGiven = NOT_GIVEN,
phase: Phase | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
Expand All @@ -239,8 +233,6 @@ async def update(

description: An informative description of the ruleset.

kind: The kind of the ruleset.

name: The human-readable name of the ruleset.

phase: The phase of the ruleset.
Expand Down Expand Up @@ -273,7 +265,6 @@ async def update(
{
"rules": rules,
"description": description,
"kind": kind,
"name": name,
"phase": phase,
},
Expand Down
14 changes: 7 additions & 7 deletions src/cloudflare/resources/rulesets/phases/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
)
from ....types.rulesets import Phase
from ....types.rulesets.phase import Phase
from ....types.rulesets.ruleset import Ruleset
from ....types.rulesets.phases.version_get_response import VersionGetResponse
from ....types.rulesets.phases.version_list_response import VersionListResponse

__all__ = ["VersionsResource", "AsyncVersionsResource"]

Expand All @@ -50,7 +50,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Ruleset]:
) -> SyncSinglePage[VersionListResponse]:
"""
Fetches the versions of an account or zone entry point ruleset.

Expand Down Expand Up @@ -85,11 +85,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions",
page=SyncSinglePage[Ruleset],
page=SyncSinglePage[VersionListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Ruleset,
model=VersionListResponse,
)

def get(
Expand Down Expand Up @@ -176,7 +176,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]:
) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]:
"""
Fetches the versions of an account or zone entry point ruleset.

Expand Down Expand Up @@ -211,11 +211,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/phases/{ruleset_phase}/entrypoint/versions",
page=AsyncSinglePage[Ruleset],
page=AsyncSinglePage[VersionListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Ruleset,
model=VersionListResponse,
)

async def get(
Expand Down
14 changes: 7 additions & 7 deletions src/cloudflare/resources/rulesets/rulesets.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
from .versions.versions import VersionsResource, AsyncVersionsResource
from ...types.rulesets.kind import Kind
from ...types.rulesets.phase import Phase
from ...types.rulesets.ruleset import Ruleset
from ...types.rulesets.ruleset_get_response import RulesetGetResponse
from ...types.rulesets.ruleset_list_response import RulesetListResponse
from ...types.rulesets.ruleset_create_response import RulesetCreateResponse
from ...types.rulesets.ruleset_update_response import RulesetUpdateResponse

Expand Down Expand Up @@ -253,7 +253,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Ruleset]:
) -> SyncSinglePage[RulesetListResponse]:
"""
Fetches all rulesets.

Expand Down Expand Up @@ -284,11 +284,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets",
page=SyncSinglePage[Ruleset],
page=SyncSinglePage[RulesetListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Ruleset,
model=RulesetListResponse,
)

def delete(
Expand Down Expand Up @@ -594,7 +594,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]:
) -> AsyncPaginator[RulesetListResponse, AsyncSinglePage[RulesetListResponse]]:
"""
Fetches all rulesets.

Expand Down Expand Up @@ -625,11 +625,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets",
page=AsyncSinglePage[Ruleset],
page=AsyncSinglePage[RulesetListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Ruleset,
model=RulesetListResponse,
)

async def delete(
Expand Down
14 changes: 7 additions & 7 deletions src/cloudflare/resources/rulesets/versions/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
AsyncPaginator,
make_request_options,
)
from ....types.rulesets.ruleset import Ruleset
from ....types.rulesets.version_get_response import VersionGetResponse
from ....types.rulesets.version_list_response import VersionListResponse

__all__ = ["VersionsResource", "AsyncVersionsResource"]

Expand Down Expand Up @@ -60,7 +60,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> SyncSinglePage[Ruleset]:
) -> SyncSinglePage[VersionListResponse]:
"""
Fetches the versions of an account or zone ruleset.

Expand Down Expand Up @@ -95,11 +95,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions",
page=SyncSinglePage[Ruleset],
page=SyncSinglePage[VersionListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Ruleset,
model=VersionListResponse,
)

def delete(
Expand Down Expand Up @@ -249,7 +249,7 @@ def list(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> AsyncPaginator[Ruleset, AsyncSinglePage[Ruleset]]:
) -> AsyncPaginator[VersionListResponse, AsyncSinglePage[VersionListResponse]]:
"""
Fetches the versions of an account or zone ruleset.

Expand Down Expand Up @@ -284,11 +284,11 @@ def list(
account_or_zone_id = zone_id
return self._get_api_list(
f"/{account_or_zone}/{account_or_zone_id}/rulesets/{ruleset_id}/versions",
page=AsyncSinglePage[Ruleset],
page=AsyncSinglePage[VersionListResponse],
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
model=Ruleset,
model=VersionListResponse,
)

async def delete(
Expand Down
3 changes: 2 additions & 1 deletion src/cloudflare/types/rulesets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from .kind import Kind as Kind
from .phase import Phase as Phase
from .logging import Logging as Logging
from .ruleset import Ruleset as Ruleset
from .log_rule import LogRule as LogRule
from .skip_rule import SkipRule as SkipRule
from .block_rule import BlockRule as BlockRule
Expand Down Expand Up @@ -40,8 +39,10 @@
from .version_get_response import VersionGetResponse as VersionGetResponse
from .phase_update_response import PhaseUpdateResponse as PhaseUpdateResponse
from .ruleset_create_params import RulesetCreateParams as RulesetCreateParams
from .ruleset_list_response import RulesetListResponse as RulesetListResponse
from .ruleset_update_params import RulesetUpdateParams as RulesetUpdateParams
from .set_config_rule_param import SetConfigRuleParam as SetConfigRuleParam
from .version_list_response import VersionListResponse as VersionListResponse
from .compress_response_rule import CompressResponseRule as CompressResponseRule
from .managed_challenge_rule import ManagedChallengeRule as ManagedChallengeRule
from .rewrite_uri_part_param import RewriteURIPartParam as RewriteURIPartParam
Expand Down
4 changes: 0 additions & 4 deletions src/cloudflare/types/rulesets/phase_update_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import Union, Iterable
from typing_extensions import Literal, Required, TypedDict

from .kind import Kind
from .phase import Phase
from .logging_param import LoggingParam
from .log_rule_param import LogRuleParam
Expand Down Expand Up @@ -50,9 +49,6 @@ class PhaseUpdateParams(TypedDict, total=False):
description: str
"""An informative description of the ruleset."""

kind: Kind
"""The kind of the ruleset."""

name: str
"""The human-readable name of the ruleset."""

Expand Down
1 change: 1 addition & 0 deletions src/cloudflare/types/rulesets/phases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from __future__ import annotations

from .version_get_response import VersionGetResponse as VersionGetResponse
from .version_list_response import VersionListResponse as VersionListResponse
33 changes: 33 additions & 0 deletions src/cloudflare/types/rulesets/phases/version_list_response.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from datetime import datetime

from ..kind import Kind
from ..phase import Phase
from ...._models import BaseModel

__all__ = ["VersionListResponse"]


class VersionListResponse(BaseModel):
id: str
"""The unique ID of the ruleset."""

kind: Kind
"""The kind of the ruleset."""

last_updated: datetime
"""The timestamp of when the ruleset was last modified."""

name: str
"""The human-readable name of the ruleset."""

phase: Phase
"""The phase of the ruleset."""

version: str
"""The version of the ruleset."""

description: Optional[str] = None
"""An informative description of the ruleset."""
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@
from .phase import Phase
from ..._models import BaseModel

__all__ = ["Ruleset"]
__all__ = ["RulesetListResponse"]


class Ruleset(BaseModel):
class RulesetListResponse(BaseModel):
id: str
"""The unique ID of the ruleset."""

kind: Kind
"""The kind of the ruleset."""

last_updated: datetime
"""The timestamp of when the ruleset was last modified."""

name: str
"""The human-readable name of the ruleset."""

phase: Phase
"""The phase of the ruleset."""

version: str
"""The version of the ruleset."""

description: Optional[str] = None
"""An informative description of the ruleset."""

kind: Optional[Kind] = None
"""The kind of the ruleset."""

name: Optional[str] = None
"""The human-readable name of the ruleset."""

phase: Optional[Phase] = None
"""The phase of the ruleset."""
Loading