ayon-python-api 1.2.0__tar.gz → 1.2.2__tar.gz
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.
- {ayon-python-api-1.2.0/ayon_python_api.egg-info → ayon_python_api-1.2.2}/PKG-INFO +2 -2
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/__init__.py +4 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/_api.py +75 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/__init__.py +42 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/actions.py +303 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/activities.py +295 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/attributes.py +159 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/base.py +130 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/bundles_addons.py +885 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/dependency_packages.py +236 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/events.py +440 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/folders.py +638 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/installers.py +174 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/links.py +661 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/lists.py +417 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/products.py +504 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/projects.py +737 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/representations.py +747 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/secrets.py +81 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/tasks.py +515 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/thumbnails.py +307 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/versions.py +640 -0
- ayon_python_api-1.2.2/ayon_api/_api_helpers/workfiles.py +265 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/entity_hub.py +5 -2
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/server_api.py +135 -27
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/typing.py +6 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/version.py +1 -1
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2/ayon_python_api.egg-info}/PKG-INFO +1 -1
- ayon_python_api-1.2.2/ayon_python_api.egg-info/SOURCES.txt +42 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/pyproject.toml +6 -5
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/setup.py +2 -2
- ayon-python-api-1.2.0/ayon_python_api.egg-info/SOURCES.txt +0 -22
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/LICENSE +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/README.md +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/constants.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/events.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/graphql.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/operations.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_api/utils.py +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-1.2.0 → ayon_python_api-1.2.2}/setup.cfg +0 -0
|
@@ -80,6 +80,8 @@ from ._api import (
|
|
|
80
80
|
get_default_fields_for_type,
|
|
81
81
|
get_rest_entity_by_id,
|
|
82
82
|
send_batch_operations,
|
|
83
|
+
send_background_batch_operations,
|
|
84
|
+
get_background_operations_status,
|
|
83
85
|
get_installers,
|
|
84
86
|
create_installer,
|
|
85
87
|
update_installer,
|
|
@@ -347,6 +349,8 @@ __all__ = (
|
|
|
347
349
|
"get_default_fields_for_type",
|
|
348
350
|
"get_rest_entity_by_id",
|
|
349
351
|
"send_batch_operations",
|
|
352
|
+
"send_background_batch_operations",
|
|
353
|
+
"get_background_operations_status",
|
|
350
354
|
"get_installers",
|
|
351
355
|
"create_installer",
|
|
352
356
|
"update_installer",
|
|
@@ -48,6 +48,7 @@ if typing.TYPE_CHECKING:
|
|
|
48
48
|
ActivityReferenceType,
|
|
49
49
|
EntityListEntityType,
|
|
50
50
|
EntityListItemMode,
|
|
51
|
+
BackgroundOperationTask,
|
|
51
52
|
LinkDirection,
|
|
52
53
|
EventFilter,
|
|
53
54
|
EventStatus,
|
|
@@ -1253,6 +1254,80 @@ def send_batch_operations(
|
|
|
1253
1254
|
)
|
|
1254
1255
|
|
|
1255
1256
|
|
|
1257
|
+
def send_background_batch_operations(
|
|
1258
|
+
project_name: str,
|
|
1259
|
+
operations: list[dict[str, Any]],
|
|
1260
|
+
*,
|
|
1261
|
+
can_fail: bool = False,
|
|
1262
|
+
wait: bool = False,
|
|
1263
|
+
raise_on_fail: bool = True,
|
|
1264
|
+
) -> BackgroundOperationTask:
|
|
1265
|
+
"""Post multiple CRUD operations to server.
|
|
1266
|
+
|
|
1267
|
+
When multiple changes should be made on server side this is the best
|
|
1268
|
+
way to go. It is possible to pass multiple operations to process on a
|
|
1269
|
+
server side and do the changes in a transaction.
|
|
1270
|
+
|
|
1271
|
+
Compared to 'send_batch_operations' this function creates a task on
|
|
1272
|
+
server which then can be periodically checked for a status and
|
|
1273
|
+
receive it's result.
|
|
1274
|
+
|
|
1275
|
+
When used with 'wait' set to 'True' this method blocks until task is
|
|
1276
|
+
finished. Which makes it work as 'send_batch_operations'
|
|
1277
|
+
but safer for large operations batch as is not bound to
|
|
1278
|
+
response timeout.
|
|
1279
|
+
|
|
1280
|
+
Args:
|
|
1281
|
+
project_name (str): On which project should be operations
|
|
1282
|
+
processed.
|
|
1283
|
+
operations (list[dict[str, Any]]): Operations to be processed.
|
|
1284
|
+
can_fail (Optional[bool]): Server will try to process all
|
|
1285
|
+
operations even if one of them fails.
|
|
1286
|
+
wait (bool): Wait for operations to end.
|
|
1287
|
+
raise_on_fail (Optional[bool]): Raise exception if an operation
|
|
1288
|
+
fails. You can handle failed operations on your own
|
|
1289
|
+
when set to 'False'. Used when 'wait' is enabled.
|
|
1290
|
+
|
|
1291
|
+
Raises:
|
|
1292
|
+
ValueError: Operations can't be converted to json string.
|
|
1293
|
+
FailedOperations: When output does not contain server operations
|
|
1294
|
+
or 'raise_on_fail' is enabled and any operation fails.
|
|
1295
|
+
|
|
1296
|
+
Returns:
|
|
1297
|
+
BackgroundOperationTask: Background operation.
|
|
1298
|
+
|
|
1299
|
+
"""
|
|
1300
|
+
con = get_server_api_connection()
|
|
1301
|
+
return con.send_background_batch_operations(
|
|
1302
|
+
project_name=project_name,
|
|
1303
|
+
operations=operations,
|
|
1304
|
+
can_fail=can_fail,
|
|
1305
|
+
wait=wait,
|
|
1306
|
+
raise_on_fail=raise_on_fail,
|
|
1307
|
+
)
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
def get_background_operations_status(
|
|
1311
|
+
project_name: str,
|
|
1312
|
+
task_id: str,
|
|
1313
|
+
) -> BackgroundOperationTask:
|
|
1314
|
+
"""Get status of background operations task.
|
|
1315
|
+
|
|
1316
|
+
Args:
|
|
1317
|
+
project_name (str): Project name.
|
|
1318
|
+
task_id (str): Backgorund operation task id.
|
|
1319
|
+
|
|
1320
|
+
Returns:
|
|
1321
|
+
BackgroundOperationTask: Background operation.
|
|
1322
|
+
|
|
1323
|
+
"""
|
|
1324
|
+
con = get_server_api_connection()
|
|
1325
|
+
return con.get_background_operations_status(
|
|
1326
|
+
project_name=project_name,
|
|
1327
|
+
task_id=task_id,
|
|
1328
|
+
)
|
|
1329
|
+
|
|
1330
|
+
|
|
1256
1331
|
def get_installers(
|
|
1257
1332
|
version: Optional[str] = None,
|
|
1258
1333
|
platform_name: Optional[str] = None,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from .base import BaseServerAPI
|
|
2
|
+
from .installers import InstallersAPI
|
|
3
|
+
from .dependency_packages import DependencyPackagesAPI
|
|
4
|
+
from .secrets import SecretsAPI
|
|
5
|
+
from .bundles_addons import BundlesAddonsAPI
|
|
6
|
+
from .events import EventsAPI
|
|
7
|
+
from .attributes import AttributesAPI
|
|
8
|
+
from .projects import ProjectsAPI
|
|
9
|
+
from .folders import FoldersAPI
|
|
10
|
+
from .tasks import TasksAPI
|
|
11
|
+
from .products import ProductsAPI
|
|
12
|
+
from .versions import VersionsAPI
|
|
13
|
+
from .representations import RepresentationsAPI
|
|
14
|
+
from .workfiles import WorkfilesAPI
|
|
15
|
+
from .thumbnails import ThumbnailsAPI
|
|
16
|
+
from .activities import ActivitiesAPI
|
|
17
|
+
from .actions import ActionsAPI
|
|
18
|
+
from .links import LinksAPI
|
|
19
|
+
from .lists import ListsAPI
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
__all__ = (
|
|
23
|
+
"BaseServerAPI",
|
|
24
|
+
"InstallersAPI",
|
|
25
|
+
"DependencyPackagesAPI",
|
|
26
|
+
"SecretsAPI",
|
|
27
|
+
"BundlesAddonsAPI",
|
|
28
|
+
"EventsAPI",
|
|
29
|
+
"AttributesAPI",
|
|
30
|
+
"ProjectsAPI",
|
|
31
|
+
"FoldersAPI",
|
|
32
|
+
"TasksAPI",
|
|
33
|
+
"ProductsAPI",
|
|
34
|
+
"VersionsAPI",
|
|
35
|
+
"RepresentationsAPI",
|
|
36
|
+
"WorkfilesAPI",
|
|
37
|
+
"ThumbnailsAPI",
|
|
38
|
+
"ActivitiesAPI",
|
|
39
|
+
"ActionsAPI",
|
|
40
|
+
"LinksAPI",
|
|
41
|
+
"ListsAPI",
|
|
42
|
+
)
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from typing import Optional, Any
|
|
5
|
+
|
|
6
|
+
from ayon_api.utils import prepare_query_string
|
|
7
|
+
|
|
8
|
+
from .base import BaseServerAPI
|
|
9
|
+
|
|
10
|
+
if typing.TYPE_CHECKING:
|
|
11
|
+
from ayon_api.typing import (
|
|
12
|
+
ActionEntityTypes,
|
|
13
|
+
ActionManifestDict,
|
|
14
|
+
ActionTriggerResponse,
|
|
15
|
+
ActionTakeResponse,
|
|
16
|
+
ActionConfigResponse,
|
|
17
|
+
ActionModeType,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ActionsAPI(BaseServerAPI):
|
|
22
|
+
"""Implementation of actions API for ServerAPI."""
|
|
23
|
+
def get_actions(
|
|
24
|
+
self,
|
|
25
|
+
project_name: Optional[str] = None,
|
|
26
|
+
entity_type: Optional[ActionEntityTypes] = None,
|
|
27
|
+
entity_ids: Optional[list[str]] = None,
|
|
28
|
+
entity_subtypes: Optional[list[str]] = None,
|
|
29
|
+
form_data: Optional[dict[str, Any]] = None,
|
|
30
|
+
*,
|
|
31
|
+
variant: Optional[str] = None,
|
|
32
|
+
mode: Optional[ActionModeType] = None,
|
|
33
|
+
) -> list[ActionManifestDict]:
|
|
34
|
+
"""Get actions for a context.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
project_name (Optional[str]): Name of the project. None for global
|
|
38
|
+
actions.
|
|
39
|
+
entity_type (Optional[ActionEntityTypes]): Entity type where the
|
|
40
|
+
action is triggered. None for global actions.
|
|
41
|
+
entity_ids (Optional[list[str]]): list of entity ids where the
|
|
42
|
+
action is triggered. None for global actions.
|
|
43
|
+
entity_subtypes (Optional[list[str]]): list of entity subtypes
|
|
44
|
+
folder types for folder ids, task types for tasks ids.
|
|
45
|
+
form_data (Optional[dict[str, Any]]): Form data of the action.
|
|
46
|
+
variant (Optional[str]): Settings variant.
|
|
47
|
+
mode (Optional[ActionModeType]): Action modes.
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
list[ActionManifestDict]: list of action manifests.
|
|
51
|
+
|
|
52
|
+
"""
|
|
53
|
+
if variant is None:
|
|
54
|
+
variant = self.get_default_settings_variant()
|
|
55
|
+
query_data = {"variant": variant}
|
|
56
|
+
if mode:
|
|
57
|
+
query_data["mode"] = mode
|
|
58
|
+
query = prepare_query_string(query_data)
|
|
59
|
+
kwargs = {
|
|
60
|
+
key: value
|
|
61
|
+
for key, value in (
|
|
62
|
+
("projectName", project_name),
|
|
63
|
+
("entityType", entity_type),
|
|
64
|
+
("entityIds", entity_ids),
|
|
65
|
+
("entitySubtypes", entity_subtypes),
|
|
66
|
+
("formData", form_data),
|
|
67
|
+
)
|
|
68
|
+
if value is not None
|
|
69
|
+
}
|
|
70
|
+
response = self.post(f"actions/list{query}", **kwargs)
|
|
71
|
+
response.raise_for_status()
|
|
72
|
+
return response.data["actions"]
|
|
73
|
+
|
|
74
|
+
def trigger_action(
|
|
75
|
+
self,
|
|
76
|
+
identifier: str,
|
|
77
|
+
addon_name: str,
|
|
78
|
+
addon_version: str,
|
|
79
|
+
project_name: Optional[str] = None,
|
|
80
|
+
entity_type: Optional[ActionEntityTypes] = None,
|
|
81
|
+
entity_ids: Optional[list[str]] = None,
|
|
82
|
+
entity_subtypes: Optional[list[str]] = None,
|
|
83
|
+
form_data: Optional[dict[str, Any]] = None,
|
|
84
|
+
*,
|
|
85
|
+
variant: Optional[str] = None,
|
|
86
|
+
) -> ActionTriggerResponse:
|
|
87
|
+
"""Trigger action.
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
identifier (str): Identifier of the action.
|
|
91
|
+
addon_name (str): Name of the addon.
|
|
92
|
+
addon_version (str): Version of the addon.
|
|
93
|
+
project_name (Optional[str]): Name of the project. None for global
|
|
94
|
+
actions.
|
|
95
|
+
entity_type (Optional[ActionEntityTypes]): Entity type where the
|
|
96
|
+
action is triggered. None for global actions.
|
|
97
|
+
entity_ids (Optional[list[str]]): list of entity ids where the
|
|
98
|
+
action is triggered. None for global actions.
|
|
99
|
+
entity_subtypes (Optional[list[str]]): list of entity subtypes
|
|
100
|
+
folder types for folder ids, task types for tasks ids.
|
|
101
|
+
form_data (Optional[dict[str, Any]]): Form data of the action.
|
|
102
|
+
variant (Optional[str]): Settings variant.
|
|
103
|
+
|
|
104
|
+
"""
|
|
105
|
+
if variant is None:
|
|
106
|
+
variant = self.get_default_settings_variant()
|
|
107
|
+
query_data = {
|
|
108
|
+
"addonName": addon_name,
|
|
109
|
+
"addonVersion": addon_version,
|
|
110
|
+
"identifier": identifier,
|
|
111
|
+
"variant": variant,
|
|
112
|
+
}
|
|
113
|
+
query = prepare_query_string(query_data)
|
|
114
|
+
|
|
115
|
+
kwargs = {
|
|
116
|
+
key: value
|
|
117
|
+
for key, value in (
|
|
118
|
+
("projectName", project_name),
|
|
119
|
+
("entityType", entity_type),
|
|
120
|
+
("entityIds", entity_ids),
|
|
121
|
+
("entitySubtypes", entity_subtypes),
|
|
122
|
+
("formData", form_data),
|
|
123
|
+
)
|
|
124
|
+
if value is not None
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
response = self.post(f"actions/execute{query}", **kwargs)
|
|
128
|
+
response.raise_for_status()
|
|
129
|
+
return response.data
|
|
130
|
+
|
|
131
|
+
def get_action_config(
|
|
132
|
+
self,
|
|
133
|
+
identifier: str,
|
|
134
|
+
addon_name: str,
|
|
135
|
+
addon_version: str,
|
|
136
|
+
project_name: Optional[str] = None,
|
|
137
|
+
entity_type: Optional[ActionEntityTypes] = None,
|
|
138
|
+
entity_ids: Optional[list[str]] = None,
|
|
139
|
+
entity_subtypes: Optional[list[str]] = None,
|
|
140
|
+
form_data: Optional[dict[str, Any]] = None,
|
|
141
|
+
*,
|
|
142
|
+
variant: Optional[str] = None,
|
|
143
|
+
) -> ActionConfigResponse:
|
|
144
|
+
"""Get action configuration.
|
|
145
|
+
|
|
146
|
+
Args:
|
|
147
|
+
identifier (str): Identifier of the action.
|
|
148
|
+
addon_name (str): Name of the addon.
|
|
149
|
+
addon_version (str): Version of the addon.
|
|
150
|
+
project_name (Optional[str]): Name of the project. None for global
|
|
151
|
+
actions.
|
|
152
|
+
entity_type (Optional[ActionEntityTypes]): Entity type where the
|
|
153
|
+
action is triggered. None for global actions.
|
|
154
|
+
entity_ids (Optional[list[str]]): list of entity ids where the
|
|
155
|
+
action is triggered. None for global actions.
|
|
156
|
+
entity_subtypes (Optional[list[str]]): list of entity subtypes
|
|
157
|
+
folder types for folder ids, task types for tasks ids.
|
|
158
|
+
form_data (Optional[dict[str, Any]]): Form data of the action.
|
|
159
|
+
variant (Optional[str]): Settings variant.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
ActionConfigResponse: Action configuration data.
|
|
163
|
+
|
|
164
|
+
"""
|
|
165
|
+
return self._send_config_request(
|
|
166
|
+
identifier,
|
|
167
|
+
addon_name,
|
|
168
|
+
addon_version,
|
|
169
|
+
None,
|
|
170
|
+
project_name,
|
|
171
|
+
entity_type,
|
|
172
|
+
entity_ids,
|
|
173
|
+
entity_subtypes,
|
|
174
|
+
form_data,
|
|
175
|
+
variant,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
def set_action_config(
|
|
179
|
+
self,
|
|
180
|
+
identifier: str,
|
|
181
|
+
addon_name: str,
|
|
182
|
+
addon_version: str,
|
|
183
|
+
value: dict[str, Any],
|
|
184
|
+
project_name: Optional[str] = None,
|
|
185
|
+
entity_type: Optional[ActionEntityTypes] = None,
|
|
186
|
+
entity_ids: Optional[list[str]] = None,
|
|
187
|
+
entity_subtypes: Optional[list[str]] = None,
|
|
188
|
+
form_data: Optional[dict[str, Any]] = None,
|
|
189
|
+
*,
|
|
190
|
+
variant: Optional[str] = None,
|
|
191
|
+
) -> ActionConfigResponse:
|
|
192
|
+
"""Set action configuration.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
identifier (str): Identifier of the action.
|
|
196
|
+
addon_name (str): Name of the addon.
|
|
197
|
+
addon_version (str): Version of the addon.
|
|
198
|
+
value (Optional[dict[str, Any]]): Value of the action
|
|
199
|
+
configuration.
|
|
200
|
+
project_name (Optional[str]): Name of the project. None for global
|
|
201
|
+
actions.
|
|
202
|
+
entity_type (Optional[ActionEntityTypes]): Entity type where the
|
|
203
|
+
action is triggered. None for global actions.
|
|
204
|
+
entity_ids (Optional[list[str]]): list of entity ids where the
|
|
205
|
+
action is triggered. None for global actions.
|
|
206
|
+
entity_subtypes (Optional[list[str]]): list of entity subtypes
|
|
207
|
+
folder types for folder ids, task types for tasks ids.
|
|
208
|
+
form_data (Optional[dict[str, Any]]): Form data of the action.
|
|
209
|
+
variant (Optional[str]): Settings variant.
|
|
210
|
+
|
|
211
|
+
Returns:
|
|
212
|
+
ActionConfigResponse: New action configuration data.
|
|
213
|
+
|
|
214
|
+
"""
|
|
215
|
+
return self._send_config_request(
|
|
216
|
+
identifier,
|
|
217
|
+
addon_name,
|
|
218
|
+
addon_version,
|
|
219
|
+
value,
|
|
220
|
+
project_name,
|
|
221
|
+
entity_type,
|
|
222
|
+
entity_ids,
|
|
223
|
+
entity_subtypes,
|
|
224
|
+
form_data,
|
|
225
|
+
variant,
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def take_action(self, action_token: str) -> ActionTakeResponse:
|
|
229
|
+
"""Take action metadata using an action token.
|
|
230
|
+
|
|
231
|
+
Args:
|
|
232
|
+
action_token (str): AYON launcher action token.
|
|
233
|
+
|
|
234
|
+
Returns:
|
|
235
|
+
ActionTakeResponse: Action metadata describing how to launch
|
|
236
|
+
action.
|
|
237
|
+
|
|
238
|
+
"""
|
|
239
|
+
response = self.get(f"actions/abort/{action_token}")
|
|
240
|
+
response.raise_for_status()
|
|
241
|
+
return response.data
|
|
242
|
+
|
|
243
|
+
def abort_action(
|
|
244
|
+
self,
|
|
245
|
+
action_token: str,
|
|
246
|
+
message: Optional[str] = None,
|
|
247
|
+
) -> None:
|
|
248
|
+
"""Abort action using an action token.
|
|
249
|
+
|
|
250
|
+
Args:
|
|
251
|
+
action_token (str): AYON launcher action token.
|
|
252
|
+
message (Optional[str]): Message to display in the UI.
|
|
253
|
+
|
|
254
|
+
"""
|
|
255
|
+
if message is None:
|
|
256
|
+
message = "Action aborted"
|
|
257
|
+
response = self.post(
|
|
258
|
+
f"actions/abort/{action_token}",
|
|
259
|
+
message=message,
|
|
260
|
+
)
|
|
261
|
+
response.raise_for_status()
|
|
262
|
+
|
|
263
|
+
def _send_config_request(
|
|
264
|
+
self,
|
|
265
|
+
identifier: str,
|
|
266
|
+
addon_name: str,
|
|
267
|
+
addon_version: str,
|
|
268
|
+
value: Optional[dict[str, Any]],
|
|
269
|
+
project_name: Optional[str],
|
|
270
|
+
entity_type: Optional[ActionEntityTypes],
|
|
271
|
+
entity_ids: Optional[list[str]],
|
|
272
|
+
entity_subtypes: Optional[list[str]],
|
|
273
|
+
form_data: Optional[dict[str, Any]],
|
|
274
|
+
variant: Optional[str],
|
|
275
|
+
) -> ActionConfigResponse:
|
|
276
|
+
"""Set and get action configuration."""
|
|
277
|
+
if variant is None:
|
|
278
|
+
variant = self.get_default_settings_variant()
|
|
279
|
+
query_data = {
|
|
280
|
+
"addonName": addon_name,
|
|
281
|
+
"addonVersion": addon_version,
|
|
282
|
+
"identifier": identifier,
|
|
283
|
+
"variant": variant,
|
|
284
|
+
}
|
|
285
|
+
query = prepare_query_string(query_data)
|
|
286
|
+
|
|
287
|
+
kwargs = {
|
|
288
|
+
query_key: query_value
|
|
289
|
+
for query_key, query_value in (
|
|
290
|
+
("projectName", project_name),
|
|
291
|
+
("entityType", entity_type),
|
|
292
|
+
("entityIds", entity_ids),
|
|
293
|
+
("entitySubtypes", entity_subtypes),
|
|
294
|
+
("formData", form_data),
|
|
295
|
+
)
|
|
296
|
+
if query_value is not None
|
|
297
|
+
}
|
|
298
|
+
if value is not None:
|
|
299
|
+
kwargs["value"] = value
|
|
300
|
+
|
|
301
|
+
response = self.post(f"actions/config{query}", **kwargs)
|
|
302
|
+
response.raise_for_status()
|
|
303
|
+
return response.data
|