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

Merged
merged 1 commit into from
Apr 11, 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
21 changes: 18 additions & 3 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4658,16 +4658,31 @@ Methods:

##### Settings

Types:

```python
from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import (
SettingEditResponse,
SettingGetResponse,
)
```

Methods:

- <code title="patch /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">edit</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers/script_setting.py">ScriptSetting</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers/script_setting.py">ScriptSetting</a></code>
- <code title="patch /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">edit</a>(script_name, \*, account_id, dispatch_namespace, \*\*<a href="src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_params.py">params</a>) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_edit_response.py">SettingEditResponse</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/settings">client.workers_for_platforms.dispatch.namespaces.scripts.settings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/settings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/setting_get_response.py">SettingGetResponse</a></code>

##### Bindings

Types:

```python
from cloudflare.types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse
```

Methods:

- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings">client.workers_for_platforms.dispatch.namespaces.scripts.bindings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/binding.py">Binding</a></code>
- <code title="get /accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings">client.workers_for_platforms.dispatch.namespaces.scripts.bindings.<a href="./src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/bindings.py">get</a>(script_name, \*, account_id, dispatch_namespace) -> <a href="./src/cloudflare/types/workers_for_platforms/dispatch/namespaces/scripts/binding_get_response.py">BindingGetResponse</a></code>

# ZeroTrust

Expand Down
6 changes: 4 additions & 2 deletions src/cloudflare/resources/workers/scripts/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def update(
may be provided as separate named parts, but at least one module must be
present. This should be referenced either in the metadata as `main_module`
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
be included using the `application/source-map` content type.
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
Expand Down Expand Up @@ -194,7 +195,8 @@ async def update(
may be provided as separate named parts, but at least one module must be
present. This should be referenced either in the metadata as `main_module`
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
be included using the `application/source-map` content type.
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
Expand Down
4 changes: 4 additions & 0 deletions src/cloudflare/resources/workers/scripts/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def update(
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
may be provided as separate named parts, but at least one module must be present
and referenced in the metadata as `main_module` or `body_part` by part name.
Source maps may also be included using the `application/source-map` content
type.
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
Expand Down Expand Up @@ -443,6 +445,8 @@ async def update(
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
may be provided as separate named parts, but at least one module must be present
and referenced in the metadata as `main_module` or `body_part` by part name.
Source maps may also be included using the `application/source-map` content
type.
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def get(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> NamespaceGetResponse:
"""
Fetch a Workers for Platforms namespace.
Get a Workers for Platforms namespace.
Args:
account_id: Identifier
Expand Down Expand Up @@ -374,7 +374,7 @@ async def get(
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> NamespaceGetResponse:
"""
Fetch a Workers for Platforms namespace.
Get a Workers for Platforms namespace.
Args:
account_id: Identifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

from __future__ import annotations

from typing import Any, cast
from typing import Type, cast

import httpx

from ......types import Binding
from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven
from ......_compat import cached_property
from ......_resource import SyncAPIResource, AsyncAPIResource
Expand All @@ -16,9 +15,11 @@
async_to_raw_response_wrapper,
async_to_streamed_response_wrapper,
)
from ......_wrappers import ResultWrapper
from ......_base_client import (
make_request_options,
)
from ......types.workers_for_platforms.dispatch.namespaces.scripts import BindingGetResponse

__all__ = ["Bindings", "AsyncBindings"]

Expand All @@ -44,7 +45,7 @@ def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Binding:
) -> BindingGetResponse:
"""
Fetch script bindings from a script uploaded to a Workers for Platforms
namespace.
Expand All @@ -70,15 +71,16 @@ def get(
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return cast(
Binding,
self._get(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(Any, Binding), # Union types cannot be passed in as arguments in the type system
return self._get(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]),
)


Expand All @@ -103,7 +105,7 @@ async def get(
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Binding:
) -> BindingGetResponse:
"""
Fetch script bindings from a script uploaded to a Workers for Platforms
namespace.
Expand All @@ -129,15 +131,16 @@ async def get(
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
if not script_name:
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
return cast(
Binding,
await self._get(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=cast(Any, Binding), # Union types cannot be passed in as arguments in the type system
return await self._get(
f"/accounts/{account_id}/workers/dispatch/namespaces/{dispatch_namespace}/scripts/{script_name}/bindings",
options=make_request_options(
extra_headers=extra_headers,
extra_query=extra_query,
extra_body=extra_body,
timeout=timeout,
post_parser=ResultWrapper._unwrapper,
),
cast_to=cast(Type[BindingGetResponse], ResultWrapper[BindingGetResponse]),
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def update(
may be provided as separate named parts, but at least one module must be
present. This should be referenced either in the metadata as `main_module`
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
be included using the `application/source-map` content type.

metadata: JSON encoded metadata about the uploaded parts and Worker configuration.

Expand Down Expand Up @@ -208,7 +209,8 @@ async def update(
may be provided as separate named parts, but at least one module must be
present. This should be referenced either in the metadata as `main_module`
(esm)/`body_part` (service worker) or as a header `CF-WORKER-MAIN-MODULE-PART`
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name.
(esm) /`CF-WORKER-BODY-PART` (service worker) by part name. Source maps may also
be included using the `application/source-map` content type.

metadata: JSON encoded metadata about the uploaded parts and Worker configuration.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,11 @@ def update(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Script:
"""
Upload a worker module to a Workers for Platforms namespace.
"""Upload a worker module to a Workers for Platforms namespace.
You can find an
example of the metadata on our docs:
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
Args:
account_id: Identifier
Expand All @@ -104,6 +107,8 @@ def update(
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
may be provided as separate named parts, but at least one module must be present
and referenced in the metadata as `main_module` or `body_part` by part name.
Source maps may also be included using the `application/source-map` content
type.
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
Expand Down Expand Up @@ -132,8 +137,11 @@ def update(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Script:
"""
Upload a worker module to a Workers for Platforms namespace.
"""Upload a worker module to a Workers for Platforms namespace.
You can find an
example of the metadata on our docs:
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
Args:
account_id: Identifier
Expand Down Expand Up @@ -344,8 +352,11 @@ async def update(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Script:
"""
Upload a worker module to a Workers for Platforms namespace.
"""Upload a worker module to a Workers for Platforms namespace.
You can find an
example of the metadata on our docs:
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
Args:
account_id: Identifier
Expand All @@ -357,6 +368,8 @@ async def update(
any_part_name: A module comprising a Worker script, often a javascript file. Multiple modules
may be provided as separate named parts, but at least one module must be present
and referenced in the metadata as `main_module` or `body_part` by part name.
Source maps may also be included using the `application/source-map` content
type.
metadata: JSON encoded metadata about the uploaded parts and Worker configuration.
Expand Down Expand Up @@ -385,8 +398,11 @@ async def update(
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> Script:
"""
Upload a worker module to a Workers for Platforms namespace.
"""Upload a worker module to a Workers for Platforms namespace.
You can find an
example of the metadata on our docs:
https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/reference/metadata/
Args:
account_id: Identifier
Expand Down
Loading