Skip to content

Commit 05e0e8a

Browse files
chore(api): update composite API spec
1 parent 716ad5a commit 05e0e8a

8 files changed

Lines changed: 119 additions & 34 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1993
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-b314e3a8f9f9c5701dfa55900eec3f80791f857921d1797f4d92056e110ea308.yml
3-
openapi_spec_hash: c15140fa93745b8b94b60ae1744098ae
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cloudflare%2Fcloudflare-3d0ffec9bed17f5a8c3518b79ad378cb759151b98cd5fb735a3c7d5a0e973628.yml
3+
openapi_spec_hash: 68032dd7cb7939a8787a2c6404619507
44
config_hash: 316e765ff117ffcf8ecf5a3187c184b1

api.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4877,14 +4877,18 @@ Methods:
48774877
Types:
48784878

48794879
```python
4880-
from cloudflare.types.stream import DownloadDeleteResponse
4880+
from cloudflare.types.stream import (
4881+
DownloadCreateResponse,
4882+
DownloadDeleteResponse,
4883+
DownloadGetResponse,
4884+
)
48814885
```
48824886

48834887
Methods:
48844888

4885-
- <code title="post /accounts/{account_id}/stream/{identifier}/downloads">client.stream.downloads.<a href="./src/cloudflare/resources/stream/downloads.py">create</a>(identifier, \*, account_id, \*\*<a href="src/cloudflare/types/stream/download_create_params.py">params</a>) -> object</code>
4889+
- <code title="post /accounts/{account_id}/stream/{identifier}/downloads">client.stream.downloads.<a href="./src/cloudflare/resources/stream/downloads.py">create</a>(identifier, \*, account_id, \*\*<a href="src/cloudflare/types/stream/download_create_params.py">params</a>) -> <a href="./src/cloudflare/types/stream/download_create_response.py">Optional[DownloadCreateResponse]</a></code>
48864890
- <code title="delete /accounts/{account_id}/stream/{identifier}/downloads">client.stream.downloads.<a href="./src/cloudflare/resources/stream/downloads.py">delete</a>(identifier, \*, account_id) -> <a href="./src/cloudflare/types/stream/download_delete_response.py">str</a></code>
4887-
- <code title="get /accounts/{account_id}/stream/{identifier}/downloads">client.stream.downloads.<a href="./src/cloudflare/resources/stream/downloads.py">get</a>(identifier, \*, account_id) -> object</code>
4891+
- <code title="get /accounts/{account_id}/stream/{identifier}/downloads">client.stream.downloads.<a href="./src/cloudflare/resources/stream/downloads.py">get</a>(identifier, \*, account_id) -> <a href="./src/cloudflare/types/stream/download_get_response.py">Optional[DownloadGetResponse]</a></code>
48884892

48894893
## Embed
48904894

src/cloudflare/resources/stream/downloads.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
from ..._wrappers import ResultWrapper
2020
from ..._base_client import make_request_options
2121
from ...types.stream import download_create_params
22+
from ...types.stream.download_get_response import DownloadGetResponse
23+
from ...types.stream.download_create_response import DownloadCreateResponse
2224
from ...types.stream.download_delete_response import DownloadDeleteResponse
2325

