universal-mcp-applications 0.1.30rc1__py3-none-any.whl → 0.1.36rc1__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 universal-mcp-applications might be problematic. Click here for more details.

Files changed (106) hide show
  1. universal_mcp/applications/ahrefs/app.py +52 -198
  2. universal_mcp/applications/airtable/app.py +23 -122
  3. universal_mcp/applications/apollo/app.py +111 -464
  4. universal_mcp/applications/asana/app.py +417 -1567
  5. universal_mcp/applications/aws_s3/app.py +33 -100
  6. universal_mcp/applications/bill/app.py +546 -1957
  7. universal_mcp/applications/box/app.py +1068 -3981
  8. universal_mcp/applications/braze/app.py +364 -1430
  9. universal_mcp/applications/browser_use/app.py +2 -8
  10. universal_mcp/applications/cal_com_v2/app.py +207 -625
  11. universal_mcp/applications/calendly/app.py +61 -200
  12. universal_mcp/applications/canva/app.py +45 -110
  13. universal_mcp/applications/clickup/app.py +207 -674
  14. universal_mcp/applications/coda/app.py +146 -426
  15. universal_mcp/applications/confluence/app.py +310 -1098
  16. universal_mcp/applications/contentful/app.py +36 -151
  17. universal_mcp/applications/crustdata/app.py +28 -107
  18. universal_mcp/applications/dialpad/app.py +283 -756
  19. universal_mcp/applications/digitalocean/app.py +1766 -5777
  20. universal_mcp/applications/domain_checker/app.py +3 -54
  21. universal_mcp/applications/e2b/app.py +14 -64
  22. universal_mcp/applications/elevenlabs/app.py +9 -47
  23. universal_mcp/applications/exa/app.py +6 -17
  24. universal_mcp/applications/falai/app.py +23 -100
  25. universal_mcp/applications/figma/app.py +53 -137
  26. universal_mcp/applications/file_system/app.py +2 -13
  27. universal_mcp/applications/firecrawl/app.py +51 -152
  28. universal_mcp/applications/fireflies/app.py +59 -281
  29. universal_mcp/applications/fpl/app.py +91 -528
  30. universal_mcp/applications/fpl/utils/fixtures.py +15 -49
  31. universal_mcp/applications/fpl/utils/helper.py +25 -89
  32. universal_mcp/applications/fpl/utils/league_utils.py +20 -64
  33. universal_mcp/applications/ghost_content/app.py +52 -161
  34. universal_mcp/applications/github/app.py +19 -56
  35. universal_mcp/applications/gong/app.py +88 -248
  36. universal_mcp/applications/google_calendar/app.py +16 -68
  37. universal_mcp/applications/google_docs/app.py +88 -188
  38. universal_mcp/applications/google_drive/app.py +140 -462
  39. universal_mcp/applications/google_gemini/app.py +12 -64
  40. universal_mcp/applications/google_mail/app.py +28 -157
  41. universal_mcp/applications/google_searchconsole/app.py +15 -48
  42. universal_mcp/applications/google_sheet/app.py +101 -578
  43. universal_mcp/applications/google_sheet/helper.py +10 -37
  44. universal_mcp/applications/hashnode/app.py +57 -269
  45. universal_mcp/applications/heygen/app.py +44 -122
  46. universal_mcp/applications/http_tools/app.py +10 -32
  47. universal_mcp/applications/hubspot/api_segments/crm_api.py +460 -1573
  48. universal_mcp/applications/hubspot/api_segments/marketing_api.py +74 -262
  49. universal_mcp/applications/hubspot/app.py +23 -87
  50. universal_mcp/applications/jira/app.py +2071 -7986
  51. universal_mcp/applications/klaviyo/app.py +494 -1376
  52. universal_mcp/applications/linkedin/README.md +23 -4
  53. universal_mcp/applications/linkedin/app.py +392 -212
  54. universal_mcp/applications/mailchimp/app.py +450 -1605
  55. universal_mcp/applications/markitdown/app.py +8 -20
  56. universal_mcp/applications/miro/app.py +217 -699
  57. universal_mcp/applications/ms_teams/app.py +64 -186
  58. universal_mcp/applications/neon/app.py +86 -192
  59. universal_mcp/applications/notion/app.py +21 -36
  60. universal_mcp/applications/onedrive/app.py +14 -36
  61. universal_mcp/applications/openai/app.py +42 -165
  62. universal_mcp/applications/outlook/app.py +16 -76
  63. universal_mcp/applications/perplexity/app.py +4 -19
  64. universal_mcp/applications/pipedrive/app.py +832 -3142
  65. universal_mcp/applications/posthog/app.py +163 -432
  66. universal_mcp/applications/reddit/app.py +40 -139
  67. universal_mcp/applications/resend/app.py +41 -107
  68. universal_mcp/applications/retell/app.py +14 -41
  69. universal_mcp/applications/rocketlane/app.py +221 -934
  70. universal_mcp/applications/scraper/README.md +7 -4
  71. universal_mcp/applications/scraper/app.py +280 -93
  72. universal_mcp/applications/semanticscholar/app.py +22 -64
  73. universal_mcp/applications/semrush/app.py +43 -77
  74. universal_mcp/applications/sendgrid/app.py +512 -1262
  75. universal_mcp/applications/sentry/app.py +271 -906
  76. universal_mcp/applications/serpapi/app.py +40 -143
  77. universal_mcp/applications/sharepoint/app.py +15 -37
  78. universal_mcp/applications/shopify/app.py +1551 -4287
  79. universal_mcp/applications/shortcut/app.py +155 -417
  80. universal_mcp/applications/slack/app.py +50 -101
  81. universal_mcp/applications/spotify/app.py +126 -325
  82. universal_mcp/applications/supabase/app.py +104 -213
  83. universal_mcp/applications/tavily/app.py +1 -1
  84. universal_mcp/applications/trello/app.py +693 -2656
  85. universal_mcp/applications/twilio/app.py +14 -50
  86. universal_mcp/applications/twitter/api_segments/compliance_api.py +4 -14
  87. universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +6 -18
  88. universal_mcp/applications/twitter/api_segments/likes_api.py +1 -3
  89. universal_mcp/applications/twitter/api_segments/lists_api.py +5 -15
  90. universal_mcp/applications/twitter/api_segments/trends_api.py +1 -3
  91. universal_mcp/applications/twitter/api_segments/tweets_api.py +9 -31
  92. universal_mcp/applications/twitter/api_segments/usage_api.py +1 -5
  93. universal_mcp/applications/twitter/api_segments/users_api.py +14 -42
  94. universal_mcp/applications/whatsapp/app.py +35 -186
  95. universal_mcp/applications/whatsapp/audio.py +2 -6
  96. universal_mcp/applications/whatsapp/whatsapp.py +17 -51
  97. universal_mcp/applications/whatsapp_business/app.py +70 -283
  98. universal_mcp/applications/wrike/app.py +45 -118
  99. universal_mcp/applications/yahoo_finance/app.py +19 -65
  100. universal_mcp/applications/youtube/app.py +75 -261
  101. universal_mcp/applications/zenquotes/app.py +2 -2
  102. {universal_mcp_applications-0.1.30rc1.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/METADATA +2 -2
  103. {universal_mcp_applications-0.1.30rc1.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/RECORD +105 -106
  104. universal_mcp/applications/scraper/scraper_testers.py +0 -17
  105. {universal_mcp_applications-0.1.30rc1.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/WHEEL +0 -0
  106. {universal_mcp_applications-0.1.30rc1.dist-info → universal_mcp_applications-0.1.36rc1.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,4 @@
1
1
  from typing import Any
2
-
3
2
  import httpx
4
3
  from loguru import logger
5
4
  from universal_mcp.applications.application import APIApplication
@@ -16,9 +15,7 @@ class GoogleDriveApp(APIApplication):
16
15
  super().__init__(name="google_drive", integration=integration)
17
16
  self.base_url = "https://www.googleapis.com/drive/v3"
18
17
 
19
- def move_file(
20
- self, file_id: str, add_parents: str, remove_parents: str
21
- ) -> dict[str, Any]:
18
+ async def move_file(self, file_id: str, add_parents: str, remove_parents: str) -> dict[str, Any]:
22
19
  """
23
20
  Moves a file to a new folder by updating its parent references. This function adds the file to a destination folder (`add_parents`) and removes it from the source (`remove_parents`), offering a focused alternative to the more comprehensive `update_file_metadata` function.
24
21
 
@@ -45,7 +42,7 @@ class GoogleDriveApp(APIApplication):
45
42
  response.raise_for_status()
46
43
  return response.json()
47
44
 
48
- def get_drive_info(self) -> dict[str, Any]:
45
+ async def get_drive_info(self) -> dict[str, Any]:
49
46
  """
50
47
  Fetches key user and storage quota information for the authenticated Google Drive account. This streamlined function offers a focused alternative to `get_about_info`, which queries the same endpoint but exposes all available API parameters, providing a simpler way to get essential account details.
51
48
 
@@ -65,9 +62,7 @@ class GoogleDriveApp(APIApplication):
65
62
  response = self._get(url, params=params)
66
63
  return response.json()
67
64
 
68
- def search_files(
69
- self, page_size: int = 10, q: str | None = None, order_by: str | None = None
70
- ) -> dict[str, Any]:
65
+ async def search_files(self, page_size: int = 10, q: str | None = None, order_by: str | None = None) -> dict[str, Any]:
71
66
  """
72
67
  Searches for files in Google Drive, allowing for powerful filtering, sorting, and pagination.
73
68
  This streamlined function offers a more user-friendly alternative to the comprehensive search_files_advanced method, making it ideal for targeted queries like finding files by name, type, or parent folder.
@@ -99,9 +94,7 @@ class GoogleDriveApp(APIApplication):
99
94
  list, files, search, google-drive, pagination, important
100
95
  """
101
96
  url = f"{self.base_url}/files"
102
- params = {
103
- "pageSize": page_size,
104
- }
97
+ params = {"pageSize": page_size}
105
98
  if q:
106
99
  params["q"] = q
107
100
  if order_by:
@@ -110,7 +103,7 @@ class GoogleDriveApp(APIApplication):
110
103
  response.raise_for_status()
111
104
  return response.json()
112
105
 
113
- def get_file_details(self, file_id: str) -> dict[str, Any]:
106
+ async def get_file_details(self, file_id: str) -> dict[str, Any]:
114
107
  """
115
108
  Fetches all default metadata for a specific file by its unique ID. This function provides a simple, direct retrieval of a single file's complete attributes, differing from `search_files` which performs broad queries for multiple files based on various criteria.
116
109
 
@@ -131,7 +124,7 @@ class GoogleDriveApp(APIApplication):
131
124
  response = self._get(url)
132
125
  return response.json()
133
126
 
134
- def trash_file(self, file_id: str) -> dict[str, Any]:
127
+ async def trash_file(self, file_id: str) -> dict[str, Any]:
135
128
  """
136
129
  Moves a specified file to the trash using its ID. It provides simplified error handling by returning a dictionary with a success or error message, unlike the `permanently_delete_file` function which raises an exception on failure.
137
130
 
@@ -154,12 +147,8 @@ class GoogleDriveApp(APIApplication):
154
147
  except Exception as e:
155
148
  return {"error": str(e)}
156
149
 
157
- def create_text_file(
158
- self,
159
- file_name: str,
160
- text_content: str,
161
- parent_id: str = None,
162
- mime_type: str = "text/plain",
150
+ async def create_text_file(
151
+ self, file_name: str, text_content: str, parent_id: str = None, mime_type: str = "text/plain"
163
152
  ) -> dict[str, Any]:
164
153
  """
165
154
  Creates a file in Google Drive using an in-memory text string. Unlike `upload_file_from_path`, which reads from a local file, this function first creates the file's metadata (name, parent) and then uploads the provided string content, returning the new file's complete metadata upon completion.
@@ -190,14 +179,12 @@ class GoogleDriveApp(APIApplication):
190
179
  upload_url = f"https://www.googleapis.com/upload/drive/v3/files/{file_id}?uploadType=media"
191
180
  upload_headers = self._get_headers()
192
181
  upload_headers["Content-Type"] = f"{mime_type}; charset=utf-8"
193
- upload_response = httpx.patch(
194
- upload_url, headers=upload_headers, content=text_content.encode("utf-8")
195
- )
182
+ upload_response = httpx.patch(upload_url, headers=upload_headers, content=text_content.encode("utf-8"))
196
183
  upload_response.raise_for_status()
197
184
  response_data = upload_response.json()
198
185
  return response_data
199
186
 
200
- def find_folder_id_by_name(self, folder_name: str) -> str | None:
187
+ async def find_folder_id_by_name(self, folder_name: str) -> str | None:
201
188
  """
202
189
  Searches for a non-trashed folder by its exact name, returning the ID of the first match. As a utility for `create_folder`, it resolves parent names to IDs and returns None if the folder isn't found or an API error occurs, logging the failure internally.
203
190
 
@@ -215,17 +202,14 @@ class GoogleDriveApp(APIApplication):
215
202
  """
216
203
  query = f"mimeType='application/vnd.google-apps.folder' and name='{folder_name}' and trashed=false"
217
204
  try:
218
- response = self._get(
219
- f"{self.base_url}/files",
220
- params={"q": query, "fields": "files(id,name)"},
221
- )
205
+ response = self._get(f"{self.base_url}/files", params={"q": query, "fields": "files(id,name)"})
222
206
  files = response.json().get("files", [])
223
207
  return files[0]["id"] if files else None
224
208
  except Exception as e:
225
209
  logger.error(f"Error finding folder ID by name: {e}")
226
210
  return None
227
211
 
228
- def create_folder(self, folder_name: str, parent_id: str = None) -> dict[str, Any]:
212
+ async def create_folder(self, folder_name: str, parent_id: str = None) -> dict[str, Any]:
229
213
  """
230
214
  Creates a new folder in Google Drive, optionally within a parent specified by name or ID. If a parent name is given, it internally resolves it to an ID using the `find_folder_id_by_name` function. Returns the metadata for the newly created folder upon successful creation.
231
215
 
@@ -244,19 +228,14 @@ class GoogleDriveApp(APIApplication):
244
228
  """
245
229
  import re
246
230
 
247
- metadata = {
248
- "name": folder_name,
249
- "mimeType": "application/vnd.google-apps.folder",
250
- }
231
+ metadata = {"name": folder_name, "mimeType": "application/vnd.google-apps.folder"}
251
232
  if parent_id:
252
- if not re.match(r"^[a-zA-Z0-9_-]{28,33}$", parent_id):
233
+ if not re.match("^[a-zA-Z0-9_-]{28,33}$", parent_id):
253
234
  found_id = self.find_folder_id_by_name(parent_id)
254
235
  if found_id:
255
236
  metadata["parents"] = [found_id]
256
237
  else:
257
- raise ValueError(
258
- f"Could not find parent folder with name: {parent_id}"
259
- )
238
+ raise ValueError(f"Could not find parent folder with name: {parent_id}")
260
239
  else:
261
240
  metadata["parents"] = [parent_id]
262
241
  url = f"{self.base_url}/files"
@@ -264,13 +243,7 @@ class GoogleDriveApp(APIApplication):
264
243
  response = self._post(url, data=metadata, params=params)
265
244
  return response.json()
266
245
 
267
- def upload_file_from_path(
268
- self,
269
- file_name: str,
270
- file_path: str,
271
- parent_id: str = None,
272
- mime_type: str = None,
273
- ) -> dict[str, Any]:
246
+ async def upload_file_from_path(self, file_name: str, file_path: str, parent_id: str = None, mime_type: str = None) -> dict[str, Any]:
274
247
  """
275
248
  Uploads a local file to Google Drive by reading its binary content from a path. It creates the file's metadata, uploads the content, and returns the new file's metadata. This differs from `create_text_file` which uses in-memory string content instead of a local file path.
276
249
 
@@ -300,19 +273,15 @@ class GoogleDriveApp(APIApplication):
300
273
  file_id = file_data.get("id")
301
274
  with open(file_path, "rb") as file_content:
302
275
  binary_content = file_content.read()
303
-
304
276
  upload_url = f"https://www.googleapis.com/upload/drive/v3/files/{file_id}?uploadType=media"
305
277
  upload_headers = self._get_headers()
306
278
  upload_headers["Content-Type"] = mime_type
307
-
308
- upload_response = httpx.patch(
309
- upload_url, headers=upload_headers, content=binary_content
310
- )
279
+ upload_response = httpx.patch(upload_url, headers=upload_headers, content=binary_content)
311
280
  upload_response.raise_for_status()
312
281
  response_data = upload_response.json()
313
282
  return response_data
314
283
 
315
- def list_installed_apps(
284
+ async def list_installed_apps(
316
285
  self,
317
286
  appFilterExtensions: str | None = None,
318
287
  appFilterMimeTypes: str | None = None,
@@ -381,18 +350,14 @@ class GoogleDriveApp(APIApplication):
381
350
  }
382
351
  response = self._get(url, params=query_params)
383
352
  response.raise_for_status()
384
- if (
385
- response.status_code == 204
386
- or not response.content
387
- or not response.text.strip()
388
- ):
353
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
389
354
  return None
390
355
  try:
391
356
  return response.json()
392
357
  except ValueError:
393
358
  return None
394
359
 
395
- def get_app_by_id(
360
+ async def get_app_by_id(
396
361
  self,
397
362
  appId: str,
398
363
  access_token: str | None = None,
@@ -456,18 +421,14 @@ class GoogleDriveApp(APIApplication):
456
421
  }
457
422
  response = self._get(url, params=query_params)
458
423
  response.raise_for_status()
459
- if (
460
- response.status_code == 204
461
- or not response.content
462
- or not response.text.strip()
463
- ):
424
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
464
425
  return None
465
426
  try:
466
427
  return response.json()
467
428
  except ValueError:
468
429
  return None
469
430
 
470
- def get_about_info(
431
+ async def get_about_info(
471
432
  self,
472
433
  alt: str | None = None,
473
434
  fields: str | None = None,
@@ -515,18 +476,14 @@ class GoogleDriveApp(APIApplication):
515
476
  }
516
477
  response = self._get(url, params=query_params)
517
478
  response.raise_for_status()
518
- if (
519
- response.status_code == 204
520
- or not response.content
521
- or not response.text.strip()
522
- ):
479
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
523
480
  return None
524
481
  try:
525
482
  return response.json()
526
483
  except ValueError:
527
484
  return None
528
485
 
529
- def list_drive_changes(
486
+ async def list_drive_changes(
530
487
  self,
531
488
  pageToken: str | None = None,
532
489
  driveId: str | None = None,
@@ -616,18 +573,14 @@ class GoogleDriveApp(APIApplication):
616
573
  }
617
574
  response = self._get(url, params=query_params)
618
575
  response.raise_for_status()
619
- if (
620
- response.status_code == 204
621
- or not response.content
622
- or not response.text.strip()
623
- ):
576
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
624
577
  return None
625
578
  try:
626
579
  return response.json()
627
580
  except ValueError:
628
581
  return None
629
582
 
630
- def get_changes_start_token(
583
+ async def get_changes_start_token(
631
584
  self,
632
585
  driveId: str | None = None,
633
586
  supportsAllDrives: str | None = None,
@@ -687,18 +640,14 @@ class GoogleDriveApp(APIApplication):
687
640
  }
688
641
  response = self._get(url, params=query_params)
689
642
  response.raise_for_status()
690
- if (
691
- response.status_code == 204
692
- or not response.content
693
- or not response.text.strip()
694
- ):
643
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
695
644
  return None
696
645
  try:
697
646
  return response.json()
698
647
  except ValueError:
699
648
  return None
700
649
 
701
- def watch_drive_changes(
650
+ async def watch_drive_changes(
702
651
  self,
703
652
  pageToken: str | None = None,
704
653
  driveId: str | None = None,
@@ -791,9 +740,7 @@ class GoogleDriveApp(APIApplication):
791
740
  "token": token,
792
741
  "type": type,
793
742
  }
794
- request_body_data = {
795
- k: v for k, v in request_body_data.items() if v is not None
796
- }
743
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
797
744
  url = f"{self.base_url}/changes/watch"
798
745
  query_params = {
799
746
  k: v
@@ -822,25 +769,16 @@ class GoogleDriveApp(APIApplication):
822
769
  ]
823
770
  if v is not None
824
771
  }
825
- response = self._post(
826
- url,
827
- data=request_body_data,
828
- params=query_params,
829
- content_type="application/json",
830
- )
772
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
831
773
  response.raise_for_status()
832
- if (
833
- response.status_code == 204
834
- or not response.content
835
- or not response.text.strip()
836
- ):
774
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
837
775
  return None
838
776
  try:
839
777
  return response.json()
840
778
  except ValueError:
841
779
  return None
842
780
 
843
- def stop_watching_channel(
781
+ async def stop_watching_channel(
844
782
  self,
845
783
  alt: str | None = None,
846
784
  fields: str | None = None,
@@ -905,9 +843,7 @@ class GoogleDriveApp(APIApplication):
905
843
  "token": token,
906
844
  "type": type,
907
845
  }
908
- request_body_data = {
909
- k: v for k, v in request_body_data.items() if v is not None
910
- }
846
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
911
847
  url = f"{self.base_url}/channels/stop"
912
848
  query_params = {
913
849
  k: v
@@ -922,25 +858,16 @@ class GoogleDriveApp(APIApplication):
922
858
  ]
923
859
  if v is not None
924
860
  }
925
- response = self._post(
926
- url,
927
- data=request_body_data,
928
- params=query_params,
929
- content_type="application/json",
930
- )
861
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
931
862
  response.raise_for_status()
932
- if (
933
- response.status_code == 204
934
- or not response.content
935
- or not response.text.strip()
936
- ):
863
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
937
864
  return None
938
865
  try:
939
866
  return response.json()
940
867
  except ValueError:
941
868
  return None
942
869
 
943
- def list_file_comments(
870
+ async def list_file_comments(
944
871
  self,
945
872
  fileId: str,
946
873
  includeDeleted: str | None = None,
@@ -1004,18 +931,14 @@ class GoogleDriveApp(APIApplication):
1004
931
  }
1005
932
  response = self._get(url, params=query_params)
1006
933
  response.raise_for_status()
1007
- if (
1008
- response.status_code == 204
1009
- or not response.content
1010
- or not response.text.strip()
1011
- ):
934
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1012
935
  return None
1013
936
  try:
1014
937
  return response.json()
1015
938
  except ValueError:
1016
939
  return None
1017
940
 
1018
- def create_file_comment(
941
+ async def create_file_comment(
1019
942
  self,
1020
943
  fileId: str,
1021
944
  alt: str | None = None,
@@ -1090,9 +1013,7 @@ class GoogleDriveApp(APIApplication):
1090
1013
  "replies": replies,
1091
1014
  "resolved": resolved,
1092
1015
  }
1093
- request_body_data = {
1094
- k: v for k, v in request_body_data.items() if v is not None
1095
- }
1016
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1096
1017
  url = f"{self.base_url}/files/{fileId}/comments"
1097
1018
  query_params = {
1098
1019
  k: v
@@ -1107,25 +1028,16 @@ class GoogleDriveApp(APIApplication):
1107
1028
  ]
1108
1029
  if v is not None
1109
1030
  }
1110
- response = self._post(
1111
- url,
1112
- data=request_body_data,
1113
- params=query_params,
1114
- content_type="application/json",
1115
- )
1031
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
1116
1032
  response.raise_for_status()
1117
- if (
1118
- response.status_code == 204
1119
- or not response.content
1120
- or not response.text.strip()
1121
- ):
1033
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1122
1034
  return None
1123
1035
  try:
1124
1036
  return response.json()
1125
1037
  except ValueError:
1126
1038
  return None
1127
1039
 
1128
- def get_file_comment_by_id(
1040
+ async def get_file_comment_by_id(
1129
1041
  self,
1130
1042
  fileId: str,
1131
1043
  commentId: str,
@@ -1184,18 +1096,14 @@ class GoogleDriveApp(APIApplication):
1184
1096
  }
1185
1097
  response = self._get(url, params=query_params)
1186
1098
  response.raise_for_status()
1187
- if (
1188
- response.status_code == 204
1189
- or not response.content
1190
- or not response.text.strip()
1191
- ):
1099
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1192
1100
  return None
1193
1101
  try:
1194
1102
  return response.json()
1195
1103
  except ValueError:
1196
1104
  return None
1197
1105
 
1198
- def delete_comment(
1106
+ async def delete_comment(
1199
1107
  self,
1200
1108
  fileId: str,
1201
1109
  commentId: str,
@@ -1251,18 +1159,14 @@ class GoogleDriveApp(APIApplication):
1251
1159
  }
1252
1160
  response = self._delete(url, params=query_params)
1253
1161
  response.raise_for_status()
1254
- if (
1255
- response.status_code == 204
1256
- or not response.content
1257
- or not response.text.strip()
1258
- ):
1162
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1259
1163
  return None
1260
1164
  try:
1261
1165
  return response.json()
1262
1166
  except ValueError:
1263
1167
  return None
1264
1168
 
1265
- def update_comment(
1169
+ async def update_comment(
1266
1170
  self,
1267
1171
  fileId: str,
1268
1172
  commentId: str,
@@ -1341,9 +1245,7 @@ class GoogleDriveApp(APIApplication):
1341
1245
  "replies": replies,
1342
1246
  "resolved": resolved,
1343
1247
  }
1344
- request_body_data = {
1345
- k: v for k, v in request_body_data.items() if v is not None
1346
- }
1248
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1347
1249
  url = f"{self.base_url}/files/{fileId}/comments/{commentId}"
1348
1250
  query_params = {
1349
1251
  k: v
@@ -1360,18 +1262,14 @@ class GoogleDriveApp(APIApplication):
1360
1262
  }
1361
1263
  response = self._patch(url, data=request_body_data, params=query_params)
1362
1264
  response.raise_for_status()
1363
- if (
1364
- response.status_code == 204
1365
- or not response.content
1366
- or not response.text.strip()
1367
- ):
1265
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1368
1266
  return None
1369
1267
  try:
1370
1268
  return response.json()
1371
1269
  except ValueError:
1372
1270
  return None
1373
1271
 
1374
- def list_shared_drives(
1272
+ async def list_shared_drives(
1375
1273
  self,
1376
1274
  pageSize: str | None = None,
1377
1275
  pageToken: str | None = None,
@@ -1431,18 +1329,14 @@ class GoogleDriveApp(APIApplication):
1431
1329
  }
1432
1330
  response = self._get(url, params=query_params)
1433
1331
  response.raise_for_status()
1434
- if (
1435
- response.status_code == 204
1436
- or not response.content
1437
- or not response.text.strip()
1438
- ):
1332
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1439
1333
  return None
1440
1334
  try:
1441
1335
  return response.json()
1442
1336
  except ValueError:
1443
1337
  return None
1444
1338
 
1445
- def create_shared_drive(
1339
+ async def create_shared_drive(
1446
1340
  self,
1447
1341
  requestId: str | None = None,
1448
1342
  alt: str | None = None,
@@ -1515,9 +1409,7 @@ class GoogleDriveApp(APIApplication):
1515
1409
  "restrictions": restrictions,
1516
1410
  "themeId": themeId,
1517
1411
  }
1518
- request_body_data = {
1519
- k: v for k, v in request_body_data.items() if v is not None
1520
- }
1412
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1521
1413
  url = f"{self.base_url}/drives"
1522
1414
  query_params = {
1523
1415
  k: v
@@ -1533,25 +1425,16 @@ class GoogleDriveApp(APIApplication):
1533
1425
  ]
1534
1426
  if v is not None
1535
1427
  }
1536
- response = self._post(
1537
- url,
1538
- data=request_body_data,
1539
- params=query_params,
1540
- content_type="application/json",
1541
- )
1428
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
1542
1429
  response.raise_for_status()
1543
- if (
1544
- response.status_code == 204
1545
- or not response.content
1546
- or not response.text.strip()
1547
- ):
1430
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1548
1431
  return None
1549
1432
  try:
1550
1433
  return response.json()
1551
1434
  except ValueError:
1552
1435
  return None
1553
1436
 
1554
- def get_shared_drive_metadata(
1437
+ async def get_shared_drive_metadata(
1555
1438
  self,
1556
1439
  driveId: str,
1557
1440
  useDomainAdminAccess: str | None = None,
@@ -1606,18 +1489,14 @@ class GoogleDriveApp(APIApplication):
1606
1489
  }
1607
1490
  response = self._get(url, params=query_params)
1608
1491
  response.raise_for_status()
1609
- if (
1610
- response.status_code == 204
1611
- or not response.content
1612
- or not response.text.strip()
1613
- ):
1492
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1614
1493
  return None
1615
1494
  try:
1616
1495
  return response.json()
1617
1496
  except ValueError:
1618
1497
  return None
1619
1498
 
1620
- def delete_shared_drive(
1499
+ async def delete_shared_drive(
1621
1500
  self,
1622
1501
  driveId: str,
1623
1502
  allowItemDeletion: str | None = None,
@@ -1675,18 +1554,14 @@ class GoogleDriveApp(APIApplication):
1675
1554
  }
1676
1555
  response = self._delete(url, params=query_params)
1677
1556
  response.raise_for_status()
1678
- if (
1679
- response.status_code == 204
1680
- or not response.content
1681
- or not response.text.strip()
1682
- ):
1557
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1683
1558
  return None
1684
1559
  try:
1685
1560
  return response.json()
1686
1561
  except ValueError:
1687
1562
  return None
1688
1563
 
1689
- def update_shared_drive(
1564
+ async def update_shared_drive(
1690
1565
  self,
1691
1566
  driveId: str,
1692
1567
  useDomainAdminAccess: str | None = None,
@@ -1763,9 +1638,7 @@ class GoogleDriveApp(APIApplication):
1763
1638
  "restrictions": restrictions,
1764
1639
  "themeId": themeId,
1765
1640
  }
1766
- request_body_data = {
1767
- k: v for k, v in request_body_data.items() if v is not None
1768
- }
1641
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
1769
1642
  url = f"{self.base_url}/drives/{driveId}"
1770
1643
  query_params = {
1771
1644
  k: v
@@ -1783,18 +1656,14 @@ class GoogleDriveApp(APIApplication):
1783
1656
  }
1784
1657
  response = self._patch(url, data=request_body_data, params=query_params)
1785
1658
  response.raise_for_status()
1786
- if (
1787
- response.status_code == 204
1788
- or not response.content
1789
- or not response.text.strip()
1790
- ):
1659
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1791
1660
  return None
1792
1661
  try:
1793
1662
  return response.json()
1794
1663
  except ValueError:
1795
1664
  return None
1796
1665
 
1797
- def hide_drive(
1666
+ async def hide_drive(
1798
1667
  self,
1799
1668
  driveId: str,
1800
1669
  alt: str | None = None,
@@ -1845,25 +1714,16 @@ class GoogleDriveApp(APIApplication):
1845
1714
  ]
1846
1715
  if v is not None
1847
1716
  }
1848
- response = self._post(
1849
- url,
1850
- data=request_body_data,
1851
- params=query_params,
1852
- content_type="application/json",
1853
- )
1717
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
1854
1718
  response.raise_for_status()
1855
- if (
1856
- response.status_code == 204
1857
- or not response.content
1858
- or not response.text.strip()
1859
- ):
1719
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1860
1720
  return None
1861
1721
  try:
1862
1722
  return response.json()
1863
1723
  except ValueError:
1864
1724
  return None
1865
1725
 
1866
- def unhide_drive(
1726
+ async def unhide_drive(
1867
1727
  self,
1868
1728
  driveId: str,
1869
1729
  alt: str | None = None,
@@ -1914,25 +1774,16 @@ class GoogleDriveApp(APIApplication):
1914
1774
  ]
1915
1775
  if v is not None
1916
1776
  }
1917
- response = self._post(
1918
- url,
1919
- data=request_body_data,
1920
- params=query_params,
1921
- content_type="application/json",
1922
- )
1777
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
1923
1778
  response.raise_for_status()
1924
- if (
1925
- response.status_code == 204
1926
- or not response.content
1927
- or not response.text.strip()
1928
- ):
1779
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
1929
1780
  return None
1930
1781
  try:
1931
1782
  return response.json()
1932
1783
  except ValueError:
1933
1784
  return None
1934
1785
 
1935
- def search_files_advanced(
1786
+ async def search_files_advanced(
1936
1787
  self,
1937
1788
  corpora: str | None = None,
1938
1789
  driveId: str | None = None,
@@ -2022,18 +1873,14 @@ class GoogleDriveApp(APIApplication):
2022
1873
  }
2023
1874
  response = self._get(url, params=query_params)
2024
1875
  response.raise_for_status()
2025
- if (
2026
- response.status_code == 204
2027
- or not response.content
2028
- or not response.text.strip()
2029
- ):
1876
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
2030
1877
  return None
2031
1878
  try:
2032
1879
  return response.json()
2033
1880
  except ValueError:
2034
1881
  return None
2035
1882
 
2036
- def create_file_metadata(
1883
+ async def create_file_metadata(
2037
1884
  self,
2038
1885
  enforceSingleParent: str | None = None,
2039
1886
  ignoreDefaultVisibility: str | None = None,
@@ -2272,9 +2119,7 @@ class GoogleDriveApp(APIApplication):
2272
2119
  "webViewLink": webViewLink,
2273
2120
  "writersCanShare": writersCanShare,
2274
2121
  }
2275
- request_body_data = {
2276
- k: v for k, v in request_body_data.items() if v is not None
2277
- }
2122
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
2278
2123
  url = f"{self.base_url}/files"
2279
2124
  query_params = {
2280
2125
  k: v
@@ -2298,25 +2143,16 @@ class GoogleDriveApp(APIApplication):
2298
2143
  ]
2299
2144
  if v is not None
2300
2145
  }
2301
- response = self._post(
2302
- url,
2303
- data=request_body_data,
2304
- params=query_params,
2305
- content_type="application/json",
2306
- )
2146
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
2307
2147
  response.raise_for_status()
2308
- if (
2309
- response.status_code == 204
2310
- or not response.content
2311
- or not response.text.strip()
2312
- ):
2148
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
2313
2149
  return None
2314
2150
  try:
2315
2151
  return response.json()
2316
2152
  except ValueError:
2317
2153
  return None
2318
2154
 
2319
- def generate_file_ids(
2155
+ async def generate_file_ids(
2320
2156
  self,
2321
2157
  count: str | None = None,
2322
2158
  space: str | None = None,
@@ -2373,18 +2209,14 @@ class GoogleDriveApp(APIApplication):
2373
2209
  }
2374
2210
  response = self._get(url, params=query_params)
2375
2211
  response.raise_for_status()
2376
- if (
2377
- response.status_code == 204
2378
- or not response.content
2379
- or not response.text.strip()
2380
- ):
2212
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
2381
2213
  return None
2382
2214
  try:
2383
2215
  return response.json()
2384
2216
  except ValueError:
2385
2217
  return None
2386
2218
 
2387
- def empty_trash(
2219
+ async def empty_trash(
2388
2220
  self,
2389
2221
  driveId: str | None = None,
2390
2222
  enforceSingleParent: str | None = None,
@@ -2438,18 +2270,14 @@ class GoogleDriveApp(APIApplication):
2438
2270
  }
2439
2271
  response = self._delete(url, params=query_params)
2440
2272
  response.raise_for_status()
2441
- if (
2442
- response.status_code == 204
2443
- or not response.content
2444
- or not response.text.strip()
2445
- ):
2273
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
2446
2274
  return None
2447
2275
  try:
2448
2276
  return response.json()
2449
2277
  except ValueError:
2450
2278
  return None
2451
2279
 
2452
- def permanently_delete_file(
2280
+ async def permanently_delete_file(
2453
2281
  self,
2454
2282
  fileId: str,
2455
2283
  enforceSingleParent: str | None = None,
@@ -2510,18 +2338,14 @@ class GoogleDriveApp(APIApplication):
2510
2338
  }
2511
2339
  response = self._delete(url, params=query_params)
2512
2340
  response.raise_for_status()
2513
- if (
2514
- response.status_code == 204
2515
- or not response.content
2516
- or not response.text.strip()
2517
- ):
2341
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
2518
2342
  return None
2519
2343
  try:
2520
2344
  return response.json()
2521
2345
  except ValueError:
2522
2346
  return None
2523
2347
 
2524
- def update_file_metadata(
2348
+ async def update_file_metadata(
2525
2349
  self,
2526
2350
  fileId: str,
2527
2351
  addParents: str | None = None,
@@ -2766,9 +2590,7 @@ class GoogleDriveApp(APIApplication):
2766
2590
  "webViewLink": webViewLink,
2767
2591
  "writersCanShare": writersCanShare,
2768
2592
  }
2769
- request_body_data = {
2770
- k: v for k, v in request_body_data.items() if v is not None
2771
- }
2593
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
2772
2594
  url = f"{self.base_url}/files/{fileId}"
2773
2595
  query_params = {
2774
2596
  k: v
@@ -2795,18 +2617,14 @@ class GoogleDriveApp(APIApplication):
2795
2617
  }
2796
2618
  response = self._patch(url, data=request_body_data, params=query_params)
2797
2619
  response.raise_for_status()
2798
- if (
2799
- response.status_code == 204
2800
- or not response.content
2801
- or not response.text.strip()
2802
- ):
2620
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
2803
2621
  return None
2804
2622
  try:
2805
2623
  return response.json()
2806
2624
  except ValueError:
2807
2625
  return None
2808
2626
 
2809
- def copy_file(
2627
+ async def copy_file(
2810
2628
  self,
2811
2629
  fileId: str,
2812
2630
  enforceSingleParent: str | None = None,
@@ -3047,9 +2865,7 @@ class GoogleDriveApp(APIApplication):
3047
2865
  "webViewLink": webViewLink,
3048
2866
  "writersCanShare": writersCanShare,
3049
2867
  }
3050
- request_body_data = {
3051
- k: v for k, v in request_body_data.items() if v is not None
3052
- }
2868
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
3053
2869
  url = f"{self.base_url}/files/{fileId}/copy"
3054
2870
  query_params = {
3055
2871
  k: v
@@ -3072,25 +2888,16 @@ class GoogleDriveApp(APIApplication):
3072
2888
  ]
3073
2889
  if v is not None
3074
2890
  }
3075
- response = self._post(
3076
- url,
3077
- data=request_body_data,
3078
- params=query_params,
3079
- content_type="application/json",
3080
- )
2891
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
3081
2892
  response.raise_for_status()
3082
- if (
3083
- response.status_code == 204
3084
- or not response.content
3085
- or not response.text.strip()
3086
- ):
2893
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3087
2894
  return None
3088
2895
  try:
3089
2896
  return response.json()
3090
2897
  except ValueError:
3091
2898
  return None
3092
2899
 
3093
- def export_file(
2900
+ async def export_file(
3094
2901
  self,
3095
2902
  fileId: str,
3096
2903
  mimeType: str | None = None,
@@ -3145,18 +2952,14 @@ class GoogleDriveApp(APIApplication):
3145
2952
  }
3146
2953
  response = self._get(url, params=query_params)
3147
2954
  response.raise_for_status()
3148
- if (
3149
- response.status_code == 204
3150
- or not response.content
3151
- or not response.text.strip()
3152
- ):
2955
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3153
2956
  return None
3154
2957
  try:
3155
2958
  return response.json()
3156
2959
  except ValueError:
3157
2960
  return None
3158
2961
 
3159
- def list_file_labels(
2962
+ async def list_file_labels(
3160
2963
  self,
3161
2964
  fileId: str,
3162
2965
  maxResults: str | None = None,
@@ -3214,18 +3017,14 @@ class GoogleDriveApp(APIApplication):
3214
3017
  }
3215
3018
  response = self._get(url, params=query_params)
3216
3019
  response.raise_for_status()
3217
- if (
3218
- response.status_code == 204
3219
- or not response.content
3220
- or not response.text.strip()
3221
- ):
3020
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3222
3021
  return None
3223
3022
  try:
3224
3023
  return response.json()
3225
3024
  except ValueError:
3226
3025
  return None
3227
3026
 
3228
- def modify_file_labels(
3027
+ async def modify_file_labels(
3229
3028
  self,
3230
3029
  fileId: str,
3231
3030
  alt: str | None = None,
@@ -3266,13 +3065,8 @@ class GoogleDriveApp(APIApplication):
3266
3065
  if fileId is None:
3267
3066
  raise ValueError("Missing required parameter 'fileId'.")
3268
3067
  request_body_data = None
3269
- request_body_data = {
3270
- "kind": kind,
3271
- "labelModifications": labelModifications,
3272
- }
3273
- request_body_data = {
3274
- k: v for k, v in request_body_data.items() if v is not None
3275
- }
3068
+ request_body_data = {"kind": kind, "labelModifications": labelModifications}
3069
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
3276
3070
  url = f"{self.base_url}/files/{fileId}/modifyLabels"
3277
3071
  query_params = {
3278
3072
  k: v
@@ -3287,25 +3081,16 @@ class GoogleDriveApp(APIApplication):
3287
3081
  ]
3288
3082
  if v is not None
3289
3083
  }
3290
- response = self._post(
3291
- url,
3292
- data=request_body_data,
3293
- params=query_params,
3294
- content_type="application/json",
3295
- )
3084
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
3296
3085
  response.raise_for_status()
3297
- if (
3298
- response.status_code == 204
3299
- or not response.content
3300
- or not response.text.strip()
3301
- ):
3086
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3302
3087
  return None
3303
3088
  try:
3304
3089
  return response.json()
3305
3090
  except ValueError:
3306
3091
  return None
3307
3092
 
3308
- def watch_file_for_changes(
3093
+ async def watch_file_for_changes(
3309
3094
  self,
3310
3095
  fileId: str,
3311
3096
  acknowledgeAbuse: str | None = None,
@@ -3384,9 +3169,7 @@ class GoogleDriveApp(APIApplication):
3384
3169
  "token": token,
3385
3170
  "type": type,
3386
3171
  }
3387
- request_body_data = {
3388
- k: v for k, v in request_body_data.items() if v is not None
3389
- }
3172
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
3390
3173
  url = f"{self.base_url}/files/{fileId}/watch"
3391
3174
  query_params = {
3392
3175
  k: v
@@ -3406,25 +3189,16 @@ class GoogleDriveApp(APIApplication):
3406
3189
  ]
3407
3190
  if v is not None
3408
3191
  }
3409
- response = self._post(
3410
- url,
3411
- data=request_body_data,
3412
- params=query_params,
3413
- content_type="application/json",
3414
- )
3192
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
3415
3193
  response.raise_for_status()
3416
- if (
3417
- response.status_code == 204
3418
- or not response.content
3419
- or not response.text.strip()
3420
- ):
3194
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3421
3195
  return None
3422
3196
  try:
3423
3197
  return response.json()
3424
3198
  except ValueError:
3425
3199
  return None
3426
3200
 
3427
- def list_file_permissions(
3201
+ async def list_file_permissions(
3428
3202
  self,
3429
3203
  fileId: str,
3430
3204
  includePermissionsForView: str | None = None,
@@ -3494,18 +3268,14 @@ class GoogleDriveApp(APIApplication):
3494
3268
  }
3495
3269
  response = self._get(url, params=query_params)
3496
3270
  response.raise_for_status()
3497
- if (
3498
- response.status_code == 204
3499
- or not response.content
3500
- or not response.text.strip()
3501
- ):
3271
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3502
3272
  return None
3503
3273
  try:
3504
3274
  return response.json()
3505
3275
  except ValueError:
3506
3276
  return None
3507
3277
 
3508
- def create_file_permission(
3278
+ async def create_file_permission(
3509
3279
  self,
3510
3280
  fileId: str,
3511
3281
  emailMessage: str | None = None,
@@ -3605,9 +3375,7 @@ class GoogleDriveApp(APIApplication):
3605
3375
  "type": type,
3606
3376
  "view": view,
3607
3377
  }
3608
- request_body_data = {
3609
- k: v for k, v in request_body_data.items() if v is not None
3610
- }
3378
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
3611
3379
  url = f"{self.base_url}/files/{fileId}/permissions"
3612
3380
  query_params = {
3613
3381
  k: v
@@ -3630,25 +3398,16 @@ class GoogleDriveApp(APIApplication):
3630
3398
  ]
3631
3399
  if v is not None
3632
3400
  }
3633
- response = self._post(
3634
- url,
3635
- data=request_body_data,
3636
- params=query_params,
3637
- content_type="application/json",
3638
- )
3401
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
3639
3402
  response.raise_for_status()
3640
- if (
3641
- response.status_code == 204
3642
- or not response.content
3643
- or not response.text.strip()
3644
- ):
3403
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3645
3404
  return None
3646
3405
  try:
3647
3406
  return response.json()
3648
3407
  except ValueError:
3649
3408
  return None
3650
3409
 
3651
- def get_permission_by_id(
3410
+ async def get_permission_by_id(
3652
3411
  self,
3653
3412
  fileId: str,
3654
3413
  permissionId: str,
@@ -3713,18 +3472,14 @@ class GoogleDriveApp(APIApplication):
3713
3472
  }
3714
3473
  response = self._get(url, params=query_params)
3715
3474
  response.raise_for_status()
3716
- if (
3717
- response.status_code == 204
3718
- or not response.content
3719
- or not response.text.strip()
3720
- ):
3475
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3721
3476
  return None
3722
3477
  try:
3723
3478
  return response.json()
3724
3479
  except ValueError:
3725
3480
  return None
3726
3481
 
3727
- def delete_permission(
3482
+ async def delete_permission(
3728
3483
  self,
3729
3484
  fileId: str,
3730
3485
  permissionId: str,
@@ -3789,18 +3544,14 @@ class GoogleDriveApp(APIApplication):
3789
3544
  }
3790
3545
  response = self._delete(url, params=query_params)
3791
3546
  response.raise_for_status()
3792
- if (
3793
- response.status_code == 204
3794
- or not response.content
3795
- or not response.text.strip()
3796
- ):
3547
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3797
3548
  return None
3798
3549
  try:
3799
3550
  return response.json()
3800
3551
  except ValueError:
3801
3552
  return None
3802
3553
 
3803
- def update_permission(
3554
+ async def update_permission(
3804
3555
  self,
3805
3556
  fileId: str,
3806
3557
  permissionId: str,
@@ -3898,9 +3649,7 @@ class GoogleDriveApp(APIApplication):
3898
3649
  "type": type,
3899
3650
  "view": view,
3900
3651
  }
3901
- request_body_data = {
3902
- k: v for k, v in request_body_data.items() if v is not None
3903
- }
3652
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
3904
3653
  url = f"{self.base_url}/files/{fileId}/permissions/{permissionId}"
3905
3654
  query_params = {
3906
3655
  k: v
@@ -3922,18 +3671,14 @@ class GoogleDriveApp(APIApplication):
3922
3671
  }
3923
3672
  response = self._patch(url, data=request_body_data, params=query_params)
3924
3673
  response.raise_for_status()
3925
- if (
3926
- response.status_code == 204
3927
- or not response.content
3928
- or not response.text.strip()
3929
- ):
3674
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
3930
3675
  return None
3931
3676
  try:
3932
3677
  return response.json()
3933
3678
  except ValueError:
3934
3679
  return None
3935
3680
 
3936
- def list_comment_replies(
3681
+ async def list_comment_replies(
3937
3682
  self,
3938
3683
  fileId: str,
3939
3684
  commentId: str,
@@ -3998,18 +3743,14 @@ class GoogleDriveApp(APIApplication):
3998
3743
  }
3999
3744
  response = self._get(url, params=query_params)
4000
3745
  response.raise_for_status()
4001
- if (
4002
- response.status_code == 204
4003
- or not response.content
4004
- or not response.text.strip()
4005
- ):
3746
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4006
3747
  return None
4007
3748
  try:
4008
3749
  return response.json()
4009
3750
  except ValueError:
4010
3751
  return None
4011
3752
 
4012
- def create_comment_reply(
3753
+ async def create_comment_reply(
4013
3754
  self,
4014
3755
  fileId: str,
4015
3756
  commentId: str,
@@ -4079,9 +3820,7 @@ class GoogleDriveApp(APIApplication):
4079
3820
  "kind": kind,
4080
3821
  "modifiedTime": modifiedTime,
4081
3822
  }
4082
- request_body_data = {
4083
- k: v for k, v in request_body_data.items() if v is not None
4084
- }
3823
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
4085
3824
  url = f"{self.base_url}/files/{fileId}/comments/{commentId}/replies"
4086
3825
  query_params = {
4087
3826
  k: v
@@ -4096,25 +3835,16 @@ class GoogleDriveApp(APIApplication):
4096
3835
  ]
4097
3836
  if v is not None
4098
3837
  }
4099
- response = self._post(
4100
- url,
4101
- data=request_body_data,
4102
- params=query_params,
4103
- content_type="application/json",
4104
- )
3838
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
4105
3839
  response.raise_for_status()
4106
- if (
4107
- response.status_code == 204
4108
- or not response.content
4109
- or not response.text.strip()
4110
- ):
3840
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4111
3841
  return None
4112
3842
  try:
4113
3843
  return response.json()
4114
3844
  except ValueError:
4115
3845
  return None
4116
3846
 
4117
- def get_reply_by_id(
3847
+ async def get_reply_by_id(
4118
3848
  self,
4119
3849
  fileId: str,
4120
3850
  commentId: str,
@@ -4177,18 +3907,14 @@ class GoogleDriveApp(APIApplication):
4177
3907
  }
4178
3908
  response = self._get(url, params=query_params)
4179
3909
  response.raise_for_status()
4180
- if (
4181
- response.status_code == 204
4182
- or not response.content
4183
- or not response.text.strip()
4184
- ):
3910
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4185
3911
  return None
4186
3912
  try:
4187
3913
  return response.json()
4188
3914
  except ValueError:
4189
3915
  return None
4190
3916
 
4191
- def delete_reply(
3917
+ async def delete_reply(
4192
3918
  self,
4193
3919
  fileId: str,
4194
3920
  commentId: str,
@@ -4248,18 +3974,14 @@ class GoogleDriveApp(APIApplication):
4248
3974
  }
4249
3975
  response = self._delete(url, params=query_params)
4250
3976
  response.raise_for_status()
4251
- if (
4252
- response.status_code == 204
4253
- or not response.content
4254
- or not response.text.strip()
4255
- ):
3977
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4256
3978
  return None
4257
3979
  try:
4258
3980
  return response.json()
4259
3981
  except ValueError:
4260
3982
  return None
4261
3983
 
4262
- def update_reply(
3984
+ async def update_reply(
4263
3985
  self,
4264
3986
  fileId: str,
4265
3987
  commentId: str,
@@ -4333,9 +4055,7 @@ class GoogleDriveApp(APIApplication):
4333
4055
  "kind": kind,
4334
4056
  "modifiedTime": modifiedTime,
4335
4057
  }
4336
- request_body_data = {
4337
- k: v for k, v in request_body_data.items() if v is not None
4338
- }
4058
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
4339
4059
  url = f"{self.base_url}/files/{fileId}/comments/{commentId}/replies/{replyId}"
4340
4060
  query_params = {
4341
4061
  k: v
@@ -4352,18 +4072,14 @@ class GoogleDriveApp(APIApplication):
4352
4072
  }
4353
4073
  response = self._patch(url, data=request_body_data, params=query_params)
4354
4074
  response.raise_for_status()
4355
- if (
4356
- response.status_code == 204
4357
- or not response.content
4358
- or not response.text.strip()
4359
- ):
4075
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4360
4076
  return None
4361
4077
  try:
4362
4078
  return response.json()
4363
4079
  except ValueError:
4364
4080
  return None
4365
4081
 
4366
- def list_file_revisions(
4082
+ async def list_file_revisions(
4367
4083
  self,
4368
4084
  fileId: str,
4369
4085
  pageSize: str | None = None,
@@ -4421,18 +4137,14 @@ class GoogleDriveApp(APIApplication):
4421
4137
  }
4422
4138
  response = self._get(url, params=query_params)
4423
4139
  response.raise_for_status()
4424
- if (
4425
- response.status_code == 204
4426
- or not response.content
4427
- or not response.text.strip()
4428
- ):
4140
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4429
4141
  return None
4430
4142
  try:
4431
4143
  return response.json()
4432
4144
  except ValueError:
4433
4145
  return None
4434
4146
 
4435
- def get_revision(
4147
+ async def get_revision(
4436
4148
  self,
4437
4149
  fileId: str,
4438
4150
  revisionId: str,
@@ -4491,18 +4203,14 @@ class GoogleDriveApp(APIApplication):
4491
4203
  }
4492
4204
  response = self._get(url, params=query_params)
4493
4205
  response.raise_for_status()
4494
- if (
4495
- response.status_code == 204
4496
- or not response.content
4497
- or not response.text.strip()
4498
- ):
4206
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4499
4207
  return None
4500
4208
  try:
4501
4209
  return response.json()
4502
4210
  except ValueError:
4503
4211
  return None
4504
4212
 
4505
- def delete_file_revision(
4213
+ async def delete_file_revision(
4506
4214
  self,
4507
4215
  fileId: str,
4508
4216
  revisionId: str,
@@ -4558,18 +4266,14 @@ class GoogleDriveApp(APIApplication):
4558
4266
  }
4559
4267
  response = self._delete(url, params=query_params)
4560
4268
  response.raise_for_status()
4561
- if (
4562
- response.status_code == 204
4563
- or not response.content
4564
- or not response.text.strip()
4565
- ):
4269
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4566
4270
  return None
4567
4271
  try:
4568
4272
  return response.json()
4569
4273
  except ValueError:
4570
4274
  return None
4571
4275
 
4572
- def update_revision(
4276
+ async def update_revision(
4573
4277
  self,
4574
4278
  fileId: str,
4575
4279
  revisionId: str,
@@ -4654,9 +4358,7 @@ class GoogleDriveApp(APIApplication):
4654
4358
  "publishedOutsideDomain": publishedOutsideDomain,
4655
4359
  "size": size,
4656
4360
  }
4657
- request_body_data = {
4658
- k: v for k, v in request_body_data.items() if v is not None
4659
- }
4361
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
4660
4362
  url = f"{self.base_url}/files/{fileId}/revisions/{revisionId}"
4661
4363
  query_params = {
4662
4364
  k: v
@@ -4673,23 +4375,15 @@ class GoogleDriveApp(APIApplication):
4673
4375
  }
4674
4376
  response = self._patch(url, data=request_body_data, params=query_params)
4675
4377
  response.raise_for_status()
4676
- if (
4677
- response.status_code == 204
4678
- or not response.content
4679
- or not response.text.strip()
4680
- ):
4378
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4681
4379
  return None
4682
4380
  try:
4683
4381
  return response.json()
4684
4382
  except ValueError:
4685
4383
  return None
4686
4384
 
4687
- def create_permission(
4688
- self,
4689
- fileId: str,
4690
- emailAddress: str | None = None,
4691
- role: str | None = None,
4692
- type: str | None = None,
4385
+ async def create_permission(
4386
+ self, fileId: str, emailAddress: str | None = None, role: str | None = None, type: str | None = None
4693
4387
  ) -> dict[str, Any]:
4694
4388
  """
4695
4389
  Grants a specified role (e.g., 'reader') to a user or group for a file. This is a simplified alternative to the comprehensive `create_file_permission` function, focusing only on the core arguments required for basic sharing operations and omitting advanced options like notification settings or ownership transfer.
@@ -4713,28 +4407,13 @@ class GoogleDriveApp(APIApplication):
4713
4407
  if fileId is None:
4714
4408
  raise ValueError("Missing required parameter 'fileId'.")
4715
4409
  request_body_data = None
4716
- request_body_data = {
4717
- "emailAddress": emailAddress,
4718
- "role": role,
4719
- "type": type,
4720
- }
4721
- request_body_data = {
4722
- k: v for k, v in request_body_data.items() if v is not None
4723
- }
4410
+ request_body_data = {"emailAddress": emailAddress, "role": role, "type": type}
4411
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
4724
4412
  url = f"{self.base_url}/drive/v3/files/{fileId}/permissions"
4725
4413
  query_params = {}
4726
- response = self._post(
4727
- url,
4728
- data=request_body_data,
4729
- params=query_params,
4730
- content_type="application/json",
4731
- )
4414
+ response = self._post(url, data=request_body_data, params=query_params, content_type="application/json")
4732
4415
  response.raise_for_status()
4733
- if (
4734
- response.status_code == 204
4735
- or not response.content
4736
- or not response.text.strip()
4737
- ):
4416
+ if response.status_code == 204 or not response.content or (not response.text.strip()):
4738
4417
  return None
4739
4418
  try:
4740
4419
  return response.json()
@@ -4751,7 +4430,6 @@ class GoogleDriveApp(APIApplication):
4751
4430
  self.create_folder,
4752
4431
  self.get_file_details,
4753
4432
  self.trash_file,
4754
- # Auto generated from openapi spec
4755
4433
  self.list_installed_apps,
4756
4434
  self.get_app_by_id,
4757
4435
  self.get_about_info,