Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b8b3891

Browse files
committedMar 6, 2025·
feat(api): api update (#2501)
1 parent 3e3ac2b commit b8b3891

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed
 

‎.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1565
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-4e5825ae442e51f0a4a2eeb61629ec50f7633a6f39d0646389f01ad49cfb50d6.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-01e83284f35a07d416527f9bc8ba97158825cf253f53b509ae0083c89ab676f4.yml

‎src/cloudflare/resources/stream/stream.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def create(
215215
body: object,
216216
tus_resumable: Literal["1.0.0"],
217217
upload_length: int,
218+
direct_user: bool | NotGiven = NOT_GIVEN,
218219
upload_creator: str | NotGiven = NOT_GIVEN,
219220
upload_metadata: str | NotGiven = NOT_GIVEN,
220221
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -240,6 +241,9 @@ def create(
240241
upload_length: Indicates the size of the entire upload in bytes. The value must be a
241242
non-negative integer.
242243
244+
direct_user: Provisions a URL to let your end users upload videos directly to Cloudflare
245+
Stream without exposing your API token to clients.
246+
243247
upload_creator: A user-defined identifier for the media creator.
244248
245249
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
@@ -272,7 +276,11 @@ def create(
272276
f"/accounts/{account_id}/stream",
273277
body=maybe_transform(body, stream_create_params.StreamCreateParams),
274278
options=make_request_options(
275-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
279+
extra_headers=extra_headers,
280+
extra_query=extra_query,
281+
extra_body=extra_body,
282+
timeout=timeout,
283+
query=maybe_transform({"direct_user": direct_user}, stream_create_params.StreamCreateParams),
276284
),
277285
cast_to=NoneType,
278286
)
@@ -617,6 +625,7 @@ async def create(
617625
body: object,
618626
tus_resumable: Literal["1.0.0"],
619627
upload_length: int,
628+
direct_user: bool | NotGiven = NOT_GIVEN,
620629
upload_creator: str | NotGiven = NOT_GIVEN,
621630
upload_metadata: str | NotGiven = NOT_GIVEN,
622631
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
@@ -642,6 +651,9 @@ async def create(
642651
upload_length: Indicates the size of the entire upload in bytes. The value must be a
643652
non-negative integer.
644653
654+
direct_user: Provisions a URL to let your end users upload videos directly to Cloudflare
655+
Stream without exposing your API token to clients.
656+
645657
upload_creator: A user-defined identifier for the media creator.
646658
647659
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
@@ -674,7 +686,13 @@ async def create(
674686
f"/accounts/{account_id}/stream",
675687
body=await async_maybe_transform(body, stream_create_params.StreamCreateParams),
676688
options=make_request_options(
677-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
689+
extra_headers=extra_headers,
690+
extra_query=extra_query,
691+
extra_body=extra_body,
692+
timeout=timeout,
693+
query=await async_maybe_transform(
694+
{"direct_user": direct_user}, stream_create_params.StreamCreateParams
695+
),
678696
),
679697
cast_to=NoneType,
680698
)

‎src/cloudflare/types/stream/stream_create_params.py

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ class StreamCreateParams(TypedDict, total=False):
2828
The value must be a non-negative integer.
2929
"""
3030

31+
direct_user: bool
32+
"""
33+
Provisions a URL to let your end users upload videos directly to Cloudflare
34+
Stream without exposing your API token to clients.
35+
"""
36+
3137
upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")]
3238
"""A user-defined identifier for the media creator."""
3339

‎tests/api_resources/test_stream.py

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def test_method_create_with_all_params(self, client: Cloudflare) -> None:
3838
body={},
3939
tus_resumable="1.0.0",
4040
upload_length=0,
41+
direct_user=True,
4142
upload_creator="creator-id_abcde12345",
4243
upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=",
4344
)
@@ -322,6 +323,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncCloudflare
322323
body={},
323324
tus_resumable="1.0.0",
324325
upload_length=0,
326+
direct_user=True,
325327
upload_creator="creator-id_abcde12345",
326328
upload_metadata="name aGVsbG8gd29ybGQ=, requiresignedurls, allowedorigins ZXhhbXBsZS5jb20sdGVzdC5jb20=",
327329
)

0 commit comments

Comments
 (0)
Please sign in to comment.