Ayon-Python-Api 0.5.4__tar.gz → 1.0.0rc1__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.
Files changed (23) hide show
  1. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/PKG-INFO +1 -1
  2. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/graphql.py +9 -0
  3. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/graphql_queries.py +63 -11
  4. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/server_api.py +212 -28
  5. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/version.py +1 -1
  6. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_python_api.egg-info/PKG-INFO +1 -1
  7. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/pyproject.toml +1 -1
  8. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/LICENSE +0 -0
  9. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/README.md +0 -0
  10. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/__init__.py +0 -0
  11. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/_api.py +0 -0
  12. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/constants.py +0 -0
  13. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/entity_hub.py +0 -0
  14. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/events.py +0 -0
  15. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/exceptions.py +0 -0
  16. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/operations.py +0 -0
  17. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_api/utils.py +0 -0
  18. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  19. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  20. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_python_api.egg-info/requires.txt +0 -0
  21. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/ayon_python_api.egg-info/top_level.txt +0 -0
  22. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/setup.cfg +0 -0
  23. {ayon-python-api-0.5.4 → ayon-python-api-1.0.0rc1}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.5.4
3
+ Version: 1.0.0rc1
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -202,6 +202,15 @@ class GraphQlQuery:
202
202
 
203
203
  self._variables[key]["value"] = value
204
204
 
205
+ def get_variable_keys(self):
206
+ """Get all variable keys.
207
+
208
+ Returns:
209
+ set[str]: Variable keys.
210
+ """
211
+
212
+ return set(self._variables.keys())
213
+
205
214
  def get_variables_values(self):
