Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit abf146e

Browse files
feat(api): manual updates
1 parent f914aa7 commit abf146e

File tree

12 files changed

+117
-127
lines changed
  • .stats.yml
  • README.md
  • src/chunkify
    • resources/jobs
      • jobs.py
    • types
      • hls_av1_param.py
      • hls_h264_param.py
      • hls_h265_param.py
      • job_create_params.py
      • jpg_param.py
      • mp4_h264_param.py
      • mp4_h265_param.py
      • webm_vp9_param.py
  • tests/api_resources
    • test_jobs.py

12 files changed

+117
-127
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 40
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/chunkify%2Fchunkify-44ef65cbb11dbc56de66f25ed5f63677e4fa2e6570c60d450d93c0c18da3ec47.yml
3-
openapi_spec_hash: 9cb5e71c6db8a6a12ec7b663978dde49
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/chunkify%2Fchunkify-b72583b1049b5fab29c466b1d0c0fb08c1cf92fdf069e4937e601b3a9ad7c795.yml
3+
openapi_spec_hash: f83fb93465d606cea0b26dc37c685d84
44
config_hash: ba46c34a1b57aba3c35375ea3ac6c749

README.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ client = Chunkify(
3636
)
3737

3838
job = client.jobs.create(
39-
format={},
39+
format={
40+
"jpg": {
41+
"width": 1920,
42+
"height": 1080,
43+
"crf": 21,
44+
}
45+
},
4046
source_id="src_2G6MJiNz71bHQGNzGwKx5cJwPFS",
4147
transcoder={
4248
"quantity": 4,
@@ -66,7 +72,13 @@ client = AsyncChunkify(
6672

6773
async def main() -> None:
6874
job = await client.jobs.create(
69-
format={},
75+
format={
76+
"jpg": {
77+
"width": 1920,
78+
"height": 1080,
79+
"crf": 21,
80+
}
81+
},
7082
source_id="src_2G6MJiNz71bHQGNzGwKx5cJwPFS",
7183
transcoder={
7284
"quantity": 4,
@@ -105,7 +117,13 @@ async def main() -> None:
105117
http_client=DefaultAioHttpClient(),
106118
) as client:
107119
job = await client.jobs.create(
108-
format={},
120+
format={
121+
"jpg": {
122+
"width": 1920,
123+
"height": 1080,
124+
"crf": 21,
125+
}
126+
},
109127
source_id="src_2G6MJiNz71bHQGNzGwKx5cJwPFS",
110128
transcoder={
111129
"quantity": 4,
@@ -209,7 +227,11 @@ from chunkify import Chunkify
209227
client = Chunkify()
210228

211229
job = client.jobs.create(
212-
format={},
230+
format={
231+
"audio_bitrate": 32000,
232+
"name": "hls_av1",
233+
"video_bitrate": 100000,
234+
},
213235
source_id="src_UioP9I876hjKlNBH78ILp0mo56t",
214236
storage={},
215237
)

src/chunkify/resources/jobs/jobs.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Dict, Union
5+
from typing import Dict
66

77
import httpx
88

@@ -85,16 +85,7 @@ def with_streaming_response(self) -> JobsResourceWithStreamingResponse:
8585
def create(
8686
self,
8787
*,
88-
format: Union[
89-
job_create_params.FormatJobsHlsAv1,
90-
job_create_params.FormatJobsHlsH264,
91-
job_create_params.FormatJobsHlsH265,
92-
job_create_params.FormatJobsJpg,
93-
job_create_params.FormatJobsMP4Av1,
94-
job_create_params.FormatJobsMP4H264,
95-
job_create_params.FormatJobsMP4H265,
96-
job_create_params.FormatJobsWebmVp9,
97-
],
88+
format: job_create_params.Format,
9889
source_id: str,
9990
hls_manifest_id: str | Omit = omit,
10091
metadata: Dict[str, str] | Omit = omit,
@@ -367,16 +358,7 @@ def with_streaming_response(self) -> AsyncJobsResourceWithStreamingResponse:
367358
async def create(
368359
self,
369360
*,
370-
format: Union[
371-
job_create_params.FormatJobsHlsAv1,
372-
job_create_params.FormatJobsHlsH264,
373-
job_create_params.FormatJobsHlsH265,
374-
job_create_params.FormatJobsJpg,
375-
job_create_params.FormatJobsMP4Av1,
376-
job_create_params.FormatJobsMP4H264,
377-
job_create_params.FormatJobsMP4H265,
378-
job_create_params.FormatJobsWebmVp9,
379-
],
361+
format: job_create_params.Format,
380362
source_id: str,
381363
hls_manifest_id: str | Omit = omit,
382364
metadata: Dict[str, str] | Omit = omit,

src/chunkify/types/hls_av1_param.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
__all__ = ["HlsAv1Param"]
88

99

1010
class HlsAv1Param(TypedDict, total=False):
11-
audio_bitrate: int
11+
audio_bitrate: Required[int]
1212
"""
1313
AudioBitrate specifies the audio bitrate in bits per second. Must be between
1414
32Kbps and 512Kbps.
1515
"""
1616

17+
name: Required[Literal["hls_av1"]]
18+
"""Name of the HLS AV1 configuration"""
19+
20+
video_bitrate: Required[int]
21+
"""
22+
VideoBitrate specifies the video bitrate in bits per second. Must be between
23+
100Kbps and 50Mbps.
24+
"""
25+
1726
bufsize: int
1827
"""
1928
Bufsize specifies the video buffer size in bits. Must be between 100Kbps and
@@ -174,12 +183,6 @@ class HlsAv1Param(TypedDict, total=False):
174183
positive value.
175184
"""
176185

177-
video_bitrate: int
178-
"""
179-
VideoBitrate specifies the video bitrate in bits per second. Must be between
180-
100Kbps and 50Mbps.
181-
"""
182-
183186
width: int
184187
"""Width specifies the output video width in pixels. Must be between -2 and 7680.
185188

src/chunkify/types/hls_h264_param.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
__all__ = ["HlsH264Param"]
88

99

1010
class HlsH264Param(TypedDict, total=False):
11-
audio_bitrate: int
11+
audio_bitrate: Required[int]
1212
"""
1313
AudioBitrate specifies the audio bitrate in bits per second. Must be between
1414
32Kbps and 512Kbps.
1515
"""
1616

17+
name: Required[Literal["hls_h264"]]
18+
"""Name of the HLS H264 configuration"""
19+
20+
video_bitrate: Required[int]
21+
"""
22+
VideoBitrate specifies the video bitrate in bits per second. Must be between
23+
100Kbps and 50Mbps.
24+
"""
25+
1726
bufsize: int
1827
"""
1928
Bufsize specifies the video buffer size in bits. Must be between 100Kbps and
@@ -177,12 +186,6 @@ class HlsH264Param(TypedDict, total=False):
177186
positive value.
178187
"""
179188

180-
video_bitrate: int
181-
"""
182-
VideoBitrate specifies the video bitrate in bits per second. Must be between
183-
100Kbps and 50Mbps.
184-
"""
185-
186189
width: int
187190
"""Width specifies the output video width in pixels. Must be between -2 and 7680.
188191

src/chunkify/types/hls_h265_param.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,27 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Literal, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
__all__ = ["HlsH265Param"]
88

99

1010
class HlsH265Param(TypedDict, total=False):
11-
audio_bitrate: int
11+
audio_bitrate: Required[int]
1212
"""
1313
AudioBitrate specifies the audio bitrate in bits per second. Must be between
1414
32Kbps and 512Kbps.
1515
"""
1616

17+
name: Required[Literal["hls_h265"]]
18+
"""Name of the HLS H265 configuration"""
19+
20+
video_bitrate: Required[int]
21+
"""
22+
VideoBitrate specifies the video bitrate in bits per second. Must be between
23+
100Kbps and 50Mbps.
24+
"""
25+
1726
bufsize: int
1827
"""
1928
Bufsize specifies the video buffer size in bits. Must be between 100Kbps and
@@ -173,12 +182,6 @@ class HlsH265Param(TypedDict, total=False):
173182
positive value.
174183
"""
175184

176-
video_bitrate: int
177-
"""
178-
VideoBitrate specifies the video bitrate in bits per second. Must be between
179-
100Kbps and 50Mbps.
180-
"""
181-
182185
width: int
183186
"""Width specifies the output video width in pixels. Must be between -2 and 7680.
184187

src/chunkify/types/job_create_params.py

Lines changed: 6 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Dict, Union
6-
from typing_extensions import Literal, Required, TypedDict
6+
from typing_extensions import Literal, Required, TypeAlias, TypedDict
77

88
from .jpg_param import JpgParam
99
from .hls_av1_param import HlsAv1Param
@@ -14,34 +14,11 @@
1414
from .mp4_h265_param import MP4H265Param
1515
from .webm_vp9_param import WebmVp9Param
1616

17-
__all__ = [
18-
"JobCreateParams",
19-
"FormatJobsHlsAv1",
20-
"FormatJobsHlsH264",
21-
"FormatJobsHlsH265",
22-
"FormatJobsJpg",
23-
"FormatJobsMP4Av1",
24-
"FormatJobsMP4H264",
25-
"FormatJobsMP4H265",
26-
"FormatJobsWebmVp9",
27-
"Storage",
28-
"Transcoder",
29-
]
17+
__all__ = ["JobCreateParams", "Format", "Storage", "Transcoder"]
3018

3119

3220
class JobCreateParams(TypedDict, total=False):
33-
format: Required[
34-
Union[
35-
FormatJobsHlsAv1,
36-
FormatJobsHlsH264,
37-
FormatJobsHlsH265,
38-
FormatJobsJpg,
39-
FormatJobsMP4Av1,
40-
FormatJobsMP4H264,
41-
FormatJobsMP4H265,
42-
FormatJobsWebmVp9,
43-
]
44-
]
21+
format: Required[Format]
4522
"""
4623
Required format configuration, one and only one valid format configuration must
4724
be provided. If you want to use a format without specifying any configuration,
@@ -73,44 +50,9 @@ class JobCreateParams(TypedDict, total=False):
7350
"""
7451

7552

76-
class FormatJobsHlsAv1(HlsAv1Param, total=False):
77-
name: str
78-
"""Name of the format"""
79-
80-
81-
class FormatJobsHlsH264(HlsH264Param, total=False):
82-
name: str
83-
"""Name of the format"""
84-
85-
86-
class FormatJobsHlsH265(HlsH265Param, total=False):
87-
name: str
88-
"""Name of the format"""
89-
90-
91-
class FormatJobsJpg(JpgParam, total=False):
92-
name: str
93-
"""Name of the format"""
94-
95-
96-
class FormatJobsMP4Av1(MP4Av1Param, total=False):
97-
name: str # type: ignore
98-
"""Name of the format"""
99-
100-
101-
class FormatJobsMP4H264(MP4H264Param, total=False):
102-
name: str
103-
"""Name of the format"""
104-
105-
106-
class FormatJobsMP4H265(MP4H265Param, total=False):
107-
name: str
108-
"""Name of the format"""
109-
110-
111-
class FormatJobsWebmVp9(WebmVp9Param, total=False):
112-
name: str
113-
"""Name of the format"""
53+
Format: TypeAlias = Union[
54+
HlsAv1Param, HlsH264Param, HlsH265Param, JpgParam, MP4Av1Param, MP4H264Param, MP4H265Param, WebmVp9Param
55+
]
11456

11557

11658
class Storage(TypedDict, total=False):

src/chunkify/types/jpg_param.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing_extensions import Required, TypedDict
5+
from typing_extensions import Literal, Required, TypedDict
66

77
__all__ = ["JpgParam"]
88

@@ -15,6 +15,9 @@ class JpgParam(TypedDict, total=False):
1515
seconds.
1616
"""
1717

18+
name: Required[Literal["jpg"]]
19+
"""Name of the JPEG configuration"""
20+
1821
chunk_duration: int
1922

2023
duration: int

src/chunkify/types/mp4_h264_param.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class MP4H264Param(TypedDict, total=False):
8181

8282
movflags: str
8383

84+
name: Literal["mp4_h264"]
85+
8486
pixfmt: Literal[
8587
"yuv410p",
8688
"yuv411p",

src/chunkify/types/mp4_h265_param.py

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

8181
movflags: str
8282

83+
name: Literal["mp4_h265"]
84+
"""Name of the MP4 H265 configuration"""
85+
8386
pixfmt: Literal[
8487
"yuv410p",
8588
"yuv411p",

0 commit comments

Comments
(0)