gcore 0.6.0__py3-none-any.whl → 0.8.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 (185) 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 -63
  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/iam/users.py +5 -5
  14. gcore/resources/streaming/__init__.py +159 -0
  15. gcore/resources/streaming/ai_tasks.py +1288 -0
  16. gcore/resources/streaming/broadcasts.py +579 -0
  17. gcore/resources/streaming/directories.py +515 -0
  18. gcore/resources/streaming/players.py +577 -0
  19. gcore/resources/streaming/playlists.py +1059 -0
  20. gcore/resources/streaming/quality_sets.py +331 -0
  21. gcore/resources/streaming/restreams.py +484 -0
  22. gcore/resources/streaming/statistics.py +3224 -0
  23. gcore/resources/streaming/streaming.py +390 -0
  24. gcore/resources/streaming/streams/__init__.py +33 -0
  25. gcore/resources/streaming/streams/overlays.py +716 -0
  26. gcore/resources/streaming/streams/streams.py +1592 -0
  27. gcore/resources/streaming/videos/__init__.py +33 -0
  28. gcore/resources/streaming/videos/subtitles.py +623 -0
  29. gcore/resources/streaming/videos/videos.py +1553 -0
  30. gcore/resources/waap/ip_info.py +28 -10
  31. gcore/types/cloud/__init__.py +10 -0
  32. gcore/types/cloud/cost_report_aggregated.py +865 -0
  33. gcore/types/cloud/cost_report_aggregated_monthly.py +865 -0
  34. gcore/types/cloud/cost_report_detailed.py +1343 -0
  35. gcore/types/cloud/cost_report_get_aggregated_monthly_params.py +394 -0
  36. gcore/types/cloud/cost_report_get_aggregated_params.py +409 -0
  37. gcore/types/cloud/cost_report_get_detailed_params.py +435 -0
  38. gcore/types/cloud/file_share.py +37 -3
  39. gcore/types/cloud/file_share_create_params.py +16 -0
  40. gcore/types/cloud/floating_ip.py +0 -9
  41. gcore/types/cloud/floating_ip_detailed.py +0 -9
  42. gcore/types/cloud/gpu_baremetal_cluster.py +2 -2
  43. gcore/types/cloud/gpu_baremetal_cluster_create_params.py +9 -0
  44. gcore/types/cloud/quota_get_all_response.py +24 -2
  45. gcore/types/cloud/quota_get_by_region_response.py +24 -2
  46. gcore/types/cloud/quotas/request_create_params.py +12 -1
  47. gcore/types/cloud/quotas/request_get_response.py +12 -1
  48. gcore/types/cloud/quotas/request_list_response.py +12 -1
  49. gcore/types/cloud/subnet.py +1 -1
  50. gcore/types/cloud/usage_report.py +1612 -0
  51. gcore/types/cloud/usage_report_get_params.py +432 -0
  52. gcore/types/streaming/__init__.py +143 -0
  53. gcore/types/streaming/ai_contentmoderation_casm.py +39 -0
  54. gcore/types/streaming/ai_contentmoderation_hardnudity.py +54 -0
  55. gcore/types/streaming/ai_contentmoderation_nsfw.py +39 -0
  56. gcore/types/streaming/ai_contentmoderation_softnudity.py +66 -0
  57. gcore/types/streaming/ai_contentmoderation_sport.py +39 -0
  58. gcore/types/streaming/ai_contentmoderation_weapon.py +39 -0
  59. gcore/types/streaming/ai_task.py +205 -0
  60. gcore/types/streaming/ai_task_cancel_response.py +12 -0
  61. gcore/types/streaming/ai_task_create_params.py +168 -0
  62. gcore/types/streaming/ai_task_create_response.py +10 -0
  63. gcore/types/streaming/ai_task_get_ai_settings_params.py +27 -0
  64. gcore/types/streaming/ai_task_get_ai_settings_response.py +12 -0
  65. gcore/types/streaming/ai_task_get_response.py +313 -0
  66. gcore/types/streaming/ai_task_list_params.py +50 -0
  67. gcore/types/streaming/broadcast.py +71 -0
  68. gcore/types/streaming/broadcast_create_params.py +76 -0
  69. gcore/types/streaming/broadcast_list_params.py +12 -0
  70. gcore/types/streaming/broadcast_spectators_count.py +12 -0
  71. gcore/types/streaming/broadcast_update_params.py +76 -0
  72. gcore/types/streaming/clip.py +78 -0
  73. gcore/types/streaming/create_video_param.py +214 -0
  74. gcore/types/streaming/direct_upload_parameters.py +33 -0
  75. gcore/types/streaming/directories_tree.py +19 -0
  76. gcore/types/streaming/directory_base.py +31 -0
  77. gcore/types/streaming/directory_create_params.py +15 -0
  78. gcore/types/streaming/directory_get_response.py +19 -0
  79. gcore/types/streaming/directory_item.py +13 -0
  80. gcore/types/streaming/directory_update_params.py +18 -0
  81. gcore/types/streaming/directory_video.py +13 -0
  82. gcore/types/streaming/ffprobes.py +25 -0
  83. gcore/types/streaming/max_stream_series.py +21 -0
  84. gcore/types/streaming/meet_series.py +23 -0
  85. gcore/types/streaming/player.py +114 -0
  86. gcore/types/streaming/player_create_params.py +18 -0
  87. gcore/types/streaming/player_list_params.py +12 -0
  88. gcore/types/streaming/player_param.py +114 -0
  89. gcore/types/streaming/player_update_params.py +18 -0
  90. gcore/types/streaming/playlist.py +102 -0
  91. gcore/types/streaming/playlist_create.py +12 -0
  92. gcore/types/streaming/playlist_create_params.py +102 -0
  93. gcore/types/streaming/playlist_list_params.py +12 -0
  94. gcore/types/streaming/playlist_list_videos_response.py +10 -0
  95. gcore/types/streaming/playlist_update_params.py +102 -0
  96. gcore/types/streaming/playlist_video.py +215 -0
  97. gcore/types/streaming/popular_videos.py +17 -0
  98. gcore/types/streaming/quality_set_set_default_params.py +23 -0
  99. gcore/types/streaming/quality_sets.py +57 -0
  100. gcore/types/streaming/restream.py +37 -0
  101. gcore/types/streaming/restream_create_params.py +41 -0
  102. gcore/types/streaming/restream_list_params.py +12 -0
  103. gcore/types/streaming/restream_update_params.py +41 -0
  104. gcore/types/streaming/statistic_get_ffprobes_params.py +22 -0
  105. gcore/types/streaming/statistic_get_live_unique_viewers_params.py +26 -0
  106. gcore/types/streaming/statistic_get_live_unique_viewers_response.py +25 -0
  107. gcore/types/streaming/statistic_get_live_watch_time_cdn_params.py +32 -0
  108. gcore/types/streaming/statistic_get_live_watch_time_total_cdn_params.py +30 -0
  109. gcore/types/streaming/statistic_get_max_streams_series_params.py +20 -0
  110. gcore/types/streaming/statistic_get_meet_series_params.py +20 -0
  111. gcore/types/streaming/statistic_get_popular_videos_params.py +15 -0
  112. gcore/types/streaming/statistic_get_storage_series_params.py +20 -0
  113. gcore/types/streaming/statistic_get_stream_series_params.py +20 -0
  114. gcore/types/streaming/statistic_get_unique_viewers_cdn_params.py +27 -0
  115. gcore/types/streaming/statistic_get_unique_viewers_params.py +34 -0
  116. gcore/types/streaming/statistic_get_views_by_browsers_params.py +15 -0
  117. gcore/types/streaming/statistic_get_views_by_country_params.py +15 -0
  118. gcore/types/streaming/statistic_get_views_by_hostname_params.py +15 -0
  119. gcore/types/streaming/statistic_get_views_by_operating_system_params.py +15 -0
  120. gcore/types/streaming/statistic_get_views_by_referer_params.py +15 -0
  121. gcore/types/streaming/statistic_get_views_by_region_params.py +15 -0
  122. gcore/types/streaming/statistic_get_views_heatmap_params.py +21 -0
  123. gcore/types/streaming/statistic_get_views_params.py +34 -0
  124. gcore/types/streaming/statistic_get_vod_storage_volume_params.py +17 -0
  125. gcore/types/streaming/statistic_get_vod_transcoding_duration_params.py +17 -0
  126. gcore/types/streaming/statistic_get_vod_unique_viewers_cdn_params.py +26 -0
  127. gcore/types/streaming/statistic_get_vod_watch_time_cdn_params.py +32 -0
  128. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_params.py +30 -0
  129. gcore/types/streaming/statistic_get_vod_watch_time_total_cdn_response.py +22 -0
  130. gcore/types/streaming/storage_series.py +23 -0
  131. gcore/types/streaming/stream.py +420 -0
  132. gcore/types/streaming/stream_create_clip_params.py +48 -0
  133. gcore/types/streaming/stream_create_params.py +165 -0
  134. gcore/types/streaming/stream_list_clips_response.py +10 -0
  135. gcore/types/streaming/stream_list_params.py +18 -0
  136. gcore/types/streaming/stream_series.py +21 -0
  137. gcore/types/streaming/stream_start_recording_response.py +76 -0
  138. gcore/types/streaming/stream_update_params.py +169 -0
  139. gcore/types/streaming/streams/__init__.py +11 -0
  140. gcore/types/streaming/streams/overlay.py +43 -0
  141. gcore/types/streaming/streams/overlay_create_params.py +36 -0
  142. gcore/types/streaming/streams/overlay_create_response.py +10 -0
  143. gcore/types/streaming/streams/overlay_list_response.py +10 -0
  144. gcore/types/streaming/streams/overlay_update_multiple_params.py +39 -0
  145. gcore/types/streaming/streams/overlay_update_multiple_response.py +10 -0
  146. gcore/types/streaming/streams/overlay_update_params.py +33 -0
  147. gcore/types/streaming/subtitle.py +12 -0
  148. gcore/types/streaming/subtitle_base.py +18 -0
  149. gcore/types/streaming/subtitle_base_param.py +18 -0
  150. gcore/types/streaming/unique_viewers.py +35 -0
  151. gcore/types/streaming/unique_viewers_cdn.py +17 -0
  152. gcore/types/streaming/video.py +444 -0
  153. gcore/types/streaming/video_create_multiple_params.py +28 -0
  154. gcore/types/streaming/video_create_multiple_response.py +10 -0
  155. gcore/types/streaming/video_create_params.py +13 -0
  156. gcore/types/streaming/video_create_response.py +10 -0
  157. gcore/types/streaming/video_list_names_params.py +13 -0
  158. gcore/types/streaming/video_list_params.py +59 -0
  159. gcore/types/streaming/video_update_params.py +214 -0
  160. gcore/types/streaming/videos/__init__.py +7 -0
  161. gcore/types/streaming/videos/subtitle_create_params.py +17 -0
  162. gcore/types/streaming/videos/subtitle_list_response.py +10 -0
  163. gcore/types/streaming/videos/subtitle_update_params.py +20 -0
  164. gcore/types/streaming/views.py +35 -0
  165. gcore/types/streaming/views_by_browser.py +17 -0
  166. gcore/types/streaming/views_by_country.py +19 -0
  167. gcore/types/streaming/views_by_hostname.py +17 -0
  168. gcore/types/streaming/views_by_operating_system.py +17 -0
  169. gcore/types/streaming/views_by_referer.py +17 -0
  170. gcore/types/streaming/views_by_region.py +19 -0
  171. gcore/types/streaming/views_heatmap.py +19 -0
  172. gcore/types/streaming/vod_statistics_series.py +21 -0
  173. gcore/types/streaming/vod_total_stream_duration_series.py +22 -0
  174. gcore/types/waap/domains/custom_rule_create_params.py +4 -4
  175. gcore/types/waap/domains/custom_rule_update_params.py +4 -4
  176. gcore/types/waap/ip_info_get_blocked_requests_params.py +5 -1
  177. gcore/types/waap/ip_info_get_counts_params.py +2 -1
  178. gcore/types/waap/ip_info_get_top_sessions_params.py +5 -1
  179. gcore/types/waap/ip_info_get_top_urls_params.py +5 -1
  180. gcore/types/waap/ip_info_get_top_user_agents_params.py +5 -1
  181. gcore/types/waap/waap_custom_rule.py +4 -4
  182. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/METADATA +1 -1
  183. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/RECORD +185 -37
  184. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/WHEEL +0 -0
  185. {gcore-0.6.0.dist-info → gcore-0.8.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,716 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable
6
+
7
+ import httpx
8
+
9
+ from ...._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
10
+ from ...._utils import maybe_transform, async_maybe_transform
11
+ from ...._compat import cached_property
12
+ from ...._resource import SyncAPIResource, AsyncAPIResource
13
+ from ...._response import (
14
+ to_raw_response_wrapper,
15
+ to_streamed_response_wrapper,
16
+ async_to_raw_response_wrapper,
17
+ async_to_streamed_response_wrapper,
18
+ )
19
+ from ...._base_client import make_request_options
20
+ from ....types.streaming.streams import overlay_create_params, overlay_update_params, overlay_update_multiple_params
21
+ from ....types.streaming.streams.overlay import Overlay
22
+ from ....types.streaming.streams.overlay_list_response import OverlayListResponse
23
+ from ....types.streaming.streams.overlay_create_response import OverlayCreateResponse
24
+ from ....types.streaming.streams.overlay_update_multiple_response import OverlayUpdateMultipleResponse
25
+
26
+ __all__ = ["OverlaysResource", "AsyncOverlaysResource"]
27
+
28
+
29
+ class OverlaysResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> OverlaysResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
37
+ """
38
+ return OverlaysResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> OverlaysResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
46
+ """
47
+ return OverlaysResourceWithStreamingResponse(self)
48
+
49
+ def create(
50
+ self,
51
+ stream_id: int,
52
+ *,
53
+ body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN,
54
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
55
+ # The extra values given here take precedence over values defined on the client or passed to this method.
56
+ extra_headers: Headers | None = None,
57
+ extra_query: Query | None = None,
58
+ extra_body: Body | None = None,
59
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
60
+ ) -> OverlayCreateResponse:
61
+ """
62
+ "Overlay" is a live HTML widget, which rendered and inserted over the live
63
+ stream.
64
+
65
+ There are can be more that 1 overlay over a stream, which are small or stretched
66
+ over full frame. Overlays can have transparent areas. Frequency of update is 1
67
+ FPS. Automatic size scaling for Adaptative Bitrate qualities is applied.
68
+ ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`coffee_run_overlays`.gif)
69
+
70
+ How to activate and use in simple steps:
71
+
72
+ - Activate feature on your account, ask the Support Team
73
+ - Set “`html_overlay`” attribute to "true" for a stream
74
+ - Set array of overlays
75
+ - Start or restart your stream again
76
+ - Enjoy :-) For the first time an overlay should be enabled **before** start
77
+ pushing of a live stream. If you are pushing the stream already (stream is
78
+ alive and you are activating overlay for the first time), then overlay will
79
+ become active after restart pushing. Once you activate the overlay for the
80
+ stream for the first time, you can add, change, move, delete widgets on the
81
+ fly even during a live stream with no affection on a result stream.
82
+
83
+ Tech limits:
84
+
85
+ - Max original stream resolution = FullHD.
86
+ - It is necessary that all widgets must fit into the original frame of the
87
+ source stream (width x height). If one of the widgets does not fit into the
88
+ original frame, for example, goes 1 pixel beyond the frame, then all widgets
89
+ will be hidden.
90
+ - Attributes of overlays:
91
+ - url – should be valid http/https url
92
+ - 0 < width <= 1920
93
+ - 0 < height <= 1080
94
+ - 0 <= x < 1920
95
+ - 0 <= y < 1080
96
+ - stretch – stretch to full frame. Cannot be used with positioning attributes.
97
+ - HTML widget can be access by HTTP 80 or HTTPS 443 ports.
98
+ - HTML page code at the "url" link is read once when starting the stream only.
99
+ For dynamically updating widgets, you must use either dynamic code via
100
+ JavaScript or cause a page refresh via HTML meta tag
101
+ <meta http-equiv="refresh" content="N">.
102
+ - Widgets can contain scripts, but they must be lightweight and using small
103
+ amount memory, CPU, and bandwidth. It is prohibited to run heavy scripts,
104
+ create a heavy load on the network, or run other heavy modules. Such widgets
105
+ can be stopped automatically, and the ability to insert widgets itself is
106
+ banned.
107
+ - If feature is disabled, you will receive HTTP code: 422. Error text: Feature
108
+ disabled. Contact support to enable. Please, pay attention to the content of
109
+ HTML widges you use. If you don't trust them, then you shouldn't use them, as
110
+ their result will be displayed in live stream to all users. **Will there be a
111
+ widget in the recording?** Right now overlay widgets are sent to the end
112
+ viewer in the HLS/DASH streams, but are not recorded due to technical
113
+ limitations. We are working to ensure that widgets remain in the recordings as
114
+ well. Follow the news.
115
+
116
+ Args:
117
+ extra_headers: Send extra headers
118
+
119
+ extra_query: Add additional query parameters to the request
120
+
121
+ extra_body: Add additional JSON properties to the request
122
+
123
+ timeout: Override the client-level default timeout for this request, in seconds
124
+ """
125
+ return self._post(
126
+ f"/streaming/streams/{stream_id}/overlays",
127
+ body=maybe_transform(body, Iterable[overlay_create_params.Body]),
128
+ options=make_request_options(
129
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
130
+ ),
131
+ cast_to=OverlayCreateResponse,
132
+ )
133
+
134
+ def update(
135
+ self,
136
+ overlay_id: int,
137
+ *,
138
+ stream_id: int,
139
+ height: int | NotGiven = NOT_GIVEN,
140
+ stretch: bool | NotGiven = NOT_GIVEN,
141
+ url: str | NotGiven = NOT_GIVEN,
142
+ width: int | NotGiven = NOT_GIVEN,
143
+ x: int | NotGiven = NOT_GIVEN,
144
+ y: int | NotGiven = NOT_GIVEN,
145
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
146
+ # The extra values given here take precedence over values defined on the client or passed to this method.
147
+ extra_headers: Headers | None = None,
148
+ extra_query: Query | None = None,
149
+ extra_body: Body | None = None,
150
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
151
+ ) -> Overlay:
152
+ """
153
+ Updates overlay's settings
154
+
155
+ Args:
156
+ height: Height of the widget
157
+
158
+ stretch: Switch of auto scaling the widget. Must not be used as "true" simultaneously
159
+ with the coordinate installation method (w, h, x, y).
160
+
161
+ url: Valid http/https URL to an HTML page/widget
162
+
163
+ width: Width of the widget
164
+
165
+ x: Coordinate of left upper corner
166
+
167
+ y: Coordinate of left upper corner
168
+
169
+ extra_headers: Send extra headers
170
+
171
+ extra_query: Add additional query parameters to the request
172
+
173
+ extra_body: Add additional JSON properties to the request
174
+
175
+ timeout: Override the client-level default timeout for this request, in seconds
176
+ """
177
+ return self._patch(
178
+ f"/streaming/streams/{stream_id}/overlays/{overlay_id}",
179
+ body=maybe_transform(
180
+ {
181
+ "height": height,
182
+ "stretch": stretch,
183
+ "url": url,
184
+ "width": width,
185
+ "x": x,
186
+ "y": y,
187
+ },
188
+ overlay_update_params.OverlayUpdateParams,
189
+ ),
190
+ options=make_request_options(
191
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
192
+ ),
193
+ cast_to=Overlay,
194
+ )
195
+
196
+ def list(
197
+ self,
198
+ stream_id: int,
199
+ *,
200
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
201
+ # The extra values given here take precedence over values defined on the client or passed to this method.
202
+ extra_headers: Headers | None = None,
203
+ extra_query: Query | None = None,
204
+ extra_body: Body | None = None,
205
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
206
+ ) -> OverlayListResponse:
207
+ """
208
+ Returns a list of HTML overlay widgets which are attached to a stream
209
+
210
+ Args:
211
+ extra_headers: Send extra headers
212
+
213
+ extra_query: Add additional query parameters to the request
214
+
215
+ extra_body: Add additional JSON properties to the request
216
+
217
+ timeout: Override the client-level default timeout for this request, in seconds
218
+ """
219
+ return self._get(
220
+ f"/streaming/streams/{stream_id}/overlays",
221
+ options=make_request_options(
222
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
223
+ ),
224
+ cast_to=OverlayListResponse,
225
+ )
226
+
227
+ def delete(
228
+ self,
229
+ overlay_id: int,
230
+ *,
231
+ stream_id: int,
232
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
233
+ # The extra values given here take precedence over values defined on the client or passed to this method.
234
+ extra_headers: Headers | None = None,
235
+ extra_query: Query | None = None,
236
+ extra_body: Body | None = None,
237
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
238
+ ) -> None:
239
+ """
240
+ Delete an overlay
241
+
242
+ Args:
243
+ extra_headers: Send extra headers
244
+
245
+ extra_query: Add additional query parameters to the request
246
+
247
+ extra_body: Add additional JSON properties to the request
248
+
249
+ timeout: Override the client-level default timeout for this request, in seconds
250
+ """
251
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
252
+ return self._delete(
253
+ f"/streaming/streams/{stream_id}/overlays/{overlay_id}",
254
+ options=make_request_options(
255
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
256
+ ),
257
+ cast_to=NoneType,
258
+ )
259
+
260
+ def get(
261
+ self,
262
+ overlay_id: int,
263
+ *,
264
+ stream_id: int,
265
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
266
+ # The extra values given here take precedence over values defined on the client or passed to this method.
267
+ extra_headers: Headers | None = None,
268
+ extra_query: Query | None = None,
269
+ extra_body: Body | None = None,
270
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
271
+ ) -> Overlay:
272
+ """
273
+ Returns overlay details
274
+
275
+ Args:
276
+ extra_headers: Send extra headers
277
+
278
+ extra_query: Add additional query parameters to the request
279
+
280
+ extra_body: Add additional JSON properties to the request
281
+
282
+ timeout: Override the client-level default timeout for this request, in seconds
283
+ """
284
+ return self._get(
285
+ f"/streaming/streams/{stream_id}/overlays/{overlay_id}",
286
+ options=make_request_options(
287
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
288
+ ),
289
+ cast_to=Overlay,
290
+ )
291
+
292
+ def update_multiple(
293
+ self,
294
+ stream_id: int,
295
+ *,
296
+ body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN,
297
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
298
+ # The extra values given here take precedence over values defined on the client or passed to this method.
299
+ extra_headers: Headers | None = None,
300
+ extra_query: Query | None = None,
301
+ extra_body: Body | None = None,
302
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
303
+ ) -> OverlayUpdateMultipleResponse:
304
+ """
305
+ Updates settings for set of overlays
306
+
307
+ Args:
308
+ extra_headers: Send extra headers
309
+
310
+ extra_query: Add additional query parameters to the request
311
+
312
+ extra_body: Add additional JSON properties to the request
313
+
314
+ timeout: Override the client-level default timeout for this request, in seconds
315
+ """
316
+ return self._patch(
317
+ f"/streaming/streams/{stream_id}/overlays",
318
+ body=maybe_transform(body, Iterable[overlay_update_multiple_params.Body]),
319
+ options=make_request_options(
320
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
321
+ ),
322
+ cast_to=OverlayUpdateMultipleResponse,
323
+ )
324
+
325
+
326
+ class AsyncOverlaysResource(AsyncAPIResource):
327
+ @cached_property
328
+ def with_raw_response(self) -> AsyncOverlaysResourceWithRawResponse:
329
+ """
330
+ This property can be used as a prefix for any HTTP method call to return
331
+ the raw response object instead of the parsed content.
332
+
333
+ For more information, see https://www.github.com/G-Core/gcore-python#accessing-raw-response-data-eg-headers
334
+ """
335
+ return AsyncOverlaysResourceWithRawResponse(self)
336
+
337
+ @cached_property
338
+ def with_streaming_response(self) -> AsyncOverlaysResourceWithStreamingResponse:
339
+ """
340
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
341
+
342
+ For more information, see https://www.github.com/G-Core/gcore-python#with_streaming_response
343
+ """
344
+ return AsyncOverlaysResourceWithStreamingResponse(self)
345
+
346
+ async def create(
347
+ self,
348
+ stream_id: int,
349
+ *,
350
+ body: Iterable[overlay_create_params.Body] | NotGiven = NOT_GIVEN,
351
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
352
+ # The extra values given here take precedence over values defined on the client or passed to this method.
353
+ extra_headers: Headers | None = None,
354
+ extra_query: Query | None = None,
355
+ extra_body: Body | None = None,
356
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
357
+ ) -> OverlayCreateResponse:
358
+ """
359
+ "Overlay" is a live HTML widget, which rendered and inserted over the live
360
+ stream.
361
+
362
+ There are can be more that 1 overlay over a stream, which are small or stretched
363
+ over full frame. Overlays can have transparent areas. Frequency of update is 1
364
+ FPS. Automatic size scaling for Adaptative Bitrate qualities is applied.
365
+ ![HTML Overlays](https://demo-files.gvideo.io/apidocs/`coffee_run_overlays`.gif)
366
+
367
+ How to activate and use in simple steps:
368
+
369
+ - Activate feature on your account, ask the Support Team
370
+ - Set “`html_overlay`” attribute to "true" for a stream
371
+ - Set array of overlays
372
+ - Start or restart your stream again
373
+ - Enjoy :-) For the first time an overlay should be enabled **before** start
374
+ pushing of a live stream. If you are pushing the stream already (stream is
375
+ alive and you are activating overlay for the first time), then overlay will
376
+ become active after restart pushing. Once you activate the overlay for the
377
+ stream for the first time, you can add, change, move, delete widgets on the
378
+ fly even during a live stream with no affection on a result stream.
379
+
380
+ Tech limits:
381
+
382
+ - Max original stream resolution = FullHD.
383
+ - It is necessary that all widgets must fit into the original frame of the
384
+ source stream (width x height). If one of the widgets does not fit into the
385
+ original frame, for example, goes 1 pixel beyond the frame, then all widgets
386
+ will be hidden.
387
+ - Attributes of overlays:
388
+ - url – should be valid http/https url
389
+ - 0 < width <= 1920
390
+ - 0 < height <= 1080
391
+ - 0 <= x < 1920
392
+ - 0 <= y < 1080
393
+ - stretch – stretch to full frame. Cannot be used with positioning attributes.
394
+ - HTML widget can be access by HTTP 80 or HTTPS 443 ports.
395
+ - HTML page code at the "url" link is read once when starting the stream only.
396
+ For dynamically updating widgets, you must use either dynamic code via
397
+ JavaScript or cause a page refresh via HTML meta tag
398
+ <meta http-equiv="refresh" content="N">.
399
+ - Widgets can contain scripts, but they must be lightweight and using small
400
+ amount memory, CPU, and bandwidth. It is prohibited to run heavy scripts,
401
+ create a heavy load on the network, or run other heavy modules. Such widgets
402
+ can be stopped automatically, and the ability to insert widgets itself is
403
+ banned.
404
+ - If feature is disabled, you will receive HTTP code: 422. Error text: Feature
405
+ disabled. Contact support to enable. Please, pay attention to the content of
406
+ HTML widges you use. If you don't trust them, then you shouldn't use them, as
407
+ their result will be displayed in live stream to all users. **Will there be a
408
+ widget in the recording?** Right now overlay widgets are sent to the end
409
+ viewer in the HLS/DASH streams, but are not recorded due to technical
410
+ limitations. We are working to ensure that widgets remain in the recordings as
411
+ well. Follow the news.
412
+
413
+ Args:
414
+ extra_headers: Send extra headers
415
+
416
+ extra_query: Add additional query parameters to the request
417
+
418
+ extra_body: Add additional JSON properties to the request
419
+
420
+ timeout: Override the client-level default timeout for this request, in seconds
421
+ """
422
+ return await self._post(
423
+ f"/streaming/streams/{stream_id}/overlays",
424
+ body=await async_maybe_transform(body, Iterable[overlay_create_params.Body]),
425
+ options=make_request_options(
426
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
427
+ ),
428
+ cast_to=OverlayCreateResponse,
429
+ )
430
+
431
+ async def update(
432
+ self,
433
+ overlay_id: int,
434
+ *,
435
+ stream_id: int,
436
+ height: int | NotGiven = NOT_GIVEN,
437
+ stretch: bool | NotGiven = NOT_GIVEN,
438
+ url: str | NotGiven = NOT_GIVEN,
439
+ width: int | NotGiven = NOT_GIVEN,
440
+ x: int | NotGiven = NOT_GIVEN,
441
+ y: int | NotGiven = NOT_GIVEN,
442
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
443
+ # The extra values given here take precedence over values defined on the client or passed to this method.
444
+ extra_headers: Headers | None = None,
445
+ extra_query: Query | None = None,
446
+ extra_body: Body | None = None,
447
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
448
+ ) -> Overlay:
449
+ """
450
+ Updates overlay's settings
451
+
452
+ Args:
453
+ height: Height of the widget
454
+
455
+ stretch: Switch of auto scaling the widget. Must not be used as "true" simultaneously
456
+ with the coordinate installation method (w, h, x, y).
457
+
458
+ url: Valid http/https URL to an HTML page/widget
459
+
460
+ width: Width of the widget
461
+
462
+ x: Coordinate of left upper corner
463
+
464
+ y: Coordinate of left upper corner
465
+
466
+ extra_headers: Send extra headers
467
+
468
+ extra_query: Add additional query parameters to the request
469
+
470
+ extra_body: Add additional JSON properties to the request
471
+
472
+ timeout: Override the client-level default timeout for this request, in seconds
473
+ """
474
+ return await self._patch(
475
+ f"/streaming/streams/{stream_id}/overlays/{overlay_id}",
476
+ body=await async_maybe_transform(
477
+ {
478
+ "height": height,
479
+ "stretch": stretch,
480
+ "url": url,
481
+ "width": width,
482
+ "x": x,
483
+ "y": y,
484
+ },
485
+ overlay_update_params.OverlayUpdateParams,
486
+ ),
487
+ options=make_request_options(
488
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
489
+ ),
490
+ cast_to=Overlay,
491
+ )
492
+
493
+ async def list(
494
+ self,
495
+ stream_id: int,
496
+ *,
497
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
498
+ # The extra values given here take precedence over values defined on the client or passed to this method.
499
+ extra_headers: Headers | None = None,
500
+ extra_query: Query | None = None,
501
+ extra_body: Body | None = None,
502
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
503
+ ) -> OverlayListResponse:
504
+ """
505
+ Returns a list of HTML overlay widgets which are attached to a stream
506
+
507
+ Args:
508
+ extra_headers: Send extra headers
509
+
510
+ extra_query: Add additional query parameters to the request
511
+
512
+ extra_body: Add additional JSON properties to the request
513
+
514
+ timeout: Override the client-level default timeout for this request, in seconds
515
+ """
516
+ return await self._get(
517
+ f"/streaming/streams/{stream_id}/overlays",
518
+ options=make_request_options(
519
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
520
+ ),
521
+ cast_to=OverlayListResponse,
522
+ )
523
+
524
+ async def delete(
525
+ self,
526
+ overlay_id: int,
527
+ *,
528
+ stream_id: int,
529
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
530
+ # The extra values given here take precedence over values defined on the client or passed to this method.
531
+ extra_headers: Headers | None = None,
532
+ extra_query: Query | None = None,
533
+ extra_body: Body | None = None,
534
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
535
+ ) -> None:
536
+ """
537
+ Delete an overlay
538
+
539
+ Args:
540
+ extra_headers: Send extra headers
541
+
542
+ extra_query: Add additional query parameters to the request
543
+
544
+ extra_body: Add additional JSON properties to the request
545
+
546
+ timeout: Override the client-level default timeout for this request, in seconds
547
+ """
548
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
549
+ return await self._delete(
550
+ f"/streaming/streams/{stream_id}/overlays/{overlay_id}",
551
+ options=make_request_options(
552
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
553
+ ),
554
+ cast_to=NoneType,
555
+ )
556
+
557
+ async def get(
558
+ self,
559
+ overlay_id: int,
560
+ *,
561
+ stream_id: int,
562
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
563
+ # The extra values given here take precedence over values defined on the client or passed to this method.
564
+ extra_headers: Headers | None = None,
565
+ extra_query: Query | None = None,
566
+ extra_body: Body | None = None,
567
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
568
+ ) -> Overlay:
569
+ """
570
+ Returns overlay details
571
+
572
+ Args:
573
+ extra_headers: Send extra headers
574
+
575
+ extra_query: Add additional query parameters to the request
576
+
577
+ extra_body: Add additional JSON properties to the request
578
+
579
+ timeout: Override the client-level default timeout for this request, in seconds
580
+ """
581
+ return await self._get(
582
+ f"/streaming/streams/{stream_id}/overlays/{overlay_id}",
583
+ options=make_request_options(
584
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
585
+ ),
586
+ cast_to=Overlay,
587
+ )
588
+
589
+ async def update_multiple(
590
+ self,
591
+ stream_id: int,
592
+ *,
593
+ body: Iterable[overlay_update_multiple_params.Body] | NotGiven = NOT_GIVEN,
594
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
595
+ # The extra values given here take precedence over values defined on the client or passed to this method.
596
+ extra_headers: Headers | None = None,
597
+ extra_query: Query | None = None,
598
+ extra_body: Body | None = None,
599
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
600
+ ) -> OverlayUpdateMultipleResponse:
601
+ """
602
+ Updates settings for set of overlays
603
+
604
+ Args:
605
+ extra_headers: Send extra headers
606
+
607
+ extra_query: Add additional query parameters to the request
608
+
609
+ extra_body: Add additional JSON properties to the request
610
+
611
+ timeout: Override the client-level default timeout for this request, in seconds
612
+ """
613
+ return await self._patch(
614
+ f"/streaming/streams/{stream_id}/overlays",
615
+ body=await async_maybe_transform(body, Iterable[overlay_update_multiple_params.Body]),
616
+ options=make_request_options(
617
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
618
+ ),
619
+ cast_to=OverlayUpdateMultipleResponse,
620
+ )
621
+
622
+
623
+ class OverlaysResourceWithRawResponse:
624
+ def __init__(self, overlays: OverlaysResource) -> None:
625
+ self._overlays = overlays
626
+
627
+ self.create = to_raw_response_wrapper(
628
+ overlays.create,
629
+ )
630
+ self.update = to_raw_response_wrapper(
631
+ overlays.update,
632
+ )
633
+ self.list = to_raw_response_wrapper(
634
+ overlays.list,
635
+ )
636
+ self.delete = to_raw_response_wrapper(
637
+ overlays.delete,
638
+ )
639
+ self.get = to_raw_response_wrapper(
640
+ overlays.get,
641
+ )
642
+ self.update_multiple = to_raw_response_wrapper(
643
+ overlays.update_multiple,
644
+ )
645
+
646
+
647
+ class AsyncOverlaysResourceWithRawResponse:
648
+ def __init__(self, overlays: AsyncOverlaysResource) -> None:
649
+ self._overlays = overlays
650
+
651
+ self.create = async_to_raw_response_wrapper(
652
+ overlays.create,
653
+ )
654
+ self.update = async_to_raw_response_wrapper(
655
+ overlays.update,
656
+ )
657
+ self.list = async_to_raw_response_wrapper(
658
+ overlays.list,
659
+ )
660
+ self.delete = async_to_raw_response_wrapper(
661
+ overlays.delete,
662
+ )
663
+ self.get = async_to_raw_response_wrapper(
664
+ overlays.get,
665
+ )
666
+ self.update_multiple = async_to_raw_response_wrapper(
667
+ overlays.update_multiple,
668
+ )
669
+
670
+
671
+ class OverlaysResourceWithStreamingResponse:
672
+ def __init__(self, overlays: OverlaysResource) -> None:
673
+ self._overlays = overlays
674
+
675
+ self.create = to_streamed_response_wrapper(
676
+ overlays.create,
677
+ )
678
+ self.update = to_streamed_response_wrapper(
679
+ overlays.update,
680
+ )
681
+ self.list = to_streamed_response_wrapper(
682
+ overlays.list,
683
+ )
684
+ self.delete = to_streamed_response_wrapper(
685
+ overlays.delete,
686
+ )
687
+ self.get = to_streamed_response_wrapper(
688
+ overlays.get,
689
+ )
690
+ self.update_multiple = to_streamed_response_wrapper(
691
+ overlays.update_multiple,
692
+ )
693
+
694
+
695
+ class AsyncOverlaysResourceWithStreamingResponse:
696
+ def __init__(self, overlays: AsyncOverlaysResource) -> None:
697
+ self._overlays = overlays
698
+
699
+ self.create = async_to_streamed_response_wrapper(
700
+ overlays.create,
701
+ )
702
+ self.update = async_to_streamed_response_wrapper(
703
+ overlays.update,
704
+ )
705
+ self.list = async_to_streamed_response_wrapper(
706
+ overlays.list,
707
+ )
708
+ self.delete = async_to_streamed_response_wrapper(
709
+ overlays.delete,
710
+ )
711
+ self.get = async_to_streamed_response_wrapper(
712
+ overlays.get,
713
+ )
714
+ self.update_multiple = async_to_streamed_response_wrapper(
715
+ overlays.update_multiple,
716
+ )