206
215
  """Calculate variable values used that should be used in query.
207
216
 
@@ -175,10 +175,15 @@ def folders_graphql_query(fields):
175
175
  folder_ids_var = query.add_variable("folderIds", "[String!]")
176
176
  parent_folder_ids_var = query.add_variable("parentFolderIds", "[String!]")
177
177
  folder_paths_var = query.add_variable("folderPaths", "[String!]")
178
+ folder_path_regex_var = query.add_variable("folderPathRegex", "String!")
178
179
  folder_names_var = query.add_variable("folderNames", "[String!]")
179
180
  folder_types_var = query.add_variable("folderTypes", "[String!]")
180
- statuses_var = query.add_variable("folderStatuses", "[String!]")
181
181
  has_products_var = query.add_variable("folderHasProducts", "Boolean!")
182
+ has_tasks_var = query.add_variable("folderHasTasks", "Boolean!")
183
+ has_links_var = query.add_variable("folderHasLinks", "HasLinksFilter")
184
+ has_children_var = query.add_variable("folderHasChildren", "Boolean!")
185
+ statuses_var = query.add_variable("folderStatuses", "[String!]")
186
+ tags_var = query.add_variable("folderTags", "[String!]")
182
187
 
183
188
  project_field = query.add_field("project")
184
189
  project_field.set_filter("name", project_name_var)
@@ -188,9 +193,14 @@ def folders_graphql_query(fields):
188
193
  folders_field.set_filter("parentIds", parent_folder_ids_var)
189
194
  folders_field.set_filter("names", folder_names_var)
190
195
  folders_field.set_filter("paths", folder_paths_var)
196
+ folders_field.set_filter("pathEx", folder_path_regex_var)
191
197
  folders_field.set_filter("folderTypes", folder_types_var)
192
198
  folders_field.set_filter("statuses", statuses_var)
199
+ folders_field.set_filter("tags", tags_var)
193
200
  folders_field.set_filter("hasProducts", has_products_var)
201
+ folders_field.set_filter("hasTasks", has_tasks_var)
202
+ folders_field.set_filter("hasLinks", has_links_var)
203
+ folders_field.set_filter("hasChildren", has_children_var)
194
204
 
195
205
  nested_fields = fields_to_dict(fields)
196
206
  add_links_fields(folders_field, nested_fields)
@@ -218,6 +228,10 @@ def tasks_graphql_query(fields):
218
228
  task_names_var = query.add_variable("taskNames", "[String!]")
219
229
  task_types_var = query.add_variable("taskTypes", "[String!]")
220
230
  folder_ids_var = query.add_variable("folderIds", "[String!]")
231
+ assignees_any_var = query.add_variable("taskAssigneesAny", "[String!]")
232
+ assignees_all_var = query.add_variable("taskAssigneesAll", "[String!]")
233
+ statuses_var = query.add_variable("taskStatuses", "[String!]")
234
+ tags_var = query.add_variable("taskTags", "[String!]")
221
235
 
222
236
  project_field = query.add_field("project")
223
237
  project_field.set_filter("name", project_name_var)
@@ -228,6 +242,10 @@ def tasks_graphql_query(fields):
228
242
  tasks_field.set_filter("names", task_names_var)
229
243
  tasks_field.set_filter("taskTypes", task_types_var)
230
244
  tasks_field.set_filter("folderIds", folder_ids_var)
245
+ tasks_field.set_filter("assigneesAny", assignees_any_var)
246
+ tasks_field.set_filter("assignees", assignees_all_var)
247
+ tasks_field.set_filter("statuses", statuses_var)
248
+ tasks_field.set_filter("tags", tags_var)
231
249
 
232
250
  nested_fields = fields_to_dict(fields)
233
251
  add_links_fields(tasks_field, nested_fields)
@@ -256,7 +274,10 @@ def products_graphql_query(fields):
256
274
  product_names_var = query.add_variable("productNames", "[String!]")
257
275
  folder_ids_var = query.add_variable("folderIds", "[String!]")
258
276
  product_types_var = query.add_variable("productTypes", "[String!]")
259
- statuses_var = query.add_variable("statuses", "[String!]")
277
+ product_name_regex_var = query.add_variable("productNameRegex", "String!")
278
+ product_path_regex_var = query.add_variable("productPathRegex", "String!")
279
+ statuses_var = query.add_variable("productStatuses.", "[String!]")
280
+ tags_var = query.add_variable("productTags.", "[String!]")
260
281
 
261
282
  project_field = query.add_field("project")
262
283
  project_field.set_filter("name", project_name_var)
@@ -267,6 +288,9 @@ def products_graphql_query(fields):
267
288
  products_field.set_filter("folderIds", folder_ids_var)
268
289
  products_field.set_filter("productTypes", product_types_var)
269
290
  products_field.set_filter("statuses", statuses_var)
291
+ products_field.set_filter("tags", tags_var)
292
+ products_field.set_filter("nameEx", product_name_regex_var)
293
+ products_field.set_filter("pathEx", product_path_regex_var)
270
294
 
271
295
  nested_fields = fields_to_dict(set(fields))
272
296
  add_links_fields(products_field, nested_fields)
@@ -299,24 +323,28 @@ def versions_graphql_query(fields):
299
323
  hero_or_latest_only_var = query.add_variable(
300
324
  "heroOrLatestOnly", "Boolean"
301
325
  )
326
+ statuses_var = query.add_variable("versionStatuses", "[String!]")
327
+ tags_var = query.add_variable("versionTags", "[String!]")
302
328
 
303
329
  project_field = query.add_field("project")
304
330
  project_field.set_filter("name", project_name_var)
305
331
 
306
- products_field = project_field.add_field_with_edges("versions")
307
- products_field.set_filter("ids", version_ids_var)
308
- products_field.set_filter("productIds", product_ids_var)
309
- products_field.set_filter("versions", versions_var)
310
- products_field.set_filter("heroOnly", hero_only_var)
311
- products_field.set_filter("latestOnly", latest_only_var)
312
- products_field.set_filter("heroOrLatestOnly", hero_or_latest_only_var)
332
+ versions_field = project_field.add_field_with_edges("versions")
333
+ versions_field.set_filter("ids", version_ids_var)
334
+ versions_field.set_filter("productIds", product_ids_var)
335
+ versions_field.set_filter("versions", versions_var)
336
+ versions_field.set_filter("heroOnly", hero_only_var)
337
+ versions_field.set_filter("latestOnly", latest_only_var)
338
+ versions_field.set_filter("heroOrLatestOnly", hero_or_latest_only_var)
339
+ versions_field.set_filter("statuses", statuses_var)
340
+ versions_field.set_filter("tags", tags_var)
313
341
 
314
342
  nested_fields = fields_to_dict(set(fields))
315
- add_links_fields(products_field, nested_fields)
343
+ add_links_fields(versions_field, nested_fields)
316
344
 
317
345
  query_queue = collections.deque()
318
346
  for key, value in nested_fields.items():
319
- query_queue.append((key, value, products_field))
347
+ query_queue.append((key, value, versions_field))
320
348
 
321
349
  while query_queue:
322
350
  item = query_queue.popleft()
@@ -337,6 +365,13 @@ def representations_graphql_query(fields):
337
365
  repre_ids_var = query.add_variable("representationIds", "[String!]")
338
366
  repre_names_var = query.add_variable("representationNames", "[String!]")
339
367
  version_ids_var = query.add_variable("versionIds", "[String!]")
368
+ has_links_var = query.add_variable("representationHasLinks", "HasLinksFilter")
369
+ statuses_var = query.add_variable(
370
+ "representationStatuses", "[String!]"
371
+ )
372
+ tags_var = query.add_variable(
373
+ "representationTags", "[String!]"
374
+ )
340
375
 
341
376
  project_field = query.add_field("project")
342
377
  project_field.set_filter("name", project_name_var)
@@ -345,6 +380,9 @@ def representations_graphql_query(fields):
345
380
  repres_field.set_filter("ids", repre_ids_var)
346
381
  repres_field.set_filter("versionIds", version_ids_var)
347
382
  repres_field.set_filter("names", repre_names_var)
383
+ repres_field.set_filter("hasLinks", has_links_var)
384
+ repres_field.set_filter("statuses", statuses_var)
385
+ repres_field.set_filter("tags", tags_var)
348
386
 
349
387
  nested_fields = fields_to_dict(set(fields))
350
388
  add_links_fields(repres_field, nested_fields)
@@ -412,6 +450,10 @@ def workfiles_info_graphql_query(fields):
412
450
  workfiles_info_ids = query.add_variable("workfileIds", "[String!]")
413
451
  task_ids_var = query.add_variable("taskIds", "[String!]")
414
452
  paths_var = query.add_variable("paths", "[String!]")
453
+ path_regex_var = query.add_variable("workfilePathRegex", "String!")
454
+ has_links_var = query.add_variable("workfilehasLinks", "HasLinksFilter")
455
+ statuses_var = query.add_variable("workfileStatuses", "[String!]")
456
+ tags_var = query.add_variable("workfileTags", "[String!]")
415
457
 
416
458
  project_field = query.add_field("project")
417
459
  project_field.set_filter("name", project_name_var)
@@ -420,6 +462,10 @@ def workfiles_info_graphql_query(fields):
420
462
  workfiles_field.set_filter("ids", workfiles_info_ids)
421
463
  workfiles_field.set_filter("taskIds", task_ids_var)
422
464
  workfiles_field.set_filter("paths", paths_var)
465
+ workfiles_field.set_filter("pathEx", path_regex_var)
466
+ workfiles_field.set_filter("hasLinks", has_links_var)
467
+ workfiles_field.set_filter("statuses", statuses_var)
468
+ workfiles_field.set_filter("tags", tags_var)
423
469
 
424
470
  nested_fields = fields_to_dict(set(fields))
425
471
  add_links_fields(workfiles_field, nested_fields)
@@ -447,6 +493,9 @@ def events_graphql_query(fields):
447
493
  states_var = query.add_variable("eventStates", "[String!]")
448
494
  users_var = query.add_variable("eventUsers", "[String!]")
449
495
  include_logs_var = query.add_variable("includeLogsFilter", "Boolean!")
496
+ has_children_var = query.add_variable("hasChildrenFilter", "Boolean!")
497
+ newer_than_var = query.add_variable("newerThanFilter", "String!")
498
+ older_than_var = query.add_variable("olderThanFilter", "String!")
450
499
 
451
500
  events_field = query.add_field_with_edges("events")
452
501
  events_field.set_filter("topics", topics_var)
@@ -454,6 +503,9 @@ def events_graphql_query(fields):
454
503
  events_field.set_filter("states", states_var)
455
504
  events_field.set_filter("users", users_var)
456
505
  events_field.set_filter("includeLogs", include_logs_var)
506
+ events_field.set_filter("hasChildren", has_children_var)
507
+ events_field.set_filter("newerThan", newer_than_var)
508
+ events_field.set_filter("olderThan", older_than_var)
457
509
 
458
510
  nested_fields = fields_to_dict(set(fields))
459
511
 
@@ -1318,6 +1318,9 @@ class ServerAPI(object):
1318
1318
  states=None,
1319
1319
  users=None,
1320
1320
  include_logs=None,
1321
+ has_children=None,
1322
+ newer_than=None,
1323
+ older_than=None,
1321
1324
  fields=None
1322
1325
  ):
1323
1326
  """Get events from server with filtering options.