2426
__all__ = ["DownloadsResource", "AsyncDownloadsResource"]
@@ -56,7 +58,7 @@ def create(
5658
extra_query: Query | None = None,
5759
extra_body: Body | None = None,
5860
timeout: float | httpx.Timeout | None | NotGiven = not_given,
59-
) -> object:
61+
) -> Optional[DownloadCreateResponse]:
6062
"""Creates a download for a video when a video is ready to view.
6163
6264
Use
@@ -88,9 +90,9 @@ def create(
8890
extra_query=extra_query,
8991
extra_body=extra_body,
9092
timeout=timeout,
91-
post_parser=ResultWrapper[Optional[object]]._unwrapper,
93+
post_parser=ResultWrapper[Optional[DownloadCreateResponse]]._unwrapper,
9294
),
93-
cast_to=cast(Type[object], ResultWrapper[object]),
95+
cast_to=cast(Type[Optional[DownloadCreateResponse]], ResultWrapper[DownloadCreateResponse]),
9496
)
9597

9698
def delete(
@@ -150,7 +152,7 @@ def get(
150152
extra_query: Query | None = None,
151153
extra_body: Body | None = None,
152154
timeout: float | httpx.Timeout | None | NotGiven = not_given,
153-
) -> object:
155+
) -> Optional[DownloadGetResponse]:
154156
"""
155157
Lists the downloads created for a video.
156158
@@ -178,9 +180,9 @@ def get(
178180
extra_query=extra_query,
179181
extra_body=extra_body,
180182
timeout=timeout,
181-
post_parser=ResultWrapper[Optional[object]]._unwrapper,
183+
post_parser=ResultWrapper[Optional[DownloadGetResponse]]._unwrapper,
182184
),
183-
cast_to=cast(Type[object], ResultWrapper[object]),
185+
cast_to=cast(Type[Optional[DownloadGetResponse]], ResultWrapper[DownloadGetResponse]),
184186
)
185187

186188

@@ -216,7 +218,7 @@ async def create(
216218
extra_query: Query | None = None,
217219
extra_body: Body | None = None,
218220
timeout: float | httpx.Timeout | None | NotGiven = not_given,
219-
) -> object:
221+
) -> Optional[DownloadCreateResponse]:
220222
"""Creates a download for a video when a video is ready to view.
221223
222224
Use
@@ -248,9 +250,9 @@ async def create(
248250
extra_query=extra_query,
249251
extra_body=extra_body,
250252
timeout=timeout,
251-
post_parser=ResultWrapper[Optional[object]]._unwrapper,
253+
post_parser=ResultWrapper[Optional[DownloadCreateResponse]]._unwrapper,
252254
),
253-
cast_to=cast(Type[object], ResultWrapper[object]),
255+
cast_to=cast(Type[Optional[DownloadCreateResponse]], ResultWrapper[DownloadCreateResponse]),
254256
)
255257

256258
async def delete(
@@ -310,7 +312,7 @@ async def get(
310312
extra_query: Query | None = None,
311313
extra_body: Body | None = None,
312314
timeout: float | httpx.Timeout | None | NotGiven = not_given,
313-
) -> object:
315+
) -> Optional[DownloadGetResponse]:
314316
"""
315317
Lists the downloads created for a video.
316318
@@ -338,9 +340,9 @@ async def get(
338340
extra_query=extra_query,
339341
extra_body=extra_body,
340342
timeout=timeout,
341-
post_parser=ResultWrapper[Optional[object]]._unwrapper,
343+
post_parser=ResultWrapper[Optional[DownloadGetResponse]]._unwrapper,
342344
),
343-
cast_to=cast(Type[object], ResultWrapper[object]),
345+
cast_to=cast(Type[Optional[DownloadGetResponse]], ResultWrapper[DownloadGetResponse]),
344346
)
345347

346348

