gcore 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of gcore might be problematic. Click here for more details.

Files changed (181) hide show
  1. gcore/_client.py +9 -0
  2. gcore/_models.py +24 -3
  3. gcore/_version.py +1 -1
  4. gcore/pagination.py +101 -1
  5. gcore/resources/__init__.py +14 -0
  6. gcore/resources/cloud/__init__.py +28 -0
  7. gcore/resources/cloud/cloud.py +64 -0
  8. gcore/resources/cloud/cost_reports.py +811 -0
  9. gcore/resources/cloud/file_shares/file_shares.py +10 -0
  10. gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +61 -26
  11. gcore/resources/cloud/inference/registry_credentials.py +4 -6
  12. gcore/resources/cloud/usage_reports.py +337 -0
  13. gcore/resources/streaming/__init__.py +159 -0
  14. gcore/resources/streaming/ai_tasks.py +1288 -0
  15. gcore/resources/streaming/broadcasts.py +579 -0
  16. gcore/resources/streaming/directories.py +515 -0
  17. gcore/resources/streaming/players.py +577 -0
  18. gcore/resources/streaming/playlists.py +1059 -0
  19. gcore/resources/streaming/quality_sets.py +331 -0
  20. gcore/resources/streaming/restreams.py +484 -0
  21. gcore/resources/streaming/statistics.py +3224 -0
  22. gcore/resources/streaming/streaming.py +390 -0
  23. gcore/resources/streaming/streams/__init__.py +33 -0
  24. gcore/resources/streaming/streams/overlays.py +716 -0
  25. gcore/resources/streaming/streams/streams.py +1592 -0
  26. gcore/resources/streaming/videos/__init__.py +33 -0
  27. gcore/resources/streaming/videos/subtitles.py +623 -0
  28. gcore/resources/streaming/videos/videos.py +1553 -0
  29. gcore/resources/waap/ip_info.py +28 -10
  30. gcore/types/cloud/__init__.py +10 -0
  31. gcore/types/cloud/cost_report_aggregated.py +865 -0
  32. gcore/types/cloud/cost_report_aggregated_monthly.py +865 -0
  33. gcore/types/cloud/cost_report_detailed.py +1343 -0
  34. gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +394 -0
  35. gcore/types/cloud/cost_report_get_aggregated_params.py +409 -0
  36. gcore/types/cloud/cost_report_get_detailed_params.py +435 -0
  37. gcore/types/cloud/file_share.py +37 -3
  38. gcore/types/cloud/file_share_create_params.py +16 -0
  39. gcore/types/cloud/gpu_baremetal_cluster.py +2 -2
  40. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +9 -0
  41. gcore/types/cloud/quota_get_all_response.py +24 -2
  42. gcore/types/cloud/quota_get_by_region_response.py +24 -2
  43. gcore/types/cloud/quotas/request_create_params.py +12 -1
  44. gcore/types/cloud/quotas/request_get_response.py +12 -1
  45. gcore/types/cloud/quotas/request_list_response.py +12 -1
  46. gcore/types/cloud/usage_report.py +1612 -0
  47. gcore/types/cloud/usage_report_get_params.py +432 -0
  48. gcore/types/streaming/__init__.py +143 -0
  49. gcore/types/streaming/ai_contentmoderation_casm.py +39 -0
  50. gcore/types/streaming/ai_contentmoderation_hardnudity.py +54 -0
  51. gcore/types/streaming/ai_contentmoderation_nsfw.py +39 -0
  52. gcore/types/streaming/ai_contentmoderation_softnudity.py +66 -0
  53. gcore/types/streaming/ai_contentmoderation_sport.py +39 -0
  54. gcore/types/streaming/ai_contentmoderation_weapon.py +39 -0
  55. gcore/types/streaming/ai_task.py +205 -0
  56. gcore/types/streaming/ai_task_cancel_response.py +12 -0
  57. gcore/types/streaming/ai_task_create_params.py +168 -0
  58. gcore/types/streaming/ai_task_create_response.py +10 -0
  59. gcore/types/streaming/ai_task_get_ai_settings_params.py +27 -0
  60. gcore/types/streaming/ai_task_get_ai_settings_response.py +12 -0
  61. gcore/types/streaming/ai_task_get_response.py +313 -0
  62. gcore/types/streaming/ai_task_list_params.py +50 -0
  63. gcore/types/streaming/broadcast.py +71 -0
  64. gcore/types/streaming/broadcast_create_params.py +76 -0
  65. gcore/types/streaming/broadcast_list_params.py +12 -0
  66. gcore/types/streaming/broadcast_spectators_count.py +12 -0
  67. gcore/types/streaming/broadcast_update_params.py +76 -0
  68. gcore/types/streaming/clip.py +78 -0
  69. gcore/types/streaming/create_video_param.py +214 -0
  70. gcore/types/streaming/direct_upload_parameters.py +33 -0
  71. gcore/types/streaming/directories_tree.py +19 -0
  72. gcore/types/streaming/directory_base.py +31 -0
  73. gcore/types/streaming/directory_create_params.py +15 -0
  74. gcore/types/streaming/directory_get_response.py +19 -0
  75. gcore/types/streaming/directory_item.py +13 -0
  76. gcore/types/streaming/directory_update_params.py +18 -0
  77. gcore/types/streaming/directory_video.py +13 -0
  78. gcore/types/streaming/ffprobes.py +25 -0
  79. gcore/types/streaming/max_stream_series.py +21 -0
  80. gcore/types/streaming/meet_series.py +23 -0
  81. gcore/types/streaming/player.py +114 -0
  82. gcore/types/streaming/player_create_params.py +18 -0
  83. gcore/types/streaming/player_list_params.py +12 -0
  84. gcore/types/streaming/player_param.py +114 -0
  85. gcore/types/streaming/player_update_params.py +18 -0
  86. gcore/types/streaming/playlist.py +102 -0
  87. gcore/types/streaming/playlist_create.py +12 -0
  88. gcore/types/streaming/playlist_create_params.py +102 -0
  89. gcore/types/streaming/playlist_list_params.py +12 -0
  90. gcore/types/streaming/playlist_list_videos_response.py +10 -0
  91. gcore/types/streaming/playlist_update_params.py +102 -0
  92. gcore/types/streaming/playlist_video.py +215 -0
  93. gcore/types/streaming/popular_videos.py +17 -0
  94. gcore/types/streaming/quality_set_set_default_params.py +23 -0
  95. gcore/types/streaming/quality_sets.py +57 -0
  96. gcore/types/streaming/restream.py +37 -0
  97. gcore/types/streaming/restream_create_params.py +41 -0
  98. gcore/types/streaming/restream_list_params.py +12 -0
  99. gcore/types/streaming/restream_update_params.py +41 -0
  100. gcore/types/streaming/statistic_get_ffprobes_params.py +22 -0
  101. gcore/types/streaming/statistic_get_live_unique_viewers_params.py +26 -0
  102. gcore/types/streaming/statistic_get_live_unique_viewers_response.py +25 -0
  103. gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +32 -0
  104. gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +30 -0
  105. gcore/types/streaming/statistic_get_max_streams_series_params.py +20 -0
  106. gcore/types/streaming/statistic_get_meet_series_params.py +20 -0
  107. gcore/types/streaming/statistic_get_popular_videos_params.py +15 -0
  108. gcore/types/streaming/statistic_get_storage_series_params.py +20 -0
  109. gcore/types/streaming/statistic_get_stream_series_params.py +20 -0
  110. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +27 -0
  111. gcore/types/streaming/statistic_get_unique_viewers_params.py +34 -0
  112. gcore/types/streaming/statistic_get_views_by_browsers_params.py +15 -0
  113. gcore/types/streaming/statistic_get_views_by_country_params.py +15 -0
  114. gcore/types/streaming/statistic_get_views_by_hostname_params.py +15 -0
  115. gcore/types/streaming/statistic_get_views_by_operating_system_params.py +15 -0
  116. gcore/types/streaming/statistic_get_views_by_referer_params.py +15 -0
  117. gcore/types/streaming/statistic_get_views_by_region_params.py +15 -0
  118. gcore/types/streaming/statistic_get_views_heatmap_params.py +21 -0
  119. gcore/types/streaming/statistic_get_views_params.py +34 -0
  120. gcore/types/streaming/statistic_get_vod_storage_volume_params.py +17 -0
  121. gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py +17 -0
  122. gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py +26 -0
  123. gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +32 -0
  124. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +30 -0
  125. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py +22 -0
  126. gcore/types/streaming/storage_series.py +23 -0
  127. gcore/types/streaming/stream.py +420 -0
  128. gcore/types/streaming/stream_create_clip_params.py +48 -0
  129. gcore/types/streaming/stream_create_params.py +165 -0
  130. gcore/types/streaming/stream_list_clips_response.py +10 -0
  131. gcore/types/streaming/stream_list_params.py +18 -0
  132. gcore/types/streaming/stream_series.py +21 -0
  133. gcore/types/streaming/stream_start_recording_response.py +76 -0
  134. gcore/types/streaming/stream_update_params.py +169 -0
  135. gcore/types/streaming/streams/__init__.py +11 -0
  136. gcore/types/streaming/streams/overlay.py +43 -0
  137. gcore/types/streaming/streams/overlay_create_params.py +36 -0
  138. gcore/types/streaming/streams/overlay_create_response.py +10 -0
  139. gcore/types/streaming/streams/overlay_list_response.py +10 -0
  140. gcore/types/streaming/streams/overlay_update_multiple_params.py +39 -0
  141. gcore/types/streaming/streams/overlay_update_multiple_response.py +10 -0
  142. gcore/types/streaming/streams/overlay_update_params.py +33 -0
  143. gcore/types/streaming/subtitle.py +12 -0
  144. gcore/types/streaming/subtitle_base.py +18 -0
  145. gcore/types/streaming/subtitle_base_param.py +18 -0
  146. gcore/types/streaming/unique_viewers.py +35 -0
  147. gcore/types/streaming/unique_viewers_cdn.py +17 -0
  148. gcore/types/streaming/video.py +444 -0
  149. gcore/types/streaming/video_create_multiple_params.py +28 -0
  150. gcore/types/streaming/video_create_multiple_response.py +10 -0
  151. gcore/types/streaming/video_create_params.py +13 -0
  152. gcore/types/streaming/video_create_response.py +10 -0
  153. gcore/types/streaming/video_list_names_params.py +13 -0
  154. gcore/types/streaming/video_list_params.py +59 -0
  155. gcore/types/streaming/video_update_params.py +214 -0
  156. gcore/types/streaming/videos/__init__.py +7 -0
  157. gcore/types/streaming/videos/subtitle_create_params.py +17 -0
  158. gcore/types/streaming/videos/subtitle_list_response.py +10 -0
  159. gcore/types/streaming/videos/subtitle_update_params.py +20 -0
  160. gcore/types/streaming/views.py +35 -0
  161. gcore/types/streaming/views_by_browser.py +17 -0
  162. gcore/types/streaming/views_by_country.py +19 -0
  163. gcore/types/streaming/views_by_hostname.py +17 -0
  164. gcore/types/streaming/views_by_operating_system.py +17 -0
  165. gcore/types/streaming/views_by_referer.py +17 -0
  166. gcore/types/streaming/views_by_region.py +19 -0
  167. gcore/types/streaming/views_heatmap.py +19 -0
  168. gcore/types/streaming/vod_statistics_series.py +21 -0
  169. gcore/types/streaming/vod_total_stream_duration_series.py +22 -0
  170. gcore/types/waap/domains/custom_rule_create_params.py +4 -4
  171. gcore/types/waap/domains/custom_rule_update_params.py +4 -4
  172. gcore/types/waap/ip_info_get_blocked_requests_params.py +5 -1
  173. gcore/types/waap/ip_info_get_counts_params.py +2 -1
  174. gcore/types/waap/ip_info_get_top_sessions_params.py +5 -1
  175. gcore/types/waap/ip_info_get_top_urls_params.py +5 -1
  176. gcore/types/waap/ip_info_get_top_user_agents_params.py +5 -1
  177. gcore/types/waap/waap_custom_rule.py +4 -4
  178. {gcore-0.6.0.dist-info → gcore-0.7.0.dist-info}/METADATA +1 -1
  179. {gcore-0.6.0.dist-info → gcore-0.7.0.dist-info}/RECORD +181 -33
  180. {gcore-0.6.0.dist-info → gcore-0.7.0.dist-info}/WHEEL +0 -0
  181. {gcore-0.6.0.dist-info → gcore-0.7.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .videos import (
4
+ VideosResource,
5
+ AsyncVideosResource,
6
+ VideosResourceWithRawResponse,
7
+ AsyncVideosResourceWithRawResponse,
8
+ VideosResourceWithStreamingResponse,
9
+ AsyncVideosResourceWithStreamingResponse,
10
+ )
11
+ from .subtitles import (
12
+ SubtitlesResource,
13
+ AsyncSubtitlesResource,
14
+ SubtitlesResourceWithRawResponse,
15
+ AsyncSubtitlesResourceWithRawResponse,
16
+ SubtitlesResourceWithStreamingResponse,
17
+ AsyncSubtitlesResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "SubtitlesResource",
22
+ "AsyncSubtitlesResource",
23
+ "SubtitlesResourceWithRawResponse",
24
+ "AsyncSubtitlesResourceWithRawResponse",
25
+ "SubtitlesResourceWithStreamingResponse",
26
+ "AsyncSubtitlesResourceWithStreamingResponse",
27
+ "VideosResource",
28
+ "AsyncVideosResource",
29
+ "VideosResourceWithRawResponse",
30
+ "AsyncVideosResourceWithRawResponse",
31
+ "VideosResourceWithStreamingResponse",
32
+ "AsyncVideosResourceWithStreamingResponse",
33
+ ]
@@ -0,0 +1,623 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ import httpx
6
+
7
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
8
+ from ...._utils import maybe_transform, async_maybe_transform
9
+ from ...._compat import cached_property
10
+ from ...._resource import SyncAPIResource, AsyncAPIResource
11
+ from ...._response import (
12
+ to_raw_response_wrapper,
13
+ to_streamed_response_wrapper,
14
+ async_to_raw_response_wrapper,
15
+ async_to_streamed_response_wrapper,
16
+ )
17
+ from ...._base_client import make_request_options
18
+ from ....types.streaming.videos import subtitle_create_params, subtitle_update_params
19
+ from ....types.streaming.subtitle import Subtitle
20
+ from ....types.streaming.subtitle_base import SubtitleBase
21
+ from ....types.streaming.videos.subtitle_list_response import SubtitleListResponse
22
+
23
+ __all__ = ["SubtitlesResource", "AsyncSubtitlesResource"]
24
+
25
+
26
+ class SubtitlesResource(SyncAPIResource):
27
+ @cached_property
28
+ def with_raw_response(self) -> SubtitlesResourceWithRawResponse:
29
+ """
30
+ This property can be used as a prefix for any HTTP method call to return
31
+ the raw response object instead of the parsed content.
32
+
33
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
34
+ """
35
+ return SubtitlesResourceWithRawResponse(self)
36
+
37
+ @cached_property
38
+ def with_streaming_response(self) -> SubtitlesResourceWithStreamingResponse:
39
+ """
40
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
41
+
42
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
43
+ """
44
+ return SubtitlesResourceWithStreamingResponse(self)
45
+
46
+ def create(
47
+ self,
48
+ video_id: int,
49
+ *,
50
+ body: subtitle_create_params.Body,
51
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
52
+ # The extra values given here take precedence over values defined on the client or passed to this method.
53
+ extra_headers: Headers | None = None,
54
+ extra_query: Query | None = None,
55
+ extra_body: Body | None = None,
56
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
57
+ ) -> Subtitle:
58
+ """
59
+ Add new subtitle/captions to a video entity.
60
+
61
+ **Add already exist subtitles** Subtitles must be in one of the following
62
+ formats:
63
+
64
+ - SRT – SubRip Text is described on
65
+ [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#`SubRip_file_format`).
66
+ Must start from integer for sequence number. Use calidators to check the
67
+ subtitles, like
68
+ [srt-validator](https://taoning2014.github.io/srt-validator-website/index.html).
69
+ - WebVTT – Web Video Text Tracks Format is described on
70
+ [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/`WebVTT_API`).
71
+ Must start from "WEBVTT" header. Use validators to check the subtitles, like
72
+ [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter
73
+ language code according to ISO-639-2 (bibliographic code). Specify language
74
+ you need, or just look at our list in the attribute "`audio_language`" of
75
+ section
76
+ ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task).
77
+ You can add multiple subtitles in the same language, language uniqueness is
78
+ not required. Size must be up to 5Mb.
79
+
80
+ The update time for added or changed subtitles is up to 30 seconds. Just like
81
+ videos, subtitles are cached, so it takes time to update the data.
82
+
83
+ **AI subtitles and transcribing** It is also possible to automatically create
84
+ subtitles based on AI. Read more:
85
+
86
+ - What is
87
+ ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task).
88
+ - If the option is enabled via `auto_transcribe_audio_language: auto|`, then
89
+ immediately after successful transcoding, an AI task will be automatically
90
+ created for transcription.
91
+ - If you need to translate subtitles from original language to any other, then
92
+ AI-task of subtitles translation can be applied. Use
93
+ `auto_translate_subtitles_language: default|` parameter for that. Also you can
94
+ point several languages to translate to, then a separate subtitle will be
95
+ generated for each specified language. The created AI-task(s) will be
96
+ automatically executed, and result will also be automatically attached to this
97
+ video as subtitle(s). If AI is disabled in your account, you will receive code
98
+ 422 in response.
99
+
100
+ **Where and how subtitles are displayed?** Subtitles are became available in the
101
+ API response and in playback manifests. All added subtitles are automatically
102
+ inserted into the output manifest .m3u8. This way, subtitles become available to
103
+ any player: our player, OS built-in, or other specialized ones. You don't need
104
+ to do anything else. Read more information in the Knowledge Base. Example:
105
+
106
+ ```
107
+ # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8"
108
+ ```
109
+
110
+ ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif)
111
+
112
+ Args:
113
+ extra_headers: Send extra headers
114
+
115
+ extra_query: Add additional query parameters to the request
116
+
117
+ extra_body: Add additional JSON properties to the request
118
+
119
+ timeout: Override the client-level default timeout for this request, in seconds
120
+ """
121
+ return self._post(
122
+ f"/streaming/videos/{video_id}/subtitles",
123
+ body=maybe_transform(body, subtitle_create_params.SubtitleCreateParams),
124
+ options=make_request_options(
125
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
126
+ ),
127
+ cast_to=Subtitle,
128
+ )
129
+
130
+ def update(
131
+ self,
132
+ id: int,
133
+ *,
134
+ video_id: int,
135
+ language: str | NotGiven = NOT_GIVEN,
136
+ name: str | NotGiven = NOT_GIVEN,
137
+ vtt: str | NotGiven = NOT_GIVEN,
138
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
139
+ # The extra values given here take precedence over values defined on the client or passed to this method.
140
+ extra_headers: Headers | None = None,
141
+ extra_query: Query | None = None,
142
+ extra_body: Body | None = None,
143
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
144
+ ) -> SubtitleBase:
145
+ """Method to update subtitle of a video.
146
+
147
+ You can update all or only some of fields
148
+ you need. If you want to replace the text of subtitles (i.e. found a typo in the
149
+ text, or the timing in the video changed), then:
150
+
151
+ - download it using GET method,
152
+ - change it in an external editor,
153
+ - and update it using this PATCH method. Just like videos, subtitles are cached,
154
+ so it takes time to update the data. See POST method for details.
155
+
156
+ Args:
157
+ language: 3-letter language code according to ISO-639-2 (bibliographic code)
158
+
159
+ name: Name of subtitle file
160
+
161
+ vtt: Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line
162
+
163
+ extra_headers: Send extra headers
164
+
165
+ extra_query: Add additional query parameters to the request
166
+
167
+ extra_body: Add additional JSON properties to the request
168
+
169
+ timeout: Override the client-level default timeout for this request, in seconds
170
+ """
171
+ return self._patch(
172
+ f"/streaming/videos/{video_id}/subtitles/{id}",
173
+ body=maybe_transform(
174
+ {
175
+ "language": language,
176
+ "name": name,
177
+ "vtt": vtt,
178
+ },
179
+ subtitle_update_params.SubtitleUpdateParams,
180
+ ),
181
+ options=make_request_options(
182
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
183
+ ),
184
+ cast_to=SubtitleBase,
185
+ )
186
+
187
+ def list(
188
+ self,
189
+ video_id: int,
190
+ *,
191
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
192
+ # The extra values given here take precedence over values defined on the client or passed to this method.
193
+ extra_headers: Headers | None = None,
194
+ extra_query: Query | None = None,
195
+ extra_body: Body | None = None,
196
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
197
+ ) -> SubtitleListResponse:
198
+ """
199
+ Method returns a list of all subtitles that are already attached to a video.
200
+
201
+ Args:
202
+ extra_headers: Send extra headers
203
+
204
+ extra_query: Add additional query parameters to the request
205
+
206
+ extra_body: Add additional JSON properties to the request
207
+
208
+ timeout: Override the client-level default timeout for this request, in seconds
209
+ """
210
+ return self._get(
211
+ f"/streaming/videos/{video_id}/subtitles",
212
+ options=make_request_options(
213
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
214
+ ),
215
+ cast_to=SubtitleListResponse,
216
+ )
217
+
218
+ def delete(
219
+ self,
220
+ id: int,
221
+ *,
222
+ video_id: int,
223
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
224
+ # The extra values given here take precedence over values defined on the client or passed to this method.
225
+ extra_headers: Headers | None = None,
226
+ extra_query: Query | None = None,
227
+ extra_body: Body | None = None,
228
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
229
+ ) -> None:
230
+ """
231
+ Delete specified video subtitle
232
+
233
+ Args:
234
+ extra_headers: Send extra headers
235
+
236
+ extra_query: Add additional query parameters to the request
237
+
238
+ extra_body: Add additional JSON properties to the request
239
+
240
+ timeout: Override the client-level default timeout for this request, in seconds
241
+ """
242
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
243
+ return self._delete(
244
+ f"/streaming/videos/{video_id}/subtitles/{id}",
245
+ options=make_request_options(
246
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
247
+ ),
248
+ cast_to=NoneType,
249
+ )
250
+
251
+ def get(
252
+ self,
253
+ id: int,
254
+ *,
255
+ video_id: int,
256
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
257
+ # The extra values given here take precedence over values defined on the client or passed to this method.
258
+ extra_headers: Headers | None = None,
259
+ extra_query: Query | None = None,
260
+ extra_body: Body | None = None,
261
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
262
+ ) -> Subtitle:
263
+ """
264
+ Returns information about a specific subtitle for a video.
265
+
266
+ Args:
267
+ extra_headers: Send extra headers
268
+
269
+ extra_query: Add additional query parameters to the request
270
+
271
+ extra_body: Add additional JSON properties to the request
272
+
273
+ timeout: Override the client-level default timeout for this request, in seconds
274
+ """
275
+ return self._get(
276
+ f"/streaming/videos/{video_id}/subtitles/{id}",
277
+ options=make_request_options(
278
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
279
+ ),
280
+ cast_to=Subtitle,
281
+ )
282
+
283
+
284
+ class AsyncSubtitlesResource(AsyncAPIResource):
285
+ @cached_property
286
+ def with_raw_response(self) -> AsyncSubtitlesResourceWithRawResponse:
287
+ """
288
+ This property can be used as a prefix for any HTTP method call to return
289
+ the raw response object instead of the parsed content.
290
+
291
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
292
+ """
293
+ return AsyncSubtitlesResourceWithRawResponse(self)
294
+
295
+ @cached_property
296
+ def with_streaming_response(self) -> AsyncSubtitlesResourceWithStreamingResponse:
297
+ """
298
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
299
+
300
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
301
+ """
302
+ return AsyncSubtitlesResourceWithStreamingResponse(self)
303
+
304
+ async def create(
305
+ self,
306
+ video_id: int,
307
+ *,
308
+ body: subtitle_create_params.Body,
309
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
310
+ # The extra values given here take precedence over values defined on the client or passed to this method.
311
+ extra_headers: Headers | None = None,
312
+ extra_query: Query | None = None,
313
+ extra_body: Body | None = None,
314
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
315
+ ) -> Subtitle:
316
+ """
317
+ Add new subtitle/captions to a video entity.
318
+
319
+ **Add already exist subtitles** Subtitles must be in one of the following
320
+ formats:
321
+
322
+ - SRT – SubRip Text is described on
323
+ [wikipedia.org](https://en.wikipedia.org/wiki/SubRip#`SubRip_file_format`).
324
+ Must start from integer for sequence number. Use calidators to check the
325
+ subtitles, like
326
+ [srt-validator](https://taoning2014.github.io/srt-validator-website/index.html).
327
+ - WebVTT – Web Video Text Tracks Format is described on
328
+ [developer.mozilla.org](https://developer.mozilla.org/en-US/docs/Web/API/`WebVTT_API`).
329
+ Must start from "WEBVTT" header. Use validators to check the subtitles, like
330
+ [W3C](https://w3c.github.io/webvtt.js/parser.html). Language is 3-letter
331
+ language code according to ISO-639-2 (bibliographic code). Specify language
332
+ you need, or just look at our list in the attribute "`audio_language`" of
333
+ section
334
+ ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task).
335
+ You can add multiple subtitles in the same language, language uniqueness is
336
+ not required. Size must be up to 5Mb.
337
+
338
+ The update time for added or changed subtitles is up to 30 seconds. Just like
339
+ videos, subtitles are cached, so it takes time to update the data.
340
+
341
+ **AI subtitles and transcribing** It is also possible to automatically create
342
+ subtitles based on AI. Read more:
343
+
344
+ - What is
345
+ ["AI Transcribe"](https://api.gcore.com/docs/streaming/docs/api-reference/streaming/ai/create-ai-asr-task).
346
+ - If the option is enabled via `auto_transcribe_audio_language: auto|`, then
347
+ immediately after successful transcoding, an AI task will be automatically
348
+ created for transcription.
349
+ - If you need to translate subtitles from original language to any other, then
350
+ AI-task of subtitles translation can be applied. Use
351
+ `auto_translate_subtitles_language: default|` parameter for that. Also you can
352
+ point several languages to translate to, then a separate subtitle will be
353
+ generated for each specified language. The created AI-task(s) will be
354
+ automatically executed, and result will also be automatically attached to this
355
+ video as subtitle(s). If AI is disabled in your account, you will receive code
356
+ 422 in response.
357
+
358
+ **Where and how subtitles are displayed?** Subtitles are became available in the
359
+ API response and in playback manifests. All added subtitles are automatically
360
+ inserted into the output manifest .m3u8. This way, subtitles become available to
361
+ any player: our player, OS built-in, or other specialized ones. You don't need
362
+ to do anything else. Read more information in the Knowledge Base. Example:
363
+
364
+ ```
365
+ # EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs0",NAME="English",LANGUAGE="en",AUTOSELECT=YES,URI="subs-0.m3u8"
366
+ ```
367
+
368
+ ![Auto generated subtitles example](https://demo-files.gvideo.io/apidocs/captions.gif)
369
+
370
+ Args:
371
+ extra_headers: Send extra headers
372
+
373
+ extra_query: Add additional query parameters to the request
374
+
375
+ extra_body: Add additional JSON properties to the request
376
+
377
+ timeout: Override the client-level default timeout for this request, in seconds
378
+ """
379
+ return await self._post(
380
+ f"/streaming/videos/{video_id}/subtitles",
381
+ body=await async_maybe_transform(body, subtitle_create_params.SubtitleCreateParams),
382
+ options=make_request_options(
383
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
384
+ ),
385
+ cast_to=Subtitle,
386
+ )
387
+
388
+ async def update(
389
+ self,
390
+ id: int,
391
+ *,
392
+ video_id: int,
393
+ language: str | NotGiven = NOT_GIVEN,
394
+ name: str | NotGiven = NOT_GIVEN,
395
+ vtt: str | NotGiven = NOT_GIVEN,
396
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
397
+ # The extra values given here take precedence over values defined on the client or passed to this method.
398
+ extra_headers: Headers | None = None,
399
+ extra_query: Query | None = None,
400
+ extra_body: Body | None = None,
401
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
402
+ ) -> SubtitleBase:
403
+ """Method to update subtitle of a video.
404
+
405
+ You can update all or only some of fields
406
+ you need. If you want to replace the text of subtitles (i.e. found a typo in the
407
+ text, or the timing in the video changed), then:
408
+
409
+ - download it using GET method,
410
+ - change it in an external editor,
411
+ - and update it using this PATCH method. Just like videos, subtitles are cached,
412
+ so it takes time to update the data. See POST method for details.
413
+
414
+ Args:
415
+ language: 3-letter language code according to ISO-639-2 (bibliographic code)
416
+
417
+ name: Name of subtitle file
418
+
419
+ vtt: Full text of subtitles/captions, with escaped "\n" ("\r") symbol of new line
420
+
421
+ extra_headers: Send extra headers
422
+
423
+ extra_query: Add additional query parameters to the request
424
+
425
+ extra_body: Add additional JSON properties to the request
426
+
427
+ timeout: Override the client-level default timeout for this request, in seconds
428
+ """
429
+ return await self._patch(
430
+ f"/streaming/videos/{video_id}/subtitles/{id}",
431
+ body=await async_maybe_transform(
432
+ {
433
+ "language": language,
434
+ "name": name,
435
+ "vtt": vtt,
436
+ },
437
+ subtitle_update_params.SubtitleUpdateParams,
438
+ ),
439
+ options=make_request_options(
440
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
441
+ ),
442
+ cast_to=SubtitleBase,
443
+ )
444
+
445
+ async def list(
446
+ self,
447
+ video_id: int,
448
+ *,
449
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
450
+ # The extra values given here take precedence over values defined on the client or passed to this method.
451
+ extra_headers: Headers | None = None,
452
+ extra_query: Query | None = None,
453
+ extra_body: Body | None = None,
454
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
455
+ ) -> SubtitleListResponse:
456
+ """
457
+ Method returns a list of all subtitles that are already attached to a video.
458
+
459
+ Args:
460
+ extra_headers: Send extra headers
461
+
462
+ extra_query: Add additional query parameters to the request
463
+
464
+ extra_body: Add additional JSON properties to the request
465
+
466
+ timeout: Override the client-level default timeout for this request, in seconds
467
+ """
468
+ return await self._get(
469
+ f"/streaming/videos/{video_id}/subtitles",
470
+ options=make_request_options(
471
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
472
+ ),
473
+ cast_to=SubtitleListResponse,
474
+ )
475
+
476
+ async def delete(
477
+ self,
478
+ id: int,
479
+ *,
480
+ video_id: int,
481
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
482
+ # The extra values given here take precedence over values defined on the client or passed to this method.
483
+ extra_headers: Headers | None = None,
484
+ extra_query: Query | None = None,
485
+ extra_body: Body | None = None,
486
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
487
+ ) -> None:
488
+ """
489
+ Delete specified video subtitle
490
+
491
+ Args:
492
+ extra_headers: Send extra headers
493
+
494
+ extra_query: Add additional query parameters to the request
495
+
496
+ extra_body: Add additional JSON properties to the request
497
+
498
+ timeout: Override the client-level default timeout for this request, in seconds
499
+ """
500
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
501
+ return await self._delete(
502
+ f"/streaming/videos/{video_id}/subtitles/{id}",
503
+ options=make_request_options(
504
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
505
+ ),
506
+ cast_to=NoneType,
507
+ )
508
+
509
+ async def get(
510
+ self,
511
+ id: int,
512
+ *,
513
+ video_id: int,
514
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
515
+ # The extra values given here take precedence over values defined on the client or passed to this method.
516
+ extra_headers: Headers | None = None,
517
+ extra_query: Query | None = None,
518
+ extra_body: Body | None = None,
519
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
520
+ ) -> Subtitle:
521
+ """
522
+ Returns information about a specific subtitle for a video.
523
+
524
+ Args:
525
+ extra_headers: Send extra headers
526
+
527
+ extra_query: Add additional query parameters to the request
528
+
529
+ extra_body: Add additional JSON properties to the request
530
+
531
+ timeout: Override the client-level default timeout for this request, in seconds
532
+ """
533
+ return await self._get(
534
+ f"/streaming/videos/{video_id}/subtitles/{id}",
535
+ options=make_request_options(
536
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
537
+ ),
538
+ cast_to=Subtitle,
539
+ )
540
+
541
+
542
+ class SubtitlesResourceWithRawResponse:
543
+ def __init__(self, subtitles: SubtitlesResource) -> None:
544
+ self._subtitles = subtitles
545
+
546
+ self.create = to_raw_response_wrapper(
547
+ subtitles.create,
548
+ )
549
+ self.update = to_raw_response_wrapper(
550
+ subtitles.update,
551
+ )
552
+ self.list = to_raw_response_wrapper(
553
+ subtitles.list,
554
+ )
555
+ self.delete = to_raw_response_wrapper(
556
+ subtitles.delete,
557
+ )
558
+ self.get = to_raw_response_wrapper(
559
+ subtitles.get,
560
+ )
561
+
562
+
563
+ class AsyncSubtitlesResourceWithRawResponse:
564
+ def __init__(self, subtitles: AsyncSubtitlesResource) -> None:
565
+ self._subtitles = subtitles
566
+
567
+ self.create = async_to_raw_response_wrapper(
568
+ subtitles.create,
569
+ )
570
+ self.update = async_to_raw_response_wrapper(
571
+ subtitles.update,
572
+ )
573
+ self.list = async_to_raw_response_wrapper(
574
+ subtitles.list,
575
+ )
576
+ self.delete = async_to_raw_response_wrapper(
577
+ subtitles.delete,
578
+ )
579
+ self.get = async_to_raw_response_wrapper(
580
+ subtitles.get,
581
+ )
582
+
583
+
584
+ class SubtitlesResourceWithStreamingResponse:
585
+ def __init__(self, subtitles: SubtitlesResource) -> None:
586
+ self._subtitles = subtitles
587
+
588
+ self.create = to_streamed_response_wrapper(
589
+ subtitles.create,
590
+ )
591
+ self.update = to_streamed_response_wrapper(
592
+ subtitles.update,
593
+ )
594
+ self.list = to_streamed_response_wrapper(
595
+ subtitles.list,
596
+ )
597
+ self.delete = to_streamed_response_wrapper(
598
+ subtitles.delete,
599
+ )
600
+ self.get = to_streamed_response_wrapper(
601
+ subtitles.get,
602
+ )
603
+
604
+
605
+ class AsyncSubtitlesResourceWithStreamingResponse:
606
+ def __init__(self, subtitles: AsyncSubtitlesResource) -> None:
607
+ self._subtitles = subtitles
608
+
609
+ self.create = async_to_streamed_response_wrapper(
610
+ subtitles.create,
611
+ )
612
+ self.update = async_to_streamed_response_wrapper(
613
+ subtitles.update,
614
+ )
615
+ self.list = async_to_streamed_response_wrapper(
616
+ subtitles.list,
617
+ )
618
+ self.delete = async_to_streamed_response_wrapper(
619
+ subtitles.delete,
620
+ )
621
+ self.get = async_to_streamed_response_wrapper(
622
+ subtitles.get,
623
+ )