@@ -1333,6 +1336,12 @@ class ServerAPI(object):
1333
1336
  users (Optional[Iterable[str]]): Filtering by users
1334
1337
  who created/triggered an event.
1335
1338
  include_logs (Optional[bool]): Query also log events.
1339
+ has_children (Optional[bool]): Event is with/without children
1340
+ events. If 'None' then all events are returned, default.
1341
+ newer_than (Optional[str]): Return only events newer than given
1342
+ iso datetime string.
1343
+ older_than (Optional[str]): Return only events older than given
1344
+ iso datetime string.
1336
1345
  fields (Optional[Iterable[str]]): Fields that should be received
1337
1346
  for each event.
1338
1347
 
@@ -1369,6 +1378,15 @@ class ServerAPI(object):
1369
1378
  include_logs = False
1370
1379
  filters["includeLogsFilter"] = include_logs
1371
1380
 
1381
+ if has_children is not None:
1382
+ filters["hasChildrenFilter"] = has_children
1383
+
1384
+ if newer_than is not None:
1385
+ filters["newerThanFilter"] = newer_than
1386
+
1387
+ if older_than is not None:
1388
+ filters["olderThanFilter"] = older_than
1389
+
1372
1390
  if not fields:
1373
1391
  fields = self.get_default_fields_for_type("event")
