22import logging
33
44from .rest_client import AtlassianRestAPI
5+
56# from deprecated import deprecated
67
78log = logging .getLogger (__name__ )
89
910
10- class Assets (AtlassianRestAPI ):
11+ class AssetsCloud (AtlassianRestAPI ):
1112 """Assets for Jira API wrapper."""
1213
1314 # https://developer.atlassian.com/cloud/assets/rest
@@ -24,7 +25,7 @@ def __init__(self, *args, **kwargs):
2425 # If cloud is set to true, trigger private __cloud__init method
2526 if kwargs .get ("cloud" ):
2627 args , kwargs = self .__cloud_init (* args , ** kwargs )
27- super (Assets , self ).__init__ (* args , ** kwargs )
28+ super (AssetsCloud , self ).__init__ (* args , ** kwargs )
2829
2930 def __cloud_init (self , * args , ** kwargs ):
3031 """
@@ -35,7 +36,7 @@ def __cloud_init(self, *args, **kwargs):
3536 """
3637 # trigger a normal init and avoid looping
3738 del kwargs ["cloud" ]
38- temp = Assets (* args , ** kwargs )
39+ temp = AssetsCloud (* args , ** kwargs )
3940 # retrieve cloud workspace id and generate the api_root
4041 kwargs ["api_root" ] = f"/jsm/assets/workspace/{ temp .__get_workspace_id ()} /v1/"
4142 # Assets cloud uses the atlassian base url, not custom instance urls
@@ -257,13 +258,7 @@ def reindex_current_node_assets(self):
257258 # Fetch Objects by AQL
258259 # Cloud-only. Server use navlist_aql()
259260 # https://developer.atlassian.com/cloud/assets/rest/api-group-object/#api-object-aql-post
260- def aql (
261- self ,
262- query ,
263- start = 0 ,
264- max_results = 25 ,
265- include_attributes = True
266- ):
261+ def aql (self , query , start = 0 , max_results = 25 , include_attributes = True ):
267262 """
268263 Resource dedicated to finding objects based on the Assets Query Language (AQL)
269264
@@ -275,14 +270,8 @@ def aql(
275270 """
276271 if not self .cloud :
277272 raise NotImplementedError
278- params = {
279- "startAt" : start ,
280- "maxResults" : max_results ,
281- "includeAttributes" : include_attributes
282- }
283- data = {
284- "qlQuery" : query
285- }
273+ params = {"startAt" : start , "maxResults" : max_results , "includeAttributes" : include_attributes }
274+ data = {"qlQuery" : query }
286275 url = self .url_joiner (self .api_root , "object/aql" )
287276 return self .post (url , params = params , data = data )
288277
@@ -331,7 +320,7 @@ def navlist_aql(
331320 "includeAttributes" : include_attributes ,
332321 "includeAttributesDeep" : include_attributes_deep ,
333322 "includeTypeAttributes" : include_type_attributes ,
334- "includeExtendedInfo" : include_extended_info
323+ "includeExtendedInfo" : include_extended_info ,
335324 }
336325 if order_by_attribute_id :
337326 data ["orderByAttributeId" ] = order_by_attribute_id
@@ -634,4 +623,4 @@ def update_issue_assets_field(self, key, field_id, assets_keys, add=False):
634623 }
635624 }
636625 data = {"fields" : {field_id : [{"key" : i } for i in assets_keys ]}}
637- return self .put (f"{ base_url } /{ key } " , data = data )
626+ return self .put (f"{ base_url } /{ key } " , data = data )
0 commit comments