ayon-python-api 1.2.2__py3-none-any.whl → 1.2.3__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.
- ayon_api/__init__.py +14 -2
- ayon_api/_api.py +244 -21
- ayon_api/_api_helpers/base.py +5 -0
- ayon_api/_api_helpers/workfiles.py +291 -35
- ayon_api/entity_hub.py +8 -3
- ayon_api/graphql.py +2 -2
- ayon_api/operations.py +163 -1
- ayon_api/version.py +1 -1
- {ayon_python_api-1.2.2.dist-info → ayon_python_api-1.2.3.dist-info}/METADATA +1 -1
- {ayon_python_api-1.2.2.dist-info → ayon_python_api-1.2.3.dist-info}/RECORD +13 -13
- {ayon_python_api-1.2.2.dist-info → ayon_python_api-1.2.3.dist-info}/LICENSE +0 -0
- {ayon_python_api-1.2.2.dist-info → ayon_python_api-1.2.3.dist-info}/WHEEL +0 -0
- {ayon_python_api-1.2.2.dist-info → ayon_python_api-1.2.3.dist-info}/top_level.txt +0 -0
ayon_api/__init__.py
CHANGED
|
@@ -222,11 +222,17 @@ from ._api import (
|
|
|
222
222
|
create_representation,
|
|
223
223
|
update_representation,
|
|
224
224
|
delete_representation,
|
|
225
|
+
get_workfile_entities,
|
|
226
|
+
get_workfile_entity,
|
|
227
|
+
get_workfile_entity_by_id,
|
|
228
|
+
create_workfile_entity,
|
|
229
|
+
update_workfile_entity,
|
|
230
|
+
delete_workfile_entity,
|
|
225
231
|
get_workfiles_info,
|
|
226
232
|
get_workfile_info,
|
|
227
233
|
get_workfile_info_by_id,
|
|
228
|
-
delete_workfile_info,
|
|
229
234
|
update_workfile_info,
|
|
235
|
+
delete_workfile_info,
|
|
230
236
|
get_full_link_type_name,
|
|
231
237
|
get_link_types,
|
|
232
238
|
get_link_type,
|
|
@@ -491,11 +497,17 @@ __all__ = (
|
|
|
491
497
|
"create_representation",
|
|
492
498
|
"update_representation",
|
|
493
499
|
"delete_representation",
|
|
500
|
+
"get_workfile_entities",
|
|
501
|
+
"get_workfile_entity",
|
|
502
|
+
"get_workfile_entity_by_id",
|
|
503
|
+
"create_workfile_entity",
|
|
504
|
+
"update_workfile_entity",
|
|
505
|
+
"delete_workfile_entity",
|
|
494
506
|
"get_workfiles_info",
|
|
495
507
|
"get_workfile_info",
|
|
496
508
|
"get_workfile_info_by_id",
|
|
497
|
-
"delete_workfile_info",
|
|
498
509
|
"update_workfile_info",
|
|
510
|
+
"delete_workfile_info",
|
|
499
511
|
"get_full_link_type_name",
|
|
500
512
|
"get_link_types",
|
|
501
513
|
"get_link_type",
|
ayon_api/_api.py
CHANGED
|
@@ -6157,8 +6157,9 @@ def delete_representation(
|
|
|
6157
6157
|
)
|
|
6158
6158
|
|
|
6159
6159
|
|
|
6160
|
-
def
|
|
6160
|
+
def get_workfile_entities(
|
|
6161
6161
|
project_name: str,
|
|
6162
|
+
*,
|
|
6162
6163
|
workfile_ids: Optional[Iterable[str]] = None,
|
|
6163
6164
|
task_ids: Optional[Iterable[str]] = None,
|
|
6164
6165
|
paths: Optional[Iterable[str]] = None,
|
|
@@ -6167,7 +6168,6 @@ def get_workfiles_info(
|
|
|
6167
6168
|
tags: Optional[Iterable[str]] = None,
|
|
6168
6169
|
has_links: Optional[str] = None,
|
|
6169
6170
|
fields: Optional[Iterable[str]] = None,
|
|
6170
|
-
own_attributes=_PLACEHOLDER,
|
|
6171
6171
|
) -> Generator[WorkfileInfoDict, None, None]:
|
|
6172
6172
|
"""Workfile info entities by passed filters.
|
|
6173
6173
|
|
|
@@ -6186,8 +6186,6 @@ def get_workfiles_info(
|
|
|
6186
6186
|
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
6187
6187
|
representation. All possible fields are returned if 'None' is
|
|
6188
6188
|
passed.
|
|
6189
|
-
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
6190
|
-
workfiles.
|
|
6191
6189
|
|
|
6192
6190
|
Returns:
|
|
6193
6191
|
Generator[WorkfileInfoDict, None, None]: Queried workfile info
|
|
@@ -6195,7 +6193,7 @@ def get_workfiles_info(
|
|
|
6195
6193
|
|
|
6196
6194
|
"""
|
|
6197
6195
|
con = get_server_api_connection()
|
|
6198
|
-
return con.
|
|
6196
|
+
return con.get_workfile_entities(
|
|
6199
6197
|
project_name=project_name,
|
|
6200
6198
|
workfile_ids=workfile_ids,
|
|
6201
6199
|
task_ids=task_ids,
|
|
@@ -6205,16 +6203,15 @@ def get_workfiles_info(
|
|
|
6205
6203
|
tags=tags,
|
|
6206
6204
|
has_links=has_links,
|
|
6207
6205
|
fields=fields,
|
|
6208
|
-
own_attributes=own_attributes,
|
|
6209
6206
|
)
|
|
6210
6207
|
|
|
6211
6208
|
|
|
6212
|
-
def
|
|
6209
|
+
def get_workfile_entity(
|
|
6213
6210
|
project_name: str,
|
|
6214
6211
|
task_id: str,
|
|
6215
6212
|
path: str,
|
|
6213
|
+
*,
|
|
6216
6214
|
fields: Optional[Iterable[str]] = None,
|
|
6217
|
-
own_attributes=_PLACEHOLDER,
|
|
6218
6215
|
) -> Optional[WorkfileInfoDict]:
|
|
6219
6216
|
"""Workfile info entity by task id and workfile path.
|
|
6220
6217
|
|
|
@@ -6225,28 +6222,25 @@ def get_workfile_info(
|
|
|
6225
6222
|
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
6226
6223
|
representation. All possible fields are returned if 'None' is
|
|
6227
6224
|
passed.
|
|
6228
|
-
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
6229
|
-
workfiles.
|
|
6230
6225
|
|
|
6231
6226
|
Returns:
|
|
6232
6227
|
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
6233
6228
|
|
|
6234
6229
|
"""
|
|
6235
6230
|
con = get_server_api_connection()
|
|
6236
|
-
return con.
|
|
6231
|
+
return con.get_workfile_entity(
|
|
6237
6232
|
project_name=project_name,
|
|
6238
6233
|
task_id=task_id,
|
|
6239
6234
|
path=path,
|
|
6240
6235
|
fields=fields,
|
|
6241
|
-
own_attributes=own_attributes,
|
|
6242
6236
|
)
|
|
6243
6237
|
|
|
6244
6238
|
|
|
6245
|
-
def
|
|
6239
|
+
def get_workfile_entity_by_id(
|
|
6246
6240
|
project_name: str,
|
|
6247
6241
|
workfile_id: str,
|
|
6242
|
+
*,
|
|
6248
6243
|
fields: Optional[Iterable[str]] = None,
|
|
6249
|
-
own_attributes=_PLACEHOLDER,
|
|
6250
6244
|
) -> Optional[WorkfileInfoDict]:
|
|
6251
6245
|
"""Workfile info entity by id.
|
|
6252
6246
|
|
|
@@ -6256,23 +6250,119 @@ def get_workfile_info_by_id(
|
|
|
6256
6250
|
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
6257
6251
|
representation. All possible fields are returned if 'None' is
|
|
6258
6252
|
passed.
|
|
6259
|
-
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
6260
|
-
workfiles.
|
|
6261
6253
|
|
|
6262
6254
|
Returns:
|
|
6263
6255
|
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
6264
6256
|
|
|
6265
6257
|
"""
|
|
6266
6258
|
con = get_server_api_connection()
|
|
6267
|
-
return con.
|
|
6259
|
+
return con.get_workfile_entity_by_id(
|
|
6268
6260
|
project_name=project_name,
|
|
6269
6261
|
workfile_id=workfile_id,
|
|
6270
6262
|
fields=fields,
|
|
6271
|
-
own_attributes=own_attributes,
|
|
6272
6263
|
)
|
|
6273
6264
|
|
|
6274
6265
|
|
|
6275
|
-
def
|
|
6266
|
+
def create_workfile_entity(
|
|
6267
|
+
project_name: str,
|
|
6268
|
+
path: str,
|
|
6269
|
+
task_id: str,
|
|
6270
|
+
*,
|
|
6271
|
+
thumbnail_id: Optional[str] = None,
|
|
6272
|
+
attrib: Optional[dict[str, Any]] = None,
|
|
6273
|
+
data: Optional[dict[str, Any]] = None,
|
|
6274
|
+
tags: Optional[list[str]] = None,
|
|
6275
|
+
status: Optional[str] = None,
|
|
6276
|
+
active: Optional[bool] = None,
|
|
6277
|
+
workfile_id: Optional[str] = None,
|
|
6278
|
+
) -> str:
|
|
6279
|
+
"""Create new workfile.
|
|
6280
|
+
|
|
6281
|
+
Args:
|
|
6282
|
+
project_name (str): Project name.
|
|
6283
|
+
path (str): Representation name.
|
|
6284
|
+
task_id (str): Parent task id.
|
|
6285
|
+
thumbnail_id (Optional[str]): Thumbnail id.
|
|
6286
|
+
attrib (Optional[dict[str, Any]]): Representation attributes.
|
|
6287
|
+
data (Optional[dict[str, Any]]): Representation data.
|
|
6288
|
+
tags (Optional[Iterable[str]]): Representation tags.
|
|
6289
|
+
status (Optional[str]): Representation status.
|
|
6290
|
+
active (Optional[bool]): Representation active state.
|
|
6291
|
+
workfile_id (Optional[str]): Workfile info id. If not
|
|
6292
|
+
passed new id is generated.
|
|
6293
|
+
|
|
6294
|
+
Returns:
|
|
6295
|
+
str: Workfile info id.
|
|
6296
|
+
|
|
6297
|
+
"""
|
|
6298
|
+
con = get_server_api_connection()
|
|
6299
|
+
return con.create_workfile_entity(
|
|
6300
|
+
project_name=project_name,
|
|
6301
|
+
path=path,
|
|
6302
|
+
task_id=task_id,
|
|
6303
|
+
thumbnail_id=thumbnail_id,
|
|
6304
|
+
attrib=attrib,
|
|
6305
|
+
data=data,
|
|
6306
|
+
tags=tags,
|
|
6307
|
+
status=status,
|
|
6308
|
+
active=active,
|
|
6309
|
+
workfile_id=workfile_id,
|
|
6310
|
+
)
|
|
6311
|
+
|
|
6312
|
+
|
|
6313
|
+
def update_workfile_entity(
|
|
6314
|
+
project_name: str,
|
|
6315
|
+
workfile_id: str,
|
|
6316
|
+
*,
|
|
6317
|
+
path: Optional[str] = None,
|
|
6318
|
+
task_id: Optional[str] = None,
|
|
6319
|
+
attrib: Optional[dict[str, Any]] = None,
|
|
6320
|
+
data: Optional[dict[str, Any]] = None,
|
|
6321
|
+
tags: Optional[Iterable[str]] = None,
|
|
6322
|
+
status: Optional[str] = None,
|
|
6323
|
+
active: Optional[bool] = None,
|
|
6324
|
+
thumbnail_id: Optional[str] = NOT_SET,
|
|
6325
|
+
created_by: Optional[str] = None,
|
|
6326
|
+
updated_by: Optional[str] = None,
|
|
6327
|
+
) -> None:
|
|
6328
|
+
"""Update workfile entity on server.
|
|
6329
|
+
|
|
6330
|
+
Update of ``attrib`` does change only passed attributes. If you want
|
|
6331
|
+
to unset value, use ``None``.
|
|
6332
|
+
|
|
6333
|
+
Args:
|
|
6334
|
+
project_name (str): Project name.
|
|
6335
|
+
workfile_id (str): Workfile id.
|
|
6336
|
+
path (Optional[str]): New rootless workfile path..
|
|
6337
|
+
task_id (Optional[str]): New parent task id.
|
|
6338
|
+
attrib (Optional[dict[str, Any]]): New attributes.
|
|
6339
|
+
data (Optional[dict[str, Any]]): New data.
|
|
6340
|
+
tags (Optional[Iterable[str]]): New tags.
|
|
6341
|
+
status (Optional[str]): New status.
|
|
6342
|
+
active (Optional[bool]): New active state.
|
|
6343
|
+
thumbnail_id (Optional[str]): New thumbnail id.
|
|
6344
|
+
created_by (Optional[str]): New created by username.
|
|
6345
|
+
updated_by (Optional[str]): New updated by username.
|
|
6346
|
+
|
|
6347
|
+
"""
|
|
6348
|
+
con = get_server_api_connection()
|
|
6349
|
+
return con.update_workfile_entity(
|
|
6350
|
+
project_name=project_name,
|
|
6351
|
+
workfile_id=workfile_id,
|
|
6352
|
+
path=path,
|
|
6353
|
+
task_id=task_id,
|
|
6354
|
+
attrib=attrib,
|
|
6355
|
+
data=data,
|
|
6356
|
+
tags=tags,
|
|
6357
|
+
status=status,
|
|
6358
|
+
active=active,
|
|
6359
|
+
thumbnail_id=thumbnail_id,
|
|
6360
|
+
created_by=created_by,
|
|
6361
|
+
updated_by=updated_by,
|
|
6362
|
+
)
|
|
6363
|
+
|
|
6364
|
+
|
|
6365
|
+
def delete_workfile_entity(
|
|
6276
6366
|
project_name: str,
|
|
6277
6367
|
workfile_id: str,
|
|
6278
6368
|
) -> None:
|
|
@@ -6284,12 +6374,127 @@ def delete_workfile_info(
|
|
|
6284
6374
|
|
|
6285
6375
|
"""
|
|
6286
6376
|
con = get_server_api_connection()
|
|
6287
|
-
return con.
|
|
6377
|
+
return con.delete_workfile_entity(
|
|
6288
6378
|
project_name=project_name,
|
|
6289
6379
|
workfile_id=workfile_id,
|
|
6290
6380
|
)
|
|
6291
6381
|
|
|
6292
6382
|
|
|
6383
|
+
def get_workfiles_info(
|
|
6384
|
+
project_name: str,
|
|
6385
|
+
workfile_ids: Optional[Iterable[str]] = None,
|
|
6386
|
+
task_ids: Optional[Iterable[str]] = None,
|
|
6387
|
+
paths: Optional[Iterable[str]] = None,
|
|
6388
|
+
path_regex: Optional[str] = None,
|
|
6389
|
+
statuses: Optional[Iterable[str]] = None,
|
|
6390
|
+
tags: Optional[Iterable[str]] = None,
|
|
6391
|
+
has_links: Optional[str] = None,
|
|
6392
|
+
fields: Optional[Iterable[str]] = None,
|
|
6393
|
+
own_attributes=_PLACEHOLDER,
|
|
6394
|
+
) -> Generator[WorkfileInfoDict, None, None]:
|
|
6395
|
+
"""DEPRECATED Workfile info entities by passed filters.
|
|
6396
|
+
|
|
6397
|
+
Args:
|
|
6398
|
+
project_name (str): Project under which the entity is located.
|
|
6399
|
+
workfile_ids (Optional[Iterable[str]]): Workfile ids.
|
|
6400
|
+
task_ids (Optional[Iterable[str]]): Task ids.
|
|
6401
|
+
paths (Optional[Iterable[str]]): Rootless workfiles paths.
|
|
6402
|
+
path_regex (Optional[str]): Regex filter for workfile path.
|
|
6403
|
+
statuses (Optional[Iterable[str]]): Workfile info statuses used
|
|
6404
|
+
for filtering.
|
|
6405
|
+
tags (Optional[Iterable[str]]): Workfile info tags used
|
|
6406
|
+
for filtering.
|
|
6407
|
+
has_links (Optional[Literal[IN, OUT, ANY]]): Filter
|
|
6408
|
+
representations with IN/OUT/ANY links.
|
|
6409
|
+
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
6410
|
+
representation. All possible fields are returned if 'None' is
|
|
6411
|
+
passed.
|
|
6412
|
+
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
6413
|
+
workfiles.
|
|
6414
|
+
|
|
6415
|
+
Returns:
|
|
6416
|
+
Generator[WorkfileInfoDict, None, None]: Queried workfile info
|
|
6417
|
+
entites.
|
|
6418
|
+
|
|
6419
|
+
"""
|
|
6420
|
+
con = get_server_api_connection()
|
|
6421
|
+
return con.get_workfiles_info(
|
|
6422
|
+
project_name=project_name,
|
|
6423
|
+
workfile_ids=workfile_ids,
|
|
6424
|
+
task_ids=task_ids,
|
|
6425
|
+
paths=paths,
|
|
6426
|
+
path_regex=path_regex,
|
|
6427
|
+
statuses=statuses,
|
|
6428
|
+
tags=tags,
|
|
6429
|
+
has_links=has_links,
|
|
6430
|
+
fields=fields,
|
|
6431
|
+
own_attributes=own_attributes,
|
|
6432
|
+
)
|
|
6433
|
+
|
|
6434
|
+
|
|
6435
|
+
def get_workfile_info(
|
|
6436
|
+
project_name: str,
|
|
6437
|
+
task_id: str,
|
|
6438
|
+
path: str,
|
|
6439
|
+
fields: Optional[Iterable[str]] = None,
|
|
6440
|
+
own_attributes=_PLACEHOLDER,
|
|
6441
|
+
) -> Optional[WorkfileInfoDict]:
|
|
6442
|
+
"""DEPRECATED Workfile info entity by task id and workfile path.
|
|
6443
|
+
|
|
6444
|
+
Args:
|
|
6445
|
+
project_name (str): Project under which the entity is located.
|
|
6446
|
+
task_id (str): Task id.
|
|
6447
|
+
path (str): Rootless workfile path.
|
|
6448
|
+
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
6449
|
+
representation. All possible fields are returned if 'None' is
|
|
6450
|
+
passed.
|
|
6451
|
+
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
6452
|
+
workfiles.
|
|
6453
|
+
|
|
6454
|
+
Returns:
|
|
6455
|
+
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
6456
|
+
|
|
6457
|
+
"""
|
|
6458
|
+
con = get_server_api_connection()
|
|
6459
|
+
return con.get_workfile_info(
|
|
6460
|
+
project_name=project_name,
|
|
6461
|
+
task_id=task_id,
|
|
6462
|
+
path=path,
|
|
6463
|
+
fields=fields,
|
|
6464
|
+
own_attributes=own_attributes,
|
|
6465
|
+
)
|
|
6466
|
+
|
|
6467
|
+
|
|
6468
|
+
def get_workfile_info_by_id(
|
|
6469
|
+
project_name: str,
|
|
6470
|
+
workfile_id: str,
|
|
6471
|
+
fields: Optional[Iterable[str]] = None,
|
|
6472
|
+
own_attributes=_PLACEHOLDER,
|
|
6473
|
+
) -> Optional[WorkfileInfoDict]:
|
|
6474
|
+
"""DEPRECATED Workfile info entity by id.
|
|
6475
|
+
|
|
6476
|
+
Args:
|
|
6477
|
+
project_name (str): Project under which the entity is located.
|
|
6478
|
+
workfile_id (str): Workfile info id.
|
|
6479
|
+
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
6480
|
+
representation. All possible fields are returned if 'None' is
|
|
6481
|
+
passed.
|
|
6482
|
+
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
6483
|
+
workfiles.
|
|
6484
|
+
|
|
6485
|
+
Returns:
|
|
6486
|
+
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
6487
|
+
|
|
6488
|
+
"""
|
|
6489
|
+
con = get_server_api_connection()
|
|
6490
|
+
return con.get_workfile_info_by_id(
|
|
6491
|
+
project_name=project_name,
|
|
6492
|
+
workfile_id=workfile_id,
|
|
6493
|
+
fields=fields,
|
|
6494
|
+
own_attributes=own_attributes,
|
|
6495
|
+
)
|
|
6496
|
+
|
|
6497
|
+
|
|
6293
6498
|
def update_workfile_info(
|
|
6294
6499
|
project_name: str,
|
|
6295
6500
|
workfile_id: str,
|
|
@@ -6304,7 +6509,7 @@ def update_workfile_info(
|
|
|
6304
6509
|
created_by: Optional[str] = None,
|
|
6305
6510
|
updated_by: Optional[str] = None,
|
|
6306
6511
|
) -> None:
|
|
6307
|
-
"""Update workfile entity on server.
|
|
6512
|
+
"""DEPRECATED Update workfile entity on server.
|
|
6308
6513
|
|
|
6309
6514
|
Update of ``attrib`` does change only passed attributes. If you want
|
|
6310
6515
|
to unset value, use ``None``.
|
|
@@ -6341,6 +6546,24 @@ def update_workfile_info(
|
|
|
6341
6546
|
)
|
|
6342
6547
|
|
|
6343
6548
|
|
|
6549
|
+
def delete_workfile_info(
|
|
6550
|
+
project_name: str,
|
|
6551
|
+
workfile_id: str,
|
|
6552
|
+
) -> None:
|
|
6553
|
+
"""DEPRECATED Delete workfile entity on server.
|
|
6554
|
+
|
|
6555
|
+
Args:
|
|
6556
|
+
project_name (str): Project name.
|
|
6557
|
+
workfile_id (str): Workfile id to delete.
|
|
6558
|
+
|
|
6559
|
+
"""
|
|
6560
|
+
con = get_server_api_connection()
|
|
6561
|
+
return con.delete_workfile_info(
|
|
6562
|
+
project_name=project_name,
|
|
6563
|
+
workfile_id=workfile_id,
|
|
6564
|
+
)
|
|
6565
|
+
|
|
6566
|
+
|
|
6344
6567
|
def get_full_link_type_name(
|
|
6345
6568
|
link_type_name: str,
|
|
6346
6569
|
input_type: str,
|
ayon_api/_api_helpers/base.py
CHANGED
|
@@ -109,6 +109,11 @@ class BaseServerAPI:
|
|
|
109
109
|
) -> Optional[ProjectDict]:
|
|
110
110
|
raise NotImplementedError()
|
|
111
111
|
|
|
112
|
+
def get_user(
|
|
113
|
+
self, username: Optional[str] = None
|
|
114
|
+
) -> Optional[dict[str, Any]]:
|
|
115
|
+
raise NotImplementedError()
|
|
116
|
+
|
|
112
117
|
def _prepare_fields(
|
|
113
118
|
self,
|
|
114
119
|
entity_type: str,
|
|
@@ -5,7 +5,8 @@ import typing
|
|
|
5
5
|
from typing import Optional, Iterable, Generator, Any
|
|
6
6
|
|
|
7
7
|
from ayon_api.graphql_queries import workfiles_info_graphql_query
|
|
8
|
-
from ayon_api.utils import NOT_SET
|
|
8
|
+
from ayon_api.utils import NOT_SET, create_entity_id
|
|
9
|
+
|
|
9
10
|
from .base import BaseServerAPI, _PLACEHOLDER
|
|
10
11
|
|
|
11
12
|
if typing.TYPE_CHECKING:
|
|
@@ -13,9 +14,10 @@ if typing.TYPE_CHECKING:
|
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class WorkfilesAPI(BaseServerAPI):
|
|
16
|
-
def
|
|
17
|
+
def get_workfile_entities(
|
|
17
18
|
self,
|
|
18
19
|
project_name: str,
|
|
20
|
+
*,
|
|
19
21
|
workfile_ids: Optional[Iterable[str]] = None,
|
|
20
22
|
task_ids: Optional[Iterable[str]] =None,
|
|
21
23
|
paths: Optional[Iterable[str]] =None,
|
|
@@ -24,7 +26,6 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
24
26
|
tags: Optional[Iterable[str]] = None,
|
|
25
27
|
has_links: Optional[str]=None,
|
|
26
28
|
fields: Optional[Iterable[str]] = None,
|
|
27
|
-
own_attributes=_PLACEHOLDER,
|
|
28
29
|
) -> Generator[WorkfileInfoDict, None, None]:
|
|
29
30
|
"""Workfile info entities by passed filters.
|
|
30
31
|
|
|
@@ -43,8 +44,6 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
43
44
|
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
44
45
|
representation. All possible fields are returned if 'None' is
|
|
45
46
|
passed.
|
|
46
|
-
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
47
|
-
workfiles.
|
|
48
47
|
|
|
49
48
|
Returns:
|
|
50
49
|
Generator[WorkfileInfoDict, None, None]: Queried workfile info
|
|
@@ -94,16 +93,6 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
94
93
|
fields = set(fields)
|
|
95
94
|
self._prepare_fields("workfile", fields)
|
|
96
95
|
|
|
97
|
-
if own_attributes is not _PLACEHOLDER:
|
|
98
|
-
warnings.warn(
|
|
99
|
-
(
|
|
100
|
-
"'own_attributes' is not supported for workfiles. The"
|
|
101
|
-
" argument will be removed form function signature in"
|
|
102
|
-
" future (apx. version 1.0.10 or 1.1.0)."
|
|
103
|
-
),
|
|
104
|
-
DeprecationWarning
|
|
105
|
-
)
|
|
106
|
-
|
|
107
96
|
query = workfiles_info_graphql_query(fields)
|
|
108
97
|
|
|
109
98
|
for attr, filter_value in filters.items():
|
|
@@ -114,13 +103,13 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
114
103
|
self._convert_entity_data(workfile_info)
|
|
115
104
|
yield workfile_info
|
|
116
105
|
|
|
117
|
-
def
|
|
106
|
+
def get_workfile_entity(
|
|
118
107
|
self,
|
|
119
108
|
project_name: str,
|
|
120
109
|
task_id: str,
|
|
121
110
|
path: str,
|
|
111
|
+
*,
|
|
122
112
|
fields: Optional[Iterable[str]] = None,
|
|
123
|
-
own_attributes=_PLACEHOLDER,
|
|
124
113
|
) -> Optional[WorkfileInfoDict]:
|
|
125
114
|
"""Workfile info entity by task id and workfile path.
|
|
126
115
|
|
|
@@ -131,8 +120,6 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
131
120
|
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
132
121
|
representation. All possible fields are returned if 'None' is
|
|
133
122
|
passed.
|
|
134
|
-
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
135
|
-
workfiles.
|
|
136
123
|
|
|
137
124
|
Returns:
|
|
138
125
|
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
@@ -141,22 +128,21 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
141
128
|
if not task_id or not path:
|
|
142
129
|
return None
|
|
143
130
|
|
|
144
|
-
for workfile_info in self.
|
|
131
|
+
for workfile_info in self.get_workfile_entities(
|
|
145
132
|
project_name,
|
|
146
133
|
task_ids=[task_id],
|
|
147
134
|
paths=[path],
|
|
148
135
|
fields=fields,
|
|
149
|
-
own_attributes=own_attributes
|
|
150
136
|
):
|
|
151
137
|
return workfile_info
|
|
152
138
|
return None
|
|
153
139
|
|
|
154
|
-
def
|
|
140
|
+
def get_workfile_entity_by_id(
|
|
155
141
|
self,
|
|
156
142
|
project_name: str,
|
|
157
143
|
workfile_id: str,
|
|
144
|
+
*,
|
|
158
145
|
fields: Optional[Iterable[str]] = None,
|
|
159
|
-
own_attributes=_PLACEHOLDER,
|
|
160
146
|
) -> Optional[WorkfileInfoDict]:
|
|
161
147
|
"""Workfile info entity by id.
|
|
162
148
|
|
|
@@ -166,8 +152,6 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
166
152
|
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
167
153
|
representation. All possible fields are returned if 'None' is
|
|
168
154
|
passed.
|
|
169
|
-
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
170
|
-
workfiles.
|
|
171
155
|
|
|
172
156
|
Returns:
|
|
173
157
|
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
@@ -176,36 +160,85 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
176
160
|
if not workfile_id:
|
|
177
161
|
return None
|
|
178
162
|
|
|
179
|
-
for workfile_info in self.
|
|
163
|
+
for workfile_info in self.get_workfile_entities(
|
|
180
164
|
project_name,
|
|
181
165
|
workfile_ids=[workfile_id],
|
|
182
166
|
fields=fields,
|
|
183
|
-
own_attributes=own_attributes
|
|
184
167
|
):
|
|
185
168
|
return workfile_info
|
|
186
169
|
return None
|
|
187
170
|
|
|
188
|
-
def
|
|
171
|
+
def create_workfile_entity(
|
|
189
172
|
self,
|
|
190
173
|
project_name: str,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
174
|
+
path: str,
|
|
175
|
+
task_id: str,
|
|
176
|
+
*,
|
|
177
|
+
thumbnail_id: Optional[str] = None,
|
|
178
|
+
attrib: Optional[dict[str, Any]] = None,
|
|
179
|
+
data: Optional[dict[str, Any]] = None,
|
|
180
|
+
tags: Optional[list[str]] = None,
|
|
181
|
+
status: Optional[str] = None,
|
|
182
|
+
active: Optional[bool] = None,
|
|
183
|
+
workfile_id: Optional[str] = None,
|
|
184
|
+
) -> str:
|
|
185
|
+
"""Create new workfile.
|
|
194
186
|
|
|
195
187
|
Args:
|
|
196
188
|
project_name (str): Project name.
|
|
197
|
-
|
|
189
|
+
path (str): Representation name.
|
|
190
|
+
task_id (str): Parent task id.
|
|
191
|
+
thumbnail_id (Optional[str]): Thumbnail id.
|
|
192
|
+
attrib (Optional[dict[str, Any]]): Representation attributes.
|
|
193
|
+
data (Optional[dict[str, Any]]): Representation data.
|
|
194
|
+
tags (Optional[Iterable[str]]): Representation tags.
|
|
195
|
+
status (Optional[str]): Representation status.
|
|
196
|
+
active (Optional[bool]): Representation active state.
|
|
197
|
+
workfile_id (Optional[str]): Workfile info id. If not
|
|
198
|
+
passed new id is generated.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
str: Workfile info id.
|
|
198
202
|
|
|
199
203
|
"""
|
|
200
|
-
|
|
201
|
-
|
|
204
|
+
if workfile_id is None:
|
|
205
|
+
workfile_id = create_entity_id()
|
|
206
|
+
|
|
207
|
+
create_data = {
|
|
208
|
+
"id": workfile_id,
|
|
209
|
+
"path": path,
|
|
210
|
+
"taskId": task_id,
|
|
211
|
+
}
|
|
212
|
+
for key, value in (
|
|
213
|
+
("thumbnailId", thumbnail_id),
|
|
214
|
+
("attrib", attrib),
|
|
215
|
+
("data", data),
|
|
216
|
+
("tags", tags),
|
|
217
|
+
("status", status),
|
|
218
|
+
("active", active),
|
|
219
|
+
):
|
|
220
|
+
if value is not None:
|
|
221
|
+
create_data[key] = value
|
|
222
|
+
|
|
223
|
+
major, minor, patch, _, _ = self.get_server_version_tuple()
|
|
224
|
+
if (major, minor, patch) < (1, 1, 3):
|
|
225
|
+
user = self.get_user()
|
|
226
|
+
username = user["name"]
|
|
227
|
+
create_data["createdBy"] = username
|
|
228
|
+
create_data["updatedBy"] = username
|
|
229
|
+
|
|
230
|
+
response = self.post(
|
|
231
|
+
f"projects/{project_name}/workfiles",
|
|
232
|
+
**create_data
|
|
202
233
|
)
|
|
203
234
|
response.raise_for_status()
|
|
235
|
+
return workfile_id
|
|
204
236
|
|
|
205
|
-
def
|
|
237
|
+
def update_workfile_entity(
|
|
206
238
|
self,
|
|
207
239
|
project_name: str,
|
|
208
240
|
workfile_id: str,
|
|
241
|
+
*,
|
|
209
242
|
path: Optional[str] = None,
|
|
210
243
|
task_id: Optional[str] = None,
|
|
211
244
|
attrib: Optional[dict[str, Any]] = None,
|
|
@@ -263,3 +296,226 @@ class WorkfilesAPI(BaseServerAPI):
|
|
|
263
296
|
**update_data
|
|
264
297
|
)
|
|
265
298
|
response.raise_for_status()
|
|
299
|
+
|
|
300
|
+
def delete_workfile_entity(
|
|
301
|
+
self,
|
|
302
|
+
project_name: str,
|
|
303
|
+
workfile_id: str,
|
|
304
|
+
) -> None:
|
|
305
|
+
"""Delete workfile entity on server.
|
|
306
|
+
|
|
307
|
+
Args:
|
|
308
|
+
project_name (str): Project name.
|
|
309
|
+
workfile_id (str): Workfile id to delete.
|
|
310
|
+
|
|
311
|
+
"""
|
|
312
|
+
response = self.delete(
|
|
313
|
+
f"projects/{project_name}/workfiles/{workfile_id}"
|
|
314
|
+
)
|
|
315
|
+
response.raise_for_status()
|
|
316
|
+
|
|
317
|
+
# --- DEPRECATED ---
|
|
318
|
+
def get_workfiles_info(
|
|
319
|
+
self,
|
|
320
|
+
project_name: str,
|
|
321
|
+
workfile_ids: Optional[Iterable[str]] = None,
|
|
322
|
+
task_ids: Optional[Iterable[str]] =None,
|
|
323
|
+
paths: Optional[Iterable[str]] =None,
|
|
324
|
+
path_regex: Optional[str] = None,
|
|
325
|
+
statuses: Optional[Iterable[str]] = None,
|
|
326
|
+
tags: Optional[Iterable[str]] = None,
|
|
327
|
+
has_links: Optional[str]=None,
|
|
328
|
+
fields: Optional[Iterable[str]] = None,
|
|
329
|
+
own_attributes=_PLACEHOLDER,
|
|
330
|
+
) -> Generator[WorkfileInfoDict, None, None]:
|
|
331
|
+
"""DEPRECATED Workfile info entities by passed filters.
|
|
332
|
+
|
|
333
|
+
Args:
|
|
334
|
+
project_name (str): Project under which the entity is located.
|
|
335
|
+
workfile_ids (Optional[Iterable[str]]): Workfile ids.
|
|
336
|
+
task_ids (Optional[Iterable[str]]): Task ids.
|
|
337
|
+
paths (Optional[Iterable[str]]): Rootless workfiles paths.
|
|
338
|
+
path_regex (Optional[str]): Regex filter for workfile path.
|
|
339
|
+
statuses (Optional[Iterable[str]]): Workfile info statuses used
|
|
340
|
+
for filtering.
|
|
341
|
+
tags (Optional[Iterable[str]]): Workfile info tags used
|
|
342
|
+
for filtering.
|
|
343
|
+
has_links (Optional[Literal[IN, OUT, ANY]]): Filter
|
|
344
|
+
representations with IN/OUT/ANY links.
|
|
345
|
+
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
346
|
+
representation. All possible fields are returned if 'None' is
|
|
347
|
+
passed.
|
|
348
|
+
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
349
|
+
workfiles.
|
|
350
|
+
|
|
351
|
+
Returns:
|
|
352
|
+
Generator[WorkfileInfoDict, None, None]: Queried workfile info
|
|
353
|
+
entites.
|
|
354
|
+
|
|
355
|
+
"""
|
|
356
|
+
if own_attributes is not _PLACEHOLDER:
|
|
357
|
+
warnings.warn(
|
|
358
|
+
(
|
|
359
|
+
"'own_attributes' is not supported for workfiles. The"
|
|
360
|
+
" argument will be removed form function signature in"
|
|
361
|
+
" future (apx. version 1.0.10 or 1.1.0)."
|
|
362
|
+
),
|
|
363
|
+
DeprecationWarning,
|
|
364
|
+
stacklevel=2,
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
return self.get_workfile_entities(
|
|
368
|
+
project_name,
|
|
369
|
+
workfile_ids=workfile_ids,
|
|
370
|
+
task_ids=task_ids,
|
|
371
|
+
paths=paths,
|
|
372
|
+
path_regex=path_regex,
|
|
373
|
+
statuses=statuses,
|
|
374
|
+
tags=tags,
|
|
375
|
+
has_links=has_links,
|
|
376
|
+
fields=fields,
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
def get_workfile_info(
|
|
380
|
+
self,
|
|
381
|
+
project_name: str,
|
|
382
|
+
task_id: str,
|
|
383
|
+
path: str,
|
|
384
|
+
fields: Optional[Iterable[str]] = None,
|
|
385
|
+
own_attributes=_PLACEHOLDER,
|
|
386
|
+
) -> Optional[WorkfileInfoDict]:
|
|
387
|
+
"""DEPRECATED Workfile info entity by task id and workfile path.
|
|
388
|
+
|
|
389
|
+
Args:
|
|
390
|
+
project_name (str): Project under which the entity is located.
|
|
391
|
+
task_id (str): Task id.
|
|
392
|
+
path (str): Rootless workfile path.
|
|
393
|
+
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
394
|
+
representation. All possible fields are returned if 'None' is
|
|
395
|
+
passed.
|
|
396
|
+
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
397
|
+
workfiles.
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
401
|
+
|
|
402
|
+
"""
|
|
403
|
+
if own_attributes is not _PLACEHOLDER:
|
|
404
|
+
warnings.warn(
|
|
405
|
+
(
|
|
406
|
+
"'own_attributes' is not supported for workfiles. The"
|
|
407
|
+
" argument will be removed form function signature in"
|
|
408
|
+
" future (apx. version 1.0.10 or 1.1.0)."
|
|
409
|
+
),
|
|
410
|
+
DeprecationWarning,
|
|
411
|
+
stacklevel=2,
|
|
412
|
+
)
|
|
413
|
+
|
|
414
|
+
return self.get_workfile_entity(
|
|
415
|
+
project_name, task_id, path,fields=fields
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
def get_workfile_info_by_id(
|
|
419
|
+
self,
|
|
420
|
+
project_name: str,
|
|
421
|
+
workfile_id: str,
|
|
422
|
+
fields: Optional[Iterable[str]] = None,
|
|
423
|
+
own_attributes=_PLACEHOLDER,
|
|
424
|
+
) -> Optional[WorkfileInfoDict]:
|
|
425
|
+
"""DEPRECATED Workfile info entity by id.
|
|
426
|
+
|
|
427
|
+
Args:
|
|
428
|
+
project_name (str): Project under which the entity is located.
|
|
429
|
+
workfile_id (str): Workfile info id.
|
|
430
|
+
fields (Optional[Iterable[str]]): Fields to be queried for
|
|
431
|
+
representation. All possible fields are returned if 'None' is
|
|
432
|
+
passed.
|
|
433
|
+
own_attributes (Optional[bool]): DEPRECATED: Not supported for
|
|
434
|
+
workfiles.
|
|
435
|
+
|
|
436
|
+
Returns:
|
|
437
|
+
Optional[WorkfileInfoDict]: Workfile info entity or None.
|
|
438
|
+
|
|
439
|
+
"""
|
|
440
|
+
if own_attributes is not _PLACEHOLDER:
|
|
441
|
+
warnings.warn(
|
|
442
|
+
(
|
|
443
|
+
"'own_attributes' is not supported for workfiles. The"
|
|
444
|
+
" argument will be removed form function signature in"
|
|
445
|
+
" future (apx. version 1.0.10 or 1.1.0)."
|
|
446
|
+
),
|
|
447
|
+
DeprecationWarning,
|
|
448
|
+
stacklevel=2,
|
|
449
|
+
)
|
|
450
|
+
return self.get_workfile_entity_by_id(
|
|
451
|
+
project_name,
|
|
452
|
+
workfile_id,
|
|
453
|
+
fields=fields,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
def update_workfile_info(
|
|
457
|
+
self,
|
|
458
|
+
project_name: str,
|
|
459
|
+
workfile_id: str,
|
|
460
|
+
path: Optional[str] = None,
|
|
461
|
+
task_id: Optional[str] = None,
|
|
462
|
+
attrib: Optional[dict[str, Any]] = None,
|
|
463
|
+
data: Optional[dict[str, Any]] = None,
|
|
464
|
+
tags: Optional[Iterable[str]] = None,
|
|
465
|
+
status: Optional[str] = None,
|
|
466
|
+
active: Optional[bool] = None,
|
|
467
|
+
thumbnail_id: Optional[str] = NOT_SET,
|
|
468
|
+
created_by: Optional[str] = None,
|
|
469
|
+
updated_by: Optional[str] = None,
|
|
470
|
+
) -> None:
|
|
471
|
+
"""DEPRECATED Update workfile entity on server.
|
|
472
|
+
|
|
473
|
+
Update of ``attrib`` does change only passed attributes. If you want
|
|
474
|
+
to unset value, use ``None``.
|
|
475
|
+
|
|
476
|
+
Args:
|
|
477
|
+
project_name (str): Project name.
|
|
478
|
+
workfile_id (str): Workfile id.
|
|
479
|
+
path (Optional[str]): New rootless workfile path..
|
|
480
|
+
task_id (Optional[str]): New parent task id.
|
|
481
|
+
attrib (Optional[dict[str, Any]]): New attributes.
|
|
482
|
+
data (Optional[dict[str, Any]]): New data.
|
|
483
|
+
tags (Optional[Iterable[str]]): New tags.
|
|
484
|
+
status (Optional[str]): New status.
|
|
485
|
+
active (Optional[bool]): New active state.
|
|
486
|
+
thumbnail_id (Optional[str]): New thumbnail id.
|
|
487
|
+
created_by (Optional[str]): New created by username.
|
|
488
|
+
updated_by (Optional[str]): New updated by username.
|
|
489
|
+
|
|
490
|
+
"""
|
|
491
|
+
return self.update_workfile_entity(
|
|
492
|
+
project_name,
|
|
493
|
+
workfile_id,
|
|
494
|
+
path=path,
|
|
495
|
+
task_id=task_id,
|
|
496
|
+
attrib=attrib,
|
|
497
|
+
data=data,
|
|
498
|
+
tags=tags,
|
|
499
|
+
status=status,
|
|
500
|
+
active=active,
|
|
501
|
+
thumbnail_id=thumbnail_id,
|
|
502
|
+
created_by=created_by,
|
|
503
|
+
updated_by=updated_by,
|
|
504
|
+
)
|
|
505
|
+
|
|
506
|
+
def delete_workfile_info(
|
|
507
|
+
self,
|
|
508
|
+
project_name: str,
|
|
509
|
+
workfile_id: str,
|
|
510
|
+
) -> None:
|
|
511
|
+
"""DEPRECATED Delete workfile entity on server.
|
|
512
|
+
|
|
513
|
+
Args:
|
|
514
|
+
project_name (str): Project name.
|
|
515
|
+
workfile_id (str): Workfile id to delete.
|
|
516
|
+
|
|
517
|
+
"""
|
|
518
|
+
return self.delete_workfile_entity(
|
|
519
|
+
project_name,
|
|
520
|
+
workfile_id,
|
|
521
|
+
)
|
ayon_api/entity_hub.py
CHANGED
|
@@ -283,14 +283,14 @@ class EntityHub:
|
|
|
283
283
|
self.project_name,
|
|
284
284
|
entity_id,
|
|
285
285
|
fields=self._get_folder_fields(),
|
|
286
|
-
own_attributes=True
|
|
286
|
+
own_attributes=True,
|
|
287
287
|
)
|
|
288
288
|
elif entity_type == "task":
|
|
289
289
|
entity_data = self._connection.get_task_by_id(
|
|
290
290
|
self.project_name,
|
|
291
291
|
entity_id,
|
|
292
292
|
fields=self._get_task_fields(),
|
|
293
|
-
own_attributes=True
|
|
293
|
+
own_attributes=True,
|
|
294
294
|
)
|
|
295
295
|
elif entity_type == "product":
|
|
296
296
|
entity_data = self._connection.get_product_by_id(
|
|
@@ -781,6 +781,7 @@ class EntityHub:
|
|
|
781
781
|
parent_ids=[entity.id],
|
|
782
782
|
fields=folder_fields,
|
|
783
783
|
own_attributes=True,
|
|
784
|
+
active=None,
|
|
784
785
|
))
|
|
785
786
|
|
|
786
787
|
elif entity.entity_type == "folder":
|
|
@@ -789,6 +790,7 @@ class EntityHub:
|
|
|
789
790
|
parent_ids=[entity.id],
|
|
790
791
|
fields=folder_fields,
|
|
791
792
|
own_attributes=True,
|
|
793
|
+
active=None,
|
|
792
794
|
))
|
|
793
795
|
|
|
794
796
|
tasks = list(self._connection.get_tasks(
|
|
@@ -796,6 +798,7 @@ class EntityHub:
|
|
|
796
798
|
folder_ids=[entity.id],
|
|
797
799
|
fields=task_fields,
|
|
798
800
|
own_attributes=True,
|
|
801
|
+
active=None,
|
|
799
802
|
))
|
|
800
803
|
|
|
801
804
|
children_ids = {
|
|
@@ -897,7 +900,7 @@ class EntityHub:
|
|
|
897
900
|
project_name = self.project_name
|
|
898
901
|
project = self._connection.get_project(
|
|
899
902
|
project_name,
|
|
900
|
-
own_attributes=True
|
|
903
|
+
own_attributes=True,
|
|
901
904
|
)
|
|
902
905
|
if not project:
|
|
903
906
|
raise ValueError(f"Project \"{project_name}\" was not found.")
|
|
@@ -949,11 +952,13 @@ class EntityHub:
|
|
|
949
952
|
project_entity.name,
|
|
950
953
|
fields=folder_fields,
|
|
951
954
|
own_attributes=True,
|
|
955
|
+
active=None,
|
|
952
956
|
)
|
|
953
957
|
tasks = self._connection.get_tasks(
|
|
954
958
|
project_entity.name,
|
|
955
959
|
fields=task_fields,
|
|
956
960
|
own_attributes=True,
|
|
961
|
+
active=None,
|
|
957
962
|
)
|
|
958
963
|
folders_by_parent_id = collections.defaultdict(list)
|
|
959
964
|
for folder in folders:
|
ayon_api/graphql.py
CHANGED
|
@@ -857,8 +857,8 @@ class GraphQlQueryEdgeField(BaseGraphQlQueryField):
|
|
|
857
857
|
self._edge_children.append(field)
|
|
858
858
|
field.set_parent(self)
|
|
859
859
|
|
|
860
|
-
def add_edge_field(self, name: str) ->
|
|
861
|
-
item =
|
|
860
|
+
def add_edge_field(self, name: str) -> GraphQlQueryField:
|
|
861
|
+
item = GraphQlQueryField(name, self, self._order)
|
|
862
862
|
self.add_obj_edge_field(item)
|
|
863
863
|
return item
|
|
864
864
|
|
ayon_api/operations.py
CHANGED
|
@@ -340,7 +340,7 @@ def new_representation_entity(
|
|
|
340
340
|
return output
|
|
341
341
|
|
|
342
342
|
|
|
343
|
-
def
|
|
343
|
+
def new_workfile_entity(
|
|
344
344
|
filepath: str,
|
|
345
345
|
task_id: str,
|
|
346
346
|
status: Optional[str] = None,
|
|
@@ -396,6 +396,28 @@ def new_workfile_info(
|
|
|
396
396
|
return output
|
|
397
397
|
|
|
398
398
|
|
|
399
|
+
def new_workfile_info(
|
|
400
|
+
filepath: str,
|
|
401
|
+
task_id: str,
|
|
402
|
+
status: Optional[str] = None,
|
|
403
|
+
tags: Optional[list[str]] = None,
|
|
404
|
+
attribs: Optional[dict[str, Any]] = None,
|
|
405
|
+
description: Optional[str] = None,
|
|
406
|
+
data: Optional[dict[str, Any]] = None,
|
|
407
|
+
entity_id: Optional[str] = None,
|
|
408
|
+
) -> NewWorkfileDict:
|
|
409
|
+
return new_workfile_entity(
|
|
410
|
+
filepath,
|
|
411
|
+
task_id,
|
|
412
|
+
status,
|
|
413
|
+
tags,
|
|
414
|
+
attribs,
|
|
415
|
+
description,
|
|
416
|
+
data,
|
|
417
|
+
entity_id,
|
|
418
|
+
)
|
|
419
|
+
|
|
420
|
+
|
|
399
421
|
class AbstractOperation(ABC):
|
|
400
422
|
"""Base operation class.
|
|
401
423
|
|
|
@@ -1544,3 +1566,143 @@ class OperationsSession(object):
|
|
|
1544
1566
|
return self.delete_entity(
|
|
1545
1567
|
project_name, "representation", representation_id
|
|
1546
1568
|
)
|
|
1569
|
+
|
|
1570
|
+
def create_workfile_entity(
|
|
1571
|
+
self,
|
|
1572
|
+
project_name: str,
|
|
1573
|
+
path: str,
|
|
1574
|
+
task_id: str,
|
|
1575
|
+
*,
|
|
1576
|
+
thumbnail_id: Optional[str] = None,
|
|
1577
|
+
attrib: Optional[dict[str, Any]] = None,
|
|
1578
|
+
data: Optional[dict[str, Any]] = None,
|
|
1579
|
+
tags: Optional[list[str]] = None,
|
|
1580
|
+
status: Optional[str] = None,
|
|
1581
|
+
active: Optional[bool] = None,
|
|
1582
|
+
workfile_id: Optional[str] = None,
|
|
1583
|
+
) -> CreateOperation:
|
|
1584
|
+
"""Create new workfile entity.
|
|
1585
|
+
|
|
1586
|
+
Args:
|
|
1587
|
+
project_name (str): Project name.
|
|
1588
|
+
path (str): Representation name.
|
|
1589
|
+
task_id (str): Parent task id.
|
|
1590
|
+
thumbnail_id (Optional[str]): Thumbnail id.
|
|
1591
|
+
attrib (Optional[dict[str, Any]]): Representation attributes.
|
|
1592
|
+
data (Optional[dict[str, Any]]): Representation data.
|
|
1593
|
+
tags (Optional[Iterable[str]]): Representation tags.
|
|
1594
|
+
status (Optional[str]): Representation status.
|
|
1595
|
+
active (Optional[bool]): Representation active state.
|
|
1596
|
+
workfile_id (Optional[str]): Workfile info id. If not
|
|
1597
|
+
passed new id is generated.
|
|
1598
|
+
|
|
1599
|
+
Returns:
|
|
1600
|
+
CreateOperation: Object of create operation.
|
|
1601
|
+
|
|
1602
|
+
"""
|
|
1603
|
+
if workfile_id is None:
|
|
1604
|
+
workfile_id = create_entity_id()
|
|
1605
|
+
|
|
1606
|
+
create_data = {
|
|
1607
|
+
"id": workfile_id,
|
|
1608
|
+
"path": path,
|
|
1609
|
+
"taskId": task_id,
|
|
1610
|
+
}
|
|
1611
|
+
for key, value in (
|
|
1612
|
+
("thumbnailId", thumbnail_id),
|
|
1613
|
+
("attrib", attrib),
|
|
1614
|
+
("data", data),
|
|
1615
|
+
("tags", tags),
|
|
1616
|
+
("status", status),
|
|
1617
|
+
("active", active),
|
|
1618
|
+
):
|
|
1619
|
+
if value is not None:
|
|
1620
|
+
create_data[key] = value
|
|
1621
|
+
|
|
1622
|
+
return self.create_entity(
|
|
1623
|
+
project_name,
|
|
1624
|
+
"workfile",
|
|
1625
|
+
create_data
|
|
1626
|
+
)
|
|
1627
|
+
|
|
1628
|
+
def update_workfile_entity(
|
|
1629
|
+
self,
|
|
1630
|
+
project_name: str,
|
|
1631
|
+
workfile_id: str,
|
|
1632
|
+
path: Optional[str] = None,
|
|
1633
|
+
task_id: Optional[str] = None,
|
|
1634
|
+
attrib: Optional[dict[str, Any]] = None,
|
|
1635
|
+
data: Optional[dict[str, Any]] = None,
|
|
1636
|
+
tags: Optional[Iterable[str]] = None,
|
|
1637
|
+
status: Optional[str] = None,
|
|
1638
|
+
active: Optional[bool] = None,
|
|
1639
|
+
thumbnail_id: Optional[str] = NOT_SET,
|
|
1640
|
+
created_by: Optional[str] = None,
|
|
1641
|
+
updated_by: Optional[str] = None,
|
|
1642
|
+
) -> UpdateOperation:
|
|
1643
|
+
"""Update workfile entity on server.
|
|
1644
|
+
|
|
1645
|
+
Update of ``data`` will override existing value on folder entity.
|
|
1646
|
+
|
|
1647
|
+
Update of ``attrib`` does change only passed attributes. If you want
|
|
1648
|
+
to unset value, use ``None``.
|
|
1649
|
+
|
|
1650
|
+
Args:
|
|
1651
|
+
project_name (str): Project name.
|
|
1652
|
+
workfile_id (str): Workfile id.
|
|
1653
|
+
path (Optional[str]): New rootless workfile path..
|
|
1654
|
+
task_id (Optional[str]): New parent task id.
|
|
1655
|
+
attrib (Optional[dict[str, Any]]): New attributes.
|
|
1656
|
+
data (Optional[dict[str, Any]]): New data.
|
|
1657
|
+
tags (Optional[Iterable[str]]): New tags.
|
|
1658
|
+
status (Optional[str]): New status.
|
|
1659
|
+
active (Optional[bool]): New active state.
|
|
1660
|
+
thumbnail_id (Optional[str]): New thumbnail id.
|
|
1661
|
+
created_by (Optional[str]): New created by username.
|
|
1662
|
+
updated_by (Optional[str]): New updated by username.
|
|
1663
|
+
|
|
1664
|
+
Returns:
|
|
1665
|
+
UpdateOperation: Object of update operation.
|
|
1666
|
+
|
|
1667
|
+
"""
|
|
1668
|
+
update_data = {}
|
|
1669
|
+
for key, value in (
|
|
1670
|
+
("path", path),
|
|
1671
|
+
("taskId", task_id),
|
|
1672
|
+
("attrib", attrib),
|
|
1673
|
+
("data", data),
|
|
1674
|
+
("tags", tags),
|
|
1675
|
+
("status", status),
|
|
1676
|
+
("active", active),
|
|
1677
|
+
("thumbnailId", thumbnail_id),
|
|
1678
|
+
("createdBy", created_by),
|
|
1679
|
+
("updatedBy", updated_by),
|
|
1680
|
+
):
|
|
1681
|
+
if value is not None:
|
|
1682
|
+
update_data[key] = value
|
|
1683
|
+
|
|
1684
|
+
return self.update_entity(
|
|
1685
|
+
project_name,
|
|
1686
|
+
"workfile",
|
|
1687
|
+
workfile_id,
|
|
1688
|
+
update_data
|
|
1689
|
+
)
|
|
1690
|
+
|
|
1691
|
+
def delete_workfile_entity(
|
|
1692
|
+
self,
|
|
1693
|
+
project_name: str,
|
|
1694
|
+
workfile_id: str,
|
|
1695
|
+
) -> DeleteOperation:
|
|
1696
|
+
"""Delete workfile entity.
|
|
1697
|
+
|
|
1698
|
+
Args:
|
|
1699
|
+
project_name (str): Project name.
|
|
1700
|
+
workfile_id (str): Workfile info id to delete.
|
|
1701
|
+
|
|
1702
|
+
Returns:
|
|
1703
|
+
DeleteOperation: Object of delete operation.
|
|
1704
|
+
|
|
1705
|
+
"""
|
|
1706
|
+
return self.delete_entity(
|
|
1707
|
+
project_name, "workfile", workfile_id
|
|
1708
|
+
)
|
ayon_api/version.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""Package declaring Python API for AYON server."""
|
|
2
|
-
__version__ = "1.2.
|
|
2
|
+
__version__ = "1.2.3"
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
ayon_api/__init__.py,sha256=
|
|
2
|
-
ayon_api/_api.py,sha256=
|
|
1
|
+
ayon_api/__init__.py,sha256=qFwQM02QfmS8uhIGHzAZxpPuDWAsPb95cNu68lsycEc,13517
|
|
2
|
+
ayon_api/_api.py,sha256=RLYgANdtsiTuRKez96j9lNji47IUhKfojnesdedlH78,231455
|
|
3
3
|
ayon_api/constants.py,sha256=Um8haZtPB3c7SJumuM1v6DGIZNonKQqufZ9Ul5DCr7g,4035
|
|
4
|
-
ayon_api/entity_hub.py,sha256=
|
|
4
|
+
ayon_api/entity_hub.py,sha256=1pu7kn_uj2aiKvnhiPvAnSZRyr-_D5v8i5GVNxIU2Nc,117270
|
|
5
5
|
ayon_api/events.py,sha256=RQ_ct_GTb3KbZ6QWBkYn5m-ZUc6NJDAFFsoy2P_w3dQ,1370
|
|
6
6
|
ayon_api/exceptions.py,sha256=FOOSgShGEqno6U3kxSOdALkWuIhfhuYzSup0TjwkgkM,3495
|
|
7
|
-
ayon_api/graphql.py,sha256=
|
|
7
|
+
ayon_api/graphql.py,sha256=PgsdNVAwZymEOoFqUuTtnswv8bjtV0IIfBij2R9WKPU,29749
|
|
8
8
|
ayon_api/graphql_queries.py,sha256=g55raaoHO1LwazFzGGGiJkAY5ZHzczJx19HLJDuEY2U,26452
|
|
9
|
-
ayon_api/operations.py,sha256=
|
|
9
|
+
ayon_api/operations.py,sha256=eN0H2ok5hbPSIeBDO6DteJgjRTo28vIj3_x1aVBxyYU,52343
|
|
10
10
|
ayon_api/server_api.py,sha256=nKpXLQkfl7-Y3AoxEMA_0U-ggbfMyil2k3aCBTBenIQ,67182
|
|
11
11
|
ayon_api/typing.py,sha256=6l6PqH2hqET4Jbhg90kNtHUP81nMmsNzmTdXpnX2Q9s,11014
|
|
12
12
|
ayon_api/utils.py,sha256=vzcH8uAKLjeDT5SqZ1k4ckAoOI2DirtD0qglgnRaG5U,31612
|
|
13
|
-
ayon_api/version.py,sha256=
|
|
13
|
+
ayon_api/version.py,sha256=0Wo0gnyDXrc4BvsuxAzI76d6IFh75FNRyTZg-ULj2e0,74
|
|
14
14
|
ayon_api/_api_helpers/__init__.py,sha256=15wxNshWe1htzZhFnwTTflBfQ3tYJzTe6-0hrEUCQbw,1076
|
|
15
15
|
ayon_api/_api_helpers/actions.py,sha256=OBRAEJSVnhGP0xf8ktQL3M7Ubz64nDmn957qZehaRQ0,10578
|
|
16
16
|
ayon_api/_api_helpers/activities.py,sha256=0iknRHukYsVf0M6KRChBs3EsQH8bgg-yzhAx-1VivYs,10445
|
|
17
17
|
ayon_api/_api_helpers/attributes.py,sha256=bdC6KzoszFZmwBGmbwcGdG5jZDmGHW9wQ0z-ffCvn1w,4674
|
|
18
|
-
ayon_api/_api_helpers/base.py,sha256=
|
|
18
|
+
ayon_api/_api_helpers/base.py,sha256=2aeQWDAS0OcI1uI0NebY61sFOruXJWXZUjQbxccbSng,3458
|
|
19
19
|
ayon_api/_api_helpers/bundles_addons.py,sha256=kSlMsJz4J5NyHGdzcngTikznh9MmWbB2VN-hfwb4L8U,30232
|
|
20
20
|
ayon_api/_api_helpers/dependency_packages.py,sha256=bPYvrCLaOmC7KvJxfrhKU-sPZkvxkg_rnr8Nf7DjWhI,8193
|
|
21
21
|
ayon_api/_api_helpers/events.py,sha256=vCH5L4whFlx44nH0bRWuZhyy7F4Uw1uTpcCkDMKTYwk,16572
|
|
@@ -30,9 +30,9 @@ ayon_api/_api_helpers/secrets.py,sha256=L74qN38Bp22tDs9CQHWdgw3gsJm7GbnHKU75mCaW
|
|
|
30
30
|
ayon_api/_api_helpers/tasks.py,sha256=PHYzOdyMJph0QnFILPgL6Glk2eQDGs5Vs61wV_fu2s8,18093
|
|
31
31
|
ayon_api/_api_helpers/thumbnails.py,sha256=bqnPClpDsp7ED7fqt3ly1tA9pg88RLHj-W4GKZlWCa8,10129
|
|
32
32
|
ayon_api/_api_helpers/versions.py,sha256=3GT2ub7Xei_y3eoEp8iZW6Ur1swBZ_0tk4xFY7684fY,22048
|
|
33
|
-
ayon_api/_api_helpers/workfiles.py,sha256=
|
|
34
|
-
ayon_python_api-1.2.
|
|
35
|
-
ayon_python_api-1.2.
|
|
36
|
-
ayon_python_api-1.2.
|
|
37
|
-
ayon_python_api-1.2.
|
|
38
|
-
ayon_python_api-1.2.
|
|
33
|
+
ayon_api/_api_helpers/workfiles.py,sha256=_JJ-e95SSbyQI0u9FniaAxsAe4HHUwadKlKSkV7amIY,17636
|
|
34
|
+
ayon_python_api-1.2.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
35
|
+
ayon_python_api-1.2.3.dist-info/METADATA,sha256=gf0t7X79IYnDOZoH_pCEsKVKvjhrub7ZuJVqLRATFcY,16175
|
|
36
|
+
ayon_python_api-1.2.3.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
37
|
+
ayon_python_api-1.2.3.dist-info/top_level.txt,sha256=PKrQbX5Cz53_UmSTR_nIySnBkGyHcBTS88SCw9tuVlc,9
|
|
38
|
+
ayon_python_api-1.2.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|