1374
1392
 
@@ -3670,8 +3688,14 @@ class ServerAPI(object):
3670
3688
  folder_names=None,
3671
3689
  folder_types=None,
3672
3690
  parent_ids=None,
3691
+ folder_path_regex=None,
3692
+ has_products=None,
3693
+ has_tasks=None,
3694
+ has_children=None,
3673
3695
  statuses=None,
3696
+ tags=None,
3674
3697
  active=True,
3698
+ has_links=None,
3675
3699
  fields=None,
3676
3700
  own_attributes=False
3677
3701
  ):
@@ -3695,10 +3719,22 @@ class ServerAPI(object):
3695
3719
  for filtering.
3696
3720
  parent_ids (Optional[Iterable[str]]): Ids of folder parents.
3697
3721
  Use 'None' if folder is direct child of project.
3722
+ folder_path_regex (Optional[str]): Folder path regex used
3723
+ for filtering.
3724
+ has_products (Optional[bool]): Filter folders with/without
3725
+ products. Ignored when None, default behavior.
3726
+ has_tasks (Optional[bool]): Filter folders with/without
3727
+ tasks. Ignored when None, default behavior.
3728
+ has_children (Optional[bool]): Filter folders with/without
3729
+ children. Ignored when None, default behavior.
3698
3730
  statuses (Optional[Iterable[str]]): Folder statuses used
3699
3731
  for filtering.
