universal-mcp 0.1.8rc2__py3-none-any.whl → 0.1.8rc3__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.
Files changed (45) hide show
  1. universal_mcp/__init__.py +0 -2
  2. universal_mcp/analytics.py +75 -0
  3. universal_mcp/applications/application.py +27 -5
  4. universal_mcp/applications/calendly/app.py +413 -160
  5. universal_mcp/applications/coda/README.md +133 -0
  6. universal_mcp/applications/coda/__init__.py +0 -0
  7. universal_mcp/applications/coda/app.py +3704 -0
  8. universal_mcp/applications/e2b/app.py +6 -7
  9. universal_mcp/applications/firecrawl/app.py +1 -1
  10. universal_mcp/applications/github/app.py +41 -42
  11. universal_mcp/applications/google_calendar/app.py +20 -20
  12. universal_mcp/applications/google_docs/app.py +22 -29
  13. universal_mcp/applications/google_drive/app.py +53 -59
  14. universal_mcp/applications/google_mail/app.py +40 -40
  15. universal_mcp/applications/google_sheet/app.py +44 -51
  16. universal_mcp/applications/markitdown/app.py +4 -4
  17. universal_mcp/applications/notion/app.py +93 -83
  18. universal_mcp/applications/perplexity/app.py +5 -5
  19. universal_mcp/applications/reddit/app.py +32 -32
  20. universal_mcp/applications/resend/app.py +4 -4
  21. universal_mcp/applications/serpapi/app.py +4 -4
  22. universal_mcp/applications/tavily/app.py +4 -4
  23. universal_mcp/applications/wrike/app.py +566 -226
  24. universal_mcp/applications/youtube/app.py +626 -166
  25. universal_mcp/applications/zenquotes/app.py +3 -3
  26. universal_mcp/exceptions.py +1 -0
  27. universal_mcp/integrations/__init__.py +11 -2
  28. universal_mcp/integrations/integration.py +2 -2
  29. universal_mcp/logger.py +3 -56
  30. universal_mcp/servers/__init__.py +2 -1
  31. universal_mcp/servers/server.py +76 -77
  32. universal_mcp/stores/store.py +5 -3
  33. universal_mcp/tools/__init__.py +1 -1
  34. universal_mcp/tools/adapters.py +4 -1
  35. universal_mcp/tools/func_metadata.py +5 -6
  36. universal_mcp/tools/tools.py +108 -51
  37. universal_mcp/utils/docgen.py +121 -69
  38. universal_mcp/utils/docstring_parser.py +44 -21
  39. universal_mcp/utils/dump_app_tools.py +33 -23
  40. universal_mcp/utils/openapi.py +121 -47
  41. {universal_mcp-0.1.8rc2.dist-info → universal_mcp-0.1.8rc3.dist-info}/METADATA +2 -2
  42. universal_mcp-0.1.8rc3.dist-info/RECORD +75 -0
  43. universal_mcp-0.1.8rc2.dist-info/RECORD +0 -71
  44. {universal_mcp-0.1.8rc2.dist-info → universal_mcp-0.1.8rc3.dist-info}/WHEEL +0 -0
  45. {universal_mcp-0.1.8rc2.dist-info → universal_mcp-0.1.8rc3.dist-info}/entry_points.txt +0 -0
@@ -11,15 +11,15 @@ class YoutubeApp(APIApplication):
11
11
  def __init__(self, integration: Integration = None, **kwargs) -> None:
12
12
  """
13
13
  Initializes an instance of a YouTube application integration.
14
-
14
+
15
15
  Args:
16
16
  integration: An optional Integration object to be used with the YouTube application integration.
17
17
  kwargs: Additional keyword arguments to be passed to the parent class initializer.
18
-
18
+
19
19
  Returns:
20
20
  None
21
21
  """
22
- super().__init__(name='youtube', integration=integration, **kwargs)
22
+ super().__init__(name="youtube", integration=integration, **kwargs)
23
23
  self.base_url = "https://www.googleapis.com/youtube/v3"
24
24
 
25
25
  def _get_headers(self):
@@ -36,11 +36,20 @@ class YoutubeApp(APIApplication):
36
36
  "Authorization": f"Bearer {credentials['access_token']}",
37
37
  "Content-Type": "application/json",
38
38
  }
39
-
40
- def get_jobs_job_reports(self, jobId, createdAfter=None, onBehalfOfContentOwner=None, pageSize=None, pageToken=None, startTimeAtOrAfter=None, startTimeBefore=None) -> Any:
39
+
40
+ def get_jobs_job_reports(
41
+ self,
42
+ jobId,
43
+ createdAfter=None,
44
+ onBehalfOfContentOwner=None,
45
+ pageSize=None,
46
+ pageToken=None,
47
+ startTimeAtOrAfter=None,
48
+ startTimeBefore=None,
49
+ ) -> Any:
41
50
  """
42
51
  Retrieves job reports for a specific job based on provided filters and parameters.
43
-
52
+
44
53
  Args:
45
54
  self: The instance of the class on which the method is being called.
46
55
  jobId: The unique identifier for the job whose reports are to be retrieved.
@@ -50,28 +59,41 @@ class YoutubeApp(APIApplication):
50
59
  pageToken: Optional; a token identifying the page of results to return.
51
60
  startTimeAtOrAfter: Optional; filter to include only reports starting at or after this date-time (ISO 8601 format).
52
61
  startTimeBefore: Optional; filter to include only reports with a start time before this date-time (ISO 8601 format).
53
-
62
+
54
63
  Returns:
55
64
  A JSON object containing the job reports matching the provided criteria.
56
65
  """
57
66
  if jobId is None:
58
67
  raise ValueError("Missing required parameter 'jobId'")
59
68
  url = f"{self.base_url}/v1/jobs/{jobId}/reports"
60
- query_params = {k: v for k, v in [('createdAfter', createdAfter), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('pageSize', pageSize), ('pageToken', pageToken), ('startTimeAtOrAfter', startTimeAtOrAfter), ('startTimeBefore', startTimeBefore)] if v is not None}
69
+ query_params = {
70
+ k: v
71
+ for k, v in [
72
+ ("createdAfter", createdAfter),
73
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
74
+ ("pageSize", pageSize),
75
+ ("pageToken", pageToken),
76
+ ("startTimeAtOrAfter", startTimeAtOrAfter),
77
+ ("startTimeBefore", startTimeBefore),
78
+ ]
79
+ if v is not None
80
+ }
61
81
  response = self._get(url, params=query_params)
62
82
  response.raise_for_status()
63
83
  return response.json()
64
84
 
65
- def get_jobs_job_reports_report(self, jobId, reportId, onBehalfOfContentOwner=None) -> Any:
85
+ def get_jobs_job_reports_report(
86
+ self, jobId, reportId, onBehalfOfContentOwner=None
87
+ ) -> Any:
66
88
  """
67
89
  Retrieves a report for a specified job using the jobId and reportId.
68
-
90
+
69
91
  Args:
70
92
  self: The instance of the class on which this method is called.
71
93
  jobId: The unique identifier for the job associated with the report.
72
94
  reportId: The unique identifier for the report to retrieve.
73
95
  onBehalfOfContentOwner: Optional; if specified, the request is performed on behalf of the content owner associated with this parameter.
74
-
96
+
75
97
  Returns:
76
98
  A JSON object containing the details of the requested report.
77
99
  """
@@ -80,7 +102,11 @@ class YoutubeApp(APIApplication):
80
102
  if reportId is None:
81
103
  raise ValueError("Missing required parameter 'reportId'")
82
104
  url = f"{self.base_url}/v1/jobs/{jobId}/reports/{reportId}"
