universal-mcp 0.1.7rc1__py3-none-any.whl → 0.1.8__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.
- universal_mcp/__init__.py +0 -2
- universal_mcp/analytics.py +75 -0
- universal_mcp/applications/ahrefs/README.md +76 -0
- universal_mcp/applications/ahrefs/app.py +2291 -0
- universal_mcp/applications/application.py +95 -5
- universal_mcp/applications/calendly/README.md +78 -0
- universal_mcp/applications/calendly/__init__.py +0 -0
- universal_mcp/applications/calendly/app.py +1195 -0
- universal_mcp/applications/coda/README.md +133 -0
- universal_mcp/applications/coda/__init__.py +0 -0
- universal_mcp/applications/coda/app.py +3671 -0
- universal_mcp/applications/e2b/app.py +14 -28
- universal_mcp/applications/figma/README.md +74 -0
- universal_mcp/applications/figma/__init__.py +0 -0
- universal_mcp/applications/figma/app.py +1261 -0
- universal_mcp/applications/firecrawl/app.py +38 -35
- universal_mcp/applications/github/app.py +127 -85
- universal_mcp/applications/google_calendar/app.py +62 -138
- universal_mcp/applications/google_docs/app.py +47 -52
- universal_mcp/applications/google_drive/app.py +119 -113
- universal_mcp/applications/google_mail/app.py +124 -50
- universal_mcp/applications/google_sheet/app.py +89 -91
- universal_mcp/applications/markitdown/app.py +9 -8
- universal_mcp/applications/notion/app.py +254 -134
- universal_mcp/applications/perplexity/app.py +13 -41
- universal_mcp/applications/reddit/app.py +94 -85
- universal_mcp/applications/resend/app.py +12 -13
- universal_mcp/applications/{serp → serpapi}/app.py +14 -25
- universal_mcp/applications/tavily/app.py +11 -18
- universal_mcp/applications/wrike/README.md +71 -0
- universal_mcp/applications/wrike/__init__.py +0 -0
- universal_mcp/applications/wrike/app.py +1372 -0
- universal_mcp/applications/youtube/README.md +82 -0
- universal_mcp/applications/youtube/__init__.py +0 -0
- universal_mcp/applications/youtube/app.py +1428 -0
- universal_mcp/applications/zenquotes/app.py +12 -2
- universal_mcp/exceptions.py +9 -2
- universal_mcp/integrations/__init__.py +24 -1
- universal_mcp/integrations/agentr.py +27 -4
- universal_mcp/integrations/integration.py +146 -32
- universal_mcp/logger.py +3 -56
- universal_mcp/servers/__init__.py +6 -14
- universal_mcp/servers/server.py +201 -146
- universal_mcp/stores/__init__.py +7 -2
- universal_mcp/stores/store.py +103 -40
- universal_mcp/tools/__init__.py +3 -0
- universal_mcp/tools/adapters.py +43 -0
- universal_mcp/tools/func_metadata.py +213 -0
- universal_mcp/tools/tools.py +342 -0
- universal_mcp/utils/docgen.py +325 -119
- universal_mcp/utils/docstring_parser.py +179 -0
- universal_mcp/utils/dump_app_tools.py +33 -23
- universal_mcp/utils/installation.py +201 -10
- universal_mcp/utils/openapi.py +229 -46
- {universal_mcp-0.1.7rc1.dist-info → universal_mcp-0.1.8.dist-info}/METADATA +9 -5
- universal_mcp-0.1.8.dist-info/RECORD +81 -0
- universal_mcp-0.1.7rc1.dist-info/RECORD +0 -58
- /universal_mcp/{utils/bridge.py → applications/ahrefs/__init__.py} +0 -0
- /universal_mcp/applications/{serp → serpapi}/README.md +0 -0
- {universal_mcp-0.1.7rc1.dist-info → universal_mcp-0.1.8.dist-info}/WHEEL +0 -0
- {universal_mcp-0.1.7rc1.dist-info → universal_mcp-0.1.8.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,1372 @@
|
|
1
|
+
from typing import Any
|
2
|
+
|
3
|
+
from universal_mcp.applications import APIApplication
|
4
|
+
from universal_mcp.integrations import Integration
|
5
|
+
|
6
|
+
|
7
|
+
class WrikeApp(APIApplication):
|
8
|
+
def __init__(self, integration: Integration = None, **kwargs) -> None:
|
9
|
+
"""
|
10
|
+
Initializes the OfficialWrikeCollectionV21App with a specified integration and additional keyword arguments.
|
11
|
+
|
12
|
+
Args:
|
13
|
+
integration: Integration, optional. The integration instance to associate with this app. Defaults to None.
|
14
|
+
**kwargs: Additional keyword arguments passed to the superclass initializer.
|
15
|
+
|
16
|
+
Returns:
|
17
|
+
None. This constructor initializes the instance in place.
|
18
|
+
"""
|
19
|
+
super().__init__(name="wrike", integration=integration, **kwargs)
|
20
|
+
self.base_url = "https://www.wrike.com/api/v4"
|
21
|
+
|
22
|
+
def get_contacts(self, deleted=None, fields=None, metadata=None) -> Any:
|
23
|
+
"""
|
24
|
+
Retrieves a list of contacts from the server, with optional filtering and field selection.
|
25
|
+
|
26
|
+
Args:
|
27
|
+
deleted: Optional[bool]. If set, filters contacts by their deleted status. Only contacts matching the specified deleted state are returned.
|
28
|
+
fields: Optional[str]. Comma-separated list of fields to include in the response for each contact. Limits the contact fields returned.
|
29
|
+
metadata: Optional[str]. Comma-separated list of metadata fields to include in the response. Filters which metadata is returned for each contact.
|
30
|
+
|
31
|
+
Returns:
|
32
|
+
The JSON-decoded response from the server containing contact information, as a Python object (such as a list or dictionary) depending on the backend API response structure.
|
33
|
+
"""
|
34
|
+
url = f"{self.base_url}/contacts"
|
35
|
+
query_params = {
|
36
|
+
k: v
|
37
|
+
for k, v in [
|
38
|
+
("deleted", deleted),
|
39
|
+
("fields", fields),
|
40
|
+
("metadata", metadata),
|
41
|
+
]
|
42
|
+
if v is not None
|
43
|
+
}
|
44
|
+
response = self._get(url, params=query_params)
|
45
|
+
response.raise_for_status()
|
46
|
+
return response.json()
|
47
|
+
|
48
|
+
def get_contacts_by_contactid(self, contactId, fields=None) -> Any:
|
49
|
+
"""
|
50
|
+
Retrieves contact information for a specific contact ID, optionally returning only specified fields.
|
51
|
+
|
52
|
+
Args:
|
53
|
+
contactId: The unique identifier of the contact to retrieve. Must not be None.
|
54
|
+
fields: Optional; a comma-separated string specifying which fields to include in the response. If None, all fields are returned.
|
55
|
+
|
56
|
+
Returns:
|
57
|
+
A JSON-decoded object containing the contact's details as returned by the API.
|
58
|
+
"""
|
59
|
+
if contactId is None:
|
60
|
+
raise ValueError("Missing required parameter 'contactId'")
|
61
|
+
url = f"{self.base_url}/contacts/{contactId}"
|
62
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
63
|
+
response = self._get(url, params=query_params)
|
64
|
+
response.raise_for_status()
|
65
|
+
return response.json()
|
66
|
+
|
67
|
+
def put_contacts_by_contactid(
|
68
|
+
self,
|
69
|
+
contactId,
|
70
|
+
metadata=None,
|
71
|
+
currentBillRate=None,
|
72
|
+
currentCostRate=None,
|
73
|
+
jobRoleId=None,
|
74
|
+
customFields=None,
|
75
|
+
fields=None,
|
76
|
+
) -> Any:
|
77
|
+
"""
|
78
|
+
Updates an existing contact by contact ID with provided details such as metadata, billing and cost rates, job role, custom fields, or additional fields.
|
79
|
+
|
80
|
+
Args:
|
81
|
+
contactId: The unique identifier of the contact to update. Must not be None.
|
82
|
+
metadata: Optional metadata dictionary for the contact (default is None).
|
83
|
+
currentBillRate: Optional current bill rate for the contact (default is None).
|
84
|
+
currentCostRate: Optional current cost rate for the contact (default is None).
|
85
|
+
jobRoleId: Optional job role identifier associated with the contact (default is None).
|
86
|
+
customFields: Optional dictionary of custom contact fields (default is None).
|
87
|
+
fields: Optional list of specific fields to include in the response (default is None).
|
88
|
+
|
89
|
+
Returns:
|
90
|
+
The JSON-decoded response containing the updated contact details.
|
91
|
+
"""
|
92
|
+
if contactId is None:
|
93
|
+
raise ValueError("Missing required parameter 'contactId'")
|
94
|
+
request_body = {
|
95
|
+
"metadata": metadata,
|
96
|
+
"currentBillRate": currentBillRate,
|
97
|
+
"currentCostRate": currentCostRate,
|
98
|
+
"jobRoleId": jobRoleId,
|
99
|
+
"customFields": customFields,
|
100
|
+
"fields": fields,
|
101
|
+
}
|
102
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
103
|
+
url = f"{self.base_url}/contacts/{contactId}"
|
104
|
+
query_params = {}
|
105
|
+
response = self._put(url, data=request_body, params=query_params)
|
106
|
+
response.raise_for_status()
|
107
|
+
return response.json()
|
108
|
+
|
109
|
+
def get_users_by_userid(self, userId) -> Any:
|
110
|
+
"""
|
111
|
+
Retrieves user information for a given user ID from the API endpoint.
|
112
|
+
|
113
|
+
Args:
|
114
|
+
userId: The unique identifier of the user whose information is to be retrieved.
|
115
|
+
|
116
|
+
Returns:
|
117
|
+
A JSON-decoded object containing user details as returned by the API.
|
118
|
+
"""
|
119
|
+
if userId is None:
|
120
|
+
raise ValueError("Missing required parameter 'userId'")
|
121
|
+
url = f"{self.base_url}/users/{userId}"
|
122
|
+
query_params = {}
|
123
|
+
response = self._get(url, params=query_params)
|
124
|
+
response.raise_for_status()
|
125
|
+
return response.json()
|
126
|
+
|
127
|
+
def put_users_by_userid(self, userId, profile=None) -> Any:
|
128
|
+
"""
|
129
|
+
Updates a user's profile information by user ID using a PUT request.
|
130
|
+
|
131
|
+
Args:
|
132
|
+
userId: str. The unique identifier of the user. Must not be None.
|
133
|
+
profile: dict or None. Optional. The profile information to update for the user. If None, no profile data is sent.
|
134
|
+
|
135
|
+
Returns:
|
136
|
+
Any. The parsed JSON response from the server after updating the user's information.
|
137
|
+
"""
|
138
|
+
if userId is None:
|
139
|
+
raise ValueError("Missing required parameter 'userId'")
|
140
|
+
request_body = {
|
141
|
+
"profile": profile,
|
142
|
+
}
|
143
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
144
|
+
url = f"{self.base_url}/users/{userId}"
|
145
|
+
query_params = {}
|
146
|
+
response = self._put(url, data=request_body, params=query_params)
|
147
|
+
response.raise_for_status()
|
148
|
+
return response.json()
|
149
|
+
|
150
|
+
def get_groups(
|
151
|
+
self, metadata=None, pageSize=None, pageToken=None, fields=None
|
152
|
+
) -> Any:
|
153
|
+
"""
|
154
|
+
Retrieves a list of groups from the API, applying optional filtering and pagination parameters.
|
155
|
+
|
156
|
+
Args:
|
157
|
+
metadata: Optional. Specifies additional metadata to include or filter by in the group results.
|
158
|
+
pageSize: Optional. The maximum number of groups to return in the response.
|
159
|
+
pageToken: Optional. A token identifying the page of results to return, for pagination.
|
160
|
+
fields: Optional. Selector specifying a subset of fields to include in the response.
|
161
|
+
|
162
|
+
Returns:
|
163
|
+
The API response parsed as a JSON-compatible object, typically a dictionary containing group information.
|
164
|
+
"""
|
165
|
+
url = f"{self.base_url}/groups"
|
166
|
+
query_params = {
|
167
|
+
k: v
|
168
|
+
for k, v in [
|
169
|
+
("metadata", metadata),
|
170
|
+
("pageSize", pageSize),
|
171
|
+
("pageToken", pageToken),
|
172
|
+
("fields", fields),
|
173
|
+
]
|
174
|
+
if v is not None
|
175
|
+
}
|
176
|
+
response = self._get(url, params=query_params)
|
177
|
+
response.raise_for_status()
|
178
|
+
return response.json()
|
179
|
+
|
180
|
+
def post_groups(
|
181
|
+
self, title, members=None, parent=None, avatar=None, metadata=None
|
182
|
+
) -> Any:
|
183
|
+
"""
|
184
|
+
Creates a new group with the specified title and optional details, sending a POST request to the groups endpoint.
|
185
|
+
|
186
|
+
Args:
|
187
|
+
title: str. The name of the group to create. This parameter is required.
|
188
|
+
members: Optional[list]. List of member identifiers to include in the group.
|
189
|
+
parent: Optional[str]. Identifier of the parent group, if applicable.
|
190
|
+
avatar: Optional[Any]. Avatar image or data to associate with the group.
|
191
|
+
metadata: Optional[dict]. Additional metadata or custom fields for the group.
|
192
|
+
|
193
|
+
Returns:
|
194
|
+
Any. A dictionary containing the response data representing the created group.
|
195
|
+
"""
|
196
|
+
if title is None:
|
197
|
+
raise ValueError("Missing required parameter 'title'")
|
198
|
+
request_body = {
|
199
|
+
"title": title,
|
200
|
+
"members": members,
|
201
|
+
"parent": parent,
|
202
|
+
"avatar": avatar,
|
203
|
+
"metadata": metadata,
|
204
|
+
}
|
205
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
206
|
+
url = f"{self.base_url}/groups"
|
207
|
+
query_params = {}
|
208
|
+
response = self._post(url, data=request_body, params=query_params)
|
209
|
+
response.raise_for_status()
|
210
|
+
return response.json()
|
211
|
+
|
212
|
+
def get_groups_by_groupid(self, groupId, fields=None) -> Any:
|
213
|
+
"""
|
214
|
+
Retrieves details for a specific group by its group ID, optionally returning only specified fields.
|
215
|
+
|
216
|
+
Args:
|
217
|
+
groupId: str. The unique identifier of the group to retrieve. Must not be None.
|
218
|
+
fields: Optional[str]. A comma-separated list of fields to include in the response. If None, all fields are returned.
|
219
|
+
|
220
|
+
Returns:
|
221
|
+
dict. A dictionary containing the group details as returned by the API.
|
222
|
+
"""
|
223
|
+
if groupId is None:
|
224
|
+
raise ValueError("Missing required parameter 'groupId'")
|
225
|
+
url = f"{self.base_url}/groups/{groupId}"
|
226
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
227
|
+
response = self._get(url, params=query_params)
|
228
|
+
response.raise_for_status()
|
229
|
+
return response.json()
|
230
|
+
|
231
|
+
def put_groups_by_groupid(
|
232
|
+
self,
|
233
|
+
groupId,
|
234
|
+
title=None,
|
235
|
+
addMembers=None,
|
236
|
+
removeMembers=None,
|
237
|
+
addInvitations=None,
|
238
|
+
removeInvitations=None,
|
239
|
+
parent=None,
|
240
|
+
avatar=None,
|
241
|
+
metadata=None,
|
242
|
+
) -> Any:
|
243
|
+
"""
|
244
|
+
Updates an existing group identified by groupId with new properties and membership changes via a PUT request.
|
245
|
+
|
246
|
+
Args:
|
247
|
+
groupId: str. The unique identifier of the group to update. Required.
|
248
|
+
title: str, optional. The new title for the group.
|
249
|
+
addMembers: list or None, optional. List of member identifiers to add to the group.
|
250
|
+
removeMembers: list or None, optional. List of member identifiers to remove from the group.
|
251
|
+
addInvitations: list or None, optional. List of invitations to add to the group.
|
252
|
+
removeInvitations: list or None, optional. List of invitations to remove from the group.
|
253
|
+
parent: str or None, optional. The new parent group identifier, if setting or changing the hierarchy.
|
254
|
+
avatar: str or None, optional. New avatar for the group, typically a URL or encoded image data.
|
255
|
+
metadata: dict or None, optional. Additional metadata to attach to the group.
|
256
|
+
|
257
|
+
Returns:
|
258
|
+
dict. The JSON response from the server containing the updated group details.
|
259
|
+
"""
|
260
|
+
if groupId is None:
|
261
|
+
raise ValueError("Missing required parameter 'groupId'")
|
262
|
+
request_body = {
|
263
|
+
"title": title,
|
264
|
+
"addMembers": addMembers,
|
265
|
+
"removeMembers": removeMembers,
|
266
|
+
"addInvitations": addInvitations,
|
267
|
+
"removeInvitations": removeInvitations,
|
268
|
+
"parent": parent,
|
269
|
+
"avatar": avatar,
|
270
|
+
"metadata": metadata,
|
271
|
+
}
|
272
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
273
|
+
url = f"{self.base_url}/groups/{groupId}"
|
274
|
+
query_params = {}
|
275
|
+
response = self._put(url, data=request_body, params=query_params)
|
276
|
+
response.raise_for_status()
|
277
|
+
return response.json()
|
278
|
+
|
279
|
+
def delete_groups_by_groupid(self, groupId) -> Any:
|
280
|
+
"""
|
281
|
+
Deletes a group resource identified by the provided groupId using an HTTP DELETE request.
|
282
|
+
|
283
|
+
Args:
|
284
|
+
groupId: str. The unique identifier of the group to be deleted. Must not be None.
|
285
|
+
|
286
|
+
Returns:
|
287
|
+
Any. The JSON-decoded response from the API after deleting the group.
|
288
|
+
"""
|
289
|
+
if groupId is None:
|
290
|
+
raise ValueError("Missing required parameter 'groupId'")
|
291
|
+
url = f"{self.base_url}/groups/{groupId}"
|
292
|
+
query_params = {}
|
293
|
+
response = self._delete(url, params=query_params)
|
294
|
+
response.raise_for_status()
|
295
|
+
return response.json()
|
296
|
+
|
297
|
+
def put_groups_bulk(self, members) -> Any:
|
298
|
+
"""
|
299
|
+
Updates multiple group memberships in bulk by sending a PUT request with the given members data.
|
300
|
+
|
301
|
+
Args:
|
302
|
+
members: List or collection of member data to be processed in bulk. Must not be None.
|
303
|
+
|
304
|
+
Returns:
|
305
|
+
Parsed JSON response from the API containing the result of the bulk update operation.
|
306
|
+
"""
|
307
|
+
if members is None:
|
308
|
+
raise ValueError("Missing required parameter 'members'")
|
309
|
+
request_body = {
|
310
|
+
"members": members,
|
311
|
+
}
|
312
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
313
|
+
url = f"{self.base_url}/groups_bulk"
|
314
|
+
query_params = {}
|
315
|
+
response = self._put(url, data=request_body, params=query_params)
|
316
|
+
response.raise_for_status()
|
317
|
+
return response.json()
|
318
|
+
|
319
|
+
def get_invitations(
|
320
|
+
self,
|
321
|
+
) -> Any:
|
322
|
+
"""
|
323
|
+
Retrieves all invitations from the server using a GET request.
|
324
|
+
|
325
|
+
Args:
|
326
|
+
None: This function takes no arguments
|
327
|
+
|
328
|
+
Returns:
|
329
|
+
The JSON-decoded response containing invitation data from the server.
|
330
|
+
"""
|
331
|
+
url = f"{self.base_url}/invitations"
|
332
|
+
query_params = {}
|
333
|
+
response = self._get(url, params=query_params)
|
334
|
+
response.raise_for_status()
|
335
|
+
return response.json()
|
336
|
+
|
337
|
+
def post_invitations(
|
338
|
+
self,
|
339
|
+
email,
|
340
|
+
firstName=None,
|
341
|
+
lastName=None,
|
342
|
+
role=None,
|
343
|
+
external=None,
|
344
|
+
subject=None,
|
345
|
+
message=None,
|
346
|
+
userTypeId=None,
|
347
|
+
) -> Any:
|
348
|
+
"""
|
349
|
+
Sends an invitation email to a user with optional details such as name, role, and custom message.
|
350
|
+
|
351
|
+
Args:
|
352
|
+
email: str. The email address of the user to invite. Required.
|
353
|
+
firstName: str, optional. The first name of the invitee.
|
354
|
+
lastName: str, optional. The last name of the invitee.
|
355
|
+
role: str, optional. The role to assign to the invited user.
|
356
|
+
external: bool, optional. Indicates if the invitation is for an external user.
|
357
|
+
subject: str, optional. Custom subject line for the invitation email.
|
358
|
+
message: str, optional. Custom message to include in the invitation.
|
359
|
+
userTypeId: Any, optional. The user type identifier to associate with the invitation.
|
360
|
+
|
361
|
+
Returns:
|
362
|
+
Any. The server's parsed JSON response to the invitation request.
|
363
|
+
"""
|
364
|
+
if email is None:
|
365
|
+
raise ValueError("Missing required parameter 'email'")
|
366
|
+
request_body = {
|
367
|
+
"email": email,
|
368
|
+
"firstName": firstName,
|
369
|
+
"lastName": lastName,
|
370
|
+
"role": role,
|
371
|
+
"external": external,
|
372
|
+
"subject": subject,
|
373
|
+
"message": message,
|
374
|
+
"userTypeId": userTypeId,
|
375
|
+
}
|
376
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
377
|
+
url = f"{self.base_url}/invitations"
|
378
|
+
query_params = {}
|
379
|
+
response = self._post(url, data=request_body, params=query_params)
|
380
|
+
response.raise_for_status()
|
381
|
+
return response.json()
|
382
|
+
|
383
|
+
def put_invitations_by_invitationid(
|
384
|
+
self, invitationId, resend=None, role=None, external=None, userTypeId=None
|
385
|
+
) -> Any:
|
386
|
+
"""
|
387
|
+
Updates an existing invitation by invitation ID with optional fields such as resend, role, external, and user type ID.
|
388
|
+
|
389
|
+
Args:
|
390
|
+
invitationId: The unique identifier of the invitation to update. Required.
|
391
|
+
resend: Optional; whether to resend the invitation (boolean or compatible type).
|
392
|
+
role: Optional; the role to assign with the invitation (string or compatible type).
|
393
|
+
external: Optional; indicates if the invitation is for an external recipient (boolean or compatible type).
|
394
|
+
userTypeId: Optional; the user type identifier to associate with the invitation (string, int, or compatible type).
|
395
|
+
|
396
|
+
Returns:
|
397
|
+
A dictionary representing the updated invitation resource as returned by the API.
|
398
|
+
"""
|
399
|
+
if invitationId is None:
|
400
|
+
raise ValueError("Missing required parameter 'invitationId'")
|
401
|
+
request_body = {
|
402
|
+
"resend": resend,
|
403
|
+
"role": role,
|
404
|
+
"external": external,
|
405
|
+
"userTypeId": userTypeId,
|
406
|
+
}
|
407
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
408
|
+
url = f"{self.base_url}/invitations/{invitationId}"
|
409
|
+
query_params = {}
|
410
|
+
response = self._put(url, data=request_body, params=query_params)
|
411
|
+
response.raise_for_status()
|
412
|
+
return response.json()
|
413
|
+
|
414
|
+
def delete_invitations_by_invitationid(self, invitationId) -> Any:
|
415
|
+
"""
|
416
|
+
Deletes an invitation specified by its invitation ID.
|
417
|
+
|
418
|
+
Args:
|
419
|
+
invitationId: The unique identifier of the invitation to delete.
|
420
|
+
|
421
|
+
Returns:
|
422
|
+
A JSON-decoded response from the API after deleting the invitation.
|
423
|
+
"""
|
424
|
+
if invitationId is None:
|
425
|
+
raise ValueError("Missing required parameter 'invitationId'")
|
426
|
+
url = f"{self.base_url}/invitations/{invitationId}"
|
427
|
+
query_params = {}
|
428
|
+
response = self._delete(url, params=query_params)
|
429
|
+
response.raise_for_status()
|
430
|
+
return response.json()
|
431
|
+
|
432
|
+
def get_a_ccount(self, fields=None) -> Any:
|
433
|
+
"""
|
434
|
+
Retrieves account information from the API, optionally including only specified fields.
|
435
|
+
|
436
|
+
Args:
|
437
|
+
fields: Optional[str]. A comma-separated string of field names to include in the response. If None, all default fields are returned.
|
438
|
+
|
439
|
+
Returns:
|
440
|
+
Any. The JSON-decoded response from the API containing account details.
|
441
|
+
"""
|
442
|
+
url = f"{self.base_url}/account"
|
443
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
444
|
+
response = self._get(url, params=query_params)
|
445
|
+
response.raise_for_status()
|
446
|
+
return response.json()
|
447
|
+
|
448
|
+
def put_a_ccount(self, metadata=None) -> Any:
|
449
|
+
"""
|
450
|
+
Sends a PUT request to update or create an account with the provided metadata and returns the server response as a JSON object.
|
451
|
+
|
452
|
+
Args:
|
453
|
+
metadata: Optional metadata to associate with the account. If provided, this will be included in the request body. The format should match the server's expected schema. Defaults to None.
|
454
|
+
|
455
|
+
Returns:
|
456
|
+
A JSON-decoded Python object representing the response from the account API endpoint.
|
457
|
+
"""
|
458
|
+
request_body = {
|
459
|
+
"metadata": metadata,
|
460
|
+
}
|
461
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
462
|
+
url = f"{self.base_url}/account"
|
463
|
+
query_params = {}
|
464
|
+
response = self._put(url, data=request_body, params=query_params)
|
465
|
+
response.raise_for_status()
|
466
|
+
return response.json()
|
467
|
+
|
468
|
+
def get_workflows(
|
469
|
+
self,
|
470
|
+
) -> Any:
|
471
|
+
"""
|
472
|
+
Retrieves all workflows from the server using a GET request.
|
473
|
+
|
474
|
+
Args:
|
475
|
+
None: This function takes no arguments
|
476
|
+
|
477
|
+
Returns:
|
478
|
+
The parsed JSON response containing the list of workflows.
|
479
|
+
"""
|
480
|
+
url = f"{self.base_url}/workflows"
|
481
|
+
query_params = {}
|
482
|
+
response = self._get(url, params=query_params)
|
483
|
+
response.raise_for_status()
|
484
|
+
return response.json()
|
485
|
+
|
486
|
+
def post_workflows(self, name=None, request_body=None) -> Any:
|
487
|
+
"""
|
488
|
+
Creates a new workflow by sending a POST request to the workflows endpoint.
|
489
|
+
|
490
|
+
Args:
|
491
|
+
name: Optional; the name of the workflow to create. Included as a query parameter if provided.
|
492
|
+
request_body: Optional; the request body containing workflow details, provided as the data payload for the POST request.
|
493
|
+
|
494
|
+
Returns:
|
495
|
+
The JSON-decoded response from the server containing details of the created workflow.
|
496
|
+
"""
|
497
|
+
url = f"{self.base_url}/workflows"
|
498
|
+
query_params = {k: v for k, v in [("name", name)] if v is not None}
|
499
|
+
response = self._post(url, data=request_body, params=query_params)
|
500
|
+
response.raise_for_status()
|
501
|
+
return response.json()
|
502
|
+
|
503
|
+
def put_workflows_by_workflowid(
|
504
|
+
self, workflowId, name=None, hidden=None, request_body=None
|
505
|
+
) -> Any:
|
506
|
+
"""
|
507
|
+
Updates an existing workflow by workflow ID with optional name, hidden status, and request body data.
|
508
|
+
|
509
|
+
Args:
|
510
|
+
workflowId: The unique identifier of the workflow to update. Required.
|
511
|
+
name: An optional new name for the workflow. If provided, updates the workflow's name.
|
512
|
+
hidden: An optional boolean indicating whether the workflow should be hidden.
|
513
|
+
request_body: Optional data to include in the request body when updating the workflow.
|
514
|
+
|
515
|
+
Returns:
|
516
|
+
The updated workflow as a JSON-decoded Python object.
|
517
|
+
"""
|
518
|
+
if workflowId is None:
|
519
|
+
raise ValueError("Missing required parameter 'workflowId'")
|
520
|
+
url = f"{self.base_url}/workflows/{workflowId}"
|
521
|
+
query_params = {
|
522
|
+
k: v for k, v in [("name", name), ("hidden", hidden)] if v is not None
|
523
|
+
}
|
524
|
+
response = self._put(url, data=request_body, params=query_params)
|
525
|
+
response.raise_for_status()
|
526
|
+
return response.json()
|
527
|
+
|
528
|
+
def get_customfields(
|
529
|
+
self,
|
530
|
+
) -> Any:
|
531
|
+
"""
|
532
|
+
Retrieves all custom fields from the API and returns them as a parsed JSON object.
|
533
|
+
|
534
|
+
Args:
|
535
|
+
None: This function takes no arguments
|
536
|
+
|
537
|
+
Returns:
|
538
|
+
The JSON-decoded response content containing the list of custom fields, typically as a Python dict or list, depending on the API response structure.
|
539
|
+
"""
|
540
|
+
url = f"{self.base_url}/customfields"
|
541
|
+
query_params = {}
|
542
|
+
response = self._get(url, params=query_params)
|
543
|
+
response.raise_for_status()
|
544
|
+
return response.json()
|
545
|
+
|
546
|
+
def post_customfields(
|
547
|
+
self,
|
548
|
+
title,
|
549
|
+
type,
|
550
|
+
spaceId=None,
|
551
|
+
sharing=None,
|
552
|
+
shareds=None,
|
553
|
+
settings=None,
|
554
|
+
request_body=None,
|
555
|
+
) -> Any:
|
556
|
+
"""
|
557
|
+
Creates a custom field by sending a POST request with the specified parameters to the customfields endpoint and returns the created field's data.
|
558
|
+
|
559
|
+
Args:
|
560
|
+
title: str. The name of the custom field to be created. Required.
|
561
|
+
type: str. The type of the custom field to be created. Required.
|
562
|
+
spaceId: Optional[str]. Identifier of the space to associate with the custom field.
|
563
|
+
sharing: Optional[str]. Determines the sharing settings for the custom field.
|
564
|
+
shareds: Optional[str]. Specifies users or groups the custom field is shared with.
|
565
|
+
settings: Optional[str]. Additional settings for the custom field in string or JSON format.
|
566
|
+
request_body: Optional[Any]. The request body payload to include in the POST request.
|
567
|
+
|
568
|
+
Returns:
|
569
|
+
Any. The JSON response data representing the created custom field.
|
570
|
+
"""
|
571
|
+
if title is None:
|
572
|
+
raise ValueError("Missing required parameter 'title'")
|
573
|
+
if type is None:
|
574
|
+
raise ValueError("Missing required parameter 'type'")
|
575
|
+
url = f"{self.base_url}/customfields"
|
576
|
+
query_params = {
|
577
|
+
k: v
|
578
|
+
for k, v in [
|
579
|
+
("title", title),
|
580
|
+
("type", type),
|
581
|
+
("spaceId", spaceId),
|
582
|
+
("sharing", sharing),
|
583
|
+
("shareds", shareds),
|
584
|
+
("settings", settings),
|
585
|
+
]
|
586
|
+
if v is not None
|
587
|
+
}
|
588
|
+
response = self._post(url, data=request_body, params=query_params)
|
589
|
+
response.raise_for_status()
|
590
|
+
return response.json()
|
591
|
+
|
592
|
+
def get_customfields_by_customfieldid(self, customFieldId) -> Any:
|
593
|
+
"""
|
594
|
+
Retrieves details for a custom field by its unique identifier from the API.
|
595
|
+
|
596
|
+
Args:
|
597
|
+
customFieldId: The unique identifier of the custom field to retrieve.
|
598
|
+
|
599
|
+
Returns:
|
600
|
+
A JSON-decoded response containing the custom field details.
|
601
|
+
"""
|
602
|
+
if customFieldId is None:
|
603
|
+
raise ValueError("Missing required parameter 'customFieldId'")
|
604
|
+
url = f"{self.base_url}/customfields/{customFieldId}"
|
605
|
+
query_params = {}
|
606
|
+
response = self._get(url, params=query_params)
|
607
|
+
response.raise_for_status()
|
608
|
+
return response.json()
|
609
|
+
|
610
|
+
def put_customfields_by_customfieldid(
|
611
|
+
self,
|
612
|
+
customFieldId,
|
613
|
+
title=None,
|
614
|
+
type=None,
|
615
|
+
changeScope=None,
|
616
|
+
spaceId=None,
|
617
|
+
sharing=None,
|
618
|
+
addShareds=None,
|
619
|
+
removeShareds=None,
|
620
|
+
settings=None,
|
621
|
+
addMirrors=None,
|
622
|
+
removeMirrors=None,
|
623
|
+
) -> Any:
|
624
|
+
"""
|
625
|
+
Updates a custom field specified by its ID with the provided parameters using an HTTP PUT request.
|
626
|
+
|
627
|
+
Args:
|
628
|
+
customFieldId: The unique identifier of the custom field to update.
|
629
|
+
title: Optional new title for the custom field (default is None).
|
630
|
+
type: Optional new field type (default is None).
|
631
|
+
changeScope: Optional scope for tracking or permission changes (default is None).
|
632
|
+
spaceId: Optional identifier of the space associated with the custom field (default is None).
|
633
|
+
sharing: Optional sharing configuration or permissions (default is None).
|
634
|
+
addShareds: Optional list of users or entities to add to the shared list (default is None).
|
635
|
+
removeShareds: Optional list of users or entities to remove from the shared list (default is None).
|
636
|
+
settings: Optional dictionary with additional settings for the custom field (default is None).
|
637
|
+
addMirrors: Optional list of entities to add as mirrors (default is None).
|
638
|
+
removeMirrors: Optional list of entities to remove as mirrors (default is None).
|
639
|
+
|
640
|
+
Returns:
|
641
|
+
The server response as a JSON-decoded object containing the updated custom field data.
|
642
|
+
"""
|
643
|
+
if customFieldId is None:
|
644
|
+
raise ValueError("Missing required parameter 'customFieldId'")
|
645
|
+
url = f"{self.base_url}/customfields/{customFieldId}"
|
646
|
+
query_params = {
|
647
|
+
k: v
|
648
|
+
for k, v in [
|
649
|
+
("title", title),
|
650
|
+
("type", type),
|
651
|
+
("changeScope", changeScope),
|
652
|
+
("spaceId", spaceId),
|
653
|
+
("sharing", sharing),
|
654
|
+
("addShareds", addShareds),
|
655
|
+
("removeShareds", removeShareds),
|
656
|
+
("settings", settings),
|
657
|
+
("addMirrors", addMirrors),
|
658
|
+
("removeMirrors", removeMirrors),
|
659
|
+
]
|
660
|
+
if v is not None
|
661
|
+
}
|
662
|
+
response = self._put(url, data={}, params=query_params)
|
663
|
+
response.raise_for_status()
|
664
|
+
return response.json()
|
665
|
+
|
666
|
+
def delete_customfields_by_customfieldid(self, customFieldId) -> Any:
|
667
|
+
"""
|
668
|
+
Deletes a custom field resource identified by its custom field ID.
|
669
|
+
|
670
|
+
Args:
|
671
|
+
customFieldId: The unique identifier of the custom field to delete.
|
672
|
+
|
673
|
+
Returns:
|
674
|
+
The server response as a deserialized JSON object, typically containing the result of the delete operation.
|
675
|
+
"""
|
676
|
+
if customFieldId is None:
|
677
|
+
raise ValueError("Missing required parameter 'customFieldId'")
|
678
|
+
url = f"{self.base_url}/customfields/{customFieldId}"
|
679
|
+
query_params = {}
|
680
|
+
response = self._delete(url, params=query_params)
|
681
|
+
response.raise_for_status()
|
682
|
+
return response.json()
|
683
|
+
|
684
|
+
def get_folders(
|
685
|
+
self,
|
686
|
+
permalink=None,
|
687
|
+
descendants=None,
|
688
|
+
metadata=None,
|
689
|
+
customFields=None,
|
690
|
+
updatedDate=None,
|
691
|
+
withInvitations=None,
|
692
|
+
project=None,
|
693
|
+
deleted=None,
|
694
|
+
contractTypes=None,
|
695
|
+
plainTextCustomFields=None,
|
696
|
+
customItemTypes=None,
|
697
|
+
pageSize=None,
|
698
|
+
nextPageToken=None,
|
699
|
+
fields=None,
|
700
|
+
) -> Any:
|
701
|
+
"""
|
702
|
+
Retrieves a list of folders from the API, supporting extensive filtering, pagination, and field selection.
|
703
|
+
|
704
|
+
Args:
|
705
|
+
permalink: str or None. Filter results by folder permalink.
|
706
|
+
descendants: bool or None. If True, include descendant folders in the results.
|
707
|
+
metadata: dict or None. Filter folders by matching metadata fields.
|
708
|
+
customFields: dict or None. Filter results by custom field values.
|
709
|
+
updatedDate: str or None. Only return folders updated on or after this date (ISO 8601 format).
|
710
|
+
withInvitations: bool or None. If True, include folders with active invitations.
|
711
|
+
project: str or None. Filter folders by associated project identifier.
|
712
|
+
deleted: bool or None. If True, include deleted folders in the response.
|
713
|
+
contractTypes: list or None. Filter folders by contract types.
|
714
|
+
plainTextCustomFields: dict or None. Filter by plain text custom fields.
|
715
|
+
customItemTypes: list or None. Filter folders by custom item types.
|
716
|
+
pageSize: int or None. Maximum number of results to return per page.
|
717
|
+
nextPageToken: str or None. Token to retrieve the next page of results.
|
718
|
+
fields: list or None. Specify which fields to include in the response.
|
719
|
+
|
720
|
+
Returns:
|
721
|
+
dict. The JSON-decoded response from the API containing folder data and related metadata.
|
722
|
+
"""
|
723
|
+
url = f"{self.base_url}/folders"
|
724
|
+
query_params = {
|
725
|
+
k: v
|
726
|
+
for k, v in [
|
727
|
+
("permalink", permalink),
|
728
|
+
("descendants", descendants),
|
729
|
+
("metadata", metadata),
|
730
|
+
("customFields", customFields),
|
731
|
+
("updatedDate", updatedDate),
|
732
|
+
("withInvitations", withInvitations),
|
733
|
+
("project", project),
|
734
|
+
("deleted", deleted),
|
735
|
+
("contractTypes", contractTypes),
|
736
|
+
("plainTextCustomFields", plainTextCustomFields),
|
737
|
+
("customItemTypes", customItemTypes),
|
738
|
+
("pageSize", pageSize),
|
739
|
+
("nextPageToken", nextPageToken),
|
740
|
+
("fields", fields),
|
741
|
+
]
|
742
|
+
if v is not None
|
743
|
+
}
|
744
|
+
response = self._get(url, params=query_params)
|
745
|
+
response.raise_for_status()
|
746
|
+
return response.json()
|
747
|
+
|
748
|
+
def get_folders_by_folderid_folders(
|
749
|
+
self,
|
750
|
+
folderId,
|
751
|
+
permalink=None,
|
752
|
+
descendants=None,
|
753
|
+
metadata=None,
|
754
|
+
customFields=None,
|
755
|
+
updatedDate=None,
|
756
|
+
withInvitations=None,
|
757
|
+
project=None,
|
758
|
+
contractTypes=None,
|
759
|
+
plainTextCustomFields=None,
|
760
|
+
customItemTypes=None,
|
761
|
+
pageSize=None,
|
762
|
+
nextPageToken=None,
|
763
|
+
fields=None,
|
764
|
+
) -> Any:
|
765
|
+
"""
|
766
|
+
Retrieves subfolders of a specified folder, applying optional filters and pagination parameters.
|
767
|
+
|
768
|
+
Args:
|
769
|
+
folderId: str. The unique identifier of the parent folder whose subfolders are to be retrieved. Required.
|
770
|
+
permalink: str, optional. Filter results to subfolders with the specified permalink.
|
771
|
+
descendants: bool, optional. If True, include descendant folders recursively in the results.
|
772
|
+
metadata: str or dict, optional. Filter subfolders by associated metadata.
|
773
|
+
customFields: str, list, or dict, optional. Filter subfolders by custom field values.
|
774
|
+
updatedDate: str or datetime, optional. Filter subfolders updated on or after the specified date.
|
775
|
+
withInvitations: bool, optional. If True, include invitation information with subfolders.
|
776
|
+
project: str or int, optional. Filter subfolders belonging to a specific project.
|
777
|
+
contractTypes: str, list, or dict, optional. Filter subfolders by contract types.
|
778
|
+
plainTextCustomFields: str, list, or dict, optional. Filter subfolders by plain text custom fields.
|
779
|
+
customItemTypes: str, list, or dict, optional. Filter subfolders by custom item types.
|
780
|
+
pageSize: int, optional. Maximum number of subfolders to return per request, for pagination.
|
781
|
+
nextPageToken: str, optional. Token for retrieving the next page of results.
|
782
|
+
fields: str or list, optional. Specify fields to include in the response for each folder.
|
783
|
+
|
784
|
+
Returns:
|
785
|
+
dict. A JSON object containing the list of subfolders matching the criteria, along with pagination tokens and any requested metadata.
|
786
|
+
"""
|
787
|
+
if folderId is None:
|
788
|
+
raise ValueError("Missing required parameter 'folderId'")
|
789
|
+
url = f"{self.base_url}/folders/{folderId}/folders"
|
790
|
+
query_params = {
|
791
|
+
k: v
|
792
|
+
for k, v in [
|
793
|
+
("permalink", permalink),
|
794
|
+
("descendants", descendants),
|
795
|
+
("metadata", metadata),
|
796
|
+
("customFields", customFields),
|
797
|
+
("updatedDate", updatedDate),
|
798
|
+
("withInvitations", withInvitations),
|
799
|
+
("project", project),
|
800
|
+
("contractTypes", contractTypes),
|
801
|
+
("plainTextCustomFields", plainTextCustomFields),
|
802
|
+
("customItemTypes", customItemTypes),
|
803
|
+
("pageSize", pageSize),
|
804
|
+
("nextPageToken", nextPageToken),
|
805
|
+
("fields", fields),
|
806
|
+
]
|
807
|
+
if v is not None
|
808
|
+
}
|
809
|
+
response = self._get(url, params=query_params)
|
810
|
+
response.raise_for_status()
|
811
|
+
return response.json()
|
812
|
+
|
813
|
+
def post_folders_by_folderid_folders(
|
814
|
+
self,
|
815
|
+
folderId,
|
816
|
+
title,
|
817
|
+
description=None,
|
818
|
+
shareds=None,
|
819
|
+
metadata=None,
|
820
|
+
customFields=None,
|
821
|
+
customColumns=None,
|
822
|
+
project=None,
|
823
|
+
userAccessRoles=None,
|
824
|
+
withInvitations=None,
|
825
|
+
customItemTypeId=None,
|
826
|
+
plainTextCustomFields=None,
|
827
|
+
fields=None,
|
828
|
+
) -> Any:
|
829
|
+
"""
|
830
|
+
Creates a new subfolder within a specified folder by folder ID, with configurable attributes such as title, description, sharing, metadata, and permissions.
|
831
|
+
|
832
|
+
Args:
|
833
|
+
folderId: str. The ID of the parent folder in which to create the new subfolder. Required.
|
834
|
+
title: str. The title of the new subfolder. Required.
|
835
|
+
description: str, optional. An optional description for the subfolder.
|
836
|
+
shareds: list or None. Optional list of user or group IDs to share the subfolder with.
|
837
|
+
metadata: dict or None. Optional metadata to associate with the subfolder.
|
838
|
+
customFields: dict or None. Optional custom fields to set for the subfolder.
|
839
|
+
customColumns: dict or None. Optional custom columns configuration.
|
840
|
+
project: str or None. Optional project identifier to associate with the subfolder.
|
841
|
+
userAccessRoles: list or None. Optional list of user access roles to assign to the subfolder.
|
842
|
+
withInvitations: bool or None. If True, send invitations to shared users or groups. Optional.
|
843
|
+
customItemTypeId: str or None. Optional custom item type identifier for the subfolder.
|
844
|
+
plainTextCustomFields: dict or None. Optional plain text custom fields to set for the subfolder.
|
845
|
+
fields: list or None. Optional list of specific fields to include in the response.
|
846
|
+
|
847
|
+
Returns:
|
848
|
+
dict. The newly created subfolder object as returned by the API.
|
849
|
+
"""
|
850
|
+
if folderId is None:
|
851
|
+
raise ValueError("Missing required parameter 'folderId'")
|
852
|
+
if title is None:
|
853
|
+
raise ValueError("Missing required parameter 'title'")
|
854
|
+
request_body = {
|
855
|
+
"title": title,
|
856
|
+
"description": description,
|
857
|
+
"shareds": shareds,
|
858
|
+
"metadata": metadata,
|
859
|
+
"customFields": customFields,
|
860
|
+
"customColumns": customColumns,
|
861
|
+
"project": project,
|
862
|
+
"userAccessRoles": userAccessRoles,
|
863
|
+
"withInvitations": withInvitations,
|
864
|
+
"customItemTypeId": customItemTypeId,
|
865
|
+
"plainTextCustomFields": plainTextCustomFields,
|
866
|
+
"fields": fields,
|
867
|
+
}
|
868
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
869
|
+
url = f"{self.base_url}/folders/{folderId}/folders"
|
870
|
+
query_params = {}
|
871
|
+
response = self._post(url, data=request_body, params=query_params)
|
872
|
+
response.raise_for_status()
|
873
|
+
return response.json()
|
874
|
+
|
875
|
+
def delete_folders_by_folderid(self, folderId) -> Any:
|
876
|
+
"""
|
877
|
+
Deletes a folder resource identified by its folder ID via an HTTP DELETE request.
|
878
|
+
|
879
|
+
Args:
|
880
|
+
folderId: The unique identifier of the folder to delete. Must not be None.
|
881
|
+
|
882
|
+
Returns:
|
883
|
+
The parsed JSON response from the server if the deletion is successful.
|
884
|
+
"""
|
885
|
+
if folderId is None:
|
886
|
+
raise ValueError("Missing required parameter 'folderId'")
|
887
|
+
url = f"{self.base_url}/folders/{folderId}"
|
888
|
+
query_params = {}
|
889
|
+
response = self._delete(url, params=query_params)
|
890
|
+
response.raise_for_status()
|
891
|
+
return response.json()
|
892
|
+
|
893
|
+
def put_folders_by_folderid(
|
894
|
+
self,
|
895
|
+
folderId,
|
896
|
+
title=None,
|
897
|
+
description=None,
|
898
|
+
addParents=None,
|
899
|
+
removeParents=None,
|
900
|
+
addShareds=None,
|
901
|
+
removeShareds=None,
|
902
|
+
metadata=None,
|
903
|
+
restore=None,
|
904
|
+
customFields=None,
|
905
|
+
customColumns=None,
|
906
|
+
clearCustomColumns=None,
|
907
|
+
project=None,
|
908
|
+
addAccessRoles=None,
|
909
|
+
removeAccessRoles=None,
|
910
|
+
withInvitations=None,
|
911
|
+
convertToCustomItemType=None,
|
912
|
+
plainTextCustomFields=None,
|
913
|
+
fields=None,
|
914
|
+
) -> Any:
|
915
|
+
"""
|
916
|
+
Updates a folder's properties and relationships by folder ID using a PUT request.
|
917
|
+
|
918
|
+
Args:
|
919
|
+
folderId: str. The unique identifier of the folder to update. Required.
|
920
|
+
title: str, optional. The new title for the folder.
|
921
|
+
description: str, optional. The updated description of the folder.
|
922
|
+
addParents: list or str, optional. Parent folder IDs to add as parents to this folder.
|
923
|
+
removeParents: list or str, optional. Parent folder IDs to remove from this folder.
|
924
|
+
addShareds: list or str, optional. Accounts to share this folder with.
|
925
|
+
removeShareds: list or str, optional. Shared accounts to remove from this folder.
|
926
|
+
metadata: dict, optional. Additional metadata to update for the folder.
|
927
|
+
restore: bool, optional. Whether to restore the folder if it was deleted.
|
928
|
+
customFields: dict, optional. Custom fields and their values to set or update.
|
929
|
+
customColumns: dict, optional. Custom columns and their values to set or update.
|
930
|
+
clearCustomColumns: list or str, optional. Custom column fields to clear.
|
931
|
+
project: str, optional. Associated project identifier for the folder.
|
932
|
+
addAccessRoles: list or str, optional. Access role IDs to add to the folder.
|
933
|
+
removeAccessRoles: list or str, optional. Access role IDs to remove from the folder.
|
934
|
+
withInvitations: bool, optional. Whether to send invitations on access role changes.
|
935
|
+
convertToCustomItemType: str, optional. Converts the folder to a specific custom item type.
|
936
|
+
plainTextCustomFields: dict, optional. Plain text fields to update.
|
937
|
+
fields: str or list, optional. Specific fields to include in the response.
|
938
|
+
|
939
|
+
Returns:
|
940
|
+
dict. The JSON response containing updated folder information from the API.
|
941
|
+
"""
|
942
|
+
if folderId is None:
|
943
|
+
raise ValueError("Missing required parameter 'folderId'")
|
944
|
+
request_body = {
|
945
|
+
"title": title,
|
946
|
+
"description": description,
|
947
|
+
"addParents": addParents,
|
948
|
+
"removeParents": removeParents,
|
949
|
+
"addShareds": addShareds,
|
950
|
+
"removeShareds": removeShareds,
|
951
|
+
"metadata": metadata,
|
952
|
+
"restore": restore,
|
953
|
+
"customFields": customFields,
|
954
|
+
"customColumns": customColumns,
|
955
|
+
"clearCustomColumns": clearCustomColumns,
|
956
|
+
"project": project,
|
957
|
+
"addAccessRoles": addAccessRoles,
|
958
|
+
"removeAccessRoles": removeAccessRoles,
|
959
|
+
"withInvitations": withInvitations,
|
960
|
+
"convertToCustomItemType": convertToCustomItemType,
|
961
|
+
"plainTextCustomFields": plainTextCustomFields,
|
962
|
+
"fields": fields,
|
963
|
+
}
|
964
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
965
|
+
url = f"{self.base_url}/folders/{folderId}"
|
966
|
+
query_params = {}
|
967
|
+
response = self._put(url, data=request_body, params=query_params)
|
968
|
+
response.raise_for_status()
|
969
|
+
return response.json()
|
970
|
+
|
971
|
+
def get_tasks(
|
972
|
+
self,
|
973
|
+
descendants=None,
|
974
|
+
title=None,
|
975
|
+
status=None,
|
976
|
+
importance=None,
|
977
|
+
startDate=None,
|
978
|
+
dueDate=None,
|
979
|
+
scheduledDate=None,
|
980
|
+
createdDate=None,
|
981
|
+
updatedDate=None,
|
982
|
+
completedDate=None,
|
983
|
+
authors=None,
|
984
|
+
responsibles=None,
|
985
|
+
responsiblePlaceholders=None,
|
986
|
+
permalink=None,
|
987
|
+
type=None,
|
988
|
+
limit=None,
|
989
|
+
sortField=None,
|
990
|
+
sortOrder=None,
|
991
|
+
subTasks=None,
|
992
|
+
pageSize=None,
|
993
|
+
nextPageToken=None,
|
994
|
+
metadata=None,
|
995
|
+
customField=None,
|
996
|
+
customFields=None,
|
997
|
+
customStatuses=None,
|
998
|
+
withInvitations=None,
|
999
|
+
billingTypes=None,
|
1000
|
+
plainTextCustomFields=None,
|
1001
|
+
customItemTypes=None,
|
1002
|
+
fields=None,
|
1003
|
+
) -> Any:
|
1004
|
+
"""
|
1005
|
+
Retrieves tasks from the API with optional filtering, sorting, pagination, and field selection parameters.
|
1006
|
+
|
1007
|
+
Args:
|
1008
|
+
descendants: Optional; filter tasks by descendant items or folders.
|
1009
|
+
title: Optional; filter tasks by title.
|
1010
|
+
status: Optional; filter tasks by their status (e.g., active, completed).
|
1011
|
+
importance: Optional; filter tasks by importance level.
|
1012
|
+
startDate: Optional; filter tasks by their start date.
|
1013
|
+
dueDate: Optional; filter tasks by due date.
|
1014
|
+
scheduledDate: Optional; filter tasks by scheduled date.
|
1015
|
+
createdDate: Optional; filter tasks by creation date.
|
1016
|
+
updatedDate: Optional; filter tasks by last updated date.
|
1017
|
+
completedDate: Optional; filter tasks by completion date.
|
1018
|
+
authors: Optional; filter tasks by author(s).
|
1019
|
+
responsibles: Optional; filter tasks by responsible user(s).
|
1020
|
+
responsiblePlaceholders: Optional; filter by responsible placeholders.
|
1021
|
+
permalink: Optional; filter tasks by their permalink.
|
1022
|
+
type: Optional; filter tasks by type.
|
1023
|
+
limit: Optional; limit the number of returned tasks.
|
1024
|
+
sortField: Optional; field to sort the tasks by.
|
1025
|
+
sortOrder: Optional; sort order ('asc' or 'desc').
|
1026
|
+
subTasks: Optional; filter tasks by whether they are sub-tasks.
|
1027
|
+
pageSize: Optional; number of tasks per page.
|
1028
|
+
nextPageToken: Optional; token for retrieving the next page of results.
|
1029
|
+
metadata: Optional; include or filter by metadata.
|
1030
|
+
customField: Optional; filter by a specific custom field.
|
1031
|
+
customFields: Optional; filter tasks by custom fields.
|
1032
|
+
customStatuses: Optional; filter tasks by custom workflow statuses.
|
1033
|
+
withInvitations: Optional; include tasks with invitations.
|
1034
|
+
billingTypes: Optional; filter tasks by billing types.
|
1035
|
+
plainTextCustomFields: Optional; specify if custom fields should be plain text.
|
1036
|
+
customItemTypes: Optional; filter by custom item types.
|
1037
|
+
fields: Optional; select specific fields to include in the result.
|
1038
|
+
|
1039
|
+
Returns:
|
1040
|
+
The JSON-decoded API response containing a list of tasks and related metadata.
|
1041
|
+
"""
|
1042
|
+
url = f"{self.base_url}/tasks"
|
1043
|
+
query_params = {
|
1044
|
+
k: v
|
1045
|
+
for k, v in [
|
1046
|
+
("descendants", descendants),
|
1047
|
+
("title", title),
|
1048
|
+
("status", status),
|
1049
|
+
("importance", importance),
|
1050
|
+
("startDate", startDate),
|
1051
|
+
("dueDate", dueDate),
|
1052
|
+
("scheduledDate", scheduledDate),
|
1053
|
+
("createdDate", createdDate),
|
1054
|
+
("updatedDate", updatedDate),
|
1055
|
+
("completedDate", completedDate),
|
1056
|
+
("authors", authors),
|
1057
|
+
("responsibles", responsibles),
|
1058
|
+
("responsiblePlaceholders", responsiblePlaceholders),
|
1059
|
+
("permalink", permalink),
|
1060
|
+
("type", type),
|
1061
|
+
("limit", limit),
|
1062
|
+
("sortField", sortField),
|
1063
|
+
("sortOrder", sortOrder),
|
1064
|
+
("subTasks", subTasks),
|
1065
|
+
("pageSize", pageSize),
|
1066
|
+
("nextPageToken", nextPageToken),
|
1067
|
+
("metadata", metadata),
|
1068
|
+
("customField", customField),
|
1069
|
+
("customFields", customFields),
|
1070
|
+
("customStatuses", customStatuses),
|
1071
|
+
("withInvitations", withInvitations),
|
1072
|
+
("billingTypes", billingTypes),
|
1073
|
+
("plainTextCustomFields", plainTextCustomFields),
|
1074
|
+
("customItemTypes", customItemTypes),
|
1075
|
+
("fields", fields),
|
1076
|
+
]
|
1077
|
+
if v is not None
|
1078
|
+
}
|
1079
|
+
response = self._get(url, params=query_params)
|
1080
|
+
response.raise_for_status()
|
1081
|
+
return response.json()
|
1082
|
+
|
1083
|
+
def get_tasks_by_taskid(self, taskId, fields=None) -> Any:
|
1084
|
+
"""
|
1085
|
+
Retrieves a task by its ID from the remote service, optionally returning only specified fields.
|
1086
|
+
|
1087
|
+
Args:
|
1088
|
+
taskId: The unique identifier of the task to retrieve.
|
1089
|
+
fields: Optional. A comma-separated string specifying which fields to include in the response. If None, all available fields are returned.
|
1090
|
+
|
1091
|
+
Returns:
|
1092
|
+
The JSON-decoded response data containing task details, as returned by the remote API.
|
1093
|
+
"""
|
1094
|
+
if taskId is None:
|
1095
|
+
raise ValueError("Missing required parameter 'taskId'")
|
1096
|
+
url = f"{self.base_url}/tasks/{taskId}"
|
1097
|
+
query_params = {k: v for k, v in [("fields", fields)] if v is not None}
|
1098
|
+
response = self._get(url, params=query_params)
|
1099
|
+
response.raise_for_status()
|
1100
|
+
return response.json()
|
1101
|
+
|
1102
|
+
def put_tasks_by_taskid(
|
1103
|
+
self,
|
1104
|
+
taskId,
|
1105
|
+
title=None,
|
1106
|
+
description=None,
|
1107
|
+
status=None,
|
1108
|
+
importance=None,
|
1109
|
+
dates=None,
|
1110
|
+
addParents=None,
|
1111
|
+
removeParents=None,
|
1112
|
+
addShareds=None,
|
1113
|
+
removeShareds=None,
|
1114
|
+
addResponsibles=None,
|
1115
|
+
removeResponsibles=None,
|
1116
|
+
addResponsiblePlaceholders=None,
|
1117
|
+
removeResponsiblePlaceholders=None,
|
1118
|
+
addFollowers=None,
|
1119
|
+
follow=None,
|
1120
|
+
priorityBefore=None,
|
1121
|
+
priorityAfter=None,
|
1122
|
+
addSuperTasks=None,
|
1123
|
+
removeSuperTasks=None,
|
1124
|
+
metadata=None,
|
1125
|
+
customFields=None,
|
1126
|
+
customStatus=None,
|
1127
|
+
restore=None,
|
1128
|
+
effortAllocation=None,
|
1129
|
+
billingType=None,
|
1130
|
+
withInvitations=None,
|
1131
|
+
convertToCustomItemType=None,
|
1132
|
+
plainTextCustomFields=None,
|
1133
|
+
fields=None,
|
1134
|
+
) -> Any:
|
1135
|
+
"""
|
1136
|
+
Updates the properties and relationships of a task specified by its ID, applying the given changes and returning the updated task data as a JSON object.
|
1137
|
+
|
1138
|
+
Args:
|
1139
|
+
taskId: str. The unique identifier of the task to update. Must not be None.
|
1140
|
+
title: Optional[str]. The new title for the task.
|
1141
|
+
description: Optional[str]. The new description for the task.
|
1142
|
+
status: Optional[str]. The new status for the task.
|
1143
|
+
importance: Optional[str]. The importance level to assign to the task.
|
1144
|
+
dates: Optional[dict]. Task dates to update (e.g., due date, start date).
|
1145
|
+
addParents: Optional[list]. List of parent task IDs to add as parents to this task.
|
1146
|
+
removeParents: Optional[list]. List of parent task IDs to remove from this task.
|
1147
|
+
addShareds: Optional[list]. List of user IDs to add as shared users for this task.
|
1148
|
+
removeShareds: Optional[list]. List of user IDs to remove from shared users.
|
1149
|
+
addResponsibles: Optional[list]. List of user IDs to add as responsible for this task.
|
1150
|
+
removeResponsibles: Optional[list]. List of user IDs to remove from responsibles.
|
1151
|
+
addResponsiblePlaceholders: Optional[list]. Placeholder IDs to add to the responsible list.
|
1152
|
+
removeResponsiblePlaceholders: Optional[list]. Placeholder IDs to remove from responsibles.
|
1153
|
+
addFollowers: Optional[list]. User IDs to add as followers of this task.
|
1154
|
+
follow: Optional[bool]. If set, follows or unfollows the task.
|
1155
|
+
priorityBefore: Optional[str]. Task ID before which this task should be prioritized.
|
1156
|
+
priorityAfter: Optional[str]. Task ID after which this task should be prioritized.
|
1157
|
+
addSuperTasks: Optional[list]. Task IDs to add as super tasks.
|
1158
|
+
removeSuperTasks: Optional[list]. Task IDs to remove from super tasks.
|
1159
|
+
metadata: Optional[dict]. Arbitrary metadata to associate with the task.
|
1160
|
+
customFields: Optional[list]. List of custom field updates for the task.
|
1161
|
+
customStatus: Optional[str]. Custom status identifier to apply.
|
1162
|
+
restore: Optional[bool]. If True, restores a deleted task.
|
1163
|
+
effortAllocation: Optional[list]. List of effort allocation data objects.
|
1164
|
+
billingType: Optional[str]. Billing type identifier to set for the task.
|
1165
|
+
withInvitations: Optional[bool]. If True, send invitations to new shared/responsible users.
|
1166
|
+
convertToCustomItemType: Optional[str]. Identifier to convert the task to a custom item type.
|
1167
|
+
plainTextCustomFields: Optional[dict]. Plain text values for custom fields.
|
1168
|
+
fields: Optional[list]. List of fields to include in the response.
|
1169
|
+
|
1170
|
+
Returns:
|
1171
|
+
dict. The JSON response containing updated task details as returned by the server.
|
1172
|
+
"""
|
1173
|
+
if taskId is None:
|
1174
|
+
raise ValueError("Missing required parameter 'taskId'")
|
1175
|
+
request_body = {
|
1176
|
+
"title": title,
|
1177
|
+
"description": description,
|
1178
|
+
"status": status,
|
1179
|
+
"importance": importance,
|
1180
|
+
"dates": dates,
|
1181
|
+
"addParents": addParents,
|
1182
|
+
"removeParents": removeParents,
|
1183
|
+
"addShareds": addShareds,
|
1184
|
+
"removeShareds": removeShareds,
|
1185
|
+
"addResponsibles": addResponsibles,
|
1186
|
+
"removeResponsibles": removeResponsibles,
|
1187
|
+
"addResponsiblePlaceholders": addResponsiblePlaceholders,
|
1188
|
+
"removeResponsiblePlaceholders": removeResponsiblePlaceholders,
|
1189
|
+
"addFollowers": addFollowers,
|
1190
|
+
"follow": follow,
|
1191
|
+
"priorityBefore": priorityBefore,
|
1192
|
+
"priorityAfter": priorityAfter,
|
1193
|
+
"addSuperTasks": addSuperTasks,
|
1194
|
+
"removeSuperTasks": removeSuperTasks,
|
1195
|
+
"metadata": metadata,
|
1196
|
+
"customFields": customFields,
|
1197
|
+
"customStatus": customStatus,
|
1198
|
+
"restore": restore,
|
1199
|
+
"effortAllocation": effortAllocation,
|
1200
|
+
"billingType": billingType,
|
1201
|
+
"withInvitations": withInvitations,
|
1202
|
+
"convertToCustomItemType": convertToCustomItemType,
|
1203
|
+
"plainTextCustomFields": plainTextCustomFields,
|
1204
|
+
"fields": fields,
|
1205
|
+
}
|
1206
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
1207
|
+
url = f"{self.base_url}/tasks/{taskId}"
|
1208
|
+
query_params = {}
|
1209
|
+
response = self._put(url, data=request_body, params=query_params)
|
1210
|
+
response.raise_for_status()
|
1211
|
+
return response.json()
|
1212
|
+
|
1213
|
+
def delete_tasks_by_taskid(self, taskId) -> Any:
|
1214
|
+
"""
|
1215
|
+
Deletes a task identified by the given task ID via an HTTP DELETE request and returns the response as a JSON object.
|
1216
|
+
|
1217
|
+
Args:
|
1218
|
+
taskId: The unique identifier of the task to be deleted. Must not be None.
|
1219
|
+
|
1220
|
+
Returns:
|
1221
|
+
A JSON object containing the API response to the delete operation.
|
1222
|
+
"""
|
1223
|
+
if taskId is None:
|
1224
|
+
raise ValueError("Missing required parameter 'taskId'")
|
1225
|
+
url = f"{self.base_url}/tasks/{taskId}"
|
1226
|
+
query_params = {}
|
1227
|
+
response = self._delete(url, params=query_params)
|
1228
|
+
response.raise_for_status()
|
1229
|
+
return response.json()
|
1230
|
+
|
1231
|
+
def post_folders_by_folderid_tasks(
|
1232
|
+
self,
|
1233
|
+
folderId,
|
1234
|
+
title,
|
1235
|
+
description=None,
|
1236
|
+
status=None,
|
1237
|
+
importance=None,
|
1238
|
+
dates=None,
|
1239
|
+
shareds=None,
|
1240
|
+
parents=None,
|
1241
|
+
responsibles=None,
|
1242
|
+
responsiblePlaceholders=None,
|
1243
|
+
followers=None,
|
1244
|
+
follow=None,
|
1245
|
+
priorityBefore=None,
|
1246
|
+
priorityAfter=None,
|
1247
|
+
superTasks=None,
|
1248
|
+
metadata=None,
|
1249
|
+
customFields=None,
|
1250
|
+
customStatus=None,
|
1251
|
+
effortAllocation=None,
|
1252
|
+
billingType=None,
|
1253
|
+
withInvitations=None,
|
1254
|
+
customItemTypeId=None,
|
1255
|
+
plainTextCustomFields=None,
|
1256
|
+
fields=None,
|
1257
|
+
) -> Any:
|
1258
|
+
"""
|
1259
|
+
Creates a new task within a specified folder by folder ID, with configurable attributes such as title, description, status, importance, dates, assigned users, metadata, custom fields, and other options.
|
1260
|
+
|
1261
|
+
Args:
|
1262
|
+
folderId: str or int. The unique identifier of the folder in which to create the new task. Required.
|
1263
|
+
title: str. The title of the task to be created. Required.
|
1264
|
+
description: str, optional. A detailed description of the task.
|
1265
|
+
status: str, optional. The status of the task (e.g., active, completed).
|
1266
|
+
importance: str or int, optional. The importance level of the task.
|
1267
|
+
dates: dict or list, optional. Date-related information for the task, such as start and due dates.
|
1268
|
+
shareds: list, optional. Users or user IDs to share the task with.
|
1269
|
+
parents: list, optional. Parent task IDs or references, if this task is a subtask.
|
1270
|
+
responsibles: list, optional. Users or user IDs responsible for this task.
|
1271
|
+
responsiblePlaceholders: list, optional. Placeholder users assigned as responsible.
|
1272
|
+
followers: list, optional. Users or user IDs who will follow task updates.
|
1273
|
+
follow: bool, optional. Whether the current user should follow the task.
|
1274
|
+
priorityBefore: str or int, optional. Task ID before which this task should be prioritized.
|
1275
|
+
priorityAfter: str or int, optional. Task ID after which this task should be prioritized.
|
1276
|
+
superTasks: list, optional. IDs of super tasks this task belongs to.
|
1277
|
+
metadata: dict, optional. Arbitrary metadata to attach to the task.
|
1278
|
+
customFields: dict or list, optional. Custom field values for the task.
|
1279
|
+
customStatus: str, optional. Custom status value for the task.
|
1280
|
+
effortAllocation: dict or list, optional. Effort allocation details (e.g., estimated time, allocation per responsible).
|
1281
|
+
billingType: str, optional. Billing details or billing type for the task.
|
1282
|
+
withInvitations: bool, optional. Whether to send invitations to newly added users.
|
1283
|
+
customItemTypeId: str or int, optional. Custom item type identifier.
|
1284
|
+
plainTextCustomFields: dict or list, optional. Custom fields in plain text format.
|
1285
|
+
fields: list or str, optional. Specifies which fields should be included in the API response.
|
1286
|
+
|
1287
|
+
Returns:
|
1288
|
+
dict. The JSON response from the server containing details of the newly created task.
|
1289
|
+
"""
|
1290
|
+
if folderId is None:
|
1291
|
+
raise ValueError("Missing required parameter 'folderId'")
|
1292
|
+
if title is None:
|
1293
|
+
raise ValueError("Missing required parameter 'title'")
|
1294
|
+
request_body = {
|
1295
|
+
"title": title,
|
1296
|
+
"description": description,
|
1297
|
+
"status": status,
|
1298
|
+
"importance": importance,
|
1299
|
+
"dates": dates,
|
1300
|
+
"shareds": shareds,
|
1301
|
+
"parents": parents,
|
1302
|
+
"responsibles": responsibles,
|
1303
|
+
"responsiblePlaceholders": responsiblePlaceholders,
|
1304
|
+
"followers": followers,
|
1305
|
+
"follow": follow,
|
1306
|
+
"priorityBefore": priorityBefore,
|
1307
|
+
"priorityAfter": priorityAfter,
|
1308
|
+
"superTasks": superTasks,
|
1309
|
+
"metadata": metadata,
|
1310
|
+
"customFields": customFields,
|
1311
|
+
"customStatus": customStatus,
|
1312
|
+
"effortAllocation": effortAllocation,
|
1313
|
+
"billingType": billingType,
|
1314
|
+
"withInvitations": withInvitations,
|
1315
|
+
"customItemTypeId": customItemTypeId,
|
1316
|
+
"plainTextCustomFields": plainTextCustomFields,
|
1317
|
+
"fields": fields,
|
1318
|
+
}
|
1319
|
+
request_body = {k: v for k, v in request_body.items() if v is not None}
|
1320
|
+
url = f"{self.base_url}/folders/{folderId}/tasks"
|
1321
|
+
query_params = {}
|
1322
|
+
response = self._post(url, data=request_body, params=query_params)
|
1323
|
+
response.raise_for_status()
|
1324
|
+
return response.json()
|
1325
|
+
|
1326
|
+
def list_tools(self):
|
1327
|
+
"""
|
1328
|
+
Returns a list of references to tool-related instance methods for managing contacts, users, groups, invitations, accounts, workflows, custom fields, folders, and tasks.
|
1329
|
+
|
1330
|
+
Args:
|
1331
|
+
None: This method does not take any arguments.
|
1332
|
+
|
1333
|
+
Returns:
|
1334
|
+
list: A list of method references corresponding to various instance-level API operations for managing organizational entities such as contacts, users, groups, invitations, accounts, workflows, custom fields, folders, and tasks.
|
1335
|
+
"""
|
1336
|
+
return [
|
1337
|
+
self.get_contacts,
|
1338
|
+
self.get_contacts_by_contactid,
|
1339
|
+
self.put_contacts_by_contactid,
|
1340
|
+
self.get_users_by_userid,
|
1341
|
+
self.put_users_by_userid,
|
1342
|
+
self.get_groups,
|
1343
|
+
self.post_groups,
|
1344
|
+
self.get_groups_by_groupid,
|
1345
|
+
self.put_groups_by_groupid,
|
1346
|
+
self.delete_groups_by_groupid,
|
1347
|
+
self.put_groups_bulk,
|
1348
|
+
self.get_invitations,
|
1349
|
+
self.post_invitations,
|
1350
|
+
self.put_invitations_by_invitationid,
|
1351
|
+
self.delete_invitations_by_invitationid,
|
1352
|
+
self.get_a_ccount,
|
1353
|
+
self.put_a_ccount,
|
1354
|
+
self.get_workflows,
|
1355
|
+
self.post_workflows,
|
1356
|
+
self.put_workflows_by_workflowid,
|
1357
|
+
self.get_customfields,
|
1358
|
+
self.post_customfields,
|
1359
|
+
self.get_customfields_by_customfieldid,
|
1360
|
+
self.put_customfields_by_customfieldid,
|
1361
|
+
self.delete_customfields_by_customfieldid,
|
1362
|
+
self.get_folders,
|
1363
|
+
self.get_folders_by_folderid_folders,
|
1364
|
+
self.post_folders_by_folderid_folders,
|
1365
|
+
self.delete_folders_by_folderid,
|
1366
|
+
self.put_folders_by_folderid,
|
1367
|
+
self.get_tasks,
|
1368
|
+
self.get_tasks_by_taskid,
|
1369
|
+
self.put_tasks_by_taskid,
|
1370
|
+
self.delete_tasks_by_taskid,
|
1371
|
+
self.post_folders_by_folderid_tasks,
|
1372
|
+
]
|