3732
+ tags (Optional[Iterable[str]]): Folder tags used
3733
+ for filtering.
3700
3734
  active (Optional[bool]): Filter active/inactive folders.
3701
3735
  Both are returned if is set to None.
3736
+ has_links (Optional[Literal[IN, OUT, ANY]]): Filter
3737
+ representations with IN/OUT/ANY links.
3702
3738
  fields (Optional[Iterable[str]]): Fields to be queried for
3703
3739
  folder. All possible folder fields are returned
3704
3740
  if 'None' is passed.
@@ -3745,6 +3781,12 @@ class ServerAPI(object):
3745
3781
  return
3746
3782
  filters["folderStatuses"] = list(statuses)
3747
3783
 
3784
+ if tags is not None:
3785
+ tags = set(tags)
3786
+ if not tags:
3787
+ return
3788
+ filters["folderTags"] = list(tags)
3789
+
3748
3790
  if parent_ids is not None:
3749
3791
  parent_ids = set(parent_ids)
3750
3792
  if not parent_ids:
@@ -3765,6 +3807,21 @@ class ServerAPI(object):
3765
3807
 
3766
3808
  filters["parentFolderIds"] = list(parent_ids)
3767
3809
 
3810
+ if folder_path_regex is not None:
3811
+ filters["folderPathRegex"] = folder_path_regex
3812
+
3813
+ if has_products is not None:
3814
+ filters["folderHasProducts"] = has_products
3815
+
3816
+ if has_tasks is not None:
3817
+ filters["folderHasTasks"] = has_tasks
3818
+
3819
+ if has_links is not None:
3820
+ filters["folderHasLinks"] = has_links.upper()
3821
+
3822
+ if has_children is not None:
3823
+ filters["folderHasChildren"] = has_children
3824
+
3768
3825
  if not fields:
3769
3826
  fields = self.get_default_fields_for_type("folder")
3770
3827
  else:
@@ -3949,6 +4006,10 @@ class ServerAPI(object):
3949
4006
  task_names=None,
3950
4007
  task_types=None,
3951
4008
  folder_ids=None,
4009
+ assignees=None,
4010
+ assignees_all=None,
4011
+ statuses=None,
4012
+ tags=None,
3952
4013
  active=True,
3953
4014
  fields=None,
3954
4015
  own_attributes=False
@@ -3962,6 +4023,16 @@ class ServerAPI(object):
3962
4023
  task_types (Iterable[str]): Task types used for filtering.
3963
4024
  folder_ids (Iterable[str]): Ids of task parents. Use 'None'
3964
4025
  if folder is direct child of project.
4026
+ assignees (Optional[Iterable[str]]): Task assignees used for
4027
+ filtering. All tasks with any of passed assignees are
4028
+ returned.
4029
+ assignees_all (Optional[Iterable[str]]): Task assignees used
4030
+ for filtering. Task must have all of passed assignees to be
4031
+ returned.
4032
+ statuses (Optional[Iterable[str]]): Task statuses used for
4033
+ filtering.
4034
+ tags (Optional[Iterable[str]]): Task tags used for
4035
+ filtering.
3965
4036
  active (Optional[bool]): Filter active/inactive tasks.
3966
4037
  Both are returned if is set to None.
3967
4038
  fields (Optional[Iterable[str]]): Fields to be queried for
@@ -4005,6 +4076,30 @@ class ServerAPI(object):
4005
4076
  return
4006
4077
  filters["folderIds"] = list(folder_ids)
4007
4078
 
4079
+ if assignees is not None:
4080
+ assignees = set(assignees)
4081
+ if not assignees:
4082
+ return
4083
+ filters["taskAssigneesAny"] = list(assignees)
4084
+
4085
+ if assignees_all is not None:
4086
+ assignees_all = set(assignees_all)
4087
+ if not assignees_all:
4088
+ return
4089
+ filters["taskAssigneesAll"] = list(assignees_all)
4090
+
4091
+ if statuses is not None:
4092
+ statuses = set(statuses)
4093
+ if not statuses:
4094
+ return
4095
+ filters["taskStatuses"] = list(statuses)
4096
+
4097
+ if tags is not None:
4098
+ tags = set(tags)
4099
+ if not tags:
4100
+ return
4101
+ filters["taskTags"] = list(tags)
4102
+
4008
4103
  if not fields:
