Ayon-Python-Api 0.3.6__tar.gz → 0.4.0__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.3.6 → ayon-python-api-0.4.0}/PKG-INFO +1 -1
  2. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/constants.py +2 -2
  3. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/server_api.py +24 -3
  4. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/version.py +1 -1
  5. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_python_api.egg-info/PKG-INFO +1 -1
  6. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/pyproject.toml +1 -1
  7. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/LICENSE +0 -0
  8. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/README.md +0 -0
  9. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/__init__.py +0 -0
  10. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/_api.py +0 -0
  11. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/entity_hub.py +0 -0
  12. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/events.py +0 -0
  13. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/exceptions.py +0 -0
  14. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/graphql.py +0 -0
  15. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/graphql_queries.py +0 -0
  16. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/operations.py +0 -0
  17. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_api/utils.py +0 -0
  18. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_python_api.egg-info/SOURCES.txt +0 -0
  19. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_python_api.egg-info/dependency_links.txt +0 -0
  20. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_python_api.egg-info/requires.txt +0 -0
  21. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/ayon_python_api.egg-info/top_level.txt +0 -0
  22. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/setup.cfg +0 -0
  23. {ayon-python-api-0.3.6 → ayon-python-api-0.4.0}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.3.6
3
+ Version: 0.4.0
4
4
  Summary: AYON Python API
5
5
  Home-page: https://github.com/ynput/ayon-python-api
6
6
  Author: ynput.io
@@ -9,13 +9,13 @@ SERVER_TOKEN_ENV_KEY = SERVER_API_ENV_KEY
9
9
 
10
10
  # --- User ---
11
11
  DEFAULT_USER_FIELDS = {
12
- "roles",
12
+ "accessGroups",
13
+ "defaultAccessGroups",
13
14
  "name",
14
15
  "isService",
15
16
  "isManager",
16
17
  "isGuest",
17
18
  "isAdmin",
18
- "defaultRoles",
19
19
  "createdAt",
20
20
  "active",
21
21
  "hasPassword",
@@ -989,9 +989,17 @@ class ServerAPI(object):
989
989
  for attr, filter_value in filters.items():
990
990
  query.set_variable_value(attr, filter_value)
991
991
 
992
+ # Backwards compatibility for server 0.3.x
993
+ # - will be removed in future releases
994
+ major, minor, _, _, _ = self.server_version_tuple
995
+ access_groups_field = "accessGroups"
996
+ if major == 0 and minor <= 3:
997
+ access_groups_field = "roles"
998
+
992
999
  for parsed_data in query.continuous_query(self):
993
1000
  for user in parsed_data["users"]:
994
- user["roles"] = json.loads(user["roles"])
1001
+ user[access_groups_field] = json.loads(
1002
+ user[access_groups_field])
995
1003
  yield user
996
1004
 
997
1005
  def get_user(self, username=None):
@@ -1866,7 +1874,15 @@ class ServerAPI(object):
1866
1874
  entity_type_defaults = DEFAULT_WORKFILE_INFO_FIELDS
1867
1875
 
1868
1876
  elif entity_type == "user":
1869
- entity_type_defaults = DEFAULT_USER_FIELDS
1877
+ entity_type_defaults = set(DEFAULT_USER_FIELDS)
1878
+ # Backwards compatibility for server 0.3.x
1879
+ # - will be removed in future releases
1880
+ major, minor, _, _, _ = self.server_version_tuple
1881
+ if major == 0 and minor <= 3:
1882
+ entity_type_defaults.discard("accessGroups")
1883
+ entity_type_defaults.discard("defaultAccessGroups")
1884
+ entity_type_defaults.add("roles")
1885
+ entity_type_defaults.add("defaultRoles")
1870
1886
 
1871
1887
  else:
1872
1888
  raise ValueError("Unknown entity type \"{}\"".format(entity_type))
@@ -2243,7 +2259,12 @@ class ServerAPI(object):
2243
2259
  server.
2244
2260
  """
2245
2261
 
2246
- result = self.get("desktop/dependency_packages")
2262
+ endpoint = "desktop/dependencyPackages"
2263
+ major, minor, _, _, _ = self.server_version_tuple
2264
+ if major == 0 and minor <= 3:
2265
+ endpoint = "desktop/dependency_packages"
2266
+
2267
+ result = self.get(endpoint)
2247
2268
  result.raise_for_status()
2248
2269
  return result.data
2249
2270
 
@@ -1,2 +1,2 @@
1
1
  """Package declaring Python API for Ayon server."""
2
- __version__ = "0.3.6"
2
+ __version__ = "0.4.0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ayon-python-api
3
- Version: 0.3.6
3
+ Version: 0.4.0
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.3.6"
3
+ version = "0.4.0"
4
4
  description = "AYON Python API"
5
5
  license = {file = "LICENSE"}
6
6
  readme = {file = "README.md", content-type = "text/markdown"}
File without changes