Ayon-Python-Api 0.1.10__tar.gz → 0.1.12__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-0.1.10/ayon_python_api.egg-info → ayon-python-api-0.1.12}/PKG-INFO +1 -1
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/__init__.py +52 -18
- ayon-python-api-0.1.10/ayon_api/server_api.py → ayon-python-api-0.1.12/ayon_api/_api.py +214 -20
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/entity_hub.py +2 -2
- ayon-python-api-0.1.12/ayon_api/events.py +52 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/operations.py +1 -1
- ayon-python-api-0.1.10/ayon_api/server.py → ayon-python-api-0.1.12/ayon_api/server_api.py +637 -41
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/utils.py +23 -3
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/version.py +1 -1
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12/ayon_python_api.egg-info}/PKG-INFO +1 -1
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_python_api.egg-info/SOURCES.txt +1 -1
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/pyproject.toml +1 -1
- ayon-python-api-0.1.10/ayon_api/events.py +0 -105
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/LICENSE +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/README.md +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/constants.py +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/exceptions.py +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/graphql.py +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/graphql_queries.py +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_api/thumbnails.py +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_python_api.egg-info/dependency_links.txt +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_python_api.egg-info/requires.txt +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/ayon_python_api.egg-info/top_level.txt +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/setup.cfg +0 -0
- {ayon-python-api-0.1.10 → ayon-python-api-0.1.12}/setup.py +0 -0
|
@@ -2,21 +2,32 @@ from .utils import (
|
|
|
2
2
|
TransferProgress,
|
|
3
3
|
slugify_string,
|
|
4
4
|
)
|
|
5
|
-
from .server import (
|
|
6
|
-
ServerAPIBase,
|
|
7
|
-
)
|
|
8
|
-
|
|
9
5
|
from .server_api import (
|
|
10
6
|
ServerAPI,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
from ._api import (
|
|
10
|
+
GlobalServerAPI,
|
|
11
11
|
ServiceContext,
|
|
12
12
|
|
|
13
13
|
init_service,
|
|
14
|
+
get_service_name,
|
|
15
|
+
get_service_addon_name,
|
|
16
|
+
get_service_addon_version,
|
|
17
|
+
get_service_addon_settings,
|
|
14
18
|
|
|
15
19
|
is_connection_created,
|
|
20
|
+
create_connection,
|
|
16
21
|
close_connection,
|
|
17
22
|
change_token,
|
|
18
23
|
set_environments,
|
|
19
24
|
get_server_api_connection,
|
|
25
|
+
get_site_id,
|
|
26
|
+
set_site_id,
|
|
27
|
+
get_client_version,
|
|
28
|
+
set_client_version,
|
|
29
|
+
get_default_settings_variant,
|
|
30
|
+
set_default_settings_variant,
|
|
20
31
|
|
|
21
32
|
get_base_url,
|
|
22
33
|
get_rest_url,
|
|
@@ -54,12 +65,6 @@ from .server_api import (
|
|
|
54
65
|
upload_dependency_package,
|
|
55
66
|
delete_dependency_package,
|
|
56
67
|
|
|
57
|
-
get_full_production_settings,
|
|
58
|
-
get_production_settings,
|
|
59
|
-
get_full_project_settings,
|
|
60
|
-
get_project_settings,
|
|
61
|
-
get_addon_settings,
|
|
62
|
-
|
|
63
68
|
get_user,
|
|
64
69
|
get_users,
|
|
65
70
|
|
|
@@ -68,6 +73,18 @@ from .server_api import (
|
|
|
68
73
|
|
|
69
74
|
get_project_anatomy_preset,
|
|
70
75
|
get_project_anatomy_presets,
|
|
76
|
+
get_project_roots_by_site,
|
|
77
|
+
get_project_roots_for_site,
|
|
78
|
+
|
|
79
|
+
get_addon_site_settings_schema,
|
|
80
|
+
get_addon_settings_schema,
|
|
81
|
+
|
|
82
|
+
get_addon_studio_settings,
|
|
83
|
+
get_addon_project_settings,
|
|
84
|
+
get_addon_settings,
|
|
85
|
+
get_addons_studio_settings,
|
|
86
|
+
get_addons_project_settings,
|
|
87
|
+
get_addons_settings,
|
|
71
88
|
|
|
72
89
|
get_projects,
|
|
73
90
|
get_project,
|
|
@@ -115,17 +132,29 @@ __all__ = (
|
|
|
115
132
|
"TransferProgress",
|
|
116
133
|
"slugify_string",
|
|
117
134
|
|
|
118
|
-
"ServerAPIBase",
|
|
119
|
-
|
|
120
135
|
"ServerAPI",
|
|
136
|
+
|
|
137
|
+
"GlobalServerAPI",
|
|
121
138
|
"ServiceContext",
|
|
139
|
+
|
|
122
140
|
"init_service",
|
|
141
|
+
"get_service_name",
|
|
142
|
+
"get_service_addon_name",
|
|
143
|
+
"get_service_addon_version",
|
|
144
|
+
"get_service_addon_settings",
|
|
123
145
|
|
|
124
146
|
"is_connection_created",
|
|
147
|
+
"create_connection",
|
|
125
148
|
"close_connection",
|
|
126
149
|
"change_token",
|
|
127
150
|
"set_environments",
|
|
128
151
|
"get_server_api_connection",
|
|
152
|
+
"get_site_id",
|
|
153
|
+
"set_site_id",
|
|
154
|
+
"get_client_version",
|
|
155
|
+
"set_client_version",
|
|
156
|
+
"get_default_settings_variant",
|
|
157
|
+
"set_default_settings_variant",
|
|
129
158
|
|
|
130
159
|
"get_base_url",
|
|
131
160
|
"get_rest_url",
|
|
@@ -163,12 +192,6 @@ __all__ = (
|
|
|
163
192
|
"upload_dependency_package",
|
|
164
193
|
"delete_dependency_package",
|
|
165
194
|
|
|
166
|
-
"get_full_production_settings",
|
|
167
|
-
"get_production_settings",
|
|
168
|
-
"get_full_project_settings",
|
|
169
|
-
"get_project_settings",
|
|
170
|
-
"get_addon_settings",
|
|
171
|
-
|
|
172
195
|
"get_user",
|
|
173
196
|
"get_users",
|
|
174
197
|
|
|
@@ -177,6 +200,17 @@ __all__ = (
|
|
|
177
200
|
|
|
178
201
|
"get_project_anatomy_preset",
|
|
179
202
|
"get_project_anatomy_presets",
|
|
203
|
+
"get_project_roots_by_site",
|
|
204
|
+
"get_project_roots_for_site",
|
|
205
|
+
|
|
206
|
+
"get_addon_site_settings_schema",
|
|
207
|
+
"get_addon_settings_schema",
|
|
208
|
+
"get_addon_studio_settings",
|
|
209
|
+
"get_addon_project_settings",
|
|
210
|
+
"get_addon_settings",
|
|
211
|
+
"get_addons_studio_settings",
|
|
212
|
+
"get_addons_project_settings",
|
|
213
|
+
"get_addons_settings",
|
|
180
214
|
|
|
181
215
|
"get_projects",
|
|
182
216
|
"get_project",
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
"""Singleton based server api for direct access.
|
|
2
|
+
|
|
3
|
+
This implementation will be probably the most used part of package. Gives
|
|
4
|
+
option to have singleton connection to Server URL based on environment variable
|
|
5
|
+
values. All public functions and classes are imported in '__init__.py' so
|
|
6
|
+
they're available directly in top module import.
|
|
7
|
+
"""
|
|
8
|
+
|
|
1
9
|
import os
|
|
2
10
|
import socket
|
|
3
11
|
|
|
@@ -5,11 +13,11 @@ from .constants import (
|
|
|
5
13
|
SERVER_URL_ENV_KEY,
|
|
6
14
|
SERVER_TOKEN_ENV_KEY,
|
|
7
15
|
)
|
|
8
|
-
from .
|
|
16
|
+
from .server_api import ServerAPI
|
|
9
17
|
from .exceptions import FailedServiceInit
|
|
10
18
|
|
|
11
19
|
|
|
12
|
-
class ServerAPI
|
|
20
|
+
class GlobalServerAPI(ServerAPI):
|
|
13
21
|
"""Extended server api which also handles storing tokens and url.
|
|
14
22
|
|
|
15
23
|
Created object expect to have set environment variables
|
|
@@ -17,11 +25,11 @@ class ServerAPI(ServerAPIBase):
|
|
|
17
25
|
but that can be filled afterwards with calling 'login' method.
|
|
18
26
|
"""
|
|
19
27
|
|
|
20
|
-
def __init__(self):
|
|
28
|
+
def __init__(self, site_id=None, client_version=None):
|
|
21
29
|
url = self.get_url()
|
|
22
30
|
token = self.get_token()
|
|
23
31
|
|
|
24
|
-
super(
|
|
32
|
+
super(GlobalServerAPI, self).__init__(url, token, site_id, client_version)
|
|
25
33
|
|
|
26
34
|
self.validate_server_availability()
|
|
27
35
|
self.create_session()
|
|
@@ -34,7 +42,7 @@ class ServerAPI(ServerAPIBase):
|
|
|
34
42
|
"""
|
|
35
43
|
|
|
36
44
|
previous_token = self._access_token
|
|
37
|
-
super(
|
|
45
|
+
super(GlobalServerAPI, self).login(username, password)
|
|
38
46
|
if self.has_valid_token and previous_token != self._access_token:
|
|
39
47
|
os.environ[SERVER_TOKEN_ENV_KEY] = self._access_token
|
|
40
48
|
|
|
@@ -74,7 +82,7 @@ class GlobalContext:
|
|
|
74
82
|
|
|
75
83
|
@classmethod
|
|
76
84
|
def change_token(cls, url, token):
|
|
77
|
-
|
|
85
|
+
GlobalServerAPI.set_environments(url, token)
|
|
78
86
|
if cls._connection is None:
|
|
79
87
|
return
|
|
80
88
|
|
|
@@ -89,10 +97,17 @@ class GlobalContext:
|
|
|
89
97
|
cls._connection.close_session()
|
|
90
98
|
cls._connection = None
|
|
91
99
|
|
|
100
|
+
@classmethod
|
|
101
|
+
def create_connection(cls, *args, **kwargs):
|
|
102
|
+
if cls._connection is not None:
|
|
103
|
+
cls.close_connection()
|
|
104
|
+
cls._connection = GlobalServerAPI(*args, **kwargs)
|
|
105
|
+
return cls._connection
|
|
106
|
+
|
|
92
107
|
@classmethod
|
|
93
108
|
def get_server_api_connection(cls):
|
|
94
109
|
if cls._connection is None:
|
|
95
|
-
cls.
|
|
110
|
+
cls.create_connection()
|
|
96
111
|
return cls._connection
|
|
97
112
|
|
|
98
113
|
|
|
@@ -170,8 +185,8 @@ class ServiceContext:
|
|
|
170
185
|
cls.addon_version = addon_version
|
|
171
186
|
cls.service_name = service_name or socket.gethostname()
|
|
172
187
|
|
|
173
|
-
# Make sure required environments for
|
|
174
|
-
|
|
188
|
+
# Make sure required environments for GlobalServerAPI are set
|
|
189
|
+
GlobalServerAPI.set_environments(cls.server_url, cls.token)
|
|
175
190
|
|
|
176
191
|
if connect:
|
|
177
192
|
print("Connecting to server \"{}\"".format(server_url))
|
|
@@ -181,9 +196,74 @@ class ServiceContext:
|
|
|
181
196
|
|
|
182
197
|
|
|
183
198
|
def init_service(*args, **kwargs):
|
|
199
|
+
"""Initialize current connection from service.
|
|
200
|
+
|
|
201
|
+
The service expect specific environment variables. The variables must all
|
|
202
|
+
be set to make the connection work as a service.
|
|
203
|
+
"""
|
|
204
|
+
|
|
184
205
|
ServiceContext.init_service(*args, **kwargs)
|
|
185
206
|
|
|
186
207
|
|
|
208
|
+
def get_service_addon_name():
|
|
209
|
+
"""Name of addon which initialized service connection.
|
|
210
|
+
|
|
211
|
+
Service context must be initialized to be able to use this function. Call
|
|
212
|
+
'init_service' on you service start to do so.
|
|
213
|
+
|
|
214
|
+
Returns:
|
|
215
|
+
Union[str, None]: Name of addon or None.
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
return ServiceContext.addon_name
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
def get_service_addon_version():
|
|
222
|
+
"""Version of addon which initialized service connection.
|
|
223
|
+
|
|
224
|
+
Service context must be initialized to be able to use this function. Call
|
|
225
|
+
'init_service' on you service start to do so.
|
|
226
|
+
|
|
227
|
+
Returns:
|
|
228
|
+
Union[str, None]: Version of addon or None.
|
|
229
|
+
"""
|
|
230
|
+
|
|
231
|
+
return ServiceContext.addon_version
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def get_service_name():
|
|
235
|
+
"""Name of service.
|
|
236
|
+
|
|
237
|
+
Service context must be initialized to be able to use this function. Call
|
|
238
|
+
'init_service' on you service start to do so.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
Union[str, None]: Name of service if service was registered.
|
|
242
|
+
"""
|
|
243
|
+
|
|
244
|
+
return ServiceContext.service_name
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
def get_service_addon_settings():
|
|
248
|
+
"""Addon settings of service which initialized service.
|
|
249
|
+
|
|
250
|
+
Service context must be initialized to be able to use this function. Call
|
|
251
|
+
'init_service' on you service start to do so.
|
|
252
|
+
|
|
253
|
+
Returns:
|
|
254
|
+
Dict[str, Any]: Addon settings.
|
|
255
|
+
|
|
256
|
+
Raises:
|
|
257
|
+
ValueError: When service was not initialized.
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
addon_name = get_service_addon_name()
|
|
261
|
+
addon_version = get_service_addon_version()
|
|
262
|
+
if addon_name is None or addon_version is None:
|
|
263
|
+
raise ValueError("Service is not initialized")
|
|
264
|
+
return get_addon_settings(addon_name, addon_version)
|
|
265
|
+
|
|
266
|
+
|
|
187
267
|
def is_connection_created():
|
|
188
268
|
"""Is global connection created.
|
|
189
269
|
|
|
@@ -194,6 +274,20 @@ def is_connection_created():
|
|
|
194
274
|
return GlobalContext.is_connection_created()
|
|
195
275
|
|
|
196
276
|
|
|
277
|
+
def create_connection(site_id=None, client_version=None):
|
|
278
|
+
"""Create global connection.
|
|
279
|
+
|
|
280
|
+
Args:
|
|
281
|
+
site_id (str): Machine site id/name.
|
|
282
|
+
client_version (str): Desktop app version.
|
|
283
|
+
|
|
284
|
+
Returns:
|
|
285
|
+
GlobalServerAPI: Created connection.
|
|
286
|
+
"""
|
|
287
|
+
|
|
288
|
+
return GlobalContext.create_connection(site_id, client_version)
|
|
289
|
+
|
|
290
|
+
|
|
197
291
|
def close_connection():
|
|
198
292
|
"""Close global connection if is connected."""
|
|
199
293
|
|
|
@@ -221,22 +315,92 @@ def set_environments(url, token):
|
|
|
221
315
|
token (Union[str, None]): API key token to be used for connection.
|
|
222
316
|
"""
|
|
223
317
|
|
|
224
|
-
|
|
318
|
+
GlobalServerAPI.set_environments(url, token)
|
|
225
319
|
|
|
226
320
|
|
|
227
321
|
def get_server_api_connection():
|
|
228
|
-
"""Access to global scope object of
|
|
322
|
+
"""Access to global scope object of GlobalServerAPI.
|
|
229
323
|
|
|
230
324
|
This access expect to have set environment variables 'AYON_SERVER_URL'
|
|
231
325
|
and 'AYON_TOKEN'.
|
|
232
326
|
|
|
233
327
|
Returns:
|
|
234
|
-
|
|
328
|
+
GlobalServerAPI: Object of connection to server.
|
|
235
329
|
"""
|
|
236
330
|
|
|
237
331
|
return GlobalContext.get_server_api_connection()
|
|
238
332
|
|
|
239
333
|
|
|
334
|
+
def get_site_id():
|
|
335
|
+
con = get_server_api_connection()
|
|
336
|
+
return con.get_site_id()
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
def set_site_id(site_id):
|
|
340
|
+
"""Set site id of already connected client connection.
|
|
341
|
+
|
|
342
|
+
Site id is human-readable machine id used in AYON desktop application.
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
site_id (Union[str, None]): Site id used in connection.
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
con = get_server_api_connection()
|
|
349
|
+
con.set_site_id(site_id)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
def get_client_version():
|
|
353
|
+
"""Version of client used to connect to server.
|
|
354
|
+
|
|
355
|
+
Client version is AYON client build desktop application.
|
|
356
|
+
|
|
357
|
+
Returns:
|
|
358
|
+
str: Client version string used in connection.
|
|
359
|
+
"""
|
|
360
|
+
|
|
361
|
+
con = get_server_api_connection()
|
|
362
|
+
return con.get_client_version()
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def set_client_version(client_version):
|
|
366
|
+
"""Set version of already connected client connection.
|
|
367
|
+
|
|
368
|
+
Client version is version of AYON desktop application.
|
|
369
|
+
|
|
370
|
+
Args:
|
|
371
|
+
client_version (Union[str, None]): Client version string.
|
|
372
|
+
"""
|
|
373
|
+
|
|
374
|
+
con = get_server_api_connection()
|
|
375
|
+
con.set_client_version(client_version)
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
def get_default_settings_variant():
|
|
379
|
+
"""Default variant used for settings.
|
|
380
|
+
|
|
381
|
+
Returns:
|
|
382
|
+
Union[str, None]: name of variant or None.
|
|
383
|
+
"""
|
|
384
|
+
|
|
385
|
+
con = get_server_api_connection()
|
|
386
|
+
return con.get_client_version()
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
def set_default_settings_variant(variant):
|
|
390
|
+
"""Change default variant for addon settings.
|
|
391
|
+
|
|
392
|
+
Note:
|
|
393
|
+
It is recommended to set only 'production' or 'staging' variants
|
|
394
|
+
as default variant.
|
|
395
|
+
|
|
396
|
+
Args:
|
|
397
|
+
variant (Union[str, None]): Settings variant name.
|
|
398
|
+
"""
|
|
399
|
+
|
|
400
|
+
con = get_server_api_connection()
|
|
401
|
+
return con.set_default_settings_variant(variant)
|
|
402
|
+
|
|
403
|
+
|
|
240
404
|
def get_base_url():
|
|
241
405
|
con = get_server_api_connection()
|
|
242
406
|
return con.get_base_url()
|
|
@@ -397,24 +561,34 @@ def get_project_anatomy_preset(*args, **kwargs):
|
|
|
397
561
|
return con.get_project_anatomy_preset(*args, **kwargs)
|
|
398
562
|
|
|
399
563
|
|
|
400
|
-
def
|
|
564
|
+
def get_project_roots_by_site(*args, **kwargs):
|
|
565
|
+
con = get_server_api_connection()
|
|
566
|
+
return con.get_project_roots(*args, **kwargs)
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
def get_project_roots_for_site(*args, **kwargs):
|
|
570
|
+
con = get_server_api_connection()
|
|
571
|
+
return con.get_project_roots_for_site(*args, **kwargs)
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
def get_addon_settings_schema(*args, **kwargs):
|
|
401
575
|
con = get_server_api_connection()
|
|
402
|
-
return con.
|
|
576
|
+
return con.get_addon_settings_schema(*args, **kwargs)
|
|
403
577
|
|
|
404
578
|
|
|
405
|
-
def
|
|
579
|
+
def get_addon_site_settings_schema(*args, **kwargs):
|
|
406
580
|
con = get_server_api_connection()
|
|
407
|
-
return con.
|
|
581
|
+
return con.get_addon_site_settings_schema(*args, **kwargs)
|
|
408
582
|
|
|
409
583
|
|
|
410
|
-
def
|
|
584
|
+
def get_addon_studio_settings(*args, **kwargs):
|
|
411
585
|
con = get_server_api_connection()
|
|
412
|
-
return con.
|
|
586
|
+
return con.get_addon_studio_settings(*args, **kwargs)
|
|
413
587
|
|
|
414
588
|
|
|
415
|
-
def
|
|
589
|
+
def get_addon_project_settings(*args, **kwargs):
|
|
416
590
|
con = get_server_api_connection()
|
|
417
|
-
return con.
|
|
591
|
+
return con.get_addon_project_settings(*args, **kwargs)
|
|
418
592
|
|
|
419
593
|
|
|
420
594
|
def get_addon_settings(*args, **kwargs):
|
|
@@ -422,6 +596,26 @@ def get_addon_settings(*args, **kwargs):
|
|
|
422
596
|
return con.get_addon_settings(*args, **kwargs)
|
|
423
597
|
|
|
424
598
|
|
|
599
|
+
def get_addon_site_settings(*args, **kwargs):
|
|
600
|
+
con = get_server_api_connection()
|
|
601
|
+
return con.get_addon_site_settings(*args, **kwargs)
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
def get_addons_studio_settings(*args, **kwargs):
|
|
605
|
+
con = get_server_api_connection()
|
|
606
|
+
return con.get_addons_studio_settings(*args, **kwargs)
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
def get_addons_project_settings(*args, **kwargs):
|
|
610
|
+
con = get_server_api_connection()
|
|
611
|
+
return con.get_addons_project_settings(*args, **kwargs)
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
def get_addons_settings(*args, **kwargs):
|
|
615
|
+
con = get_server_api_connection()
|
|
616
|
+
return con.get_addons_settings(*args, **kwargs)
|
|
617
|
+
|
|
618
|
+
|
|
425
619
|
def get_project(*args, **kwargs):
|
|
426
620
|
con = get_server_api_connection()
|
|
427
621
|
return con.get_project(*args, **kwargs)
|
|
@@ -3,7 +3,7 @@ import collections
|
|
|
3
3
|
from abc import ABCMeta, abstractmethod, abstractproperty
|
|
4
4
|
|
|
5
5
|
import six
|
|
6
|
-
from .
|
|
6
|
+
from ._api import get_server_api_connection
|
|
7
7
|
from .utils import create_entity_id, convert_entity_id
|
|
8
8
|
|
|
9
9
|
UNKNOWN_VALUE = object()
|
|
@@ -27,7 +27,7 @@ class EntityHub(object):
|
|
|
27
27
|
|
|
28
28
|
Args:
|
|
29
29
|
project_name (str): Name of project where changes will happen.
|
|
30
|
-
connection (
|
|
30
|
+
connection (ServerAPI): Connection to server with logged user.
|
|
31
31
|
allow_data_changes (bool): This option gives ability to change 'data'
|
|
32
32
|
key on entities. This is not recommended as 'data' may be use for
|
|
33
33
|
secure information and would also slow down server queries. Content
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import copy
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class ServerEvent(object):
|
|
5
|
+
def __init__(
|
|
6
|
+
self,
|
|
7
|
+
topic,
|
|
8
|
+
sender=None,
|
|
9
|
+
event_hash=None,
|
|
10
|
+
project_name=None,
|
|
11
|
+
username=None,
|
|
12
|
+
dependencies=None,
|
|
13
|
+
description=None,
|
|
14
|
+
summary=None,
|
|
15
|
+
payload=None,
|
|
16
|
+
finished=True,
|
|
17
|
+
store=True,
|
|
18
|
+
):
|
|
19
|
+
if dependencies is None:
|
|
20
|
+
dependencies = []
|
|
21
|
+
if payload is None:
|
|
22
|
+
payload = {}
|
|
23
|
+
if summary is None:
|
|
24
|
+
summary = {}
|
|
25
|
+
|
|
26
|
+
self.topic = topic
|
|
27
|
+
self.sender = sender
|
|
28
|
+
self.event_hash = event_hash
|
|
29
|
+
self.project_name = project_name
|
|
30
|
+
self.username = username
|
|
31
|
+
self.dependencies = dependencies
|
|
32
|
+
self.description = description
|
|
33
|
+
self.summary = summary
|
|
34
|
+
self.payload = payload
|
|
35
|
+
self.finished = finished
|
|
36
|
+
self.store = store
|
|
37
|
+
|
|
38
|
+
def to_data(self):
|
|
39
|
+
return {
|
|
40
|
+
"topic": self.topic,
|
|
41
|
+
"sender": self.sender,
|
|
42
|
+
"hash": self.event_hash,
|
|
43
|
+
"project": self.project_name,
|
|
44
|
+
"user": self.username,
|
|
45
|
+
"dependencies": copy.deepcopy(self.dependencies),
|
|
46
|
+
"description": self.description,
|
|
47
|
+
"description": self.description,
|
|
48
|
+
"summary": copy.deepcopy(self.summary),
|
|
49
|
+
"payload": self.payload,
|
|
50
|
+
"finished": self.finished,
|
|
51
|
+
"store": self.store
|
|
52
|
+
}
|