8000 feat(api): OpenAPI spec update via Stainless API (#1084) · cloudflare/cloudflare-python@eb53bcb · GitHub
[go: up one dir, main page]

Skip to content

Commit eb53bcb

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#1084)
1 parent 939d9df commit eb53bcb

File tree

16 files changed

+249
-2
lines changed

16 files changed

+249
-2
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
configured_endpoints: 1348
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-cc907ac853f9f492d6e9168c4a32fd2c7ccacbabbcb716280dbaa42a0d9c14f2.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-f2b480625b4e667e5ed9a238c9b5314522dc9be0bf8f514bed4e03a88d09455c.yml

src/cloudflare/resources/stream/copy.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1111
from ..._utils import (
1212
maybe_transform,
13+
strip_not_given,
1314
async_maybe_transform,
1415
)
1516
from ..._compat import cached_property
@@ -52,6 +53,8 @@ def create(
5253
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
5354
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
5455
watermark: copy_create_params.Watermark | NotGiven = NOT_GIVEN,
56+
upload_creator: str | NotGiven = NOT_GIVEN,
57+
upload_metadata: str | NotGiven = NOT_GIVEN,
5558
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5659
# The extra values given here take precedence over values defined on the client or passed to this method.
5760
extra_headers: Headers | None = None,
@@ -90,6 +93,12 @@ def create(
9093
divide the desired timestamp by the total duration of the video. If this value
9194
is not set, the default thumbnail image is taken from 0s of the video.
9295
96+
upload_creator: A user-defined identifier for the media creator.
97+
98+
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
99+
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
100+
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
101+
93102
extra_headers: Send extra headers
94103
95104
extra_query: Add additional query parameters to the request
@@ -100,6 +109,15 @@ def create(
100109
"""
101110
if not account_id:
102111
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
112+
extra_headers = {
113+
**strip_not_given(
114+
{
115+
"Upload-Creator": upload_creator,
116+
"Upload-Metadata": upload_metadata,
117+
}
118+
),
119+
**(extra_headers or {}),
120+
}
103121
return self._post(
104122
f"/accounts/{account_id}/stream/copy",
105123
body=maybe_transform(
@@ -147,6 +165,8 @@ async def create(
147165
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
148166
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
149167
watermark: copy_create_params.Watermark | NotGiven = NOT_GIVEN,
168+
upload_creator: str | NotGiven = NOT_GIVEN,
169+
upload_metadata: str | NotGiven = NOT_GIVEN,
150170
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
151171
# The extra values given here take precedence over values defined on the client or passed to this method.
152172
extra_headers: Headers | None = None,
@@ -185,6 +205,12 @@ async def create(
185205
divide the desired timestamp by the total duration of the video. If this value
186206
is not set, the default thumbnail image is taken from 0s of the video.
187207
208+
upload_creator: A user-defined identifier for the media creator.
209+
210+
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
211+
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
212+
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
213+
188214
extra_headers: Send extra headers
189215
190216
extra_query: Add additional query parameters to the request
@@ -195,6 +221,15 @@ async def create(
195221
"""
196222
if not account_id:
197223
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
224+
extra_headers = {
225+
**strip_not_given(
226+
{
227+
"Upload-Creator": upload_creator,
228+
"Upload-Metadata": upload_metadata,
229+
}
230+
),
231+
**(extra_headers or {}),
232+
}
198233
return await self._post(
199234
f"/accounts/{account_id}/stream/copy",
200235
body=await async_maybe_transform(

src/cloudflare/resources/stream/direct_upload.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
1111
from ..._utils import (
1212
maybe_transform,
13+
strip_not_given,
1314
async_maybe_transform,
1415
)
1516
from ..._compat import cached_property
@@ -53,6 +54,7 @@ def create(
5354
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
5455
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
5556
watermark: direct_upload_create_params.Watermark | NotGiven = NOT_GIVEN,
57+
upload_creator: str | NotGiven = NOT_GIVEN,
5658
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5759
# The extra values given here take precedence over values defined on the client or passed to this method.
5860
extra_headers: Headers | None = None,
@@ -94,6 +96,8 @@ def create(
9496
divide the desired timestamp by the total duration of the video. If this value
9597
is not set, the default thumbnail image is taken from 0s of the video.
9698
99+
upload_creator: A user-defined identifier for the media creator.
100+
97101
extra_headers: Send extra headers
98102
99103
extra_query: Add additional query parameters to the request
@@ -104,6 +108,7 @@ def create(
104108
"""
105109
if not account_id:
106110
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
111+
extra_headers = {**strip_not_given({"Upload-Creator": upload_creator}), **(extra_headers or {})}
107112
return self._post(
108113
f"/accounts/{account_id}/stream/direct_upload",
109114
body=maybe_transform(
@@ -153,6 +158,7 @@ async def create(
153158
scheduled_deletion: Union[str, datetime] | NotGiven = NOT_GIVEN,
154159
thumbnail_timestamp_pct: float | NotGiven = NOT_GIVEN,
155160
watermark: direct_upload_create_params.Watermark | NotGiven = NOT_GIVEN,
161+
upload_creator: str | NotGiven = NOT_GIVEN,
156162
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
157163
# The extra values given here take precedence over values defined on the cli F438 ent or passed to this method.
158164
extra_headers: Headers | None = None,
@@ -194,6 +200,8 @@ async def create(
194200
divide the desired timestamp by the total duration of the video. If this value
195201
is not set, the default thumbnail image is taken from 0s of the video.
196202
203+
upload_creator: A user-defined identifier for the media creator.
204+
197205
extra_headers: Send extra headers
198206
199207
extra_query: Add additional query parameters to the request
@@ -204,6 +212,7 @@ async def create(
204212
"""
205213
if not account_id:
206214
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
215+
extra_headers = {**strip_not_given({"Upload-Creator": upload_creator}), **(extra_headers or {})}
207216
return await self._post(
208217
f"/accounts/{account_id}/stream/direct_upload",
209218
body=await async_maybe_transform(

src/cloudflare/resources/stream/stream.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
6060
from ..._utils import (
6161
maybe_transform,
62+
strip_not_given,
6263
async_maybe_transform,
6364
)
6465
from .captions import (
@@ -205,6 +206,10 @@ def create(
205206
*,
206207
account_id: str,
207208
body: object,
209+
tus_resumable: Literal["1.0.0"],
210+
upload_length: int,
211+
upload_creator: str | NotGiven = NOT_GIVEN,
212+
upload_metadata: str | NotGiven = NOT_GIVEN,
208213
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
209214
# The extra values given here take precedence over values defined on the client or passed to this method.
210215
extra_headers: Headers | None = None,
@@ -222,6 +227,18 @@ def create(
222227
Args:
223228
account_id: The account identifier tag.
224229
230+
tus_resumable: Specifies the TUS protocol version. This value must be included in every upload
231+
request. Notes: The only supported version of TUS protocol is 1.0.0.
232+
233+
upload_length: Indicates the size of the entire upload in bytes. The value must be a
234+
non-negative integer.
235+
236+
upload_creator: A user-defined identifier for the media creator.
237+
238+
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
239+
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
240+
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
241+
225242
extra_headers: Send extra headers
226243
227244
extra_query: Add additional query parameters to the request
@@ -233,6 +250,17 @@ def create(
233250
if not account_id:
234251
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
235252
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
253+
extra_headers = {
254+
**strip_not_given(
255+
{
256+
"Tus-Resumable": str(tus_resumable),
257+
"Upload-Length": str(upload_length),
258+
"Upload-Creator": upload_creator,
259+
"Upload-Metadata": upload_metadata,
260+
}
261+
),
262+
**(extra_headers or {}),
263+
}
236264
return self._post(
237265
f"/accounts/{account_id}/stream",
238266
body=maybe_transform(body, stream_create_params.StreamCreateParams),
@@ -475,6 +503,10 @@ async def create(
475503
*,
476504
account_id: str,
477505
body: object,
506+
tus_resumable: Literal["1.0.0"],
507+
upload_length: int,
508+
upload_creator: str | NotGiven = NOT_GIVEN,
509+
upload_metadata: str | NotGiven = NOT_GIVEN,
478510
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
479511
# The extra values given here take precedence over values defined on the client or passed to this method.
480512
extra_headers: Headers | None = None,
@@ -492,6 +524,18 @@ async def create(
492524
Args:
493525
account_id: The account identifier tag.
494526
527+
tus_resumable: Specifies the TUS protocol version. This value must be included in every upload
528+
request. Notes: The only supported version of TUS protocol is 1.0.0.
529+
530+
upload_length: Indicates the size of the entire upload in bytes. The value must be a
531+
non-negative integer.
532+
533+
upload_creator: A user-defined identifier for the media creator.
534+
535+
upload_metadata: Comma-separated key-value pairs following the TUS protocol specification. Values
536+
are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
537+
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
538+
495539
extra_headers: Send extra headers
496540
497541
extra_query: Add additional query parameters to the request
@@ -503,6 +547,17 @@ async def create(
503547
if not account_id:
504548
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
505549
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
550+
extra_headers = {
551+
**strip_not_given(
552+
{
553+
"Tus-Resumable": str(tus_resumable),
554+
"Upload-Length": str(upload_length),
555+
"Upload-Creator": upload_creator,
556+
"Upload-Metadata": upload_metadata,
557+
}
558+
),
559+
**(extra_headers or {}),
560+
}
506561
return await self._post(
507562
f"/accounts/{account_id}/stream",
508563
body=await async_maybe_transform(body, stream_create_params.StreamCreateParams),

src/cloudflare/resources/workers/scripts/content.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ...._utils import (
1111
extract_files,
1212
maybe_transform,
13+
strip_not_given,
1314
deepcopy_minimal,
1415
async_maybe_transform,
1516
)
@@ -56,6 +57,8 @@ def update(
5657
account_id: str,
5758
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
5859
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
60+
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
61+
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
5962
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6063
# The extra values given here take precedence over values defined on the client or passed to this method.
6164
extra_headers: Headers | None = None,
@@ -92,6 +95,15 @@ def update(
9295
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
9396
if not script_name:
9497
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
98+
extra_headers = {
99+
**strip_not_given(
100+
{
101+
"CF-WORKER-BODY-PART": cf_worker_body_part,
102+
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
103+
}
104+
),
105+
**(extra_headers or {}),
106+
}
95107
body = deepcopy_minimal(
96108
{
97109
"any_part_name": any_part_name,
@@ -176,6 +188,8 @@ async def update(
176188
account_id: str,
177189
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
178190
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
191+
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
192+
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
179193
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
180194
# The extra values given here take precedence over values defined on the client or passed to this method.
181195
extra_headers: Headers | None = None,
@@ -212,6 +226,15 @@ async def update(
212226
raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}")
213227
if not script_name:
214228
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
229+
extra_headers = {
230+
**strip_not_given(
231+
{
232+
"CF-WORKER-BODY-PART": cf_worker_body_part,
233+
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
234+
}
235+
),
236+
**(extra_headers or {}),
237+
}
215238
body = deepcopy_minimal(
216239
{
217240
"any_part_name": any_part_name,

src/cloudflare/resources/workers_for_platforms/dispatch/namespaces/scripts/content.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from ......_utils import (
1111
extract_files,
1212
maybe_transform,
13+
strip_not_given,
1314
deepcopy_minimal,
1415
async_maybe_transform,
1516
)
@@ -57,6 +58,8 @@ def update(
5758
dispatch_namespace: str,
5859
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
5960
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
61+
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
62+
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
6063
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
6164
# The extra values given here take precedence over values defined on the client or passed to this method.
6265
extra_headers: Headers | None = None,
@@ -97,6 +100,15 @@ def update(
97100
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
98101
if not script_name:
99102
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
103+
extra_headers = {
104+
**strip_not_given(
105+
{
106+
"CF-WORKER-BODY-PART": cf_worker_body_part,
107+
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
108+
}
109+
),
110+
**(extra_headers or {}),
111+
}
100112
body = deepcopy_minimal(
101113
{
102114
"any_part_name": any_part_name,
@@ -188,6 +200,8 @@ async def update(
188200
dispatch_namespace: str,
189201
any_part_name: List[FileTypes] | NotGiven = NOT_GIVEN,
190202
metadata: WorkerMetadataParam | NotGiven = NOT_GIVEN,
203+
cf_worker_body_part: str | NotGiven = NOT_GIVEN,
204+
cf_worker_main_module_part: str | NotGiven = NOT_GIVEN,
191205
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
192206
# The extra values given here take precedence over values defined on the client or passed to this method.
193207
extra_headers: Headers | None = None,
@@ -228,6 +242,15 @@ async def update(
228242
raise ValueError(f"Expected a non-empty value for `dispatch_namespace` but received {dispatch_namespace!r}")
229243
if not script_name:
230244
raise ValueError(f"Expected a non-empty value for `script_name` but received {script_name!r}")
245+
extra_headers = {
246+
**strip_not_given(
247+
{
248+
"CF-WORKER-BODY-PART": cf_worker_body_part,
249+
"CF-WORKER-MAIN-MODULE-PART": cf_worker_main_module_part,
250+
}
251+
),
252+
**(extra_headers or {}),
253+
}
231254
body = deepcopy_minimal(
232255
{
233256
"any_part_name": any_part_name,

src/cloudflare/types/stream/copy_create_params.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ class CopyCreateParams(TypedDict, total=False):
6565

6666
watermark: Watermark
6767

68+
upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")]
69+
"""A user-defined identifier for the media creator."""
70+
71+
upload_metadata: Annotated[str, PropertyInfo(alias="Upload-Metadata")]
72+
"""Comma-separated key-value pairs following the TUS protocol specification.
73+
74+
Values are Base-64 encoded. Supported keys: `name`, `requiresignedurls`,
75+
`allowedorigins`, `thumbnailtimestamppct`, `watermark`, `scheduleddeletion`.
76+
"""
77+
6878

6979
class Watermark(TypedDict, total=False):
7080
uid: str

src/cloudflare/types/stream/direct_upload_create_params.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ class DirectUploadCreateParams(TypedDict, total=False):
6868

6969
watermark: Watermark
7070

71+
upload_creator: Annotated[str, PropertyInfo(alias="Upload-Creator")]
72+
"""A user-defined identifier for the media creator."""
73+
7174

7275
class Watermark(TypedDict, total=False):
7376
uid: str

0 commit comments

Comments
 (0)
0