4009
4104
  fields = self.get_default_fields_for_type("task")
4010
4105
  else:
@@ -4132,8 +4227,11 @@ class ServerAPI(object):
4132
4227
  product_names=None,
4133
4228
  folder_ids=None,
4134
4229
  product_types=None,
4135
- statuses=None,
4230
+ product_name_regex=None,
4231
+ product_path_regex=None,
4136
4232
  names_by_folder_ids=None,
4233
+ statuses=None,
4234
+ tags=None,
4137
4235
  active=True,
4138
4236
  fields=None,
4139
4237
  own_attributes=False
@@ -4153,10 +4251,15 @@ class ServerAPI(object):
4153
4251
  Use 'None' if folder is direct child of project.
4154
4252
  product_types (Optional[Iterable[str]]): Product types used for
4155
4253
  filtering.
4156
- statuses (Optional[Iterable[str]]): Product statuses used for
4157
- filtering.
4254
+ product_name_regex (Optional[str]): Filter products by name regex.
4255
+ product_path_regex (Optional[str]): Filter products by path regex.
4256
+ Path starts with folder path and ends with product name.
4158
4257
  names_by_folder_ids (Optional[dict[str, Iterable[str]]]): Product
4159
4258
  name filtering by folder id.
4259
+ statuses (Optional[Iterable[str]]): Product statuses used
4260
+ for filtering.
4261
+ tags (Optional[Iterable[str]]): Product tags used
4262
+ for filtering.
4160
4263
  active (Optional[bool]): Filter active/inactive products.
4161
4264
  Both are returned if is set to None.
4162
4265
  fields (Optional[Iterable[str]]): Fields to be queried for
@@ -4172,11 +4275,7 @@ class ServerAPI(object):
4172
4275
  if not project_name:
4173
4276
  return
4174
4277
 
4175
- if product_ids is not None:
4176
- product_ids = set(product_ids)
4177
- if not product_ids:
4178
- return
4179
-
4278
+ # Prepare these filters before 'name_by_filter_ids' filter
4180
4279
  filter_product_names = None
4181
4280
  if product_names is not None:
4182
4281
  filter_product_names = set(product_names)
@@ -4189,18 +4288,6 @@ class ServerAPI(object):
4189
4288
  if not filter_folder_ids:
4190
4289
  return
4191
4290
 
4192
- filter_product_types = None
4193
- if product_types is not None:
4194
- filter_product_types = set(product_types)
4195
- if not filter_product_types:
4196
- return
4197
-
4198
- filter_statuses = None
4199
- if statuses is not None:
4200
- filter_statuses = set(statuses)
4201
- if not filter_statuses:
4202
- return
4203
-
4204
4291
  # This will disable 'folder_ids' and 'product_names' filters
4205
4292
  # - maybe could be enhanced in future?
4206
4293
  if names_by_folder_ids is not None:
@@ -4244,20 +4331,42 @@ class ServerAPI(object):
4244
4331
  filters = {
4245
4332
  "projectName": project_name
4246
4333
  }
4334
+
4247
4335
  if filter_folder_ids:
4248
4336
  filters["folderIds"] = list(filter_folder_ids)
4249
4337
 
4250
- if filter_product_types:
4251
- filters["productTypes"] = list(filter_product_types)
4252
-
4253
- if filter_statuses:
4254
- filters["statuses"] = list(filter_statuses)
4338
+ if filter_product_names:
4339
+ filters["productNames"] = list(filter_product_names)
4255
4340
 
4256
- if product_ids:
4341
+ if product_ids is not None:
4342
+ product_ids = set(product_ids)
4343
+ if not product_ids:
4344
+ return
4257
4345
  filters["productIds"] = list(product_ids)
4258
4346
 
