universal-mcp-applications 0.1.33__py3-none-any.whl → 0.1.39rc8__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.
- universal_mcp/applications/ahrefs/app.py +92 -238
- universal_mcp/applications/airtable/app.py +23 -122
- universal_mcp/applications/apollo/app.py +122 -475
- universal_mcp/applications/asana/app.py +605 -1755
- universal_mcp/applications/aws_s3/app.py +36 -103
- universal_mcp/applications/bill/app.py +644 -2055
- universal_mcp/applications/box/app.py +1246 -4159
- universal_mcp/applications/braze/app.py +410 -1476
- universal_mcp/applications/browser_use/README.md +15 -1
- universal_mcp/applications/browser_use/__init__.py +1 -0
- universal_mcp/applications/browser_use/app.py +86 -24
- universal_mcp/applications/cal_com_v2/app.py +207 -625
- universal_mcp/applications/calendly/app.py +103 -242
- universal_mcp/applications/canva/app.py +75 -140
- universal_mcp/applications/clickup/app.py +331 -798
- universal_mcp/applications/coda/app.py +240 -520
- universal_mcp/applications/confluence/app.py +497 -1285
- universal_mcp/applications/contentful/app.py +36 -151
- universal_mcp/applications/crustdata/app.py +42 -121
- universal_mcp/applications/dialpad/app.py +451 -924
- universal_mcp/applications/digitalocean/app.py +2071 -6082
- universal_mcp/applications/domain_checker/app.py +3 -54
- universal_mcp/applications/e2b/app.py +14 -64
- universal_mcp/applications/elevenlabs/app.py +9 -47
- universal_mcp/applications/exa/README.md +8 -4
- universal_mcp/applications/exa/app.py +408 -186
- universal_mcp/applications/falai/app.py +24 -101
- universal_mcp/applications/figma/app.py +91 -175
- universal_mcp/applications/file_system/app.py +2 -13
- universal_mcp/applications/firecrawl/app.py +186 -163
- universal_mcp/applications/fireflies/app.py +59 -281
- universal_mcp/applications/fpl/app.py +92 -529
- universal_mcp/applications/fpl/utils/fixtures.py +15 -49
- universal_mcp/applications/fpl/utils/helper.py +25 -89
- universal_mcp/applications/fpl/utils/league_utils.py +20 -64
- universal_mcp/applications/ghost_content/app.py +66 -175
- universal_mcp/applications/github/app.py +28 -65
- universal_mcp/applications/gong/app.py +140 -300
- universal_mcp/applications/google_calendar/app.py +26 -78
- universal_mcp/applications/google_docs/app.py +98 -202
- universal_mcp/applications/google_drive/app.py +194 -793
- universal_mcp/applications/google_gemini/app.py +27 -62
- universal_mcp/applications/google_mail/README.md +1 -0
- universal_mcp/applications/google_mail/app.py +93 -214
- universal_mcp/applications/google_searchconsole/app.py +25 -58
- universal_mcp/applications/google_sheet/app.py +171 -624
- universal_mcp/applications/google_sheet/helper.py +26 -53
- universal_mcp/applications/hashnode/app.py +57 -269
- universal_mcp/applications/heygen/app.py +77 -155
- universal_mcp/applications/http_tools/app.py +10 -32
- universal_mcp/applications/hubspot/README.md +1 -1
- universal_mcp/applications/hubspot/app.py +7508 -99
- universal_mcp/applications/jira/app.py +2419 -8334
- universal_mcp/applications/klaviyo/app.py +737 -1619
- universal_mcp/applications/linkedin/README.md +5 -0
- universal_mcp/applications/linkedin/app.py +332 -227
- universal_mcp/applications/mailchimp/app.py +696 -1851
- universal_mcp/applications/markitdown/app.py +8 -20
- universal_mcp/applications/miro/app.py +333 -815
- universal_mcp/applications/ms_teams/app.py +85 -207
- universal_mcp/applications/neon/app.py +144 -250
- universal_mcp/applications/notion/app.py +36 -51
- universal_mcp/applications/onedrive/app.py +26 -48
- universal_mcp/applications/openai/app.py +42 -165
- universal_mcp/applications/outlook/README.md +22 -9
- universal_mcp/applications/outlook/app.py +403 -141
- universal_mcp/applications/perplexity/README.md +2 -1
- universal_mcp/applications/perplexity/app.py +162 -20
- universal_mcp/applications/pipedrive/app.py +1021 -3331
- universal_mcp/applications/posthog/app.py +272 -541
- universal_mcp/applications/reddit/app.py +61 -160
- universal_mcp/applications/resend/app.py +41 -107
- universal_mcp/applications/retell/app.py +23 -50
- universal_mcp/applications/rocketlane/app.py +250 -963
- universal_mcp/applications/scraper/app.py +67 -125
- universal_mcp/applications/semanticscholar/app.py +36 -78
- universal_mcp/applications/semrush/app.py +43 -77
- universal_mcp/applications/sendgrid/app.py +826 -1576
- universal_mcp/applications/sentry/app.py +444 -1079
- universal_mcp/applications/serpapi/app.py +40 -143
- universal_mcp/applications/sharepoint/app.py +27 -49
- universal_mcp/applications/shopify/app.py +1743 -4479
- universal_mcp/applications/shortcut/app.py +272 -534
- universal_mcp/applications/slack/app.py +41 -123
- universal_mcp/applications/spotify/app.py +206 -405
- universal_mcp/applications/supabase/app.py +174 -283
- universal_mcp/applications/tavily/app.py +2 -2
- universal_mcp/applications/trello/app.py +853 -2816
- universal_mcp/applications/twilio/app.py +14 -50
- universal_mcp/applications/twitter/api_segments/compliance_api.py +4 -14
- universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +6 -18
- universal_mcp/applications/twitter/api_segments/likes_api.py +1 -3
- universal_mcp/applications/twitter/api_segments/lists_api.py +5 -15
- universal_mcp/applications/twitter/api_segments/trends_api.py +1 -3
- universal_mcp/applications/twitter/api_segments/tweets_api.py +9 -31
- universal_mcp/applications/twitter/api_segments/usage_api.py +1 -5
- universal_mcp/applications/twitter/api_segments/users_api.py +14 -42
- universal_mcp/applications/whatsapp/app.py +35 -186
- universal_mcp/applications/whatsapp/audio.py +2 -6
- universal_mcp/applications/whatsapp/whatsapp.py +17 -51
- universal_mcp/applications/whatsapp_business/app.py +86 -299
- universal_mcp/applications/wrike/app.py +80 -153
- universal_mcp/applications/yahoo_finance/app.py +19 -65
- universal_mcp/applications/youtube/app.py +120 -306
- universal_mcp/applications/zenquotes/app.py +3 -3
- {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc8.dist-info}/METADATA +4 -2
- {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc8.dist-info}/RECORD +109 -113
- {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc8.dist-info}/WHEEL +1 -1
- universal_mcp/applications/hubspot/api_segments/__init__.py +0 -0
- universal_mcp/applications/hubspot/api_segments/api_segment_base.py +0 -54
- universal_mcp/applications/hubspot/api_segments/crm_api.py +0 -7337
- universal_mcp/applications/hubspot/api_segments/marketing_api.py +0 -1467
- {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc8.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
|
|
|
@@ -41,11 +38,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
41
38
|
url = f"{self.base_url}/files/{file_id}"
|
|
42
39
|
data = {}
|
|
43
40
|
params = {"addParents": add_parents, "removeParents": remove_parents}
|
|
44
|
-
response = self.
|
|
45
|
-
|
|
46
|
-
return response.json()
|
|
41
|
+
response = await self._apatch(url, params=params, data=data)
|
|
42
|
+
return self._handle_response(response)
|
|
47
43
|
|
|
48
|
-
def get_drive_info(self) -> dict[str, Any]:
|
|
44
|
+
async def get_drive_info(self) -> dict[str, Any]:
|
|
49
45
|
"""
|
|
50
46
|
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
47
|
|
|
@@ -62,12 +58,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
62
58
|
"""
|
|
63
59
|
url = f"{self.base_url}/about"
|
|
64
60
|
params = {"fields": "storageQuota,user"}
|
|
65
|
-
response = self.
|
|
66
|
-
return
|
|
61
|
+
response = await self._aget(url, params=params)
|
|
62
|
+
return self._handle_response(response)
|
|
67
63
|
|
|
68
|
-
def search_files(
|
|
69
|
-
self, page_size: int = 10, q: str | None = None, order_by: str | None = None
|
|
70
|
-
) -> dict[str, Any]:
|
|
64
|
+
async def search_files(self, page_size: int = 10, q: str | None = None, order_by: str | None = None) -> dict[str, Any]:
|
|
71
65
|
"""
|
|
72
66
|
Searches for files in Google Drive, allowing for powerful filtering, sorting, and pagination.
|
|
73
67
|
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,18 +93,15 @@ class GoogleDriveApp(APIApplication):
|
|
|
99
93
|
list, files, search, google-drive, pagination, important
|
|
100
94
|
"""
|
|
101
95
|
url = f"{self.base_url}/files"
|
|
102
|
-
params = {
|
|
103
|
-
"pageSize": page_size,
|
|
104
|
-
}
|
|
96
|
+
params = {"pageSize": page_size}
|
|
105
97
|
if q:
|
|
106
98
|
params["q"] = q
|
|
107
99
|
if order_by:
|
|
108
100
|
params["orderBy"] = order_by
|
|
109
|
-
response = self.
|
|
110
|
-
|
|
111
|
-
return response.json()
|
|
101
|
+
response = await self._aget(url, params=params)
|
|
102
|
+
return self._handle_response(response)
|
|
112
103
|
|
|
113
|
-
def get_file_details(self, file_id: str) -> dict[str, Any]:
|
|
104
|
+
async def get_file_details(self, file_id: str) -> dict[str, Any]:
|
|
114
105
|
"""
|
|
115
106
|
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
107
|
|
|
@@ -128,10 +119,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
128
119
|
retrieve, file, metadata, get, api, important
|
|
129
120
|
"""
|
|
130
121
|
url = f"{self.base_url}/files/{file_id}"
|
|
131
|
-
response = self.
|
|
132
|
-
return
|
|
122
|
+
response = await self._aget(url)
|
|
123
|
+
return self._handle_response(response)
|
|
133
124
|
|
|
134
|
-
def trash_file(self, file_id: str) -> dict[str, Any]:
|
|
125
|
+
async def trash_file(self, file_id: str) -> dict[str, Any]:
|
|
135
126
|
"""
|
|
136
127
|
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
128
|
|
|
@@ -149,17 +140,13 @@ class GoogleDriveApp(APIApplication):
|
|
|
149
140
|
"""
|
|
150
141
|
url = f"{self.base_url}/files/{file_id}"
|
|
151
142
|
try:
|
|
152
|
-
self.
|
|
143
|
+
await self._adelete(url)
|
|
153
144
|
return {"message": "File deleted successfully"}
|
|
154
145
|
except Exception as e:
|
|
155
146
|
return {"error": str(e)}
|
|
156
147
|
|
|
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",
|
|
148
|
+
async def create_text_file(
|
|
149
|
+
self, file_name: str, text_content: str, parent_id: str = None, mime_type: str = "text/plain"
|
|
163
150
|
) -> dict[str, Any]:
|
|
164
151
|
"""
|
|
165
152
|
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.
|
|
@@ -184,20 +171,16 @@ class GoogleDriveApp(APIApplication):
|
|
|
184
171
|
if parent_id:
|
|
185
172
|
metadata["parents"] = [parent_id]
|
|
186
173
|
create_url = f"{self.base_url}/files"
|
|
187
|
-
create_response = self.
|
|
188
|
-
file_data =
|
|
174
|
+
create_response = await self._apost(create_url, data=metadata)
|
|
175
|
+
file_data = self._handle_response(create_response)
|
|
189
176
|
file_id = file_data.get("id")
|
|
190
177
|
upload_url = f"https://www.googleapis.com/upload/drive/v3/files/{file_id}?uploadType=media"
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
upload_response = httpx.patch(
|
|
194
|
-
upload_url, headers=upload_headers, content=text_content.encode("utf-8")
|
|
178
|
+
upload_response = await self._apatch(
|
|
179
|
+
upload_url, data=text_content.encode("utf-8"), content_type=f"{mime_type}; charset=utf-8"
|
|
195
180
|
)
|
|
196
|
-
|
|
197
|
-
response_data = upload_response.json()
|
|
198
|
-
return response_data
|
|
181
|
+
return self._handle_response(upload_response)
|
|
199
182
|
|
|
200
|
-
def find_folder_id_by_name(self, folder_name: str) -> str | None:
|
|
183
|
+
async def find_folder_id_by_name(self, folder_name: str) -> str | None:
|
|
201
184
|
"""
|
|
202
185
|
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
186
|
|
|
@@ -215,17 +198,15 @@ class GoogleDriveApp(APIApplication):
|
|
|
215
198
|
"""
|
|
216
199
|
query = f"mimeType='application/vnd.google-apps.folder' and name='{folder_name}' and trashed=false"
|
|
217
200
|
try:
|
|
218
|
-
response = self.
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
)
|
|
222
|
-
files = response.json().get("files", [])
|
|
201
|
+
response = await self._aget(f"{self.base_url}/files", params={"q": query, "fields": "files(id,name)"})
|
|
202
|
+
data = self._handle_response(response)
|
|
203
|
+
files = data.get("files", [])
|
|
223
204
|
return files[0]["id"] if files else None
|
|
224
205
|
except Exception as e:
|
|
225
206
|
logger.error(f"Error finding folder ID by name: {e}")
|
|
226
207
|
return None
|
|
227
208
|
|
|
228
|
-
def create_folder(self, folder_name: str, parent_id: str = None) -> dict[str, Any]:
|
|
209
|
+
async def create_folder(self, folder_name: str, parent_id: str = None) -> dict[str, Any]:
|
|
229
210
|
"""
|
|
230
211
|
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
212
|
|
|
@@ -244,33 +225,22 @@ class GoogleDriveApp(APIApplication):
|
|
|
244
225
|
"""
|
|
245
226
|
import re
|
|
246
227
|
|
|
247
|
-
metadata = {
|
|
248
|
-
"name": folder_name,
|
|
249
|
-
"mimeType": "application/vnd.google-apps.folder",
|
|
250
|
-
}
|
|
228
|
+
metadata = {"name": folder_name, "mimeType": "application/vnd.google-apps.folder"}
|
|
251
229
|
if parent_id:
|
|
252
|
-
if not re.match(
|
|
253
|
-
found_id = self.find_folder_id_by_name(parent_id)
|
|
230
|
+
if not re.match("^[a-zA-Z0-9_-]{28,33}$", parent_id):
|
|
231
|
+
found_id = await self.find_folder_id_by_name(parent_id)
|
|
254
232
|
if found_id:
|
|
255
233
|
metadata["parents"] = [found_id]
|
|
256
234
|
else:
|
|
257
|
-
raise ValueError(
|
|
258
|
-
f"Could not find parent folder with name: {parent_id}"
|
|
259
|
-
)
|
|
235
|
+
raise ValueError(f"Could not find parent folder with name: {parent_id}")
|
|
260
236
|
else:
|
|
261
237
|
metadata["parents"] = [parent_id]
|
|
262
238
|
url = f"{self.base_url}/files"
|
|
263
239
|
params = {"supportsAllDrives": "true"}
|
|
264
|
-
response = self.
|
|
265
|
-
return
|
|
240
|
+
response = await self._apost(url, data=metadata, params=params)
|
|
241
|
+
return self._handle_response(response)
|
|
266
242
|
|
|
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]:
|
|
243
|
+
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
244
|
"""
|
|
275
245
|
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
246
|
|
|
@@ -295,24 +265,16 @@ class GoogleDriveApp(APIApplication):
|
|
|
295
265
|
if parent_id:
|
|
296
266
|
metadata["parents"] = [parent_id]
|
|
297
267
|
create_url = f"{self.base_url}/files"
|
|
298
|
-
create_response = self.
|
|
299
|
-
file_data =
|
|
268
|
+
create_response = await self._apost(create_url, data=metadata)
|
|
269
|
+
file_data = self._handle_response(create_response)
|
|
300
270
|
file_id = file_data.get("id")
|
|
301
271
|
with open(file_path, "rb") as file_content:
|
|
302
272
|
binary_content = file_content.read()
|
|
303
|
-
|
|
304
273
|
upload_url = f"https://www.googleapis.com/upload/drive/v3/files/{file_id}?uploadType=media"
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
upload_response = httpx.patch(
|
|
309
|
-
upload_url, headers=upload_headers, content=binary_content
|
|
310
|
-
)
|
|
311
|
-
upload_response.raise_for_status()
|
|
312
|
-
response_data = upload_response.json()
|
|
313
|
-
return response_data
|
|
274
|
+
upload_response = await self._apatch(upload_url, data=binary_content, content_type=mime_type)
|
|
275
|
+
return self._handle_response(upload_response)
|
|
314
276
|
|
|
315
|
-
def list_installed_apps(
|
|
277
|
+
async def list_installed_apps(
|
|
316
278
|
self,
|
|
317
279
|
appFilterExtensions: str | None = None,
|
|
318
280
|
appFilterMimeTypes: str | None = None,
|
|
@@ -379,20 +341,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
379
341
|
]
|
|
380
342
|
if v is not None
|
|
381
343
|
}
|
|
382
|
-
response = self.
|
|
383
|
-
|
|
384
|
-
if (
|
|
385
|
-
response.status_code == 204
|
|
386
|
-
or not response.content
|
|
387
|
-
or not response.text.strip()
|
|
388
|
-
):
|
|
389
|
-
return None
|
|
390
|
-
try:
|
|
391
|
-
return response.json()
|
|
392
|
-
except ValueError:
|
|
393
|
-
return None
|
|
344
|
+
response = await self._aget(url, params=query_params)
|
|
345
|
+
return self._handle_response(response)
|
|
394
346
|
|
|
395
|
-
def get_app_by_id(
|
|
347
|
+
async def get_app_by_id(
|
|
396
348
|
self,
|
|
397
349
|
appId: str,
|
|
398
350
|
access_token: str | None = None,
|
|
@@ -454,20 +406,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
454
406
|
]
|
|
455
407
|
if v is not None
|
|
456
408
|
}
|
|
457
|
-
response = self.
|
|
458
|
-
|
|
459
|
-
if (
|
|
460
|
-
response.status_code == 204
|
|
461
|
-
or not response.content
|
|
462
|
-
or not response.text.strip()
|
|
463
|
-
):
|
|
464
|
-
return None
|
|
465
|
-
try:
|
|
466
|
-
return response.json()
|
|
467
|
-
except ValueError:
|
|
468
|
-
return None
|
|
409
|
+
response = await self._aget(url, params=query_params)
|
|
410
|
+
return self._handle_response(response)
|
|
469
411
|
|
|
470
|
-
def get_about_info(
|
|
412
|
+
async def get_about_info(
|
|
471
413
|
self,
|
|
472
414
|
alt: str | None = None,
|
|
473
415
|
fields: str | None = None,
|
|
@@ -513,20 +455,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
513
455
|
]
|
|
514
456
|
if v is not None
|
|
515
457
|
}
|
|
516
|
-
response = self.
|
|
517
|
-
|
|
518
|
-
if (
|
|
519
|
-
response.status_code == 204
|
|
520
|
-
or not response.content
|
|
521
|
-
or not response.text.strip()
|
|
522
|
-
):
|
|
523
|
-
return None
|
|
524
|
-
try:
|
|
525
|
-
return response.json()
|
|
526
|
-
except ValueError:
|
|
527
|
-
return None
|
|
458
|
+
response = await self._aget(url, params=query_params)
|
|
459
|
+
return self._handle_response(response)
|
|
528
460
|
|
|
529
|
-
def list_drive_changes(
|
|
461
|
+
async def list_drive_changes(
|
|
530
462
|
self,
|
|
531
463
|
pageToken: str | None = None,
|
|
532
464
|
driveId: str | None = None,
|
|
@@ -614,20 +546,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
614
546
|
]
|
|
615
547
|
if v is not None
|
|
616
548
|
}
|
|
617
|
-
response = self.
|
|
618
|
-
|
|
619
|
-
if (
|
|
620
|
-
response.status_code == 204
|
|
621
|
-
or not response.content
|
|
622
|
-
or not response.text.strip()
|
|
623
|
-
):
|
|
624
|
-
return None
|
|
625
|
-
try:
|
|
626
|
-
return response.json()
|
|
627
|
-
except ValueError:
|
|
628
|
-
return None
|
|
549
|
+
response = await self._aget(url, params=query_params)
|
|
550
|
+
return self._handle_response(response)
|
|
629
551
|
|
|
630
|
-
def get_changes_start_token(
|
|
552
|
+
async def get_changes_start_token(
|
|
631
553
|
self,
|
|
632
554
|
driveId: str | None = None,
|
|
633
555
|
supportsAllDrives: str | None = None,
|
|
@@ -685,20 +607,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
685
607
|
]
|
|
686
608
|
if v is not None
|
|
687
609
|
}
|
|
688
|
-
response = self.
|
|
689
|
-
|
|
690
|
-
if (
|
|
691
|
-
response.status_code == 204
|
|
692
|
-
or not response.content
|
|
693
|
-
or not response.text.strip()
|
|
694
|
-
):
|
|
695
|
-
return None
|
|
696
|
-
try:
|
|
697
|
-
return response.json()
|
|
698
|
-
except ValueError:
|
|
699
|
-
return None
|
|
610
|
+
response = await self._aget(url, params=query_params)
|
|
611
|
+
return self._handle_response(response)
|
|
700
612
|
|
|
701
|
-
def watch_drive_changes(
|
|
613
|
+
async def watch_drive_changes(
|
|
702
614
|
self,
|
|
703
615
|
pageToken: str | None = None,
|
|
704
616
|
driveId: str | None = None,
|
|
@@ -791,9 +703,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
791
703
|
"token": token,
|
|
792
704
|
"type": type,
|
|
793
705
|
}
|
|
794
|
-
request_body_data = {
|
|
795
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
796
|
-
}
|
|
706
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
797
707
|
url = f"{self.base_url}/changes/watch"
|
|
798
708
|
query_params = {
|
|
799
709
|
k: v
|
|
@@ -822,25 +732,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
822
732
|
]
|
|
823
733
|
if v is not None
|
|
824
734
|
}
|
|
825
|
-
response = self.
|
|
826
|
-
|
|
827
|
-
data=request_body_data,
|
|
828
|
-
params=query_params,
|
|
829
|
-
content_type="application/json",
|
|
830
|
-
)
|
|
831
|
-
response.raise_for_status()
|
|
832
|
-
if (
|
|
833
|
-
response.status_code == 204
|
|
834
|
-
or not response.content
|
|
835
|
-
or not response.text.strip()
|
|
836
|
-
):
|
|
837
|
-
return None
|
|
838
|
-
try:
|
|
839
|
-
return response.json()
|
|
840
|
-
except ValueError:
|
|
841
|
-
return None
|
|
735
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
736
|
+
return self._handle_response(response)
|
|
842
737
|
|
|
843
|
-
def stop_watching_channel(
|
|
738
|
+
async def stop_watching_channel(
|
|
844
739
|
self,
|
|
845
740
|
alt: str | None = None,
|
|
846
741
|
fields: str | None = None,
|
|
@@ -905,9 +800,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
905
800
|
"token": token,
|
|
906
801
|
"type": type,
|
|
907
802
|
}
|
|
908
|
-
request_body_data = {
|
|
909
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
910
|
-
}
|
|
803
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
911
804
|
url = f"{self.base_url}/channels/stop"
|
|
912
805
|
query_params = {
|
|
913
806
|
k: v
|
|
@@ -922,25 +815,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
922
815
|
]
|
|
923
816
|
if v is not None
|
|
924
817
|
}
|
|
925
|
-
response = self.
|
|
926
|
-
|
|
927
|
-
data=request_body_data,
|
|
928
|
-
params=query_params,
|
|
929
|
-
content_type="application/json",
|
|
930
|
-
)
|
|
931
|
-
response.raise_for_status()
|
|
932
|
-
if (
|
|
933
|
-
response.status_code == 204
|
|
934
|
-
or not response.content
|
|
935
|
-
or not response.text.strip()
|
|
936
|
-
):
|
|
937
|
-
return None
|
|
938
|
-
try:
|
|
939
|
-
return response.json()
|
|
940
|
-
except ValueError:
|
|
941
|
-
return None
|
|
818
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
819
|
+
return self._handle_response(response)
|
|
942
820
|
|
|
943
|
-
def list_file_comments(
|
|
821
|
+
async def list_file_comments(
|
|
944
822
|
self,
|
|
945
823
|
fileId: str,
|
|
946
824
|
includeDeleted: str | None = None,
|
|
@@ -1002,20 +880,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1002
880
|
]
|
|
1003
881
|
if v is not None
|
|
1004
882
|
}
|
|
1005
|
-
response = self.
|
|
1006
|
-
|
|
1007
|
-
if (
|
|
1008
|
-
response.status_code == 204
|
|
1009
|
-
or not response.content
|
|
1010
|
-
or not response.text.strip()
|
|
1011
|
-
):
|
|
1012
|
-
return None
|
|
1013
|
-
try:
|
|
1014
|
-
return response.json()
|
|
1015
|
-
except ValueError:
|
|
1016
|
-
return None
|
|
883
|
+
response = await self._aget(url, params=query_params)
|
|
884
|
+
return self._handle_response(response)
|
|
1017
885
|
|
|
1018
|
-
def create_file_comment(
|
|
886
|
+
async def create_file_comment(
|
|
1019
887
|
self,
|
|
1020
888
|
fileId: str,
|
|
1021
889
|
alt: str | None = None,
|
|
@@ -1090,9 +958,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
1090
958
|
"replies": replies,
|
|
1091
959
|
"resolved": resolved,
|
|
1092
960
|
}
|
|
1093
|
-
request_body_data = {
|
|
1094
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
1095
|
-
}
|
|
961
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
1096
962
|
url = f"{self.base_url}/files/{fileId}/comments"
|
|
1097
963
|
query_params = {
|
|
1098
964
|
k: v
|
|
@@ -1107,25 +973,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1107
973
|
]
|
|
1108
974
|
if v is not None
|
|
1109
975
|
}
|
|
1110
|
-
response = self.
|
|
1111
|
-
|
|
1112
|
-
data=request_body_data,
|
|
1113
|
-
params=query_params,
|
|
1114
|
-
content_type="application/json",
|
|
1115
|
-
)
|
|
1116
|
-
response.raise_for_status()
|
|
1117
|
-
if (
|
|
1118
|
-
response.status_code == 204
|
|
1119
|
-
or not response.content
|
|
1120
|
-
or not response.text.strip()
|
|
1121
|
-
):
|
|
1122
|
-
return None
|
|
1123
|
-
try:
|
|
1124
|
-
return response.json()
|
|
1125
|
-
except ValueError:
|
|
1126
|
-
return None
|
|
976
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
977
|
+
return self._handle_response(response)
|
|
1127
978
|
|
|
1128
|
-
def get_file_comment_by_id(
|
|
979
|
+
async def get_file_comment_by_id(
|
|
1129
980
|
self,
|
|
1130
981
|
fileId: str,
|
|
1131
982
|
commentId: str,
|
|
@@ -1182,20 +1033,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1182
1033
|
]
|
|
1183
1034
|
if v is not None
|
|
1184
1035
|
}
|
|
1185
|
-
response = self.
|
|
1186
|
-
|
|
1187
|
-
if (
|
|
1188
|
-
response.status_code == 204
|
|
1189
|
-
or not response.content
|
|
1190
|
-
or not response.text.strip()
|
|
1191
|
-
):
|
|
1192
|
-
return None
|
|
1193
|
-
try:
|
|
1194
|
-
return response.json()
|
|
1195
|
-
except ValueError:
|
|
1196
|
-
return None
|
|
1036
|
+
response = await self._aget(url, params=query_params)
|
|
1037
|
+
return self._handle_response(response)
|
|
1197
1038
|
|
|
1198
|
-
def delete_comment(
|
|
1039
|
+
async def delete_comment(
|
|
1199
1040
|
self,
|
|
1200
1041
|
fileId: str,
|
|
1201
1042
|
commentId: str,
|
|
@@ -1249,20 +1090,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1249
1090
|
]
|
|
1250
1091
|
if v is not None
|
|
1251
1092
|
}
|
|
1252
|
-
response = self.
|
|
1253
|
-
|
|
1254
|
-
if (
|
|
1255
|
-
response.status_code == 204
|
|
1256
|
-
or not response.content
|
|
1257
|
-
or not response.text.strip()
|
|
1258
|
-
):
|
|
1259
|
-
return None
|
|
1260
|
-
try:
|
|
1261
|
-
return response.json()
|
|
1262
|
-
except ValueError:
|
|
1263
|
-
return None
|
|
1093
|
+
response = await self._adelete(url, params=query_params)
|
|
1094
|
+
return self._handle_response(response)
|
|
1264
1095
|
|
|
1265
|
-
def update_comment(
|
|
1096
|
+
async def update_comment(
|
|
1266
1097
|
self,
|
|
1267
1098
|
fileId: str,
|
|
1268
1099
|
commentId: str,
|
|
@@ -1341,9 +1172,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
1341
1172
|
"replies": replies,
|
|
1342
1173
|
"resolved": resolved,
|
|
1343
1174
|
}
|
|
1344
|
-
request_body_data = {
|
|
1345
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
1346
|
-
}
|
|
1175
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
1347
1176
|
url = f"{self.base_url}/files/{fileId}/comments/{commentId}"
|
|
1348
1177
|
query_params = {
|
|
1349
1178
|
k: v
|
|
@@ -1358,20 +1187,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1358
1187
|
]
|
|
1359
1188
|
if v is not None
|
|
1360
1189
|
}
|
|
1361
|
-
response = self.
|
|
1362
|
-
|
|
1363
|
-
if (
|
|
1364
|
-
response.status_code == 204
|
|
1365
|
-
or not response.content
|
|
1366
|
-
or not response.text.strip()
|
|
1367
|
-
):
|
|
1368
|
-
return None
|
|
1369
|
-
try:
|
|
1370
|
-
return response.json()
|
|
1371
|
-
except ValueError:
|
|
1372
|
-
return None
|
|
1190
|
+
response = await self._apatch(url, data=request_body_data, params=query_params)
|
|
1191
|
+
return self._handle_response(response)
|
|
1373
1192
|
|
|
1374
|
-
def list_shared_drives(
|
|
1193
|
+
async def list_shared_drives(
|
|
1375
1194
|
self,
|
|
1376
1195
|
pageSize: str | None = None,
|
|
1377
1196
|
pageToken: str | None = None,
|
|
@@ -1429,20 +1248,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1429
1248
|
]
|
|
1430
1249
|
if v is not None
|
|
1431
1250
|
}
|
|
1432
|
-
response = self.
|
|
1433
|
-
|
|
1434
|
-
if (
|
|
1435
|
-
response.status_code == 204
|
|
1436
|
-
or not response.content
|
|
1437
|
-
or not response.text.strip()
|
|
1438
|
-
):
|
|
1439
|
-
return None
|
|
1440
|
-
try:
|
|
1441
|
-
return response.json()
|
|
1442
|
-
except ValueError:
|
|
1443
|
-
return None
|
|
1251
|
+
response = await self._aget(url, params=query_params)
|
|
1252
|
+
return self._handle_response(response)
|
|
1444
1253
|
|
|
1445
|
-
def create_shared_drive(
|
|
1254
|
+
async def create_shared_drive(
|
|
1446
1255
|
self,
|
|
1447
1256
|
requestId: str | None = None,
|
|
1448
1257
|
alt: str | None = None,
|
|
@@ -1515,9 +1324,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
1515
1324
|
"restrictions": restrictions,
|
|
1516
1325
|
"themeId": themeId,
|
|
1517
1326
|
}
|
|
1518
|
-
request_body_data = {
|
|
1519
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
1520
|
-
}
|
|
1327
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
1521
1328
|
url = f"{self.base_url}/drives"
|
|
1522
1329
|
query_params = {
|
|
1523
1330
|
k: v
|
|
@@ -1533,25 +1340,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1533
1340
|
]
|
|
1534
1341
|
if v is not None
|
|
1535
1342
|
}
|
|
1536
|
-
response = self.
|
|
1537
|
-
|
|
1538
|
-
data=request_body_data,
|
|
1539
|
-
params=query_params,
|
|
1540
|
-
content_type="application/json",
|
|
1541
|
-
)
|
|
1542
|
-
response.raise_for_status()
|
|
1543
|
-
if (
|
|
1544
|
-
response.status_code == 204
|
|
1545
|
-
or not response.content
|
|
1546
|
-
or not response.text.strip()
|
|
1547
|
-
):
|
|
1548
|
-
return None
|
|
1549
|
-
try:
|
|
1550
|
-
return response.json()
|
|
1551
|
-
except ValueError:
|
|
1552
|
-
return None
|
|
1343
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
1344
|
+
return self._handle_response(response)
|
|
1553
1345
|
|
|
1554
|
-
def get_shared_drive_metadata(
|
|
1346
|
+
async def get_shared_drive_metadata(
|
|
1555
1347
|
self,
|
|
1556
1348
|
driveId: str,
|
|
1557
1349
|
useDomainAdminAccess: str | None = None,
|
|
@@ -1604,20 +1396,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1604
1396
|
]
|
|
1605
1397
|
if v is not None
|
|
1606
1398
|
}
|
|
1607
|
-
response = self.
|
|
1608
|
-
|
|
1609
|
-
if (
|
|
1610
|
-
response.status_code == 204
|
|
1611
|
-
or not response.content
|
|
1612
|
-
or not response.text.strip()
|
|
1613
|
-
):
|
|
1614
|
-
return None
|
|
1615
|
-
try:
|
|
1616
|
-
return response.json()
|
|
1617
|
-
except ValueError:
|
|
1618
|
-
return None
|
|
1399
|
+
response = await self._aget(url, params=query_params)
|
|
1400
|
+
return self._handle_response(response)
|
|
1619
1401
|
|
|
1620
|
-
def delete_shared_drive(
|
|
1402
|
+
async def delete_shared_drive(
|
|
1621
1403
|
self,
|
|
1622
1404
|
driveId: str,
|
|
1623
1405
|
allowItemDeletion: str | None = None,
|
|
@@ -1673,20 +1455,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1673
1455
|
]
|
|
1674
1456
|
if v is not None
|
|
1675
1457
|
}
|
|
1676
|
-
response = self.
|
|
1677
|
-
|
|
1678
|
-
if (
|
|
1679
|
-
response.status_code == 204
|
|
1680
|
-
or not response.content
|
|
1681
|
-
or not response.text.strip()
|
|
1682
|
-
):
|
|
1683
|
-
return None
|
|
1684
|
-
try:
|
|
1685
|
-
return response.json()
|
|
1686
|
-
except ValueError:
|
|
1687
|
-
return None
|
|
1458
|
+
response = await self._adelete(url, params=query_params)
|
|
1459
|
+
return self._handle_response(response)
|
|
1688
1460
|
|
|
1689
|
-
def update_shared_drive(
|
|
1461
|
+
async def update_shared_drive(
|
|
1690
1462
|
self,
|
|
1691
1463
|
driveId: str,
|
|
1692
1464
|
useDomainAdminAccess: str | None = None,
|
|
@@ -1763,9 +1535,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
1763
1535
|
"restrictions": restrictions,
|
|
1764
1536
|
"themeId": themeId,
|
|
1765
1537
|
}
|
|
1766
|
-
request_body_data = {
|
|
1767
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
1768
|
-
}
|
|
1538
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
1769
1539
|
url = f"{self.base_url}/drives/{driveId}"
|
|
1770
1540
|
query_params = {
|
|
1771
1541
|
k: v
|
|
@@ -1781,20 +1551,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1781
1551
|
]
|
|
1782
1552
|
if v is not None
|
|
1783
1553
|
}
|
|
1784
|
-
response = self.
|
|
1785
|
-
|
|
1786
|
-
if (
|
|
1787
|
-
response.status_code == 204
|
|
1788
|
-
or not response.content
|
|
1789
|
-
or not response.text.strip()
|
|
1790
|
-
):
|
|
1791
|
-
return None
|
|
1792
|
-
try:
|
|
1793
|
-
return response.json()
|
|
1794
|
-
except ValueError:
|
|
1795
|
-
return None
|
|
1554
|
+
response = await self._apatch(url, data=request_body_data, params=query_params)
|
|
1555
|
+
return self._handle_response(response)
|
|
1796
1556
|
|
|
1797
|
-
def hide_drive(
|
|
1557
|
+
async def hide_drive(
|
|
1798
1558
|
self,
|
|
1799
1559
|
driveId: str,
|
|
1800
1560
|
alt: str | None = None,
|
|
@@ -1845,25 +1605,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1845
1605
|
]
|
|
1846
1606
|
if v is not None
|
|
1847
1607
|
}
|
|
1848
|
-
response = self.
|
|
1849
|
-
|
|
1850
|
-
data=request_body_data,
|
|
1851
|
-
params=query_params,
|
|
1852
|
-
content_type="application/json",
|
|
1853
|
-
)
|
|
1854
|
-
response.raise_for_status()
|
|
1855
|
-
if (
|
|
1856
|
-
response.status_code == 204
|
|
1857
|
-
or not response.content
|
|
1858
|
-
or not response.text.strip()
|
|
1859
|
-
):
|
|
1860
|
-
return None
|
|
1861
|
-
try:
|
|
1862
|
-
return response.json()
|
|
1863
|
-
except ValueError:
|
|
1864
|
-
return None
|
|
1608
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
1609
|
+
return self._handle_response(response)
|
|
1865
1610
|
|
|
1866
|
-
def unhide_drive(
|
|
1611
|
+
async def unhide_drive(
|
|
1867
1612
|
self,
|
|
1868
1613
|
driveId: str,
|
|
1869
1614
|
alt: str | None = None,
|
|
@@ -1914,25 +1659,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
1914
1659
|
]
|
|
1915
1660
|
if v is not None
|
|
1916
1661
|
}
|
|
1917
|
-
response = self.
|
|
1918
|
-
|
|
1919
|
-
data=request_body_data,
|
|
1920
|
-
params=query_params,
|
|
1921
|
-
content_type="application/json",
|
|
1922
|
-
)
|
|
1923
|
-
response.raise_for_status()
|
|
1924
|
-
if (
|
|
1925
|
-
response.status_code == 204
|
|
1926
|
-
or not response.content
|
|
1927
|
-
or not response.text.strip()
|
|
1928
|
-
):
|
|
1929
|
-
return None
|
|
1930
|
-
try:
|
|
1931
|
-
return response.json()
|
|
1932
|
-
except ValueError:
|
|
1933
|
-
return None
|
|
1662
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
1663
|
+
return self._handle_response(response)
|
|
1934
1664
|
|
|
1935
|
-
def search_files_advanced(
|
|
1665
|
+
async def search_files_advanced(
|
|
1936
1666
|
self,
|
|
1937
1667
|
corpora: str | None = None,
|
|
1938
1668
|
driveId: str | None = None,
|
|
@@ -2020,20 +1750,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
2020
1750
|
]
|
|
2021
1751
|
if v is not None
|
|
2022
1752
|
}
|
|
2023
|
-
response = self.
|
|
2024
|
-
|
|
2025
|
-
if (
|
|
2026
|
-
response.status_code == 204
|
|
2027
|
-
or not response.content
|
|
2028
|
-
or not response.text.strip()
|
|
2029
|
-
):
|
|
2030
|
-
return None
|
|
2031
|
-
try:
|
|
2032
|
-
return response.json()
|
|
2033
|
-
except ValueError:
|
|
2034
|
-
return None
|
|
1753
|
+
response = await self._aget(url, params=query_params)
|
|
1754
|
+
return self._handle_response(response)
|
|
2035
1755
|
|
|
2036
|
-
def create_file_metadata(
|
|
1756
|
+
async def create_file_metadata(
|
|
2037
1757
|
self,
|
|
2038
1758
|
enforceSingleParent: str | None = None,
|
|
2039
1759
|
ignoreDefaultVisibility: str | None = None,
|
|
@@ -2272,9 +1992,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
2272
1992
|
"webViewLink": webViewLink,
|
|
2273
1993
|
"writersCanShare": writersCanShare,
|
|
2274
1994
|
}
|
|
2275
|
-
request_body_data = {
|
|
2276
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
2277
|
-
}
|
|
1995
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
2278
1996
|
url = f"{self.base_url}/files"
|
|
2279
1997
|
query_params = {
|
|
2280
1998
|
k: v
|
|
@@ -2298,25 +2016,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
2298
2016
|
]
|
|
2299
2017
|
if v is not None
|
|
2300
2018
|
}
|
|
2301
|
-
response = self.
|
|
2302
|
-
|
|
2303
|
-
data=request_body_data,
|
|
2304
|
-
params=query_params,
|
|
2305
|
-
content_type="application/json",
|
|
2306
|
-
)
|
|
2307
|
-
response.raise_for_status()
|
|
2308
|
-
if (
|
|
2309
|
-
response.status_code == 204
|
|
2310
|
-
or not response.content
|
|
2311
|
-
or not response.text.strip()
|
|
2312
|
-
):
|
|
2313
|
-
return None
|
|
2314
|
-
try:
|
|
2315
|
-
return response.json()
|
|
2316
|
-
except ValueError:
|
|
2317
|
-
return None
|
|
2019
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
2020
|
+
return self._handle_response(response)
|
|
2318
2021
|
|
|
2319
|
-
def generate_file_ids(
|
|
2022
|
+
async def generate_file_ids(
|
|
2320
2023
|
self,
|
|
2321
2024
|
count: str | None = None,
|
|
2322
2025
|
space: str | None = None,
|
|
@@ -2371,20 +2074,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
2371
2074
|
]
|
|
2372
2075
|
if v is not None
|
|
2373
2076
|
}
|
|
2374
|
-
response = self.
|
|
2375
|
-
|
|
2376
|
-
if (
|
|
2377
|
-
response.status_code == 204
|
|
2378
|
-
or not response.content
|
|
2379
|
-
or not response.text.strip()
|
|
2380
|
-
):
|
|
2381
|
-
return None
|
|
2382
|
-
try:
|
|
2383
|
-
return response.json()
|
|
2384
|
-
except ValueError:
|
|
2385
|
-
return None
|
|
2077
|
+
response = await self._aget(url, params=query_params)
|
|
2078
|
+
return self._handle_response(response)
|
|
2386
2079
|
|
|
2387
|
-
def empty_trash(
|
|
2080
|
+
async def empty_trash(
|
|
2388
2081
|
self,
|
|
2389
2082
|
driveId: str | None = None,
|
|
2390
2083
|
enforceSingleParent: str | None = None,
|
|
@@ -2436,20 +2129,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
2436
2129
|
]
|
|
2437
2130
|
if v is not None
|
|
2438
2131
|
}
|
|
2439
|
-
response = self.
|
|
2440
|
-
|
|
2441
|
-
if (
|
|
2442
|
-
response.status_code == 204
|
|
2443
|
-
or not response.content
|
|
2444
|
-
or not response.text.strip()
|
|
2445
|
-
):
|
|
2446
|
-
return None
|
|
2447
|
-
try:
|
|
2448
|
-
return response.json()
|
|
2449
|
-
except ValueError:
|
|
2450
|
-
return None
|
|
2132
|
+
response = await self._adelete(url, params=query_params)
|
|
2133
|
+
return self._handle_response(response)
|
|
2451
2134
|
|
|
2452
|
-
def permanently_delete_file(
|
|
2135
|
+
async def permanently_delete_file(
|
|
2453
2136
|
self,
|
|
2454
2137
|
fileId: str,
|
|
2455
2138
|
enforceSingleParent: str | None = None,
|
|
@@ -2508,20 +2191,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
2508
2191
|
]
|
|
2509
2192
|
if v is not None
|
|
2510
2193
|
}
|
|
2511
|
-
response = self.
|
|
2512
|
-
|
|
2513
|
-
if (
|
|
2514
|
-
response.status_code == 204
|
|
2515
|
-
or not response.content
|
|
2516
|
-
or not response.text.strip()
|
|
2517
|
-
):
|
|
2518
|
-
return None
|
|
2519
|
-
try:
|
|
2520
|
-
return response.json()
|
|
2521
|
-
except ValueError:
|
|
2522
|
-
return None
|
|
2194
|
+
response = await self._adelete(url, params=query_params)
|
|
2195
|
+
return self._handle_response(response)
|
|
2523
2196
|
|
|
2524
|
-
def update_file_metadata(
|
|
2197
|
+
async def update_file_metadata(
|
|
2525
2198
|
self,
|
|
2526
2199
|
fileId: str,
|
|
2527
2200
|
addParents: str | None = None,
|
|
@@ -2766,9 +2439,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
2766
2439
|
"webViewLink": webViewLink,
|
|
2767
2440
|
"writersCanShare": writersCanShare,
|
|
2768
2441
|
}
|
|
2769
|
-
request_body_data = {
|
|
2770
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
2771
|
-
}
|
|
2442
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
2772
2443
|
url = f"{self.base_url}/files/{fileId}"
|
|
2773
2444
|
query_params = {
|
|
2774
2445
|
k: v
|
|
@@ -2793,20 +2464,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
2793
2464
|
]
|
|
2794
2465
|
if v is not None
|
|
2795
2466
|
}
|
|
2796
|
-
response = self.
|
|
2797
|
-
|
|
2798
|
-
if (
|
|
2799
|
-
response.status_code == 204
|
|
2800
|
-
or not response.content
|
|
2801
|
-
or not response.text.strip()
|
|
2802
|
-
):
|
|
2803
|
-
return None
|
|
2804
|
-
try:
|
|
2805
|
-
return response.json()
|
|
2806
|
-
except ValueError:
|
|
2807
|
-
return None
|
|
2467
|
+
response = await self._apatch(url, data=request_body_data, params=query_params)
|
|
2468
|
+
return self._handle_response(response)
|
|
2808
2469
|
|
|
2809
|
-
def copy_file(
|
|
2470
|
+
async def copy_file(
|
|
2810
2471
|
self,
|
|
2811
2472
|
fileId: str,
|
|
2812
2473
|
enforceSingleParent: str | None = None,
|
|
@@ -3047,9 +2708,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
3047
2708
|
"webViewLink": webViewLink,
|
|
3048
2709
|
"writersCanShare": writersCanShare,
|
|
3049
2710
|
}
|
|
3050
|
-
request_body_data = {
|
|
3051
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
3052
|
-
}
|
|
2711
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
3053
2712
|
url = f"{self.base_url}/files/{fileId}/copy"
|
|
3054
2713
|
query_params = {
|
|
3055
2714
|
k: v
|
|
@@ -3072,25 +2731,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3072
2731
|
]
|
|
3073
2732
|
if v is not None
|
|
3074
2733
|
}
|
|
3075
|
-
response = self.
|
|
3076
|
-
|
|
3077
|
-
data=request_body_data,
|
|
3078
|
-
params=query_params,
|
|
3079
|
-
content_type="application/json",
|
|
3080
|
-
)
|
|
3081
|
-
response.raise_for_status()
|
|
3082
|
-
if (
|
|
3083
|
-
response.status_code == 204
|
|
3084
|
-
or not response.content
|
|
3085
|
-
or not response.text.strip()
|
|
3086
|
-
):
|
|
3087
|
-
return None
|
|
3088
|
-
try:
|
|
3089
|
-
return response.json()
|
|
3090
|
-
except ValueError:
|
|
3091
|
-
return None
|
|
2734
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
2735
|
+
return self._handle_response(response)
|
|
3092
2736
|
|
|
3093
|
-
def export_file(
|
|
2737
|
+
async def export_file(
|
|
3094
2738
|
self,
|
|
3095
2739
|
fileId: str,
|
|
3096
2740
|
mimeType: str | None = None,
|
|
@@ -3143,20 +2787,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3143
2787
|
]
|
|
3144
2788
|
if v is not None
|
|
3145
2789
|
}
|
|
3146
|
-
response = self.
|
|
3147
|
-
|
|
3148
|
-
if (
|
|
3149
|
-
response.status_code == 204
|
|
3150
|
-
or not response.content
|
|
3151
|
-
or not response.text.strip()
|
|
3152
|
-
):
|
|
3153
|
-
return None
|
|
3154
|
-
try:
|
|
3155
|
-
return response.json()
|
|
3156
|
-
except ValueError:
|
|
3157
|
-
return None
|
|
2790
|
+
response = await self._aget(url, params=query_params)
|
|
2791
|
+
return self._handle_response(response)
|
|
3158
2792
|
|
|
3159
|
-
def list_file_labels(
|
|
2793
|
+
async def list_file_labels(
|
|
3160
2794
|
self,
|
|
3161
2795
|
fileId: str,
|
|
3162
2796
|
maxResults: str | None = None,
|
|
@@ -3212,20 +2846,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3212
2846
|
]
|
|
3213
2847
|
if v is not None
|
|
3214
2848
|
}
|
|
3215
|
-
response = self.
|
|
3216
|
-
|
|
3217
|
-
if (
|
|
3218
|
-
response.status_code == 204
|
|
3219
|
-
or not response.content
|
|
3220
|
-
or not response.text.strip()
|
|
3221
|
-
):
|
|
3222
|
-
return None
|
|
3223
|
-
try:
|
|
3224
|
-
return response.json()
|
|
3225
|
-
except ValueError:
|
|
3226
|
-
return None
|
|
2849
|
+
response = await self._aget(url, params=query_params)
|
|
2850
|
+
return self._handle_response(response)
|
|
3227
2851
|
|
|
3228
|
-
def modify_file_labels(
|
|
2852
|
+
async def modify_file_labels(
|
|
3229
2853
|
self,
|
|
3230
2854
|
fileId: str,
|
|
3231
2855
|
alt: str | None = None,
|
|
@@ -3266,13 +2890,8 @@ class GoogleDriveApp(APIApplication):
|
|
|
3266
2890
|
if fileId is None:
|
|
3267
2891
|
raise ValueError("Missing required parameter 'fileId'.")
|
|
3268
2892
|
request_body_data = None
|
|
3269
|
-
request_body_data = {
|
|
3270
|
-
|
|
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
|
-
}
|
|
2893
|
+
request_body_data = {"kind": kind, "labelModifications": labelModifications}
|
|
2894
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
3276
2895
|
url = f"{self.base_url}/files/{fileId}/modifyLabels"
|
|
3277
2896
|
query_params = {
|
|
3278
2897
|
k: v
|
|
@@ -3287,25 +2906,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3287
2906
|
]
|
|
3288
2907
|
if v is not None
|
|
3289
2908
|
}
|
|
3290
|
-
response = self.
|
|
3291
|
-
|
|
3292
|
-
data=request_body_data,
|
|
3293
|
-
params=query_params,
|
|
3294
|
-
content_type="application/json",
|
|
3295
|
-
)
|
|
3296
|
-
response.raise_for_status()
|
|
3297
|
-
if (
|
|
3298
|
-
response.status_code == 204
|
|
3299
|
-
or not response.content
|
|
3300
|
-
or not response.text.strip()
|
|
3301
|
-
):
|
|
3302
|
-
return None
|
|
3303
|
-
try:
|
|
3304
|
-
return response.json()
|
|
3305
|
-
except ValueError:
|
|
3306
|
-
return None
|
|
2909
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
2910
|
+
return self._handle_response(response)
|
|
3307
2911
|
|
|
3308
|
-
def watch_file_for_changes(
|
|
2912
|
+
async def watch_file_for_changes(
|
|
3309
2913
|
self,
|
|
3310
2914
|
fileId: str,
|
|
3311
2915
|
acknowledgeAbuse: str | None = None,
|
|
@@ -3384,9 +2988,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
3384
2988
|
"token": token,
|
|
3385
2989
|
"type": type,
|
|
3386
2990
|
}
|
|
3387
|
-
request_body_data = {
|
|
3388
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
3389
|
-
}
|
|
2991
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
3390
2992
|
url = f"{self.base_url}/files/{fileId}/watch"
|
|
3391
2993
|
query_params = {
|
|
3392
2994
|
k: v
|
|
@@ -3406,25 +3008,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3406
3008
|
]
|
|
3407
3009
|
if v is not None
|
|
3408
3010
|
}
|
|
3409
|
-
response = self.
|
|
3410
|
-
|
|
3411
|
-
data=request_body_data,
|
|
3412
|
-
params=query_params,
|
|
3413
|
-
content_type="application/json",
|
|
3414
|
-
)
|
|
3415
|
-
response.raise_for_status()
|
|
3416
|
-
if (
|
|
3417
|
-
response.status_code == 204
|
|
3418
|
-
or not response.content
|
|
3419
|
-
or not response.text.strip()
|
|
3420
|
-
):
|
|
3421
|
-
return None
|
|
3422
|
-
try:
|
|
3423
|
-
return response.json()
|
|
3424
|
-
except ValueError:
|
|
3425
|
-
return None
|
|
3011
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
3012
|
+
return self._handle_response(response)
|
|
3426
3013
|
|
|
3427
|
-
def list_file_permissions(
|
|
3014
|
+
async def list_file_permissions(
|
|
3428
3015
|
self,
|
|
3429
3016
|
fileId: str,
|
|
3430
3017
|
includePermissionsForView: str | None = None,
|
|
@@ -3492,20 +3079,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3492
3079
|
]
|
|
3493
3080
|
if v is not None
|
|
3494
3081
|
}
|
|
3495
|
-
response = self.
|
|
3496
|
-
|
|
3497
|
-
if (
|
|
3498
|
-
response.status_code == 204
|
|
3499
|
-
or not response.content
|
|
3500
|
-
or not response.text.strip()
|
|
3501
|
-
):
|
|
3502
|
-
return None
|
|
3503
|
-
try:
|
|
3504
|
-
return response.json()
|
|
3505
|
-
except ValueError:
|
|
3506
|
-
return None
|
|
3082
|
+
response = await self._aget(url, params=query_params)
|
|
3083
|
+
return self._handle_response(response)
|
|
3507
3084
|
|
|
3508
|
-
def create_file_permission(
|
|
3085
|
+
async def create_file_permission(
|
|
3509
3086
|
self,
|
|
3510
3087
|
fileId: str,
|
|
3511
3088
|
emailMessage: str | None = None,
|
|
@@ -3605,9 +3182,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
3605
3182
|
"type": type,
|
|
3606
3183
|
"view": view,
|
|
3607
3184
|
}
|
|
3608
|
-
request_body_data = {
|
|
3609
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
3610
|
-
}
|
|
3185
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
3611
3186
|
url = f"{self.base_url}/files/{fileId}/permissions"
|
|
3612
3187
|
query_params = {
|
|
3613
3188
|
k: v
|
|
@@ -3630,25 +3205,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3630
3205
|
]
|
|
3631
3206
|
if v is not None
|
|
3632
3207
|
}
|
|
3633
|
-
response = self.
|
|
3634
|
-
|
|
3635
|
-
data=request_body_data,
|
|
3636
|
-
params=query_params,
|
|
3637
|
-
content_type="application/json",
|
|
3638
|
-
)
|
|
3639
|
-
response.raise_for_status()
|
|
3640
|
-
if (
|
|
3641
|
-
response.status_code == 204
|
|
3642
|
-
or not response.content
|
|
3643
|
-
or not response.text.strip()
|
|
3644
|
-
):
|
|
3645
|
-
return None
|
|
3646
|
-
try:
|
|
3647
|
-
return response.json()
|
|
3648
|
-
except ValueError:
|
|
3649
|
-
return None
|
|
3208
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
3209
|
+
return self._handle_response(response)
|
|
3650
3210
|
|
|
3651
|
-
def get_permission_by_id(
|
|
3211
|
+
async def get_permission_by_id(
|
|
3652
3212
|
self,
|
|
3653
3213
|
fileId: str,
|
|
3654
3214
|
permissionId: str,
|
|
@@ -3711,20 +3271,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3711
3271
|
]
|
|
3712
3272
|
if v is not None
|
|
3713
3273
|
}
|
|
3714
|
-
response = self.
|
|
3715
|
-
|
|
3716
|
-
if (
|
|
3717
|
-
response.status_code == 204
|
|
3718
|
-
or not response.content
|
|
3719
|
-
or not response.text.strip()
|
|
3720
|
-
):
|
|
3721
|
-
return None
|
|
3722
|
-
try:
|
|
3723
|
-
return response.json()
|
|
3724
|
-
except ValueError:
|
|
3725
|
-
return None
|
|
3274
|
+
response = await self._aget(url, params=query_params)
|
|
3275
|
+
return self._handle_response(response)
|
|
3726
3276
|
|
|
3727
|
-
def delete_permission(
|
|
3277
|
+
async def delete_permission(
|
|
3728
3278
|
self,
|
|
3729
3279
|
fileId: str,
|
|
3730
3280
|
permissionId: str,
|
|
@@ -3787,20 +3337,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3787
3337
|
]
|
|
3788
3338
|
if v is not None
|
|
3789
3339
|
}
|
|
3790
|
-
response = self.
|
|
3791
|
-
|
|
3792
|
-
if (
|
|
3793
|
-
response.status_code == 204
|
|
3794
|
-
or not response.content
|
|
3795
|
-
or not response.text.strip()
|
|
3796
|
-
):
|
|
3797
|
-
return None
|
|
3798
|
-
try:
|
|
3799
|
-
return response.json()
|
|
3800
|
-
except ValueError:
|
|
3801
|
-
return None
|
|
3340
|
+
response = await self._adelete(url, params=query_params)
|
|
3341
|
+
return self._handle_response(response)
|
|
3802
3342
|
|
|
3803
|
-
def update_permission(
|
|
3343
|
+
async def update_permission(
|
|
3804
3344
|
self,
|
|
3805
3345
|
fileId: str,
|
|
3806
3346
|
permissionId: str,
|
|
@@ -3898,9 +3438,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
3898
3438
|
"type": type,
|
|
3899
3439
|
"view": view,
|
|
3900
3440
|
}
|
|
3901
|
-
request_body_data = {
|
|
3902
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
3903
|
-
}
|
|
3441
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
3904
3442
|
url = f"{self.base_url}/files/{fileId}/permissions/{permissionId}"
|
|
3905
3443
|
query_params = {
|
|
3906
3444
|
k: v
|
|
@@ -3920,20 +3458,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3920
3458
|
]
|
|
3921
3459
|
if v is not None
|
|
3922
3460
|
}
|
|
3923
|
-
response = self.
|
|
3924
|
-
|
|
3925
|
-
if (
|
|
3926
|
-
response.status_code == 204
|
|
3927
|
-
or not response.content
|
|
3928
|
-
or not response.text.strip()
|
|
3929
|
-
):
|
|
3930
|
-
return None
|
|
3931
|
-
try:
|
|
3932
|
-
return response.json()
|
|
3933
|
-
except ValueError:
|
|
3934
|
-
return None
|
|
3461
|
+
response = await self._apatch(url, data=request_body_data, params=query_params)
|
|
3462
|
+
return self._handle_response(response)
|
|
3935
3463
|
|
|
3936
|
-
def list_comment_replies(
|
|
3464
|
+
async def list_comment_replies(
|
|
3937
3465
|
self,
|
|
3938
3466
|
fileId: str,
|
|
3939
3467
|
commentId: str,
|
|
@@ -3996,20 +3524,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
3996
3524
|
]
|
|
3997
3525
|
if v is not None
|
|
3998
3526
|
}
|
|
3999
|
-
response = self.
|
|
4000
|
-
|
|
4001
|
-
if (
|
|
4002
|
-
response.status_code == 204
|
|
4003
|
-
or not response.content
|
|
4004
|
-
or not response.text.strip()
|
|
4005
|
-
):
|
|
4006
|
-
return None
|
|
4007
|
-
try:
|
|
4008
|
-
return response.json()
|
|
4009
|
-
except ValueError:
|
|
4010
|
-
return None
|
|
3527
|
+
response = await self._aget(url, params=query_params)
|
|
3528
|
+
return self._handle_response(response)
|
|
4011
3529
|
|
|
4012
|
-
def create_comment_reply(
|
|
3530
|
+
async def create_comment_reply(
|
|
4013
3531
|
self,
|
|
4014
3532
|
fileId: str,
|
|
4015
3533
|
commentId: str,
|
|
@@ -4079,9 +3597,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
4079
3597
|
"kind": kind,
|
|
4080
3598
|
"modifiedTime": modifiedTime,
|
|
4081
3599
|
}
|
|
4082
|
-
request_body_data = {
|
|
4083
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
4084
|
-
}
|
|
3600
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
4085
3601
|
url = f"{self.base_url}/files/{fileId}/comments/{commentId}/replies"
|
|
4086
3602
|
query_params = {
|
|
4087
3603
|
k: v
|
|
@@ -4096,25 +3612,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4096
3612
|
]
|
|
4097
3613
|
if v is not None
|
|
4098
3614
|
}
|
|
4099
|
-
response = self.
|
|
4100
|
-
|
|
4101
|
-
data=request_body_data,
|
|
4102
|
-
params=query_params,
|
|
4103
|
-
content_type="application/json",
|
|
4104
|
-
)
|
|
4105
|
-
response.raise_for_status()
|
|
4106
|
-
if (
|
|
4107
|
-
response.status_code == 204
|
|
4108
|
-
or not response.content
|
|
4109
|
-
or not response.text.strip()
|
|
4110
|
-
):
|
|
4111
|
-
return None
|
|
4112
|
-
try:
|
|
4113
|
-
return response.json()
|
|
4114
|
-
except ValueError:
|
|
4115
|
-
return None
|
|
3615
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
3616
|
+
return self._handle_response(response)
|
|
4116
3617
|
|
|
4117
|
-
def get_reply_by_id(
|
|
3618
|
+
async def get_reply_by_id(
|
|
4118
3619
|
self,
|
|
4119
3620
|
fileId: str,
|
|
4120
3621
|
commentId: str,
|
|
@@ -4175,20 +3676,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4175
3676
|
]
|
|
4176
3677
|
if v is not None
|
|
4177
3678
|
}
|
|
4178
|
-
response = self.
|
|
4179
|
-
|
|
4180
|
-
if (
|
|
4181
|
-
response.status_code == 204
|
|
4182
|
-
or not response.content
|
|
4183
|
-
or not response.text.strip()
|
|
4184
|
-
):
|
|
4185
|
-
return None
|
|
4186
|
-
try:
|
|
4187
|
-
return response.json()
|
|
4188
|
-
except ValueError:
|
|
4189
|
-
return None
|
|
3679
|
+
response = await self._aget(url, params=query_params)
|
|
3680
|
+
return self._handle_response(response)
|
|
4190
3681
|
|
|
4191
|
-
def delete_reply(
|
|
3682
|
+
async def delete_reply(
|
|
4192
3683
|
self,
|
|
4193
3684
|
fileId: str,
|
|
4194
3685
|
commentId: str,
|
|
@@ -4246,20 +3737,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4246
3737
|
]
|
|
4247
3738
|
if v is not None
|
|
4248
3739
|
}
|
|
4249
|
-
response = self.
|
|
4250
|
-
|
|
4251
|
-
if (
|
|
4252
|
-
response.status_code == 204
|
|
4253
|
-
or not response.content
|
|
4254
|
-
or not response.text.strip()
|
|
4255
|
-
):
|
|
4256
|
-
return None
|
|
4257
|
-
try:
|
|
4258
|
-
return response.json()
|
|
4259
|
-
except ValueError:
|
|
4260
|
-
return None
|
|
3740
|
+
response = await self._adelete(url, params=query_params)
|
|
3741
|
+
return self._handle_response(response)
|
|
4261
3742
|
|
|
4262
|
-
def update_reply(
|
|
3743
|
+
async def update_reply(
|
|
4263
3744
|
self,
|
|
4264
3745
|
fileId: str,
|
|
4265
3746
|
commentId: str,
|
|
@@ -4333,9 +3814,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
4333
3814
|
"kind": kind,
|
|
4334
3815
|
"modifiedTime": modifiedTime,
|
|
4335
3816
|
}
|
|
4336
|
-
request_body_data = {
|
|
4337
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
4338
|
-
}
|
|
3817
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
4339
3818
|
url = f"{self.base_url}/files/{fileId}/comments/{commentId}/replies/{replyId}"
|
|
4340
3819
|
query_params = {
|
|
4341
3820
|
k: v
|
|
@@ -4350,20 +3829,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4350
3829
|
]
|
|
4351
3830
|
if v is not None
|
|
4352
3831
|
}
|
|
4353
|
-
response = self.
|
|
4354
|
-
|
|
4355
|
-
if (
|
|
4356
|
-
response.status_code == 204
|
|
4357
|
-
or not response.content
|
|
4358
|
-
or not response.text.strip()
|
|
4359
|
-
):
|
|
4360
|
-
return None
|
|
4361
|
-
try:
|
|
4362
|
-
return response.json()
|
|
4363
|
-
except ValueError:
|
|
4364
|
-
return None
|
|
3832
|
+
response = await self._apatch(url, data=request_body_data, params=query_params)
|
|
3833
|
+
return self._handle_response(response)
|
|
4365
3834
|
|
|
4366
|
-
def list_file_revisions(
|
|
3835
|
+
async def list_file_revisions(
|
|
4367
3836
|
self,
|
|
4368
3837
|
fileId: str,
|
|
4369
3838
|
pageSize: str | None = None,
|
|
@@ -4419,20 +3888,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4419
3888
|
]
|
|
4420
3889
|
if v is not None
|
|
4421
3890
|
}
|
|
4422
|
-
response = self.
|
|
4423
|
-
|
|
4424
|
-
if (
|
|
4425
|
-
response.status_code == 204
|
|
4426
|
-
or not response.content
|
|
4427
|
-
or not response.text.strip()
|
|
4428
|
-
):
|
|
4429
|
-
return None
|
|
4430
|
-
try:
|
|
4431
|
-
return response.json()
|
|
4432
|
-
except ValueError:
|
|
4433
|
-
return None
|
|
3891
|
+
response = await self._aget(url, params=query_params)
|
|
3892
|
+
return self._handle_response(response)
|
|
4434
3893
|
|
|
4435
|
-
def get_revision(
|
|
3894
|
+
async def get_revision(
|
|
4436
3895
|
self,
|
|
4437
3896
|
fileId: str,
|
|
4438
3897
|
revisionId: str,
|
|
@@ -4489,20 +3948,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4489
3948
|
]
|
|
4490
3949
|
if v is not None
|
|
4491
3950
|
}
|
|
4492
|
-
response = self.
|
|
4493
|
-
|
|
4494
|
-
if (
|
|
4495
|
-
response.status_code == 204
|
|
4496
|
-
or not response.content
|
|
4497
|
-
or not response.text.strip()
|
|
4498
|
-
):
|
|
4499
|
-
return None
|
|
4500
|
-
try:
|
|
4501
|
-
return response.json()
|
|
4502
|
-
except ValueError:
|
|
4503
|
-
return None
|
|
3951
|
+
response = await self._aget(url, params=query_params)
|
|
3952
|
+
return self._handle_response(response)
|
|
4504
3953
|
|
|
4505
|
-
def delete_file_revision(
|
|
3954
|
+
async def delete_file_revision(
|
|
4506
3955
|
self,
|
|
4507
3956
|
fileId: str,
|
|
4508
3957
|
revisionId: str,
|
|
@@ -4556,20 +4005,10 @@ class GoogleDriveApp(APIApplication):
|
|
|
4556
4005
|
]
|
|
4557
4006
|
if v is not None
|
|
4558
4007
|
}
|
|
4559
|
-
response = self.
|
|
4560
|
-
|
|
4561
|
-
if (
|
|
4562
|
-
response.status_code == 204
|
|
4563
|
-
or not response.content
|
|
4564
|
-
or not response.text.strip()
|
|
4565
|
-
):
|
|
4566
|
-
return None
|
|
4567
|
-
try:
|
|
4568
|
-
return response.json()
|
|
4569
|
-
except ValueError:
|
|
4570
|
-
return None
|
|
4008
|
+
response = await self._adelete(url, params=query_params)
|
|
4009
|
+
return self._handle_response(response)
|
|
4571
4010
|
|
|
4572
|
-
def update_revision(
|
|
4011
|
+
async def update_revision(
|
|
4573
4012
|
self,
|
|
4574
4013
|
fileId: str,
|
|
4575
4014
|
revisionId: str,
|
|
@@ -4654,9 +4093,7 @@ class GoogleDriveApp(APIApplication):
|
|
|
4654
4093
|
"publishedOutsideDomain": publishedOutsideDomain,
|
|
4655
4094
|
"size": size,
|
|
4656
4095
|
}
|
|
4657
|
-
request_body_data = {
|
|
4658
|
-
k: v for k, v in request_body_data.items() if v is not None
|
|
4659
|
-
}
|
|
4096
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
4660
4097
|
url = f"{self.base_url}/files/{fileId}/revisions/{revisionId}"
|
|
4661
4098
|
query_params = {
|
|
4662
4099
|
k: v
|
|
@@ -4671,25 +4108,11 @@ class GoogleDriveApp(APIApplication):
|
|
|
4671
4108
|
]
|
|
4672
4109
|
if v is not None
|
|
4673
4110
|
}
|
|
4674
|
-
response = self.
|
|
4675
|
-
|
|
4676
|
-
if (
|
|
4677
|
-
response.status_code == 204
|
|
4678
|
-
or not response.content
|
|
4679
|
-
or not response.text.strip()
|
|
4680
|
-
):
|
|
4681
|
-
return None
|
|
4682
|
-
try:
|
|
4683
|
-
return response.json()
|
|
4684
|
-
except ValueError:
|
|
4685
|
-
return None
|
|
4111
|
+
response = await self._apatch(url, data=request_body_data, params=query_params)
|
|
4112
|
+
return self._handle_response(response)
|
|
4686
4113
|
|
|
4687
|
-
def create_permission(
|
|
4688
|
-
self,
|
|
4689
|
-
fileId: str,
|
|
4690
|
-
emailAddress: str | None = None,
|
|
4691
|
-
role: str | None = None,
|
|
4692
|
-
type: str | None = None,
|
|
4114
|
+
async def create_permission(
|
|
4115
|
+
self, fileId: str, emailAddress: str | None = None, role: str | None = None, type: str | None = None
|
|
4693
4116
|
) -> dict[str, Any]:
|
|
4694
4117
|
"""
|
|
4695
4118
|
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,33 +4136,12 @@ class GoogleDriveApp(APIApplication):
|
|
|
4713
4136
|
if fileId is None:
|
|
4714
4137
|
raise ValueError("Missing required parameter 'fileId'.")
|
|
4715
4138
|
request_body_data = None
|
|
4716
|
-
request_body_data = {
|
|
4717
|
-
|
|
4718
|
-
|
|
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
|
-
}
|
|
4724
|
-
url = f"{self.base_url}/drive/v3/files/{fileId}/permissions"
|
|
4139
|
+
request_body_data = {"emailAddress": emailAddress, "role": role, "type": type}
|
|
4140
|
+
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
4141
|
+
url = f"{self.base_url}/files/{fileId}/permissions"
|
|
4725
4142
|
query_params = {}
|
|
4726
|
-
response = self.
|
|
4727
|
-
|
|
4728
|
-
data=request_body_data,
|
|
4729
|
-
params=query_params,
|
|
4730
|
-
content_type="application/json",
|
|
4731
|
-
)
|
|
4732
|
-
response.raise_for_status()
|
|
4733
|
-
if (
|
|
4734
|
-
response.status_code == 204
|
|
4735
|
-
or not response.content
|
|
4736
|
-
or not response.text.strip()
|
|
4737
|
-
):
|
|
4738
|
-
return None
|
|
4739
|
-
try:
|
|
4740
|
-
return response.json()
|
|
4741
|
-
except ValueError:
|
|
4742
|
-
return None
|
|
4143
|
+
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
4144
|
+
return self._handle_response(response)
|
|
4743
4145
|
|
|
4744
4146
|
def list_tools(self):
|
|
4745
4147
|
return [
|
|
@@ -4751,7 +4153,6 @@ class GoogleDriveApp(APIApplication):
|
|
|
4751
4153
|
self.create_folder,
|
|
4752
4154
|
self.get_file_details,
|
|
4753
4155
|
self.trash_file,
|
|
4754
|
-
# Auto generated from openapi spec
|
|
4755
4156
|
self.list_installed_apps,
|
|
4756
4157
|
self.get_app_by_id,
|
|
4757
4158
|
self.get_about_info,
|