src/cloudflare/types/stream/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from .key_delete_response import KeyDeleteResponse as KeyDeleteResponse
2121
from .token_create_params import TokenCreateParams as TokenCreateParams
2222
from .stream_create_params import StreamCreateParams as StreamCreateParams
23+
from .download_get_response import DownloadGetResponse as DownloadGetResponse
2324
from .token_create_response import TokenCreateResponse as TokenCreateResponse
2425
from .webhook_update_params import WebhookUpdateParams as WebhookUpdateParams
2526
from .download_create_params import DownloadCreateParams as DownloadCreateParams
@@ -28,6 +29,7 @@
2829
from .audio_track_edit_params import AudioTrackEditParams as AudioTrackEditParams
2930
from .watermark_create_params import WatermarkCreateParams as WatermarkCreateParams
3031
from .webhook_delete_response import WebhookDeleteResponse as WebhookDeleteResponse
32+
from .download_create_response import DownloadCreateResponse as DownloadCreateResponse
3133
from .download_delete_response import DownloadDeleteResponse as DownloadDeleteResponse
3234
from .live_input_create_params import LiveInputCreateParams as LiveInputCreateParams
3335
from .live_input_list_response import LiveInputListResponse as LiveInputListResponse
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from pydantic import Field as FieldInfo
7+
8+
from ..._models import BaseModel
9+
10+
__all__ = ["DownloadCreateResponse"]
11+
12+
13+
class DownloadCreateResponse(BaseModel):
14+
percent_complete: Optional[float] = FieldInfo(alias="percentComplete", default=None)
15+
"""Indicates the progress as a percentage between 0 and 100."""
16+
17+
status: Optional[Literal["ready", "inprogress", "error"]] = None
18+
"""The status of a generated download."""
19+
20+
url: Optional[str] = None
21+
"""The URL to access the generated download."""
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import Optional
4+
from typing_extensions import Literal
5+
6+
from pydantic import Field as FieldInfo
7+
8+
from ..._models import BaseModel
9+
10+
__all__ = ["DownloadGetResponse", "Audio", "Default"]
11+
12+
13+
class Audio(BaseModel):
14+
"""The audio-only download. Only present if this download type has been created."""
15+
16+
percent_complete: Optional[float] = FieldInfo(alias="percentComplete", default=None)
17+
"""Indicates the progress as a percentage between 0 and 100."""
18+
19+
status: Optional[Literal["ready", "inprogress", "error"]] = None
20+
"""The status of a generated download."""
21+
22+
url: Optional[str] = None
23+
"""The URL to access the generated download."""
24+
25+
26+
class Default(BaseModel):
27+
"""The default video download.
28+
29+
Only present if this download type has been created.
30+
"""
31+
32+
percent_complete: Optional[float] = FieldInfo(alias="percentComplete", default=None)
33+
"""Indicates the progress as a percentage between 0 and 100."""
34+
35+
status: Optional[Literal["ready", "inprogress", "error"]] = None
36+
"""The status of a generated download."""
37+
38+
url: Optional[str] = None
39+
"""The URL to access the generated download."""
40+
41+
42+
class DownloadGetResponse(BaseModel):
43+
"""An object with download type keys.
44+
45+
Each key is optional and only present if that download type has been created.
46+
"""
47+
48+
audio: Optional[Audio] = None
49+
"""The audio-only download. Only present if this download type has been created."""
50+
51+
default: Optional[Default] = None
52+
"""The default video download.
53+
54+
Only present if this download type has been created.
55+
"""