4259
- if filter_product_names:
4260
- filters["productNames"] = list(filter_product_names)
4347
+ if product_types is not None:
4348
+ product_types = set(product_types)
4349
+ if not product_types:
4350
+ return
4351
+ filters["productTypes"] = list(product_types)
4352
+
4353
+ if statuses is not None:
4354
+ statuses = set(statuses)
4355
+ if not statuses:
4356
+ return
4357
+ filters["productStatuses"] = list(statuses)
4358
+
4359
+ if tags is not None:
4360
+ tags = set(tags)
4361
+ if not tags:
4362
+ return
4363
+ filters["productTags"] = list(tags)
4364
+
4365
+ if product_name_regex:
4366
+ filters["productNameRegex"] = product_name_regex
4367
+
4368
+ if product_path_regex:
4369
+ filters["productPathRegex"] = product_path_regex
4261
4370
 
4262
4371
  query = products_graphql_query(fields)
4263
4372
  for attr, filter_value in filters.items():
@@ -4450,6 +4559,8 @@ class ServerAPI(object):
4450
4559
  hero=True,
4451
4560
  standard=True,
4452
4561
  latest=None,
4562
+ statuses=None,
4563
+ tags=None,
4453
4564
  active=True,
4454
4565
  fields=None,
4455
4566
  own_attributes=False
@@ -4469,6 +4580,10 @@ class ServerAPI(object):
4469
4580
  latest (Optional[bool]): Return only latest version of standard
4470
4581
  versions. This can be combined only with 'standard' attribute
4471
4582
  set to True.
4583
+ statuses (Optional[Iterable[str]]): Representation statuses used
4584
+ for filtering.
4585
+ tags (Optional[Iterable[str]]): Representation tags used
4586
+ for filtering.
4472
4587
  active (Optional[bool]): Receive active/inactive entities.
4473
4588
  Both are returned when 'None' is passed.
4474
4589
  fields (Optional[Iterable[str]]): Fields to be queried
@@ -4525,6 +4640,18 @@ class ServerAPI(object):
4525
4640
  return
4526
4641
  filters["versions"] = list(versions)
4527
4642
 
4643
+ if statuses is not None:
4644
+ statuses = set(statuses)
4645
+ if not statuses:
4646
+ return
4647
+ filters["versionStatuses"] = list(statuses)
4648
+
4649
+ if tags is not None:
4650
+ tags = set(tags)
4651
+ if not tags:
4652
+ return
4653
+ filters["versionTags"] = list(tags)
4654
+
4528
4655
  if not hero and not standard:
4529
4656
  return
4530
4657
 
@@ -4781,6 +4908,10 @@ class ServerAPI(object):
4781
4908
  dict[str, dict[str, Any]]: Last versions by product id.
