mirror of
https://github.com/cloudflare/cloudflare-python.git
synced 2026-01-16 23:01:03 +00:00
feat(api): OpenAPI spec update via Stainless API (#1084)
This commit is contained in:
parent
939d9df3e3
commit
eb53bcb83a
16 changed files with 249 additions and 2 deletions
|
|
@ -1,2 +1,2 @@
|
|||
configured_endpoints: 1348
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc907ac853f9f492d6e9168c4a32fd2c7ccacbabbcb716280dbaa42a0d9c14f2.yml
|
||||
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f2b480625b4e667e5ed9a238c9b5314522dc9be0bf8f514bed4e03a88d09455c.yml
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import httpx
|
|||
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ..._utils import (
|
||||
maybe_transform,
|
||||
strip_not_given,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from ..._compat import cached_property
|
||||
|
|
@ -52,6 +53,8 @@ class CopyResource(SyncAPIResource):
|
|||
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
|
||||
watermark: copy_create_params.Watermark | NotGiven = NOT_GIVEN,
|
||||
upload_creator: str | NotGiven = NOT_GIVEN,
|
||||
upload_metadata: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -90,6 +93,12 @@ class CopyResource(SyncAPIResource):
|
|||
divide the desired timestamp by the total duration of the video. If this value
|
||||
is not set, the default thumbnail image is taken from 0s of the video.
|
||||
|
||||
upload_creator: A user-defined identifier for the media creator.
|
||||
|
||||
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
|
||||
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
|
||||
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
|
@ -100,6 +109,15 @@ class CopyResource(SyncAPIResource):
|
|||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"Upload-Creator": upload_creator,
|
||||
"Upload-Metadata": upload_metadata,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
return self._post(
|
||||
f"/accounts/{account_id}/stream/copy",
|
||||
body=maybe_transform(
|
||||
|
|
@ -147,6 +165,8 @@ class AsyncCopyResource(AsyncAPIResource):
|
|||
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
|
||||
watermark: copy_create_params.Watermark | NotGiven = NOT_GIVEN,
|
||||
upload_creator: str | NotGiven = NOT_GIVEN,
|
||||
upload_metadata: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -185,6 +205,12 @@ class AsyncCopyResource(AsyncAPIResource):
|
|||
divide the desired timestamp by the total duration of the video. If this value
|
||||
is not set, the default thumbnail image is taken from 0s of the video.
|
||||
|
||||
upload_creator: A user-defined identifier for the media creator.
|
||||
|
||||
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
|
||||
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
|
||||
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
|
@ -195,6 +221,15 @@ class AsyncCopyResource(AsyncAPIResource):
|
|||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"Upload-Creator": upload_creator,
|
||||
"Upload-Metadata": upload_metadata,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
return await self._post(
|
||||
f"/accounts/{account_id}/stream/copy",
|
||||
body=await async_maybe_transform(
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import httpx
|
|||
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
||||
from ..._utils import (
|
||||
maybe_transform,
|
||||
strip_not_given,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from ..._compat import cached_property
|
||||
|
|
@ -53,6 +54,7 @@ class DirectUploadResource(SyncAPIResource):
|
|||
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
|
||||
watermark: direct_upload_create_params.Watermark | NotGiven = NOT_GIVEN,
|
||||
upload_creator: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -94,6 +96,8 @@ class DirectUploadResource(SyncAPIResource):
|
|||
divide the desired timestamp by the total duration of the video. If this value
|
||||
is not set, the default thumbnail image is taken from 0s of the video.
|
||||
|
||||
upload_creator: A user-defined identifier for the media creator.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
|
@ -104,6 +108,7 @@ class DirectUploadResource(SyncAPIResource):
|
|||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
extra_headers = {**strip_not_given({"Upload-Creator": upload_creator}), **(extra_headers or {})}
|
||||
return self._post(
|
||||
f"/accounts/{account_id}/stream/direct_upload",
|
||||
body=maybe_transform(
|
||||
|
|
@ -153,6 +158,7 @@ class AsyncDirectUploadResource(AsyncAPIResource):
|
|||
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
|
||||
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
|
||||
watermark: direct_upload_create_params.Watermark | NotGiven = NOT_GIVEN,
|
||||
upload_creator: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -194,6 +200,8 @@ class AsyncDirectUploadResource(AsyncAPIResource):
|
|||
divide the desired timestamp by the total duration of the video. If this value
|
||||
is not set, the default thumbnail image is taken from 0s of the video.
|
||||
|
||||
upload_creator: A user-defined identifier for the media creator.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
|
@ -204,6 +212,7 @@ class AsyncDirectUploadResource(AsyncAPIResource):
|
|||
"""
|
||||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
extra_headers = {**strip_not_given({"Upload-Creator": upload_creator}), **(extra_headers or {})}
|
||||
return await self._post(
|
||||
f"/accounts/{account_id}/stream/direct_upload",
|
||||
body=await async_maybe_transform(
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ from .videos import (
|
|||
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
||||
from ..._utils import (
|
||||
maybe_transform,
|
||||
strip_not_given,
|
||||
async_maybe_transform,
|
||||
)
|
||||
from .captions import (
|
||||
|
|
@ -205,6 +206,10 @@ class StreamResource(SyncAPIResource):
|
|||
*,
|
||||
account_id: str,
|
||||
body: object,
|
||||
tus_resumable: Literal["1.0.0"],
|
||||
upload_length: int,
|
||||
upload_creator: str | NotGiven = NOT_GIVEN,
|
||||
upload_metadata: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -222,6 +227,18 @@ class StreamResource(SyncAPIResource):
|
|||
Args:
|
||||
account_id: The account identifier tag.
|
||||
|
||||
tus_resumable: Specifies the TUS protocol version. This value must be included in every upload
|
||||
request. Notes: The only supported version of TUS protocol is 1.0.0.
|
||||
|
||||
upload_length: Indicates the size of the entire upload in bytes. The value must be a
|
||||
non-negative integer.
|
||||
|
||||
upload_creator: A user-defined identifier for the media creator.
|
||||
|
||||
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
|
||||
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
|
||||
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
|
@ -233,6 +250,17 @@ class StreamResource(SyncAPIResource):
|
|||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"Tus-Resumable": str(tus_resumable),
|
||||
"Upload-Length": str(upload_length),
|
||||
"Upload-Creator": upload_creator,
|
||||
"Upload-Metadata": upload_metadata,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
return self._post(
|
||||
f"/accounts/{account_id}/stream",
|
||||
body=maybe_transform(body, stream_create_params.StreamCreateParams),
|
||||
|
|
@ -475,6 +503,10 @@ class AsyncStreamResource(AsyncAPIResource):
|
|||
*,
|
||||
account_id: str,
|
||||
body: object,
|
||||
tus_resumable: Literal["1.0.0"],
|
||||
upload_length: int,
|
||||
upload_creator: str | NotGiven = NOT_GIVEN,
|
||||
upload_metadata: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -492,6 +524,18 @@ class AsyncStreamResource(AsyncAPIResource):
|
|||
Args:
|
||||
account_id: The account identifier tag.
|
||||
|
||||
tus_resumable: Specifies the TUS protocol version. This value must be included in every upload
|
||||
request. Notes: The only supported version of TUS protocol is 1.0.0.
|
||||
|
||||
upload_length: Indicates the size of the entire upload in bytes. The value must be a
|
||||
non-negative integer.
|
||||
|
||||
upload_creator: A user-defined identifier for the media creator.
|
||||
|
||||
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
|
||||
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
|
||||
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
|
||||
|
||||
extra_headers: Send extra headers
|
||||
|
||||
extra_query: Add additional query parameters to the request
|
||||
|
|
@ -503,6 +547,17 @@ class AsyncStreamResource(AsyncAPIResource):
|
|||
if not account_id:
|
||||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"Tus-Resumable": str(tus_resumable),
|
||||
"Upload-Length": str(upload_length),
|
||||
"Upload-Creator": upload_creator,
|
||||
"Upload-Metadata": upload_metadata,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
return await self._post(
|
||||
f"/accounts/{account_id}/stream",
|
||||
body=await async_maybe_transform(body, stream_create_params.StreamCreateParams),
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from ...._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
|||
from ...._utils import (
|
||||
extract_files,
|
||||
maybe_transform,
|
||||
strip_not_given,
|
||||
deepcopy_minimal,
|
||||
async_maybe_transform,
|
||||
)
|
||||
|
|
@ -56,6 +57,8 @@ class ContentResource(SyncAPIResource):
|
|||
account_id: str,
|
||||
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
|
||||
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
|
||||
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
|
||||
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -92,6 +95,15 @@ class ContentResource(SyncAPIResource):
|
|||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not script_name:
|
||||
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"CF-WORKER-BODY-PART": cf_worker_body_part,
|
||||
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
body = deepcopy_minimal(
|
||||
{
|
||||
"any_part_name": any_part_name,
|
||||
|
|
@ -176,6 +188,8 @@ class AsyncContentResource(AsyncAPIResource):
|
|||
account_id: str,
|
||||
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
|
||||
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
|
||||
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
|
||||
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -212,6 +226,15 @@ class AsyncContentResource(AsyncAPIResource):
|
|||
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
|
||||
if not script_name:
|
||||
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"CF-WORKER-BODY-PART": cf_worker_body_part,
|
||||
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
body = deepcopy_minimal(
|
||||
{
|
||||
"any_part_name": any_part_name,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from ......_types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes
|
|||
from ......_utils import (
|
||||
extract_files,
|
||||
maybe_transform,
|
||||
strip_not_given,
|
||||
deepcopy_minimal,
|
||||
async_maybe_transform,
|
||||
)
|
||||
|
|
@ -57,6 +58,8 @@ class ContentResource(SyncAPIResource):
|
|||
dispatch_namespace: str,
|
||||
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
|
||||
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
|
||||
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
|
||||
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -97,6 +100,15 @@ class ContentResource(SyncAPIResource):
|
|||
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}")
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"CF-WORKER-BODY-PART": cf_worker_body_part,
|
||||
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
body = deepcopy_minimal(
|
||||
{
|
||||
"any_part_name": any_part_name,
|
||||
|
|
@ -188,6 +200,8 @@ class AsyncContentResource(AsyncAPIResource):
|
|||
dispatch_namespace: str,
|
||||
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
|
||||
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
|
||||
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
|
||||
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
|
||||
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
||||
# The extra values given here take precedence over values defined on the client or passed to this method.
|
||||
extra_headers: Headers | None = None,
|
||||
|
|
@ -228,6 +242,15 @@ class AsyncContentResource(AsyncAPIResource):
|
|||
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}")
|
||||
extra_headers = {
|
||||
**strip_not_given(
|
||||
{
|
||||
"CF-WORKER-BODY-PART": cf_worker_body_part,
|
||||
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
|
||||
}
|
||||
),
|
||||
**(extra_headers or {}),
|
||||
}
|
||||
body = deepcopy_minimal(
|
||||
{
|
||||
"any_part_name": any_part_name,
|
||||
|
|
|
|||
|
|
@ -65,6 +65,16 @@ class CopyCreateParams(TypedDict, total=False):
|
|||
|
||||
watermark: Watermark
|
||||
|
||||
upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")]
|
||||
"""A user-defined identifier for the media creator."""
|
||||
|
||||
upload_metadata: Annotated[str, PropertyInfo(alias="Upload-Metadata")]
|
||||
"""Comma-separated key-value pairs following the TUS protocol specification.
|
||||
|
||||
Values are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
|
||||
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
|
||||
"""
|
||||
|
||||
|
||||
class Watermark(TypedDict, total=False):
|
||||
uid: str
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ class DirectUploadCreateParams(TypedDict, total=False):
|
|||
|
||||
watermark: Watermark
|
||||
|
||||
upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")]
|
||||
"""A user-defined identifier for the media creator."""
|
||||
|
||||
|
||||
class Watermark(TypedDict, total=False):
|
||||
uid: str
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing_extensions import Required, TypedDict
|
||||
from typing_extensions import Literal, Required, Annotated, TypedDict
|
||||
|
||||
from ..._utils import PropertyInfo
|
||||
|
||||
__all__ = ["StreamCreateParams"]
|
||||
|
||||
|
|
@ -12,3 +14,26 @@ class StreamCreateParams(TypedDict, total=False):
|
|||
"""The account identifier tag."""
|
||||
|
||||
body: Required[object]
|
||||
|
||||
tus_resumable: Required[Annotated[Literal["1.0.0"], PropertyInfo(alias="Tus-Resumable")]]
|
||||
"""Specifies the TUS protocol version.
|
||||
|
||||
This value must be included in every upload request. Notes: The only supported
|
||||
version of TUS protocol is 1.0.0.
|
||||
"""
|
||||
|
||||
upload_length: Required[Annotated[int, PropertyInfo(alias="Upload-Length")]]
|
||||
"""Indicates the size of the entire upload in bytes.
|
||||
|
||||
The value must be a non-negative integer.
|
||||
"""
|
||||
|
||||
upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")]
|
||||
"""A user-defined identifier for the media creator."""
|
||||
|
||||
upload_metadata: Annotated[str, PropertyInfo(alias="Upload-Metadata")]
|
||||
"""Comma-separated key-value pairs following the TUS protocol specification.
|
||||
|
||||
Values are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
|
||||
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -29,3 +29,7 @@ class ContentUpdateParams(TypedDict, total=False):
|
|||
|
||||
metadata: WorkerMetadataParam
|
||||
"""JSON encoded metadata about the uploaded parts and Worker configuration."""
|
||||
|
||||
cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")]
|
||||
|
||||
cf_worker_main_module_part: Annotated[str, PropertyInfo(alias="CF-WORKER-MAIN-MODULE-PART")]
|
||||
|
|
|
|||
|
|
@ -32,3 +32,7 @@ class ContentUpdateParams(TypedDict, total=False):
|
|||
|
||||
metadata: WorkerMetadataParam
|
||||
"""JSON encoded metadata about the uploaded parts and Worker configuration."""
|
||||
|
||||
cf_worker_body_part: Annotated[str, PropertyInfo(alias="CF-WORKER-BODY-PART")]
|
||||
|
||||
cf_worker_main_module_part: Annotated[str, PropertyInfo(alias="CF-WORKER-MAIN-MODULE-PART")]
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ class TestCopy:
|
|||
scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"),
|
||||
thumbnail_timestamp_pct=0.529241,
|
||||
watermark={"uid": "ea95132c15732412d22c1476fa83f27a"},
|
||||
upload_creator="creator-id_abcde12345",
|
||||
upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=",
|
||||
)
|
||||
assert_matches_type(Optional[Video], copy, path=["response"])
|
||||
|
||||
|
|
@ -99,6 +101,8 @@ class TestAsyncCopy:
|
|||
scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"),
|
||||
thumbnail_timestamp_pct=0.529241,
|
||||
watermark={"uid": "ea95132c15732412d22c1476fa83f27a"},
|
||||
upload_creator="creator-id_abcde12345",
|
||||
upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=",
|
||||
)
|
||||
assert_matches_type(Optional[Video], copy, path=["response"])
|
||||
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class TestDirectUpload:
|
|||
scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"),
|
||||
thumbnail_timestamp_pct=0.529241,
|
||||
watermark={"uid": "ea95132c15732412d22c1476fa83f27a"},
|
||||
upload_creator="creator-id_abcde12345",
|
||||
)
|
||||
assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"])
|
||||
|
||||
|
|
@ -101,6 +102,7 @@ class TestAsyncDirectUpload:
|
|||
scheduled_deletion=parse_datetime("2014-01-02T02:20:00Z"),
|
||||
thumbnail_timestamp_pct=0.529241,
|
||||
watermark={"uid": "ea95132c15732412d22c1476fa83f27a"},
|
||||
upload_creator="creator-id_abcde12345",
|
||||
)
|
||||
assert_matches_type(Optional[DirectUploadCreateResponse], direct_upload, path=["response"])
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,21 @@ class TestStream:
|
|||
stream = client.stream.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
)
|
||||
assert stream is None
|
||||
|
||||
@pytest.mark.skip(reason="TODO: investigate broken test")
|
||||
@parametrize
|
||||
def test_method_create_with_all_params(self, client: Cloudflare) -> None:
|
||||
stream = client.stream.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
upload_creator="creator-id_abcde12345",
|
||||
upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=",
|
||||
)
|
||||
assert stream is None
|
||||
|
||||
|
|
@ -34,6 +49,8 @@ class TestStream:
|
|||
response = client.stream.with_raw_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
|
|
@ -47,6 +64,8 @@ class TestStream:
|
|||
with client.stream.with_streaming_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
|
@ -63,6 +82,8 @@ class TestStream:
|
|||
client.stream.with_raw_response.create(
|
||||
account_id="",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
)
|
||||
|
||||
@parametrize
|
||||
|
|
@ -224,6 +245,21 @@ class TestAsyncStream:
|
|||
stream = await async_client.stream.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
)
|
||||
assert stream is None
|
||||
|
||||
@pytest.mark.skip(reason="TODO: investigate broken test")
|
||||
@parametrize
|
||||
async def test_method_create_with_all_params(self, async_client: AsyncCloudflare) -> None:
|
||||
stream = await async_client.stream.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
upload_creator="creator-id_abcde12345",
|
||||
upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=",
|
||||
)
|
||||
assert stream is None
|
||||
|
||||
|
|
@ -233,6 +269,8 @@ class TestAsyncStream:
|
|||
response = await async_client.stream.with_raw_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
)
|
||||
|
||||
assert response.is_closed is True
|
||||
|
|
@ -246,6 +284,8 @@ class TestAsyncStream:
|
|||
async with async_client.stream.with_streaming_response.create(
|
||||
account_id="023e105f4ecef8ad9ca31a8372d0c353",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
) as response:
|
||||
assert not response.is_closed
|
||||
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
|
||||
|
|
@ -262,6 +302,8 @@ class TestAsyncStream:
|
|||
await async_client.stream.with_raw_response.create(
|
||||
account_id="",
|
||||
body={},
|
||||
tus_resumable="1.0.0",
|
||||
upload_length=0,
|
||||
)
|
||||
|
||||
@parametrize
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class TestContent:
|
|||
"body_part": "worker.js",
|
||||
"main_module": "worker.js",
|
||||
},
|
||||
cf_worker_body_part="string",
|
||||
cf_worker_main_module_part="string",
|
||||
)
|
||||
assert_matches_type(Optional[Script], content, path=["response"])
|
||||
|
||||
|
|
@ -181,6 +183,8 @@ class TestAsyncContent:
|
|||
"body_part": "worker.js",
|
||||
"main_module": "worker.js",
|
||||
},
|
||||
cf_worker_body_part="string",
|
||||
cf_worker_main_module_part="string",
|
||||
)
|
||||
assert_matches_type(Optional[Script], content, path=["response"])
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class TestContent:
|
|||
"body_part": "worker.js",
|
||||
"main_module": "worker.js",
|
||||
},
|
||||
cf_worker_body_part="string",
|
||||
cf_worker_main_module_part="string",
|
||||
)
|
||||
assert_matches_type(Optional[Script], content, path=["response"])
|
||||
|
||||
|
|
@ -208,6 +210,8 @@ class TestAsyncContent:
|
|||
"body_part": "worker.js",
|
||||
"main_module": "worker.js",
|
||||
},
|
||||
cf_worker_body_part="string",
|
||||
cf_worker_main_module_part="string",
|
||||
)
|
||||
assert_matches_type(Optional[Script], content, path=["response"])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue