universal-mcp-applications 0.1.32__py3-none-any.whl → 0.1.36rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) 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 +36 -103
  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 +24 -101
  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 +85 -189
  38. universal_mcp/applications/google_drive/app.py +141 -463
  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 +100 -581
  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 +9 -2
  53. universal_mcp/applications/linkedin/app.py +240 -181
  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 +16 -38
  61. universal_mcp/applications/openai/app.py +42 -165
  62. universal_mcp/applications/outlook/app.py +24 -84
  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 +50 -109
  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 +17 -39
  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 +33 -115
  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.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/METADATA +2 -2
  103. {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/RECORD +105 -105
  104. {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/WHEEL +0 -0
  105. {universal_mcp_applications-0.1.32.dist-info → universal_mcp_applications-0.1.36rc2.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,4 @@
1
1
  from typing import Any
2
-
3
2
  from universal_mcp.applications.application import APIApplication
4
3
  from universal_mcp.integrations import Integration
5
4
 
@@ -9,20 +8,20 @@ class GoogleDocsApp(APIApplication):
9
8
  super().__init__(name="google_docs", integration=integration)
10
9
  self.base_api_url = "https://docs.googleapis.com/v1/documents"
11
10
 
12
- def create_document(self, title: str) -> dict[str, Any]:
11
+ async def create_document(self, title: str) -> dict[str, Any]:
13
12
  """
14
13
  Creates a blank Google Document with a specified title by sending a POST request to the Google Docs API. The function returns a dictionary containing the new document's metadata, including the unique document ID required by other functions for subsequent modifications or retrieval. Note that you need to call other google_docs functions (e.g. `google_docs__insert_text`) to actually add content after creating the document.
15
-
14
+
16
15
  Args:
17
16
  title: The title for the new Google Document to be created.
18
-
17
+
19
18
  Returns:
20
19
  A dictionary containing the response from the Google Docs API with document details and metadata.
21
-
20
+
22
21
  Raises:
23
22
  HTTPError: If the API request fails due to network issues, authentication errors, or invalid parameters.
24
23
  RequestException: If there are connection errors or timeout issues during the API request.
25
-
24
+
26
25
  Tags:
27
26
  create, document, api, important, google-docs, http
28
27
  """
@@ -31,25 +30,23 @@ class GoogleDocsApp(APIApplication):
31
30
  response = self._post(url, data=document_data)
32
31
  response.raise_for_status()
33
32
  payload = response.json()
34
- payload["Note"] = (
35
- "You must load and call other google docs content functions (like google_docs__insert_text)"
36
- )
33
+ payload["Note"] = "You must load and call other google docs content functions (like google_docs__insert_text)"
37
34
  return payload
38
35
 
39
36
  def get_document(self, document_id: str) -> dict[str, Any]:
40
37
  """
41
38
  Retrieves the complete, raw JSON object for a Google Document by its ID. This function returns the full, unprocessed API response with all metadata and structural elements, distinguishing it from `get_document_content`, which parses this data to extract only the title and plain text.
42
-
39
+
43
40
  Args:
44
41
  document_id: The unique identifier of the Google Document to retrieve.
45
-
42
+
46
43
  Returns:
47
44
  A dictionary containing the complete document data as returned by the Google Docs API.
48
-
45
+
49
46
  Raises:
50
47
  HTTPError: If the API request fails or the specified document cannot be found.
51
48
  JSONDecodeError: If the API response is not valid JSON and cannot be parsed.
52
-
49
+
53
50
  Tags:
54
51
  retrieve, read, api, document, google-docs, important
55
52
  """
@@ -57,7 +54,7 @@ class GoogleDocsApp(APIApplication):
57
54
  response = self._get(url)
58
55
  return response.json()
59
56
 
60
- def get_document_content(self, document_id: str) -> dict[str, Any]:
57
+ async def get_document_content(self, document_id: str) -> dict[str, Any]:
61
58
  """
62
59
  Retrieves and converts a Google Docs document into Markdown-formatted content.
63
60
 
@@ -94,7 +91,6 @@ class GoogleDocsApp(APIApplication):
94
91
  inline_objects = response.get("inlineObjects", {})
95
92
  lists = response.get("lists", {})
96
93
  footnotes_data = response.get("footnotes", {})
97
-
98
94
  text_chunks: list[str] = []
99
95
  footnotes: dict[str, str] = {}
100
96
  footnote_index: dict[str, int] = {}
@@ -136,7 +132,7 @@ class GoogleDocsApp(APIApplication):
136
132
  """Returns appropriate Markdown heading level."""
137
133
  style = paragraph.get("paragraphStyle", {})
138
134
  heading = style.get("namedStyleType", "")
139
- match = re.match(r"HEADING_(\d)", heading)
135
+ match = re.match("HEADING_(\\d)", heading)
140
136
  if match:
141
137
  level = int(match.group(1))
142
138
  return "#" * level
@@ -151,7 +147,6 @@ class GoogleDocsApp(APIApplication):
151
147
  nesting = paragraph["bullet"].get("nestingLevel", 0)
152
148
  list_info = lists.get(list_id, {})
153
149
  list_type = list_info.get("listProperties", {}).get("nestingLevels", [{}])[nesting].get("glyphType")
154
-
155
150
  indent = " " * nesting
156
151
  if list_type and "DECIMAL" in list_type:
157
152
  current_list_counters[list_id] = current_list_counters.get(list_id, 1)
@@ -181,10 +176,8 @@ class GoogleDocsApp(APIApplication):
181
176
  if "equation" in para:
182
177
  text_chunks.append(extract_equation(para))
183
178
  continue
184
-
185
179
  heading_md = extract_heading_style(para)
186
180
  list_prefix = extract_list_prefix(para)
187
-
188
181
  para_text = extract_text_from_paragraph(para).strip()
189
182
  if para_text:
190
183
  if heading_md:
@@ -193,69 +186,50 @@ class GoogleDocsApp(APIApplication):
193
186
  text_chunks.append(f"{list_prefix}{para_text}")
194
187
  else:
195
188
  text_chunks.append(para_text)
196
-
197
189
  elif "table" in element:
198
190
  table_md = extract_table(element["table"])
199
191
  text_chunks.append(table_md)
200
-
201
192
  elif "horizontalRule" in element:
202
193
  text_chunks.append("\n---\n")
203
-
204
194
  elif "tableOfContents" in element:
205
195
  text_chunks.append("<!-- Table of Contents -->")
206
-
207
- # Handle footnote references (inline elements)
208
196
  elif "footnoteReference" in element:
209
197
  footnote_id = element["footnoteReference"]["footnoteId"]
210
198
  ref = extract_footnote_ref(footnote_id)
211
199
  text_chunks.append(ref)
212
-
213
- # Append footnotes at the end
214
200
  if footnotes:
215
201
  text_chunks.append("\n## Footnotes\n")
216
202
  for fid, index in sorted(footnote_index.items(), key=lambda x: x[1]):
217
203
  text_chunks.append(f"[^{index}]: {footnotes[fid]}")
204
+ content = "\n\n".join((chunk.strip() for chunk in text_chunks if chunk.strip()))
205
+ return {"title": title, "content": content}
218
206
 
219
- content = "\n\n".join(chunk.strip() for chunk in text_chunks if chunk.strip())
220
-
221
- return {
222
- "title": title,
223
- "content": content
224
- }
225
-
226
-
227
- def insert_text(
228
- self, document_id: str, content: str, index: int = 1
229
- ) -> dict[str, Any]:
207
+ async def insert_text(self, document_id: str, content: str, index: int = 1) -> dict[str, Any]:
230
208
  """
231
209
  Inserts a text string at a specified index within a Google Document using the batchUpdate API. Unlike functions that format existing text or delete content ranges, this method specifically adds new textual content to the document body.
232
-
210
+
233
211
  Args:
234
212
  document_id: The unique identifier of the Google Document to be updated.
235
213
  content: The text content to be inserted into the document.
236
214
  index: The zero-based position in the document where the text should be inserted (default is 1).
237
-
215
+
238
216
  Returns:
239
217
  A dictionary containing the Google Docs API response after performing the batch update operation.
240
-
218
+
241
219
  Raises:
242
220
  HTTPError: If the API request fails, for example due to invalid document_id or insufficient permissions.
243
221
  RequestException: If there are network connectivity issues or problems contacting the API endpoint.
244
-
222
+
245
223
  Tags:
246
224
  update, insert, document, api, google-docs, batch, content-management, important
247
225
  """
248
226
  url = f"{self.base_api_url}/{document_id}:batchUpdate"
249
- batch_update_data = {
250
- "requests": [
251
- {"insertText": {"location": {"index": index}, "text": content}}
252
- ]
253
- }
227
+ batch_update_data = {"requests": [{"insertText": {"location": {"index": index}, "text": content}}]}
254
228
  response = self._post(url, data=batch_update_data)
255
229
  response.raise_for_status()
256
230
  return response.json()
257
231
 
258
- def apply_text_style(
232
+ async def apply_text_style(
259
233
  self,
260
234
  document_id: str,
261
235
  start_index: int,
@@ -270,7 +244,7 @@ class GoogleDocsApp(APIApplication):
270
244
  ) -> dict[str, Any]:
271
245
  """
272
246
  Applies character-level formatting (e.g., bold, italic, color, links) to a specified text range. This function modifies text attributes directly, distinguishing it from `update_paragraph_style` which handles block-level properties like alignment.
273
-
247
+
274
248
  Args:
275
249
  document_id: The unique identifier of the Google Document to update.
276
250
  start_index: The zero-based start index of the text range to apply the style.
@@ -282,14 +256,14 @@ class GoogleDocsApp(APIApplication):
282
256
  link_url: URL to apply as a hyperlink to the text.
283
257
  foreground_color: RGB color dictionary with 'red', 'green', and 'blue' floats (0.0 to 1.0) for the text color.
284
258
  background_color: RGB color dictionary with 'red', 'green', and 'blue' floats (0.0 to 1.0) for the text background color.
285
-
259
+
286
260
  Returns:
287
261
  A dictionary containing the Google Docs API response, or a message if no styling was applied.
288
-
262
+
289
263
  Raises:
290
264
  HTTPError: If the Google Docs API request fails.
291
265
  RequestException: If there are network connectivity issues during the API request.
292
-
266
+
293
267
  Tags:
294
268
  style, format, text, document, api, google-docs, important
295
269
  """
@@ -349,7 +323,7 @@ class GoogleDocsApp(APIApplication):
349
323
  response = self._post(url, data=batch_update_data)
350
324
  return self._handle_response(response)
351
325
 
352
- def update_paragraph_style(
326
+ async def update_paragraph_style(
353
327
  self,
354
328
  document_id: str,
355
329
  start_index: int,
@@ -363,7 +337,7 @@ class GoogleDocsApp(APIApplication):
363
337
  ) -> dict[str, Any]:
364
338
  """
365
339
  Applies paragraph-level formatting like alignment, named styles (e.g., 'HEADING_1'), and text direction to a text range in a Google Doc. Distinct from `apply_text_style`, which handles character formatting, this method modifies properties for entire paragraphs using the batchUpdate API.
366
-
340
+
367
341
  Args:
368
342
  document_id: The unique identifier of the Google Document to update.
369
343
  start_index: The zero-based start index of the paragraph range to style.
@@ -374,14 +348,14 @@ class GoogleDocsApp(APIApplication):
374
348
  spacing_mode: Spacing mode for the paragraph ('NEVER_COLLAPSE', 'COLLAPSE_LISTS').
375
349
  segment_id: Optional segment ID for the text range.
376
350
  tab_id: Optional tab ID for the text range.
377
-
351
+
378
352
  Returns:
379
353
  A dictionary containing the API response from the Google Docs batchUpdate request.
380
-
354
+
381
355
  Raises:
382
356
  HTTPError: If the API request to update the document fails due to an HTTP error.
383
357
  RequestException: If there are network connectivity issues during the API request.
384
-
358
+
385
359
  Tags:
386
360
  style, format, paragraph, document, api, google-docs, batch, content-management, important
387
361
  """
@@ -409,50 +383,37 @@ class GoogleDocsApp(APIApplication):
409
383
  range_obj["tabId"] = tab_id
410
384
  batch_update_data = {
411
385
  "requests": [
412
- {
413
- "updateParagraphStyle": {
414
- "range": range_obj,
415
- "paragraphStyle": paragraph_style,
416
- "fields": ",".join(fields_to_update),
417
- }
418
- }
386
+ {"updateParagraphStyle": {"range": range_obj, "paragraphStyle": paragraph_style, "fields": ",".join(fields_to_update)}}
419
387
  ]
420
388
  }
421
389
  response = self._post(url, data=batch_update_data)
422
390
  return self._handle_response(response)
423
391
 
424
- def delete_content_range(
425
- self,
426
- document_id: str,
427
- start_index: int,
428
- end_index: int,
429
- segment_id: str | None = None,
430
- tab_id: str | None = None,
392
+ async def delete_content_range(
393
+ self, document_id: str, start_index: int, end_index: int, segment_id: str | None = None, tab_id: str | None = None
431
394
  ) -> dict[str, Any]:
432
395
  """
433
396
  Removes content from a specified index range in a Google Document via the batchUpdate API. Unlike functions that delete entire elements (e.g., `delete_header`), this provides granular control by targeting content based on its precise start and end location, optionally within a specific segment or tab.
434
-
397
+
435
398
  Args:
436
399
  document_id: The unique identifier of the Google Document to be updated.
437
400
  start_index: The zero-based start index of the content range to delete.
438
401
  end_index: The zero-based end index of the content range to delete (exclusive).
439
402
  segment_id: Optional; the ID of the header, footer, or footnote segment containing the content.
440
403
  tab_id: Optional; the ID of the tab containing the content to delete.
441
-
404
+
442
405
  Returns:
443
406
  A dictionary representing the Google Docs API response after performing the delete operation.
444
-
407
+
445
408
  Raises:
446
409
  HTTPError: Raised when the API request fails due to issues such as invalid document ID or insufficient permissions.
447
410
  RequestException: Raised when there are network connectivity issues or problems with the API endpoint.
448
-
411
+
449
412
  Tags:
450
413
  delete, remove, content, document, api, google-docs, batch, content-management, important
451
414
  """
452
415
  url = f"{self.base_api_url}/{document_id}:batchUpdate"
453
- delete_request: dict[str, Any] = {
454
- "range": {"startIndex": start_index, "endIndex": end_index}
455
- }
416
+ delete_request: dict[str, Any] = {"range": {"startIndex": start_index, "endIndex": end_index}}
456
417
  if segment_id is not None:
457
418
  delete_request["range"]["segmentId"] = segment_id
458
419
  if tab_id is not None:
@@ -461,18 +422,12 @@ class GoogleDocsApp(APIApplication):
461
422
  response = self._post(url, data=batch_update_data)
462
423
  return self._handle_response(response)
463
424
 
464
- def insert_table(
465
- self,
466
- document_id: str,
467
- location_index: int,
468
- rows: int,
469
- columns: int,
470
- segment_id: str = None,
471
- tab_id: str = None,
425
+ async def insert_table(
426
+ self, document_id: str, location_index: int, rows: int, columns: int, segment_id: str = None, tab_id: str = None
472
427
  ) -> dict[str, Any]:
473
428
  """
474
429
  Inserts a table with specified rows and columns at a given index in a Google Document using the batchUpdate API. It can optionally place the table within specific document segments, such as headers or footers, handling structural additions rather than text or style modifications.
475
-
430
+
476
431
  Args:
477
432
  document_id: The unique identifier of the Google Document to be updated.
478
433
  location_index: The zero-based index within the document body or segment where the table should be inserted.
@@ -480,14 +435,14 @@ class GoogleDocsApp(APIApplication):
480
435
  columns: The number of columns the inserted table should have.
481
436
  segment_id: Optional ID of the header, footer, or footnote segment where the table will be inserted (if applicable).
482
437
  tab_id: Optional ID of the tab containing the insertion location.
483
-
438
+
484
439
  Returns:
485
440
  A dictionary containing the response from the Google Docs API after performing the table insertion.
486
-
441
+
487
442
  Raises:
488
443
  HTTPError: Raised when the API request fails due to reasons such as invalid document ID or insufficient permissions.
489
444
  RequestException: Raised when there are network connectivity issues or problems reaching the API endpoint.
490
-
445
+
491
446
  Tags:
492
447
  table, insert, document, api, google-docs, batch, content-management, important
493
448
  """
@@ -497,21 +452,11 @@ class GoogleDocsApp(APIApplication):
497
452
  location["segmentId"] = segment_id
498
453
  if tab_id is not None:
499
454
  location["tabId"] = tab_id
500
- batch_update_data = {
501
- "requests": [
502
- {
503
- "insertTable": {
504
- "location": location,
505
- "rows": rows,
506
- "columns": columns,
507
- }
508
- }
509
- ]
510
- }
455
+ batch_update_data = {"requests": [{"insertTable": {"location": location, "rows": rows, "columns": columns}}]}
511
456
  response = self._post(url, data=batch_update_data)
512
457
  return self._handle_response(response)
513
458
 
514
- def create_footer(
459
+ async def create_footer(
515
460
  self,
516
461
  document_id: str,
517
462
  footer_type: str = "DEFAULT",
@@ -521,21 +466,21 @@ class GoogleDocsApp(APIApplication):
521
466
  ) -> dict[str, Any]:
522
467
  """
523
468
  Creates a footer of a specified type in a Google Document using the batch update API. This function, distinct from `create_header`, can optionally associate the new footer with a specific section break, enabling section-specific footers within the document.
524
-
469
+
525
470
  Args:
526
471
  document_id: The unique identifier of the Google Document to update.
527
472
  footer_type: The type of footer to create, such as 'DEFAULT' or 'HEADER_FOOTER_TYPE_UNSPECIFIED'.
528
473
  section_break_location_index: Optional index of the SectionBreak location to associate with the footer.
529
474
  section_break_segment_id: Optional segment ID of the SectionBreak location.
530
475
  section_break_tab_id: Optional tab ID of the SectionBreak location.
531
-
476
+
532
477
  Returns:
533
478
  A dictionary containing the Google Docs API response from the create footer operation.
534
-
479
+
535
480
  Raises:
536
481
  HTTPError: Raised when the API request fails due to reasons like invalid document_id or insufficient permissions.
537
482
  RequestException: Raised when there are network connectivity issues or problems with the API endpoint.
538
-
483
+
539
484
  Tags:
540
485
  footer, create, document, api, google-docs, batch, content-management, important
541
486
  """
@@ -543,19 +488,16 @@ class GoogleDocsApp(APIApplication):
543
488
  create_footer_request = {"type": footer_type}
544
489
  if section_break_location_index is not None:
545
490
  section_break_location = {"index": section_break_location_index}
546
-
547
491
  if section_break_segment_id is not None:
548
492
  section_break_location["segmentId"] = section_break_segment_id
549
-
550
493
  if section_break_tab_id is not None:
551
494
  section_break_location["tabId"] = section_break_tab_id
552
-
553
495
  create_footer_request["sectionBreakLocation"] = section_break_location
554
496
  batch_update_data = {"requests": [{"createFooter": create_footer_request}]}
555
497
  response = self._post(url, data=batch_update_data)
556
498
  return self._handle_response(response)
557
499
 
558
- def create_footnote(
500
+ async def create_footnote(
559
501
  self,
560
502
  document_id: str,
561
503
  location_index: int = None,
@@ -567,7 +509,7 @@ class GoogleDocsApp(APIApplication):
567
509
  ) -> dict[str, Any]:
568
510
  """
569
511
  Inserts a numbered footnote reference into a Google Document using the batchUpdate API. The footnote can be placed at a precise index or at the end of a document segment, distinct from the `create_footer` function which adds standard page footers.
570
-
512
+
571
513
  Args:
572
514
  document_id: The unique identifier of the Google Document to be updated.
573
515
  location_index: The zero-based index within the document where the footnote reference will be inserted (optional if inserting at end of segment).
@@ -576,68 +518,53 @@ class GoogleDocsApp(APIApplication):
576
518
  end_of_segment_location: If True, inserts the footnote reference at the end of a segment instead of a specific index (default is False).
577
519
  end_of_segment_segment_id: The segment ID indicating where to insert the footnote at the end of a segment (optional).
578
520
  end_of_segment_tab_id: The tab ID for the end-of-segment location (optional).
579
-
521
+
580
522
  Returns:
581
523
  A dictionary containing the response from the Google Docs API after performing the footnote creation operation.
582
-
524
+
583
525
  Raises:
584
526
  HTTPError: Raised when the API request fails, such as due to an invalid document ID or insufficient permissions.
585
527
  RequestException: Raised when there are network connectivity issues or problems reaching the API endpoint.
586
-
528
+
587
529
  Tags:
588
530
  footnote, create, document, api, google-docs, batch, content-management, important
589
531
  """
590
532
  url = f"{self.base_api_url}/{document_id}:batchUpdate"
591
533
  create_footnote_request = {}
592
534
  if end_of_segment_location:
593
- # Use endOfSegmentLocation
594
535
  end_of_segment_location_obj = {}
595
-
596
536
  if end_of_segment_segment_id is not None:
597
537
  end_of_segment_location_obj["segmentId"] = end_of_segment_segment_id
598
-
599
538
  if end_of_segment_tab_id is not None:
600
539
  end_of_segment_location_obj["tabId"] = end_of_segment_tab_id
601
-
602
- create_footnote_request["endOfSegmentLocation"] = (
603
- end_of_segment_location_obj
604
- )
540
+ create_footnote_request["endOfSegmentLocation"] = end_of_segment_location_obj
605
541
  else:
606
- # Use specific location
607
542
  location = {"index": location_index}
608
-
609
543
  if location_segment_id is not None:
610
544
  location["segmentId"] = location_segment_id
611
-
612
545
  if location_tab_id is not None:
613
546
  location["tabId"] = location_tab_id
614
-
615
547
  create_footnote_request["location"] = location
616
548
  batch_update_data = {"requests": [{"createFootnote": create_footnote_request}]}
617
549
  response = self._post(url, data=batch_update_data)
618
550
  return self._handle_response(response)
619
551
 
620
- def delete_footer(
621
- self,
622
- document_id: str,
623
- footer_id: str,
624
- tab_id: str = None,
625
- ) -> dict[str, Any]:
552
+ async def delete_footer(self, document_id: str, footer_id: str, tab_id: str = None) -> dict[str, Any]:
626
553
  """
627
554
  Deletes a specific footer from a Google Document using its unique ID via a batchUpdate API request. This operation removes the entire footer object, optionally within a specific tab, distinguishing it from functions that delete headers (`delete_header`) or general content (`delete_content_range`).
628
-
555
+
629
556
  Args:
630
557
  document_id: The unique identifier of the Google Document to be updated.
631
558
  footer_id: The identifier of the footer to delete.
632
559
  tab_id: Optional identifier of the tab containing the footer to delete.
633
-
560
+
634
561
  Returns:
635
562
  A dictionary containing the response from the Google Docs API after performing the delete footer operation.
636
-
563
+
637
564
  Raises:
638
565
  HTTPError: Raised when the API request fails due to reasons such as an invalid document ID or insufficient permissions.
639
566
  RequestException: Raised for network-related issues or problems reaching the API endpoint.
640
-
567
+
641
568
  Tags:
642
569
  footer, delete, remove, document, api, google-docs, batch, content-management, important
643
570
  """
@@ -649,7 +576,7 @@ class GoogleDocsApp(APIApplication):
649
576
  response = self._post(url, data=batch_update_data)
650
577
  return self._handle_response(response)
651
578
 
652
- def create_header(
579
+ async def create_header(
653
580
  self,
654
581
  document_id: str,
655
582
  header_type: str = "DEFAULT",
@@ -659,21 +586,21 @@ class GoogleDocsApp(APIApplication):
659
586
  ) -> dict[str, Any]:
660
587
  """
661
588
  Creates a header of a specified type in a Google Document using the batchUpdate API. This function can optionally associate the new header with a specific section break, distinguishing it from the `create_footer` method, which performs the equivalent action for footers.
662
-
589
+
663
590
  Args:
664
591
  document_id: The unique identifier of the Google Document to be updated.
665
592
  header_type: The type of header to create, e.g., 'DEFAULT' or 'HEADER_FOOTER_TYPE_UNSPECIFIED'.
666
593
  section_break_location_index: The index position of the section break location within the document, if applicable.
667
594
  section_break_segment_id: The segment ID associated with the section break location, if applicable.
668
595
  section_break_tab_id: The tab ID associated with the section break location, if applicable.
669
-
596
+
670
597
  Returns:
671
598
  A dictionary containing the response from the Google Docs API after the header creation request.
672
-
599
+
673
600
  Raises:
674
601
  HTTPError: If the API request fails due to issues such as an invalid document ID or insufficient permissions.
675
602
  RequestException: If there are network problems or issues reaching the API endpoint.
676
-
603
+
677
604
  Tags:
678
605
  header, create, document, api, google-docs, batch, content-management, important
679
606
  """
@@ -681,39 +608,31 @@ class GoogleDocsApp(APIApplication):
681
608
  create_header_request = {"type": header_type}
682
609
  if section_break_location_index is not None:
683
610
  section_break_location = {"index": section_break_location_index}
684
-
685
611
  if section_break_segment_id is not None:
686
612
  section_break_location["segmentId"] = section_break_segment_id
687
-
688
613
  if section_break_tab_id is not None:
689
614
  section_break_location["tabId"] = section_break_tab_id
690
-
691
615
  create_header_request["sectionBreakLocation"] = section_break_location
692
616
  batch_update_data = {"requests": [{"createHeader": create_header_request}]}
693
617
  response = self._post(url, data=batch_update_data)
694
618
  return self._handle_response(response)
695
619
 
696
- def delete_header(
697
- self,
698
- document_id: str,
699
- header_id: str,
700
- tab_id: str = None,
701
- ) -> dict[str, Any]:
620
+ async def delete_header(self, document_id: str, header_id: str, tab_id: str = None) -> dict[str, Any]:
702
621
  """
703
622
  Deletes a specific header from a Google Document using its unique ID via a batchUpdate API request. This function, the counterpart to `create_header`, removes headers and can optionally target a header within a specific tab. It requires both the document and header IDs for the operation.
704
-
623
+
705
624
  Args:
706
625
  document_id: The unique identifier of the Google Document to be updated.
707
626
  header_id: The ID of the header to delete.
708
627
  tab_id: Optional ID of the tab containing the header to delete.
709
-
628
+
710
629
  Returns:
711
630
  A dictionary containing the response from the Google Docs API after performing the delete header operation.
712
-
631
+
713
632
  Raises:
714
633
  HTTPError: Raised when the API request fails due to invalid document_id, insufficient permissions, or other HTTP errors.
715
634
  RequestException: Raised when network connectivity issues or API endpoint problems occur during the request.
716
-
635
+
717
636
  Tags:
718
637
  header, delete, remove, document, api, google-docs, batch, content-management, important
719
638
  """
@@ -725,18 +644,12 @@ class GoogleDocsApp(APIApplication):
725
644
  response = self._post(url, data=batch_update_data)
726
645
  return self._handle_response(response)
727
646
 
728
- def apply_list_style(
729
- self,
730
- document_id: str,
731
- start_index: int,
732
- end_index: int,
733
- bullet_preset: str,
734
- segment_id: str = None,
735
- tab_id: str = None,
647
+ async def apply_list_style(
648
+ self, document_id: str, start_index: int, end_index: int, bullet_preset: str, segment_id: str = None, tab_id: str = None
736
649
  ) -> dict[str, Any]:
737
650
  """
738
651
  Applies a predefined list style (bulleted or numbered) to paragraphs within a specified range using a chosen preset. Unlike `delete_paragraph_bullets`, which removes list formatting, this function creates it, distinguishing it from other text and paragraph styling methods in the class.
739
-
652
+
740
653
  Args:
741
654
  document_id: The unique identifier of the Google Document to be updated.
742
655
  start_index: The zero-based start index of the text range to which the list style should be applied.
@@ -744,14 +657,14 @@ class GoogleDocsApp(APIApplication):
744
657
  bullet_preset: Specifies the bullet or numbering style preset to use (e.g., bulleted or numbered formats with specific glyphs).
745
658
  segment_id: Optional segment ID within the document where the updates apply.
746
659
  tab_id: Optional tab ID within the segment to narrow the update scope.
747
-
660
+
748
661
  Returns:
749
662
  A dictionary representing the Google Docs API response confirming the application of the bullet list style.
750
-
663
+
751
664
  Raises:
752
665
  HTTPError: Raised when the API request to update the document fails (e.g., invalid document ID or insufficient permissions).
753
666
  RequestException: Raised on network issues or problems reaching the API endpoint.
754
-
667
+
755
668
  Tags:
756
669
  bullets, list, paragraph, document, api, google-docs, batch, content-management, important
757
670
  """
@@ -761,44 +674,30 @@ class GoogleDocsApp(APIApplication):
761
674
  range_obj["segmentId"] = segment_id
762
675
  if tab_id is not None:
763
676
  range_obj["tabId"] = tab_id
764
- batch_update_data = {
765
- "requests": [
766
- {
767
- "createParagraphBullets": {
768
- "range": range_obj,
769
- "bulletPreset": bullet_preset,
770
- }
771
- }
772
- ]
773
- }
677
+ batch_update_data = {"requests": [{"createParagraphBullets": {"range": range_obj, "bulletPreset": bullet_preset}}]}
774
678
  response = self._post(url, data=batch_update_data)
775
679
  return self._handle_response(response)
776
680
 
777
- def delete_paragraph_bullets(
778
- self,
779
- document_id: str,
780
- start_index: int,
781
- end_index: int,
782
- segment_id: str = None,
783
- tab_id: str = None,
681
+ async def delete_paragraph_bullets(
682
+ self, document_id: str, start_index: int, end_index: int, segment_id: str = None, tab_id: str = None
784
683
  ) -> dict[str, Any]:
785
684
  """
786
685
  Removes bullet points or numbering from paragraphs within a specified index range in a Google Document. This reverts list formatting to normal text while preserving content, acting as the inverse operation to the `apply_list_style` function.
787
-
686
+
788
687
  Args:
789
688
  document_id: The unique identifier of the Google Document to be updated.
790
689
  start_index: The zero-based start index of the range to remove bullets from.
791
690
  end_index: The zero-based end index of the range to remove bullets from (exclusive).
792
691
  segment_id: Optional segment ID specifying a subset of the document where the range applies.
793
692
  tab_id: Optional tab ID specifying a particular tab within the document where the range applies.
794
-
693
+
795
694
  Returns:
796
695
  A dictionary containing the Google Docs API response after performing the delete bullets operation.
797
-
696
+
798
697
  Raises:
799
698
  HTTPError: Raised when the API request fails due to invalid document ID, insufficient permissions, or other server-side errors.
800
699
  RequestException: Raised when there are network connectivity issues or problems accessing the API endpoint.
801
-
700
+
802
701
  Tags:
803
702
  bullets, delete, remove, list, paragraph, document, api, google-docs, batch, content-management
804
703
  """
@@ -808,16 +707,13 @@ class GoogleDocsApp(APIApplication):
808
707
  range_obj["segmentId"] = segment_id
809
708
  if tab_id is not None:
810
709
  range_obj["tabId"] = tab_id
811
- batch_update_data = {
812
- "requests": [{"deleteParagraphBullets": {"range": range_obj}}]
813
- }
710
+ batch_update_data = {"requests": [{"deleteParagraphBullets": {"range": range_obj}}]}
814
711
  response = self._post(url, data=batch_update_data)
815
712
  return self._handle_response(response)
816
713
 
817
714
  def list_tools(self):
818
715
  return [
819
716
  self.create_document,
820
- # self.get_document,
821
717
  self.get_document_content,
822
718
  self.insert_text,
823
719
  self.apply_text_style,