4782
4909
  """
4783
4910
 
4911
+ if fields:
4912
+ fields = set(fields)
4913
+ fields.add("productId")
4914
+
4784
4915
  versions = self.get_versions(
4785
4916
  project_name,
4786
4917
  product_ids=product_ids,
@@ -4928,7 +5059,10 @@ class ServerAPI(object):
4928
5059
  representation_names=None,
4929
5060
  version_ids=None,
4930
5061
  names_by_version_ids=None,
5062
+ statuses=None,
5063
+ tags=None,
4931
5064
  active=True,
5065
+ has_links=None,
4932
5066
  fields=None,
4933
5067
  own_attributes=False
4934
5068
  ):
@@ -4950,8 +5084,14 @@ class ServerAPI(object):
4950
5084
  names_by_version_ids (Optional[bool]): Find representations
4951
5085
  by names and version ids. This filter discard all
4952
5086
  other filters.
5087
+ statuses (Optional[Iterable[str]]): Representation statuses used
5088
+ for filtering.
5089
+ tags (Optional[Iterable[str]]): Representation tags used
5090
+ for filtering.
4953
5091
  active (Optional[bool]): Receive active/inactive entities.
4954
5092
  Both are returned when 'None' is passed.
5093
+ has_links (Optional[Literal[IN, OUT, ANY]]): Filter
5094
+ representations with IN/OUT/ANY links.
4955
5095
  fields (Optional[Iterable[str]]): Fields to be queried for
4956
5096
  representation. All possible fields are returned if 'None' is
4957
5097
  passed.
@@ -5022,6 +5162,21 @@ class ServerAPI(object):
5022
5162
  if representaion_names_filter:
5023
5163
  filters["representationNames"] = list(representaion_names_filter)
5024
5164
 
5165
+ if statuses is not None:
5166
+ statuses = set(statuses)
5167
+ if not statuses:
5168
+ return
5169
+ filters["representationStatuses"] = list(statuses)
5170
+
5171
+ if tags is not None:
5172
+ tags = set(tags)
5173
+ if not tags:
5174
+ return
5175
+ filters["representationTags"] = list(tags)
5176
+
5177
+ if has_links is not None:
5178
+ filters["representationHasLinks"] = has_links.upper()
5179
+
5025
5180
  query = representations_graphql_query(fields)
5026
5181
 
5027
5182
  for attr, filter_value in filters.items():
@@ -5276,6 +5431,10 @@ class ServerAPI(object):
5276
5431
  workfile_ids=None,
5277
5432
  task_ids=None,
5278
5433
  paths=None,
5434
+ path_regex=None,
5435
+ statuses=None,
5436
+ tags=None,
5437
+ has_links=None,
5279
5438
  fields=None,
5280
5439
  own_attributes=False
5281
5440
  ):
@@ -5286,6 +5445,13 @@ class ServerAPI(object):
5286
5445
  workfile_ids (Optional[Iterable[str]]): Workfile ids.
5287
5446
  task_ids (Optional[Iterable[str]]): Task ids.
5288
5447
  paths (Optional[Iterable[str]]): Rootless workfiles paths.
5448
+ path_regex (Optional[str]): Regex filter for workfile path.
5449
+ statuses (Optional[Iterable[str]]): Workfile info statuses used
5450
+ for filtering.
5451
+ tags (Optional[Iterable[str]]): Workfile info tags used
5452
+ for filtering.
5453
+ has_links (Optional[Literal[IN, OUT, ANY]]): Filter
5454
+ representations with IN/OUT/ANY links.
5289
5455
  fields (Optional[Iterable[str]]): Fields to be queried for
5290
5456
  representation. All possible fields are returned if 'None' is
5291
5457
  passed.
@@ -5309,12 +5475,30 @@ class ServerAPI(object):
5309
5475
  return
5310
5476
  filters["paths"] = list(paths)
5311
5477
 
5478
+ if path_regex is not None:
5479
+ filters["workfilePathRegex"] = path_regex
5480
+
5312
5481
  if workfile_ids is not None:
5313
5482
  workfile_ids = set(workfile_ids)
5314
5483
  if not workfile_ids:
5315
5484
  return
5316
5485
  filters["workfileIds"] = list(workfile_ids)
5317
5486
 
5487
+ if statuses is not None:
5488
+ statuses = set(statuses)
5489
+ if not statuses:
5490
+ return
5491
+ filters["workfileStatuses"] = list(statuses)
5492
+
5493
+ if tags is not None:
5494
+ tags = set(tags)
5495
+ if not tags:
5496
+ return
5497
+ filters["workfileTags"] = list(tags)
5498
+
5499
+ if has_links is not None:
5500
+ filters["workfilehasLinks"] = has_links.upper()
5501
+
5318
5502
  if not fields:
5319
5503
  fields = self.get_default_fields_for_type("workfile")
5320
5504
 
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.5.4"
2
+ __version__ = "1.0.0-rc.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.5.4
3
+ Version: 1.0.0rc1
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "ayon-python-api"
3
- version = "0.5.4"
3
+ version = "1.0.0-rc.1"
4
4
  description = "AYON Python API"
5
5
  license = {file = "LICENSE"}
6
6
  readme = {file = "README.md", content-type = "text/markdown"}