83
- query_params = {k: v for k, v in [('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
105
+ query_params = {
106
+ k: v
107
+ for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
108
+ if v is not None
109
+ }
84
110
  response = self._get(url, params=query_params)
85
111
  response.raise_for_status()
86
112
  return response.json()
@@ -88,37 +114,56 @@ class YoutubeApp(APIApplication):
88
114
  def delete_jobs_job(self, jobId, onBehalfOfContentOwner=None) -> Any:
89
115
  """
90
116
  Deletes a job with the specified job ID, optionally acting on behalf of a content owner.
91
-
117
+
92
118
  Args:
93
119
  jobId: The unique identifier of the job to be deleted. Must not be None.
94
120
  onBehalfOfContentOwner: Optional. The ID of the content owner on whose behalf the request is made.
95
-
121
+
96
122
  Returns:
97
123
  Returns the JSON response of the delete operation as a Python dictionary.
98
124
  """
99
125
  if jobId is None:
100
126
  raise ValueError("Missing required parameter 'jobId'")
101
127
  url = f"{self.base_url}/v1/jobs/{jobId}"
102
- query_params = {k: v for k, v in [('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
128
+ query_params = {
129
+ k: v
130
+ for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
131
+ if v is not None
132
+ }
103
133
  response = self._delete(url, params=query_params)
104
134
  response.raise_for_status()
105
135
  return response.json()
106
136
 
107
- def get_jobs(self, includeSystemManaged=None, onBehalfOfContentOwner=None, pageSize=None, pageToken=None) -> Any:
137
+ def get_jobs(
138
+ self,
139
+ includeSystemManaged=None,
140
+ onBehalfOfContentOwner=None,
141
+ pageSize=None,
142
+ pageToken=None,
143
+ ) -> Any:
108
144
  """
109
145
  Retrieves a list of jobs from the server, optionally filtering by specified query parameters.
110
-
146
+
111
147
  Args:
112
148
  includeSystemManaged: Optional; a boolean indicating whether to include system managed jobs in the result.
113
149
  onBehalfOfContentOwner: Optional; a string representing the content owner on behalf of which the request is made.
114
150
  pageSize: Optional; an integer specifying the number of jobs to return per page.
115
151
  pageToken: Optional; a string representing the token to specify the start of the page for paginated results.
116
-
152
+
117
153
  Returns:
118
154
  A JSON-decoded response containing the list of jobs and related metadata.
119
155
  """
120
156
  url = f"{self.base_url}/v1/jobs"
121
- query_params = {k: v for k, v in [('includeSystemManaged', includeSystemManaged), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('pageSize', pageSize), ('pageToken', pageToken)] if v is not None}
157
+ query_params = {
158
+ k: v
159
+ for k, v in [
160
+ ("includeSystemManaged", includeSystemManaged),
161
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
162
+ ("pageSize", pageSize),
163
+ ("pageToken", pageToken),
164
+ ]
165
+ if v is not None
166
+ }
122
167
  response = self._get(url, params=query_params)
123
168
  response.raise_for_status()
124
169
  return response.json()
@@ -126,10 +171,10 @@ class YoutubeApp(APIApplication):
126
171
  def get_media_resource_name(self, resourceName) -> Any:
127
172
  """
128
173
  Retrieves a media resource by name and returns its JSON representation.
129
-
174
+
130
175
  Args:
131
176
  resourceName: The name of the media resource to be retrieved. Cannot be None.
132
-
177
+
133
178
  Returns:
134
179
  The JSON representation of the media resource.
135
180
  """
@@ -141,61 +186,97 @@ class YoutubeApp(APIApplication):
141
186
  response.raise_for_status()
142
187
  return response.json()
143
188
 
144
- def get_reporttypes(self, includeSystemManaged=None, onBehalfOfContentOwner=None, pageSize=None, pageToken=None) -> Any:
189
+ def get_reporttypes(
190
+ self,
191
+ includeSystemManaged=None,
192
+ onBehalfOfContentOwner=None,
193
+ pageSize=None,
194
+ pageToken=None,
195
+ ) -> Any:
145
196
  """
146
197
  Retrieves a list of report types from the API with optional filtering and pagination.
147
-
198
+
148
199
  Args:
149
200
  includeSystemManaged: Optional; a boolean flag indicating if system-managed report types should be included.
150
201
  onBehalfOfContentOwner: Optional; a string that specifies the content owner for whom the user is acting on behalf of.
151
202
  pageSize: Optional; an integer that defines the number of results to return per page.
152
203
  pageToken: Optional; a string token that indicates a specific page of results to retrieve.
153
-
204
+
154
205
  Returns:
155
206
  A JSON object containing the list of report types available from the API.
156
207
  """
157
208
  url = f"{self.base_url}/v1/reportTypes"
158
- query_params = {k: v for k, v in [('includeSystemManaged', includeSystemManaged), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('pageSize', pageSize), ('pageToken', pageToken)] if v is not None}
209
+ query_params = {
210
+ k: v
211
+ for k, v in [
212
+ ("includeSystemManaged", includeSystemManaged),
213
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
214
+ ("pageSize", pageSize),
215
+ ("pageToken", pageToken),
216
+ ]
217
+ if v is not None
218
+ }
159
219
  response = self._get(url, params=query_params)
160
220
  response.raise_for_status()
161
221
  return response.json()
162
222
 
163
- def delete_captions(self, id=None, onBehalfOf=None, onBehalfOfContentOwner=None) -> Any:
223
+ def delete_captions(
224
+ self, id=None, onBehalfOf=None, onBehalfOfContentOwner=None
225
+ ) -> Any:
164
226
  """
165
227
  Deletes captions from a specified resource.
166
-
228
+
167
229
  Args:
168
230
  id: Optional; the unique identifier for the caption resource to delete.
169
231
  onBehalfOf: Optional; a parameter to identify the user for whom the request is made.
170
232
  onBehalfOfContentOwner: Optional; a parameter to specify the content owner for whom the request is made.
171
-
233
+
172
234
  Returns:
173
235
  Returns the response JSON object after deleting the caption resource.
174
236
  """
175
237
  url = f"{self.base_url}/captions"
176
- query_params = {k: v for k, v in [('id', id), ('onBehalfOf', onBehalfOf), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
238
+ query_params = {
239
+ k: v
240
+ for k, v in [
241
+ ("id", id),
242
+ ("onBehalfOf", onBehalfOf),
243
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
244
+ ]
245
+ if v is not None
246
+ }
177
247
  response = self._delete(url, params=query_params)
178
248
  response.raise_for_status()
179
249
  return response.json()
180
250
 
181
- def get_captions(self, id, onBehalfOf=None, onBehalfOfContentOwner=None, tfmt=None, tlang=None) -> Any:
251
+ def get_captions(
252
+ self, id, onBehalfOf=None, onBehalfOfContentOwner=None, tfmt=None, tlang=None
253
+ ) -> Any:
182
254
  """
183
255
  Retrieves captions for a specified video by its ID, optionally allowing additional query customizations.
184
-
256
+
185
257
  Args:
186
258
  id: The unique identifier for the video whose captions are to be retrieved. This parameter is mandatory.
187
259
  onBehalfOf: The ID of the user on whose behalf the request is made. Defaults to None.
188
260
  onBehalfOfContentOwner: The ID of the content owner on whose behalf the request is made. Defaults to None.
189
261
  tfmt: The format of the caption track, such as 'srt' or 'ttml'. Defaults to None.
190
262
  tlang: The language of the caption track, specified as a language code. Defaults to None.
191
-
263
+
192
264
  Returns:
193
265
  A JSON object containing the captions data for the specified video.
194
266
  """
195
267
  if id is None:
196
268
  raise ValueError("Missing required parameter 'id'")
197
269
  url = f"{self.base_url}/captions/{id}"
198
- query_params = {k: v for k, v in [('onBehalfOf', onBehalfOf), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('tfmt', tfmt), ('tlang', tlang)] if v is not None}
270
+ query_params = {
271
+ k: v
272
+ for k, v in [
273
+ ("onBehalfOf", onBehalfOf),
274
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
275
+ ("tfmt", tfmt),
276
+ ("tlang", tlang),
277
+ ]
278
+ if v is not None
279
+ }
199
280
  response = self._get(url, params=query_params)
200
281
  response.raise_for_status()
201
282
  return response.json()
@@ -203,15 +284,15 @@ class YoutubeApp(APIApplication):
203
284
  def delete_comments(self, id=None) -> Any:
204
285
  """
205
286
  Deletes a comment or comments from the server based on the specified ID.
206
-
287
+
207
288
  Args:
208
289
  id: Optional ID of the comment to be deleted. If not provided, and based on implementation, all comments may be deleted.
209
-
290
+
210
291
  Returns:
211
292
  The JSON response from the server after attempting to delete the comment(s).
212
293
  """
213
294
  url = f"{self.base_url}/comments"
214
- query_params = {k: v for k, v in [('id', id)] if v is not None}
295
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
215
296
  response = self._delete(url, params=query_params)
216
297
  response.raise_for_status()
217
298
  return response.json()
@@ -219,79 +300,125 @@ class YoutubeApp(APIApplication):
219
300
  def add_comments_mark_as_spam(self, id=None) -> Any:
220
301
  """
221
302
  Marks a comment as spam by sending a POST request to the specified API endpoint.
222
-
303
+
223
304
  Args:
224
305
  id: Optional; the unique identifier of the comment to be marked as spam. If not provided, no specific comment ID is included in the request parameters.
225
-
306
+
226
307
  Returns:
227
308
  The JSON response from the API containing the result of the mark-as-spam operation.
228
309
  """
229
310
  url = f"{self.base_url}/comments/markAsSpam"
230
- query_params = {k: v for k, v in [('id', id)] if v is not None}
311
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
231
312
  response = self._post(url, data={}, params=query_params)
232
313
  response.raise_for_status()
233
314
  return response.json()
234
315
 
235
- def add_comments_set_moderation_status(self, banAuthor=None, id=None, moderationStatus=None) -> Any:
316
+ def add_comments_set_moderation_status(
317
+ self, banAuthor=None, id=None, moderationStatus=None
318
+ ) -> Any:
236
319
  """
237
320
  Sets the moderation status for a comment and optionally bans the author.
238
-
321
+
239
322
  Args:
240
323
  banAuthor: Optional; a boolean indicating whether to ban the author of the comment.
241
324
  id: Optional; a string representing the unique identifier of the comment to be moderated.
242
325
  moderationStatus: Optional; a string specifying the desired moderation status for the comment, such as 'approved', 'rejected', etc.
243
-
326
+
244
327
  Returns:
245
328
  A JSON object containing the response from the server after attempting to set the moderation status for the specified comment.
246
329
  """
247
330
  url = f"{self.base_url}/comments/setModerationStatus"
248
- query_params = {k: v for k, v in [('banAuthor', banAuthor), ('id', id), ('moderationStatus', moderationStatus)] if v is not None}
331
+ query_params = {
332
+ k: v
333
+ for k, v in [
334
+ ("banAuthor", banAuthor),
335
+ ("id", id),
336
+ ("moderationStatus", moderationStatus),
337
+ ]
338
+ if v is not None
339
+ }
249
340
  response = self._post(url, data={}, params=query_params)
250
341
  response.raise_for_status()
251
342
  return response.json()
252
343
 
253
- def delete_live_broadcasts(self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None) -> Any:
344
+ def delete_live_broadcasts(
345
+ self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None
346
+ ) -> Any:
254
347
  """
255
348
  Deletes live broadcasts from a platform using specified query parameters.
256
-
349
+
257
350
  Args:
258
351
  id: Optional; The unique identifier for the live broadcast to delete.
259
352
  onBehalfOfContentOwner: Optional; The content owner on whose behalf the API request is being made.
260
353
  onBehalfOfContentOwnerChannel: Optional; The channel ID associated with the content owner.
261
-
354
+
262
355
  Returns:
263
356
  A JSON object containing the server's response to the delete request.
264
357
  """
265
358
  url = f"{self.base_url}/liveBroadcasts"
266
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('onBehalfOfContentOwnerChannel', onBehalfOfContentOwnerChannel)] if v is not None}
359
+ query_params = {
360
+ k: v
361
+ for k, v in [
362
+ ("id", id),
363
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
364
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
365
+ ]
366
+ if v is not None
367
+ }
267
368
  response = self._delete(url, params=query_params)
268
369
  response.raise_for_status()
269
370
  return response.json()
270
371
 
271
- def add_live_broadcasts_bind(self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None, part=None, streamId=None) -> Any:
372
+ def add_live_broadcasts_bind(
373
+ self,
374
+ id=None,
375
+ onBehalfOfContentOwner=None,
376
+ onBehalfOfContentOwnerChannel=None,
377
+ part=None,
378
+ streamId=None,
379
+ ) -> Any:
272
380
  """
273
381
  Binds a live broadcast to a stream on YouTube, using specified parameters to authenticate and identify the broadcast and stream.
274
-
382
+
275
383
  Args:
276
384
  id: Optional; str. The id of the live broadcast to bind.
277
385
  onBehalfOfContentOwner: Optional; str. The YouTube CMS content owner on behalf of whom the operation is performed.
278
386
  onBehalfOfContentOwnerChannel: Optional; str. The YouTube channel ID for which the live broadcast is operated, on behalf of a content owner.
279
387
  part: Optional; str. The part parameter specifies a comma-separated list of one or more liveBroadcast resource properties that the API response will include.
280
388
  streamId: Optional; str. The id of the stream to which the live broadcast is to be bound.
281
-
389
+
282
390
  Returns:
283
391
  The JSON response object from the YouTube API after attempting to bind the live broadcast to the stream.
284
392
  """
285
393
  url = f"{self.base_url}/liveBroadcasts/bind"
286
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('onBehalfOfContentOwnerChannel', onBehalfOfContentOwnerChannel), ('part', part), ('streamId', streamId)] if v is not None}
394
+ query_params = {
395
+ k: v
396
+ for k, v in [
397
+ ("id", id),
398
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
399
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
400
+ ("part", part),
401
+ ("streamId", streamId),
402
+ ]
403
+ if v is not None
404
+ }
287
405
  response = self._post(url, data={}, params=query_params)
288
406
  response.raise_for_status()
289
407
  return response.json()
290
408
 
291
- def add_live_broadcasts_control(self, displaySlate=None, id=None, offsetTimeMs=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None, part=None, walltime=None) -> Any:
409
+ def add_live_broadcasts_control(
410
+ self,
411
+ displaySlate=None,
412
+ id=None,
413
+ offsetTimeMs=None,
414
+ onBehalfOfContentOwner=None,
415
+ onBehalfOfContentOwnerChannel=None,
416
+ part=None,
417
+ walltime=None,
418
+ ) -> Any:
292
419
  """
293
420
  Controls a live broadcast by sending a POST request with specified parameters.
294
-
421
+
295
422
  Args:
296
423
  displaySlate: Optional; Specifies whether or not to show a slate during the broadcast.
297
424
  id: Optional; The ID of the live broadcast to control.
@@ -300,32 +427,61 @@ class YoutubeApp(APIApplication):
300
427
  onBehalfOfContentOwnerChannel: Optional; The channel owned by the content owner.
301
428
  part: Optional; Specifies a comma-separated list of one or more broadcasts resource properties.
302
429
  walltime: Optional; An RFC 3339 timestamp that represents the time at which the action takes place.
303
-
430
+
304
431
  Returns:
305
432
  The JSON response from the server after controlling the live broadcast.
306
433
  """
307
434
  url = f"{self.base_url}/liveBroadcasts/control"
308
- query_params = {k: v for k, v in [('displaySlate', displaySlate), ('id', id), ('offsetTimeMs', offsetTimeMs), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('onBehalfOfContentOwnerChannel', onBehalfOfContentOwnerChannel), ('part', part), ('walltime', walltime)] if v is not None}
435
+ query_params = {
436
+ k: v
437
+ for k, v in [
438
+ ("displaySlate", displaySlate),
439
+ ("id", id),
440
+ ("offsetTimeMs", offsetTimeMs),
441
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
442
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
443
+ ("part", part),
444
+ ("walltime", walltime),
445
+ ]
446
+ if v is not None
447
+ }
309
448
  response = self._post(url, data={}, params=query_params)
310
449
  response.raise_for_status()
311
450
  return response.json()
312
451
 
313
- def add_live_broadcasts_transition(self, broadcastStatus=None, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None, part=None) -> Any:
452
+ def add_live_broadcasts_transition(
453
+ self,
454
+ broadcastStatus=None,
455
+ id=None,
456
+ onBehalfOfContentOwner=None,
457
+ onBehalfOfContentOwnerChannel=None,
458
+ part=None,
459
+ ) -> Any:
314
460
  """
315
461
  Transitions a live broadcast to a specified status for a given broadcast ID.
316
-
462
+
317
463
  Args:
318
464
  broadcastStatus: Optional; The status to which the live broadcast should be transitioned.
319
465
  id: Optional; The unique identifier of the broadcast that needs to be transitioned.
320
466
  onBehalfOfContentOwner: Optional; The YouTube content owner on whose behalf the API request is being made.
321
467
  onBehalfOfContentOwnerChannel: Optional; The YouTube channel ID of the channel associated with the specified content owner.
322
468
  part: Optional; A comma-separated list of one or more liveBroadcast resource properties that the API response will include.
323
-
469
+
324
470
  Returns:
325
471
  The JSON response from the API containing the details of the transitioned live broadcast.
326
472
  """
327
473
  url = f"{self.base_url}/liveBroadcasts/transition"
328
- query_params = {k: v for k, v in [('broadcastStatus', broadcastStatus), ('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('onBehalfOfContentOwnerChannel', onBehalfOfContentOwnerChannel), ('part', part)] if v is not None}
474
+ query_params = {
475
+ k: v
476
+ for k, v in [
477
+ ("broadcastStatus", broadcastStatus),
478
+ ("id", id),
479
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
480
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
481
+ ("part", part),
482
+ ]
483
+ if v is not None
484
+ }
329
485
  response = self._post(url, data={}, params=query_params)
330
486
  response.raise_for_status()
331
487
  return response.json()
@@ -333,15 +489,15 @@ class YoutubeApp(APIApplication):
333
489
  def delete_live_chat_bans(self, id=None) -> Any:
334
490
  """
335
491
  Deletes a live chat ban identified by the given ID from the server.
336
-
492
+
337
493
  Args:
338
494
  id: Optional; The unique identifier of the live chat ban to be deleted. If None, no specific ban is targeted.
339
-
495
+
340
496
  Returns:
341
497
  The JSON response from the server after the delete operation, which may include details of the deletion.
342
498
  """
343
499
  url = f"{self.base_url}/liveChat/bans"
344
- query_params = {k: v for k, v in [('id', id)] if v is not None}
500
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
345
501
  response = self._delete(url, params=query_params)
346
502
  response.raise_for_status()
347
503
  return response.json()
@@ -349,15 +505,15 @@ class YoutubeApp(APIApplication):
349
505
  def delete_live_chat_messages(self, id=None) -> Any:
350
506
  """
351
507
  Deletes live chat messages based on the specified message ID.
352
-
508
+
353
509
  Args:
354
510
  id: Optional; The identifier of the specific live chat message to be deleted. If not provided, it defaults to None.
355
-
511
+
356
512
  Returns:
357
513
  A JSON object containing the server's response to the deletion request. It includes details about the operation's success or failure.
358
514
  """
359
515
  url = f"{self.base_url}/liveChat/messages"
360
- query_params = {k: v for k, v in [('id', id)] if v is not None}
516
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
361
517
  response = self._delete(url, params=query_params)
362
518
  response.raise_for_status()
363
519
  return response.json()
@@ -365,15 +521,15 @@ class YoutubeApp(APIApplication):
365
521
  def delete_live_chat_moderators(self, id=None) -> Any:
366
522
  """
367
523
  Deletes a live chat moderator by ID.
368
-
524
+
369
525
  Args:
370
526
  id: The ID of the live chat moderator to delete. If None, no moderator is deleted.
371
-
527
+
372
528
  Returns:
373
529
  The JSON response from the server after attempting to delete the moderator.
374
530
  """
375
531
  url = f"{self.base_url}/liveChat/moderators"
376
- query_params = {k: v for k, v in [('id', id)] if v is not None}
532
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
377
533
  response = self._delete(url, params=query_params)
378
534
  response.raise_for_status()
379
535
  return response.json()
@@ -381,16 +537,20 @@ class YoutubeApp(APIApplication):
381
537
  def delete_videos(self, id=None, onBehalfOfContentOwner=None) -> Any:
382
538
  """
383
539
  Deletes videos based on specified criteria from a video platform.
384
-
540
+
385
541
  Args:
386
542
  id: Optional; A string representing the unique identifier of the video to be deleted. If not provided, no video ID will be specified for deletion.
387
543
  onBehalfOfContentOwner: Optional; A string representing the content owner on whose behalf the operation is being performed. If omitted, the operation is performed on behalf of the authenticated user.
388
-
544
+
389
545
  Returns:
390
546
  Returns a JSON object containing the response from the API after attempting to delete the video(s), including any relevant status or error information.
391
547
  """
392
548
  url = f"{self.base_url}/videos"
393
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
549
+ query_params = {
550
+ k: v
551
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
552
+ if v is not None
553
+ }
394
554
  response = self._delete(url, params=query_params)
395
555
  response.raise_for_status()
396
556
  return response.json()
@@ -398,16 +558,20 @@ class YoutubeApp(APIApplication):
398
558
  def get_videos_get_rating(self, id=None, onBehalfOfContentOwner=None) -> Any:
399
559
  """
400
560
  Retrieves the rating of a video using video ID and optional content owner specification.
401
-
561
+
402
562
  Args:
403
563
  id: Optional; The ID of the video for which the rating is to be retrieved. If None, no specific video ID is used in the request.
404
564
  onBehalfOfContentOwner: Optional; Identifies the content owner for whom the request is being made. Used for API requests made on behalf of a content owner.
405
-
565
+
406
566
  Returns:
407
567
  A JSON object containing the video rating information returned by the API.
408
568
  """
409
569
  url = f"{self.base_url}/videos/getRating"
410
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
570
+ query_params = {
571
+ k: v
572
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
573
+ if v is not None
574
+ }
411
575
  response = self._get(url, params=query_params)
412
576
  response.raise_for_status()
413
577
  return response.json()
@@ -415,16 +579,18 @@ class YoutubeApp(APIApplication):
415
579
  def add_videos_rate(self, id=None, rating=None) -> Any:
416
580
  """
417
581
  Submit a rating for a video on the server using the provided video ID and rating value.
418
-
582
+
419
583
  Args:
420
584
  id: Optional; The unique identifier of the video to rate. If None, the video ID is not included in the request.
421
585
  rating: Optional; The rating value to assign to the video. If None, the rating is not included in the request.
422
-
586
+
423
587
  Returns:
424
588
  The JSON response from the server after submitting the rating.
425
589
  """
426
590
  url = f"{self.base_url}/videos/rate"
427
- query_params = {k: v for k, v in [('id', id), ('rating', rating)] if v is not None}
591
+ query_params = {
592
+ k: v for k, v in [("id", id), ("rating", rating)] if v is not None
593
+ }
428
594
  response = self._post(url, data={}, params=query_params)
429
595
  response.raise_for_status()
430
596
  return response.json()
@@ -432,16 +598,20 @@ class YoutubeApp(APIApplication):
432
598
  def add_videos_report_abuse(self, onBehalfOfContentOwner=None) -> Any:
433
599
  """
434
600
  Sends a report to YouTube indicating a video's potential abuse.
435
-
601
+
436
602
  Args:
437
603
  self: The instance of the class containing this method.
438
604
  onBehalfOfContentOwner: Optional; The YouTube content owner on whose behalf the abuse report is being sent.
439
-
605
+
440
606
  Returns:
441
607
  The JSON response from the YouTube API after reporting the abuse.
442
608
  """
443
609
  url = f"{self.base_url}/videos/reportAbuse"
444
- query_params = {k: v for k, v in [('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
610
+ query_params = {
611
+ k: v
612
+ for k, v in [("onBehalfOfContentOwner", onBehalfOfContentOwner)]
613
+ if v is not None
614
+ }
445
615
  response = self._post(url, data={}, params=query_params)
446
616
  response.raise_for_status()
447
617
  return response.json()
@@ -449,16 +619,23 @@ class YoutubeApp(APIApplication):
449
619
  def add_watermarks_set(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
450
620
  """
451
621
  Sets watermarks on a specified YouTube channel using optional content owner credentials.
452
-
622
+
453
623
  Args:
454
624
  channelId: Optional; The ID of the YouTube channel on which to set the watermark.
455
625
  onBehalfOfContentOwner: Optional; The content owner's ID that the request is made on behalf of, allowing authenticated channel actions.
456
-
626
+
457
627
  Returns:
458
628
  The JSON response from the API call, which includes details about the watermark setting operation.
459
629
  """
460
630
  url = f"{self.base_url}/watermarks/set"
461
- query_params = {k: v for k, v in [('channelId', channelId), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
631
+ query_params = {
632
+ k: v
633
+ for k, v in [
634
+ ("channelId", channelId),
635
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
636
+ ]
637
+ if v is not None
638
+ }
462
639
  response = self._post(url, data={}, params=query_params)
463
640
  response.raise_for_status()
464
641
  return response.json()
@@ -466,24 +643,42 @@ class YoutubeApp(APIApplication):
466
643
  def add_watermarks_unset(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
467
644
  """
468
645
  Removes watermarks from a YouTube channel specified by channel ID.
469
-
646
+
470
647
  Args:
471
648
  channelId: Optional; The unique identifier of the YouTube channel from which to remove watermarks.
472
649
  onBehalfOfContentOwner: Optional; The content owner that the request is on behalf of, used by YouTube content partners.
473
-
650
+
474
651
  Returns:
475
652
  The JSON response from the YouTube API after attempting to remove the watermarks.
476
653
  """
477
654
  url = f"{self.base_url}/watermarks/unset"
478
- query_params = {k: v for k, v in [('channelId', channelId), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
655
+ query_params = {
656
+ k: v
657
+ for k, v in [
658
+ ("channelId", channelId),
659
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
660
+ ]
661
+ if v is not None
662
+ }
479
663
  response = self._post(url, data={}, params=query_params)
480
664
  response.raise_for_status()
481
665
  return response.json()
482
666
 
483
- def get_activities(self, channelId=None, home=None, maxResults=None, mine=None, pageToken=None, part=None, publishedAfter=None, publishedBefore=None, regionCode=None) -> Any:
667
+ def get_activities(
668
+ self,
669
+ channelId=None,
670
+ home=None,
671
+ maxResults=None,
672
+ mine=None,
673
+ pageToken=None,
674
+ part=None,
675
+ publishedAfter=None,
676
+ publishedBefore=None,
677
+ regionCode=None,
678
+ ) -> Any:
484
679
  """
485
680
  Get YouTube channel activities.
486
-
681
+
487
682
  Args:
488
683
  channelId: Channel ID
489
684
  home: User's feed
@@ -494,29 +689,52 @@ class YoutubeApp(APIApplication):
494
689
  publishedAfter: After date
495
690
  publishedBefore: Before date
496
691
  regionCode: Region code
497
-
692
+
498
693
  Returns:
499
694
  JSON with activities
500
695
  """
501
696
  url = f"{self.base_url}/activities"
502
- query_params = {k: v for k, v in [('channelId', channelId), ('home', home), ('maxResults', maxResults), ('mine', mine), ('pageToken', pageToken), ('part', part), ('publishedAfter', publishedAfter), ('publishedBefore', publishedBefore), ('regionCode', regionCode)] if v is not None}
697
+ query_params = {
698
+ k: v
699
+ for k, v in [
700
+ ("channelId", channelId),
701
+ ("home", home),
702
+ ("maxResults", maxResults),
703
+ ("mine", mine),
704
+ ("pageToken", pageToken),
705
+ ("part", part),
706
+ ("publishedAfter", publishedAfter),
707
+ ("publishedBefore", publishedBefore),
708
+ ("regionCode", regionCode),
709
+ ]
710
+ if v is not None
711
+ }
503
712
  response = self._get(url, params=query_params)
504
713
  response.raise_for_status()
505
714
  return response.json()
506
715
 
507
- def add_channel_banners_insert(self, channelId=None, onBehalfOfContentOwner=None) -> Any:
716
+ def add_channel_banners_insert(
717
+ self, channelId=None, onBehalfOfContentOwner=None
718
+ ) -> Any:
508
719
  """
509
720
  Inserts a new channel banner for a specified YouTube channel using YouTube Data API.
510
-
721
+
511
722
  Args:
512
723
  channelId: Optional; A string representing the unique identifier of the YouTube channel for which the banner is being inserted.
513
724
  onBehalfOfContentOwner: Optional; A string indicating that the request is on behalf of an authenticated content owner and specifies the content owner's external ID.
514
-
725
+
515
726
  Returns:
516
727
  A JSON object containing the response from the YouTube Data API with details about the newly inserted channel banner.
517
728
  """
518
729
  url = f"{self.base_url}/channelBanners/insert"
519
- query_params = {k: v for k, v in [('channelId', channelId), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
730
+ query_params = {
731
+ k: v
732
+ for k, v in [
733
+ ("channelId", channelId),
734
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
735
+ ]
736
+ if v is not None
737
+ }
520
738
  response = self._post(url, data={}, params=query_params)
521
739
  response.raise_for_status()
522
740
  return response.json()
@@ -524,24 +742,41 @@ class YoutubeApp(APIApplication):
524
742
  def delete_channel_sections(self, id=None, onBehalfOfContentOwner=None) -> Any:
525
743
  """
526
744
  Deletes channel sections from a platform specified by the base URL.
527
-
745
+
528
746
  Args:
529
747
  id: Optional; A string representing the unique identifier of the channel section to be deleted.
530
748
  onBehalfOfContentOwner: Optional; A string indicating that the request is being made on behalf of the content owner specified by this parameter.
531
-
749
+
532
750
  Returns:
533
751
  Returns a JSON-decoded response object from the server after attempting to delete the specified channel section.
534
752
  """
535
753
  url = f"{self.base_url}/channelSections"
536
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
754
+ query_params = {
755
+ k: v
756
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
757
+ if v is not None
758
+ }
537
759
  response = self._delete(url, params=query_params)
538
760
  response.raise_for_status()
539
761
  return response.json()
540
762
 
541
- def get_channels(self, categoryId=None, forUsername=None, hl=None, id=None, managedByMe=None, maxResults=None, mine=None, mySubscribers=None, onBehalfOfContentOwner=None, pageToken=None, part=None) -> Any:
763
+ def get_channels(
764
+ self,
765
+ categoryId=None,
766
+ forUsername=None,
767
+ hl=None,
768
+ id=None,
769
+ managedByMe=None,
770
+ maxResults=None,
771
+ mine=None,
772
+ mySubscribers=None,
773
+ onBehalfOfContentOwner=None,
774
+ pageToken=None,
775
+ part=None,
776
+ ) -> Any:
542
777
  """
543
778
  Get YouTube channels.
544
-
779
+
545
780
  Args:
546
781
  categoryId: Category ID
547
782
  forUsername: Username
@@ -554,23 +789,52 @@ class YoutubeApp(APIApplication):
554
789
  onBehalfOfContentOwner: Owner ID
555
790
  pageToken: Page token
556
791
  part: Response parts
557
-
792
+
558
793
  Returns:
559
794
  JSON with channels
560
795
  """
561
796
  url = f"{self.base_url}/channels"
562
- query_params = {k: v for k, v in [('categoryId', categoryId), ('forUsername', forUsername), ('hl', hl), ('id', id), ('managedByMe', managedByMe), ('maxResults', maxResults), ('mine', mine), ('mySubscribers', mySubscribers), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('pageToken', pageToken), ('part', part)] if v is not None}
797
+ query_params = {
798
+ k: v
799
+ for k, v in [
800
+ ("categoryId", categoryId),
801
+ ("forUsername", forUsername),
802
+ ("hl", hl),
803
+ ("id", id),
804
+ ("managedByMe", managedByMe),
805
+ ("maxResults", maxResults),
806
+ ("mine", mine),
807
+ ("mySubscribers", mySubscribers),
808
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
809
+ ("pageToken", pageToken),
810
+ ("part", part),
811
+ ]
812
+ if v is not None
813
+ }
563
814
  response = self._get(url, params=query_params)
564
815
  response.raise_for_status()
565
816
  return response.json()
566
817
 
567
- def get_comment_threads(self, allThreadsRelatedToChannelId=None, channelId=None, id=None, maxResults=None, moderationStatus=None, order=None, pageToken=None, part=None, searchTerms=None, textFormat=None, videoId=None) -> Any:
818
+ def get_comment_threads(
819
+ self,
820
+ allThreadsRelatedToChannelId=None,
821
+ channelId=None,
822
+ id=None,
823
+ maxResults=None,
824
+ moderationStatus=None,
825
+ order=None,
826
+ pageToken=None,
827
+ part=None,
828
+ searchTerms=None,
829
+ textFormat=None,
830
+ videoId=None,
831
+ ) -> Any:
568
832
  """
569
833
  Get YouTube comment threads.
570
-
834
+
571
835
  Args:
572
836
  allThreadsRelatedToChannelId: Threads for channel
573
- channelId: Channel ID
837
+ channelId: Channel ID
574
838
  id: Comment thread IDs
575
839
  maxResults: Results limit
576
840
  moderationStatus: Moderation status
@@ -580,31 +844,58 @@ class YoutubeApp(APIApplication):
580
844
  searchTerms: Search terms
581
845
  textFormat: Text format
582
846
  videoId: Video ID
583
-
847
+
584
848
  Returns:
585
849
  JSON with comment threads
586
850
  """
587
851
  url = f"{self.base_url}/commentThreads"
588
- query_params = {k: v for k, v in [('allThreadsRelatedToChannelId', allThreadsRelatedToChannelId), ('channelId', channelId), ('id', id), ('maxResults', maxResults), ('moderationStatus', moderationStatus), ('order', order), ('pageToken', pageToken), ('part', part), ('searchTerms', searchTerms), ('textFormat', textFormat), ('videoId', videoId)] if v is not None}
852
+ query_params = {
853
+ k: v
854
+ for k, v in [
855
+ ("allThreadsRelatedToChannelId", allThreadsRelatedToChannelId),
856
+ ("channelId", channelId),
857
+ ("id", id),
858
+ ("maxResults", maxResults),
859
+ ("moderationStatus", moderationStatus),
860
+ ("order", order),
861
+ ("pageToken", pageToken),
862
+ ("part", part),
863
+ ("searchTerms", searchTerms),
864
+ ("textFormat", textFormat),
865
+ ("videoId", videoId),
866
+ ]
867
+ if v is not None
868
+ }
589
869
  response = self._get(url, params=query_params)
590
870
  response.raise_for_status()
591
871
  return response.json()
592
872
 
593
- def get_fanfundingevents(self, hl=None, maxResults=None, pageToken=None, part=None) -> Any:
873
+ def get_fanfundingevents(
874
+ self, hl=None, maxResults=None, pageToken=None, part=None
875
+ ) -> Any:
594
876
  """
595
877
  Retrieves fan funding events based on specified filter criteria.
596
-
878
+
597
879
  Args:
598
880
  hl: Optional; a string representing the language for text values. If not specified, the default language will be used.
599
881
  maxResults: Optional; an integer specifying the maximum number of results to return. If not specified, a server-determined default will be used.
600
882
  pageToken: Optional; a string token to retrieve a specific page in a paginated set of results. Useful for navigating through large sets of data.
601
883
  part: Optional; a comma-separated list of one or more 'fanFundingEvent' resource properties that the API response will include.
602
-
884
+
603
885
  Returns:
604
886
  The function returns the JSON-decoded response of the fan funding events data retrieved from the API.
605
887
  """
606
888
  url = f"{self.base_url}/fanFundingEvents"
607
- query_params = {k: v for k, v in [('hl', hl), ('maxResults', maxResults), ('pageToken', pageToken), ('part', part)] if v is not None}
889
+ query_params = {
890
+ k: v
891
+ for k, v in [
892
+ ("hl", hl),
893
+ ("maxResults", maxResults),
894
+ ("pageToken", pageToken),
895
+ ("part", part),
896
+ ]
897
+ if v is not None
898
+ }
608
899
  response = self._get(url, params=query_params)
609
900
  response.raise_for_status()
610
901
  return response.json()
@@ -612,18 +903,27 @@ class YoutubeApp(APIApplication):
612
903
  def get_guecategories(self, hl=None, id=None, part=None, regionCode=None) -> Any:
613
904
  """
614
905
  Fetches guide categories from a remote service based on specified parameters.
615
-
906
+
616
907
  Args:
617
908
  hl: Optional; a string that specifies the language localization.
618
909
  id: Optional; a string representing the ID of the guide category.
619
910
  part: Optional; a string indicating which parts of the guide category resource to return.
620
911
  regionCode: Optional; a string that denotes the region of interest.
621
-
912
+
622
913
  Returns:
623
914
  A dictionary containing the JSON response representing guide categories from the service.
624
915
  """
625
916
  url = f"{self.base_url}/guideCategories"
626
- query_params = {k: v for k, v in [('hl', hl), ('id', id), ('part', part), ('regionCode', regionCode)] if v is not None}
917
+ query_params = {
918
+ k: v
919
+ for k, v in [
920
+ ("hl", hl),
921
+ ("id", id),
922
+ ("part", part),
923
+ ("regionCode", regionCode),
924
+ ]
925
+ if v is not None
926
+ }
627
927
  response = self._get(url, params=query_params)
628
928
  response.raise_for_status()
629
929
  return response.json()
@@ -631,16 +931,16 @@ class YoutubeApp(APIApplication):
631
931
  def get_languages(self, hl=None, part=None) -> Any:
632
932
  """
633
933
  Fetches a list of supported languages from the internationalization API.
634
-
934
+
635
935
  Args:
636
936
  hl: Optional; The language code to localize the language names, e.g., 'en' for English.
637
937
  part: Optional; The part parameter specifies a comma-separated list of one or more i18nLanguage resource properties that the API response will include.
638
-
938
+
639
939
  Returns:
640
940
  A JSON object containing the API response with the list of supported languages.
641
941
  """
642
942
  url = f"{self.base_url}/i18nLanguages"
643
- query_params = {k: v for k, v in [('hl', hl), ('part', part)] if v is not None}
943
+ query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
644
944
  response = self._get(url, params=query_params)
645
945
  response.raise_for_status()
646
946
  return response.json()
@@ -648,34 +948,44 @@ class YoutubeApp(APIApplication):
648
948
  def get_regions(self, hl=None, part=None) -> Any:
649
949
  """
650
950
  Retrieves a list of i18n regions from a specified API endpoint.
651
-
951
+
652
952
  Args:
653
953
  hl: Optional; a string representing the language code for which the regions are requested.
654
954
  part: Optional; a string specifying a comma-separated list of one or more i18nRegion resource parts to include in the API response.
655
-
955
+
656
956
  Returns:
657
957
  The JSON response from the API containing the list of i18n regions.
658
958
  """
659
959
  url = f"{self.base_url}/i18nRegions"
660
- query_params = {k: v for k, v in [('hl', hl), ('part', part)] if v is not None}
960
+ query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
661
961
  response = self._get(url, params=query_params)
662
962
  response.raise_for_status()
663
963
  return response.json()
664
964
 
665
- def delete_livestreams(self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None) -> Any:
965
+ def delete_livestreams(
966
+ self, id=None, onBehalfOfContentOwner=None, onBehalfOfContentOwnerChannel=None
967
+ ) -> Any:
666
968
  """
667
969
  Deletes a livestream resource from the YouTube Data API using optional filtering parameters.
668
-
970
+
669
971
  Args:
670
972
  id: Optional; A comma-separated list of YouTube livestream IDs that identify the resources to be deleted.
671
973
  onBehalfOfContentOwner: Optional; YouTube content owner who is channel owner of the livestream and makes this API call.
672
974
  onBehalfOfContentOwnerChannel: Optional; The YouTube channel ID on behalf of which the API call is being made.
673
-
975
+
674
976
  Returns:
675
977
  A JSON object containing the API's response to the delete request.
676
978
  """
677
979
  url = f"{self.base_url}/liveStreams"
678
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('onBehalfOfContentOwnerChannel', onBehalfOfContentOwnerChannel)] if v is not None}
980
+ query_params = {
981
+ k: v
982
+ for k, v in [
983
+ ("id", id),
984
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
985
+ ("onBehalfOfContentOwnerChannel", onBehalfOfContentOwnerChannel),
986
+ ]
987
+ if v is not None
988
+ }
679
989
  response = self._delete(url, params=query_params)
680
990
  response.raise_for_status()
681
991
  return response.json()
@@ -683,16 +993,20 @@ class YoutubeApp(APIApplication):
683
993
  def delete_play_list_items(self, id=None, onBehalfOfContentOwner=None) -> Any:
684
994
  """
685
995
  Deletes playlist items identified by the given id or on behalf of the specified content owner.
686
-
996
+
687
997
  Args:
688
998
  id: Optional; The ID of the playlist item to be deleted.
689
999
  onBehalfOfContentOwner: Optional; The content owner on whose behalf the playlist item is being deleted.
690
-
1000
+
691
1001
  Returns:
692
1002
  The JSON response from the server indicating the result of the deletion operation.
693
1003
  """
694
1004
  url = f"{self.base_url}/playlistItems"
695
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
1005
+ query_params = {
1006
+ k: v
1007
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1008
+ if v is not None
1009
+ }
696
1010
  response = self._delete(url, params=query_params)
697
1011
  response.raise_for_status()
698
1012
  return response.json()
@@ -700,24 +1014,61 @@ class YoutubeApp(APIApplication):
700
1014
  def delete_playlists(self, id=None, onBehalfOfContentOwner=None) -> Any:
701
1015
  """
702
1016
  Deletes playlists based on specified criteria.
703
-
1017
+
704
1018
  Args:
705
1019
  id: Optional; A string representing the ID of the playlist to delete. Default is None.
706
1020
  onBehalfOfContentOwner: Optional; A string representing the content owner in whose behalf the operation is being performed. Default is None.
707
-
1021
+
708
1022
  Returns:
709
1023
  The JSON response from the server as a result of the delete operation.
710
1024
  """
711
1025
  url = f"{self.base_url}/playlists"
712
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
1026
+ query_params = {
1027
+ k: v
1028
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1029
+ if v is not None
1030
+ }
713
1031
  response = self._delete(url, params=query_params)
714
1032
  response.raise_for_status()
715
1033
  return response.json()
716
1034
 
717
- def get_search(self, channelId=None, channelType=None, eventType=None, forContentOwner=None, forDeveloper=None, forMine=None, location=None, locationRadius=None, maxResults=None, onBehalfOfContentOwner=None, order=None, pageToken=None, part=None, publishedAfter=None, publishedBefore=None, q=None, regionCode=None, relatedToVideoId=None, relevanceLanguage=None, safeSearch=None, topicId=None, type=None, videoCaption=None, videoCategoryId=None, videoDefinition=None, videoDimension=None, videoDuration=None, videoEmbeddable=None, videoLicense=None, videoSyndicated=None, videoType=None) -> Any:
1035
+ def get_search(
1036
+ self,
1037
+ channelId=None,
1038
+ channelType=None,
1039
+ eventType=None,
1040
+ forContentOwner=None,
1041
+ forDeveloper=None,
1042
+ forMine=None,
1043
+ location=None,
1044
+ locationRadius=None,
1045
+ maxResults=None,
1046
+ onBehalfOfContentOwner=None,
1047
+ order=None,
1048
+ pageToken=None,
1049
+ part=None,
1050
+ publishedAfter=None,
1051
+ publishedBefore=None,
1052
+ q=None,
1053
+ regionCode=None,
1054
+ relatedToVideoId=None,
1055
+ relevanceLanguage=None,
1056
+ safeSearch=None,
1057
+ topicId=None,
1058
+ type=None,
1059
+ videoCaption=None,
1060
+ videoCategoryId=None,
1061
+ videoDefinition=None,
1062
+ videoDimension=None,
1063
+ videoDuration=None,
1064
+ videoEmbeddable=None,
1065
+ videoLicense=None,
1066
+ videoSyndicated=None,
1067
+ videoType=None,
1068
+ ) -> Any:
718
1069
  """
719
1070
  Search YouTube Data API with filters.
720
-
1071
+
721
1072
  Args:
722
1073
  channelId: Channel filter
723
1074
  channelType: Channel type
@@ -750,31 +1101,78 @@ class YoutubeApp(APIApplication):
750
1101
  videoLicense: License
751
1102
  videoSyndicated: Syndicated
752
1103
  videoType: Video type
753
-
1104
+
754
1105
  Returns:
755
1106
  JSON with search results
756
1107
  """
757
1108
  url = f"{self.base_url}/search"
758
- query_params = {k: v for k, v in [('channelId', channelId), ('channelType', channelType), ('eventType', eventType), ('forContentOwner', forContentOwner), ('forDeveloper', forDeveloper), ('forMine', forMine), ('location', location), ('locationRadius', locationRadius), ('maxResults', maxResults), ('onBehalfOfContentOwner', onBehalfOfContentOwner), ('order', order), ('pageToken', pageToken), ('part', part), ('publishedAfter', publishedAfter), ('publishedBefore', publishedBefore), ('q', q), ('regionCode', regionCode), ('relatedToVideoId', relatedToVideoId), ('relevanceLanguage', relevanceLanguage), ('safeSearch', safeSearch), ('topicId', topicId), ('type', type), ('videoCaption', videoCaption), ('videoCategoryId', videoCategoryId), ('videoDefinition', videoDefinition), ('videoDimension', videoDimension), ('videoDuration', videoDuration), ('videoEmbeddable', videoEmbeddable), ('videoLicense', videoLicense), ('videoSyndicated', videoSyndicated), ('videoType', videoType)] if v is not None}
1109
+ query_params = {
1110
+ k: v
1111
+ for k, v in [
1112
+ ("channelId", channelId),
1113
+ ("channelType", channelType),
1114
+ ("eventType", eventType),
1115
+ ("forContentOwner", forContentOwner),
1116
+ ("forDeveloper", forDeveloper),
1117
+ ("forMine", forMine),
1118
+ ("location", location),
1119
+ ("locationRadius", locationRadius),
1120
+ ("maxResults", maxResults),
1121
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
1122
+ ("order", order),
1123
+ ("pageToken", pageToken),
1124
+ ("part", part),
1125
+ ("publishedAfter", publishedAfter),
1126
+ ("publishedBefore", publishedBefore),
1127
+ ("q", q),
1128
+ ("regionCode", regionCode),
1129
+ ("relatedToVideoId", relatedToVideoId),
1130
+ ("relevanceLanguage", relevanceLanguage),
1131
+ ("safeSearch", safeSearch),
1132
+ ("topicId", topicId),
1133
+ ("type", type),
1134
+ ("videoCaption", videoCaption),
1135
+ ("videoCategoryId", videoCategoryId),
1136
+ ("videoDefinition", videoDefinition),
1137
+ ("videoDimension", videoDimension),
1138
+ ("videoDuration", videoDuration),
1139
+ ("videoEmbeddable", videoEmbeddable),
1140
+ ("videoLicense", videoLicense),
1141
+ ("videoSyndicated", videoSyndicated),
1142
+ ("videoType", videoType),
1143
+ ]
1144
+ if v is not None
1145
+ }
759
1146
  response = self._get(url, params=query_params)
760
1147
  response.raise_for_status()
761
1148
  return response.json()
762
1149
 
763
- def get_sponsors(self, filter=None, maxResults=None, pageToken=None, part=None) -> Any:
1150
+ def get_sponsors(
1151
+ self, filter=None, maxResults=None, pageToken=None, part=None
1152
+ ) -> Any:
764
1153
  """
765
1154
  Fetches a list of sponsors from a server, applying optional filtering and pagination.
766
-
1155
+
767
1156
  Args:
768
1157
  filter: Optional; A string containing filtering criteria for the sponsors.
769
1158
  maxResults: Optional; An integer limiting the number of sponsors returned.
770
1159
  pageToken: Optional; A token string used to retrieve a specific page of results.
771
1160
  part: Optional; A string specifying which parts of the sponsor details to fetch.
772
-
1161
+
773
1162
  Returns:
774
1163
  The JSON response containing the list of sponsors, potentially filtered and paginated, as returned by the server.
775
1164
  """
776
1165
  url = f"{self.base_url}/sponsors"
777
- query_params = {k: v for k, v in [('filter', filter), ('maxResults', maxResults), ('pageToken', pageToken), ('part', part)] if v is not None}
1166
+ query_params = {
1167
+ k: v
1168
+ for k, v in [
1169
+ ("filter", filter),
1170
+ ("maxResults", maxResults),
1171
+ ("pageToken", pageToken),
1172
+ ("part", part),
1173
+ ]
1174
+ if v is not None
1175
+ }
778
1176
  response = self._get(url, params=query_params)
779
1177
  response.raise_for_status()
780
1178
  return response.json()
@@ -782,34 +1180,45 @@ class YoutubeApp(APIApplication):
782
1180
  def delete_subscriptions(self, id=None) -> Any:
783
1181
  """
784
1182
  Deletes subscriptions by sending a DELETE request to the API.
785
-
1183
+
786
1184
  Args:
787
1185
  id: Optional; An identifier for a specific subscription to delete. If None, deletes all subscriptions.
788
-
1186
+
789
1187
  Returns:
790
1188
  The JSON response from the API after attempting to delete the subscription(s).
791
1189
  """
792
1190
  url = f"{self.base_url}/subscriptions"
793
- query_params = {k: v for k, v in [('id', id)] if v is not None}
1191
+ query_params = {k: v for k, v in [("id", id)] if v is not None}
794
1192
  response = self._delete(url, params=query_params)
795
1193
  response.raise_for_status()
796
1194
  return response.json()
797
1195
 
798
- def get_superchatevents(self, hl=None, maxResults=None, pageToken=None, part=None) -> Any:
1196
+ def get_superchatevents(
1197
+ self, hl=None, maxResults=None, pageToken=None, part=None
1198
+ ) -> Any:
799
1199
  """
800
1200
  Fetches a list of super chat events from the YouTube API with optional filtering parameters.
801
-
1201
+
802
1202
  Args:
803
1203
  hl: Optional; the language code to select localized resource information.
804
1204
  maxResults: Optional; the maximum number of items that should be returned in the result set.
805
1205
  pageToken: Optional; the token to identify a specific page in the result set.
806
1206
  part: Optional; the parameter specifying which super chat event resource parts to include in the response.
807
-
1207
+
808
1208
  Returns:
809
1209
  A JSON object containing the super chat events data returned by the YouTube API.
810
1210
  """
811
1211
  url = f"{self.base_url}/superChatEvents"
812
- query_params = {k: v for k, v in [('hl', hl), ('maxResults', maxResults), ('pageToken', pageToken), ('part', part)] if v is not None}
1212
+ query_params = {
1213
+ k: v
1214
+ for k, v in [
1215
+ ("hl", hl),
1216
+ ("maxResults", maxResults),
1217
+ ("pageToken", pageToken),
1218
+ ("part", part),
1219
+ ]
1220
+ if v is not None
1221
+ }
813
1222
  response = self._get(url, params=query_params)
814
1223
  response.raise_for_status()
815
1224
  return response.json()
@@ -817,16 +1226,23 @@ class YoutubeApp(APIApplication):
817
1226
  def add_thumbnails_set(self, onBehalfOfContentOwner=None, videoId=None) -> Any:
818
1227
  """
819
1228
  Sets a thumbnail for a specified video on behalf of a content owner using the YouTube API.
820
-
1229
+
821
1230
  Args:
822
1231
  onBehalfOfContentOwner: Optional; str. The YouTube content owner ID on whose behalf the request is being made.
823
1232
  videoId: Optional; str. The ID of the video for which the thumbnails are being set.
824
-
1233
+
825
1234
  Returns:
826
1235
  dict. The response from the YouTube API as a JSON object, containing details of the updated video thumbnail.
827
1236
  """
828
1237
  url = f"{self.base_url}/thumbnails/set"
829
- query_params = {k: v for k, v in [('onBehalfOfContentOwner', onBehalfOfContentOwner), ('videoId', videoId)] if v is not None}
1238
+ query_params = {
1239
+ k: v
1240
+ for k, v in [
1241
+ ("onBehalfOfContentOwner", onBehalfOfContentOwner),
1242
+ ("videoId", videoId),
1243
+ ]
1244
+ if v is not None
1245
+ }
830
1246
  response = self._post(url, data={}, params=query_params)
831
1247
  response.raise_for_status()
832
1248
  return response.json()
@@ -834,16 +1250,16 @@ class YoutubeApp(APIApplication):
834
1250
  def get_video_abuse_report_reasons(self, hl=None, part=None) -> Any:
835
1251
  """
836
1252
  Fetches a list of video abuse report reasons with optional localization and response filtering.
837
-
1253
+
838
1254
  Args:
839
1255
  hl: An optional parameter specifying the language for localizing the response. This is typically a BCP-47 language code, such as 'en' or 'fr'.
840
1256
  part: An optional parameter specifying which parts of the abuse report reasons to include in the response. This could specify fields like 'id' or 'snippet'.
841
-
1257
+
842
1258
  Returns:
843
1259
  The function returns a JSON object containing the list of video abuse report reasons, or filtered parts of it, if specified.
844
1260
  """
845
1261
  url = f"{self.base_url}/videoAbuseReportReasons"
846
- query_params = {k: v for k, v in [('hl', hl), ('part', part)] if v is not None}
1262
+ query_params = {k: v for k, v in [("hl", hl), ("part", part)] if v is not None}
847
1263
  response = self._get(url, params=query_params)
848
1264
  response.raise_for_status()
849
1265
  return response.json()
@@ -851,18 +1267,27 @@ class YoutubeApp(APIApplication):
851
1267
  def get_veocategories(self, hl=None, id=None, part=None, regionCode=None) -> Any:
852
1268
  """
853
1269
  Fetches video categories from an external API using specified query parameters.
854
-
1270
+
855
1271
  Args:
856
1272
  hl: Optional; the language code for localized video category names, e.g., 'en'.
857
1273
  id: Optional; a comma-separated list of video category IDs to filter the results.
858
1274
  part: Optional; a list of properties to include in the response, e.g., 'snippet'.
859
1275
  regionCode: Optional; an ISO 3166-1 alpha-2 country code to filter the categories for a specific region.
860
-
1276
+
861
1277
  Returns:
862
1278
  The JSON response from the API containing video category information.
863
1279
  """
864
1280
  url = f"{self.base_url}/videoCategories"
865
- query_params = {k: v for k, v in [('hl', hl), ('id', id), ('part', part), ('regionCode', regionCode)] if v is not None}
1281
+ query_params = {
1282
+ k: v
1283
+ for k, v in [
1284
+ ("hl", hl),
1285
+ ("id", id),
1286
+ ("part", part),
1287
+ ("regionCode", regionCode),
1288
+ ]
1289
+ if v is not None
1290
+ }
866
1291
  response = self._get(url, params=query_params)
867
1292
  response.raise_for_status()
868
1293
  return response.json()
@@ -870,16 +1295,20 @@ class YoutubeApp(APIApplication):
870
1295
  def delete_groupitems(self, id=None, onBehalfOfContentOwner=None) -> Any:
871
1296
  """
872
1297
  Deletes group items based on specified parameters.
873
-
1298
+
874
1299
  Args:
875
1300
  id: Optional; A string that identifies the group item to be deleted. If not provided, all group items may be affected depending on other parameters.
876
1301
  onBehalfOfContentOwner: Optional; A string representing the content owner on whose behalf the request is being made. This is typically used for partners or channels managed by the content owner.
877
-
1302
+
878
1303
  Returns:
879
1304
  A JSON object containing the response from the deletion request, which includes the results of the delete operation.
880
1305
  """
881
1306
  url = f"{self.base_url}/groupItems"
882
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
1307
+ query_params = {
1308
+ k: v
1309
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1310
+ if v is not None
1311
+ }
883
1312
  response = self._delete(url, params=query_params)
884
1313
  response.raise_for_status()
885
1314
  return response.json()
@@ -887,24 +1316,40 @@ class YoutubeApp(APIApplication):
887
1316
  def delete_groups(self, id=None, onBehalfOfContentOwner=None) -> Any:
888
1317
  """
889
1318
  Deletes groups specified by their ID, optionally on behalf of a content owner.
890
-
1319
+
891
1320
  Args:
892
1321
  id: Optional; The unique identifier for the group to be deleted. If not provided, no specific group ID will be targeted.
893
1322
  onBehalfOfContentOwner: Optional; The content owner that the group deletion is being performed on behalf of.
894
-
1323
+
895
1324
  Returns:
896
1325
  A JSON-decoded response from the server indicating the success or failure of the delete operation.
897
1326
  """
898
1327
  url = f"{self.base_url}/groups"
899
- query_params = {k: v for k, v in [('id', id), ('onBehalfOfContentOwner', onBehalfOfContentOwner)] if v is not None}
1328
+ query_params = {
1329
+ k: v
1330
+ for k, v in [("id", id), ("onBehalfOfContentOwner", onBehalfOfContentOwner)]
1331
+ if v is not None
1332
+ }
900
1333
  response = self._delete(url, params=query_params)
901
1334
  response.raise_for_status()
902
1335
  return response.json()
903
1336
 
904
- def get_reports(self, currency=None, dimensions=None, end=None, filters=None, ids=None, include=None, max=None, metrics=None, sort=None, start=None) -> Any:
1337
+ def get_reports(
1338
+ self,
1339
+ currency=None,
1340
+ dimensions=None,
1341
+ end=None,
1342
+ filters=None,
1343
+ ids=None,
1344
+ include=None,
1345
+ max=None,
1346
+ metrics=None,
1347
+ sort=None,
1348
+ start=None,
1349
+ ) -> Any:
905
1350
  """
906
1351
  Fetches and returns report data based on specified filtering and sorting criteria.
907
-
1352
+
908
1353
  Args:
909
1354
  currency: Optional; Specifies the currency format for the report.
910
1355
  dimensions: Optional; List of dimensions to include in the report.
@@ -916,12 +1361,27 @@ class YoutubeApp(APIApplication):
916
1361
  metrics: Optional; List of metrics to include in the report.
917
1362
  sort: Optional; Order by which to sort the report results.
918
1363
  start: Optional; Start date for the report data range.
919
-
1364
+
920
1365
  Returns:
921
1366
  The response containing the report data in JSON format.
922
1367
  """
923
1368
  url = f"{self.base_url}/reports"
924
- query_params = {k: v for k, v in [('currency', currency), ('dimensions', dimensions), ('end', end), ('filters', filters), ('ids', ids), ('include', include), ('max', max), ('metrics', metrics), ('sort', sort), ('start', start)] if v is not None}
1369
+ query_params = {
1370
+ k: v
1371
+ for k, v in [
1372
+ ("currency", currency),
1373
+ ("dimensions", dimensions),
1374
+ ("end", end),
1375
+ ("filters", filters),
1376
+ ("ids", ids),
1377
+ ("include", include),
1378
+ ("max", max),
1379
+ ("metrics", metrics),
1380
+ ("sort", sort),
1381
+ ("start", start),
1382
+ ]
1383
+ if v is not None
1384
+ }
925
1385
  response = self._get(url, params=query_params)
926
1386
  response.raise_for_status()
927
1387
  return response.json()
@@ -929,10 +1389,10 @@ class YoutubeApp(APIApplication):
929
1389
  def list_tools(self):
930
1390
  """
931
1391
  Returns a list of tool methods available in the class instance.
932
-
1392
+
933
1393
  Args:
934
1394
  None: This function does not accept any parameters.
935
-
1395
+
936
1396
  Returns:
937
1397
  list: A list containing references to various tool methods associated with job reports, media resources, comments, broadcasts, videos, activities, channels, etc.
938
1398
  """
@@ -982,5 +1442,5 @@ class YoutubeApp(APIApplication):
982
1442
  self.get_veocategories,
983
1443
  self.delete_groupitems,
984
1444
  self.delete_groups,
985
- self.get_reports
1445
+ self.get_reports,
986
1446
  ]