src/cloudflare/types/stream/video.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ class Status(BaseModel):
5757
"""
5858

5959
pct_complete: Optional[str] = FieldInfo(alias="pctComplete", default=None)
60-
"""Indicates the size of the entire upload in bytes.
61-
62-
The value must be a non-negative integer.
63-
"""
60+
"""Indicates the progress as a percentage between 0 and 100."""
6461

6562
state: Optional[
6663
Literal["pendingupload", "downloading", "queued", "inprogress", "ready", "error", "live-inprogress"]

tests/api_resources/stream/test_downloads.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
from __future__ import annotations
44

55
import os
6-
from typing import Any, cast
6+
from typing import Any, Optional, cast
77

88
import pytest
99

1010
from cloudflare import Cloudflare, AsyncCloudflare
1111
from tests.utils import assert_matches_type
12+
from cloudflare.types.stream import (
13+
DownloadGetResponse,
14+
DownloadCreateResponse,
15+
)
1216

1317
base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010")
1418

@@ -23,7 +27,7 @@ def test_method_create(self, client: Cloudflare) -> None:
2327
account_id="023e105f4ecef8ad9ca31a8372d0c353",
2428
body={},
2529
)
26-
assert_matches_type(object, download, path=["response"])
30+
assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"])
2731

2832
@parametrize
2933
def test_raw_response_create(self, client: Cloudflare) -> None:
@@ -36,7 +40,7 @@ def test_raw_response_create(self, client: Cloudflare) -> None:
3640
assert response.is_closed is True
3741
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
3842
download = response.parse()
39-
assert_matches_type(object, download, path=["response"])
43+
assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"])
4044

4145
@parametrize
4246
def test_streaming_response_create(self, client: Cloudflare) -> None:
@@ -49,7 +53,7 @@ def test_streaming_response_create(self, client: Cloudflare) -> None:
4953
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
5054

5155
download = response.parse()
52-
assert_matches_type(object, download, path=["response"])
56+
assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"])
5357

5458
assert cast(Any, response.is_closed) is True
5559

@@ -123,7 +127,7 @@ def test_method_get(self, client: Cloudflare) -> None:
123127
identifier="ea95132c15732412d22c1476fa83f27a",
124128
account_id="023e105f4ecef8ad9ca31a8372d0c353",
125129
)
126-
assert_matches_type(object, download, path=["response"])
130+
assert_matches_type(Optional[DownloadGetResponse], download, path=["response"])
127131

128132
@parametrize
129133
def test_raw_response_get(self, client: Cloudflare) -> None:
@@ -135,7 +139,7 @@ def test_raw_response_get(self, client: Cloudflare) -> None:
135139
assert response.is_closed is True
136140
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
137141
download = response.parse()
138-
assert_matches_type(object, download, path=["response"])
142+
assert_matches_type(Optional[DownloadGetResponse], download, path=["response"])
139143

140144
@parametrize
141145
def test_streaming_response_get(self, client: Cloudflare) -> None:
@@ -147,7 +151,7 @@ def test_streaming_response_get(self, client: Cloudflare) -> None:
147151
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
148152

149153
download = response.parse()
150-
assert_matches_type(object, download, path=["response"])
154+
assert_matches_type(Optional[DownloadGetResponse], download, path=["response"])
151155

152156
assert cast(Any, response.is_closed) is True
153157

@@ -178,7 +182,7 @@ async def test_method_create(self, async_client: AsyncCloudflare) -> None:
178182
account_id="023e105f4ecef8ad9ca31a8372d0c353",
179183
body={},
180184
)
181-
assert_matches_type(object, download, path=["response"])
185+
assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"])
182186

183187
@parametrize
184188
async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
@@ -191,7 +195,7 @@ async def test_raw_response_create(self, async_client: AsyncCloudflare) -> None:
191195
assert response.is_closed is True
192196
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
193197
download = await response.parse()
194-
assert_matches_type(object, download, path=["response"])
198+
assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"])
195199

196200
@parametrize
197201
async def test_streaming_response_create(self, async_client: AsyncCloudflare) -> None:
@@ -204,7 +208,7 @@ async def test_streaming_response_create(self, async_client: AsyncCloudflare) ->
204208
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
205209

206210
download = await response.parse()
207-
assert_matches_type(object, download, path=["response"])
211+
assert_matches_type(Optional[DownloadCreateResponse], download, path=["response"])
208212

209213
assert cast(Any, response.is_closed) is True
210214

@@ -278,7 +282,7 @@ async def test_method_get(self, async_client: AsyncCloudflare) -> None:
278282
identifier="ea95132c15732412d22c1476fa83f27a",
279283
account_id="023e105f4ecef8ad9ca31a8372d0c353",
280284
)
281-
assert_matches_type(object, download, path=["response"])
285+
assert_matches_type(Optional[DownloadGetResponse], download, path=["response"])
282286

283287
@parametrize
284288
async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -290,7 +294,7 @@ async def test_raw_response_get(self, async_client: AsyncCloudflare) -> None:
290294
assert response.is_closed is True
291295
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
292296
download = await response.parse()
293-
assert_matches_type(object, download, path=["response"])
297+
assert_matches_type(Optional[DownloadGetResponse], download, path=["response"])
294298

295299
@parametrize
296300
async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> None:
@@ -302,7 +306,7 @@ async def test_streaming_response_get(self, async_client: AsyncCloudflare) -> No
302306
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
303307

304308
download = await response.parse()
305-
assert_matches_type(object, download, path=["response"])
309+
assert_matches_type(Optional[DownloadGetResponse], download, path=["response"])
306310

307311
assert cast(Any, response.is_closed) is True
308312

0 commit comments

Comments
 (0)