Update Insights to Assets
What's the status on a release which updates to the new assets endpoints?
Looking specifically at: https://github.com/atlassian-api/atlassian-python-api/blob/0a5bc5ee72427be0ec16ce5db4f4b091f7a00ddc/atlassian/insight.py#L23
https://github.com/atlassian-api/atlassian-python-api/blob/0a5bc5ee72427be0ec16ce5db4f4b091f7a00ddc/atlassian/insight.py#L258
@shaun-actionanalytics I'm using the following to give myself a way to use aql, but it's still using this wrapper's Insight class which uses the insight API. This only implements a function to fetch all objects matching the search, since that's all I needed for now.
""""
Assets class extends the atlassian-api-wrapper Insight class to add functions that use the new /object/aql endpoint
instead of the deprecated /iql/object endpoint. If the wrapper receives an update to use these new endpoints, we could
look at making use of their functions instead.
"""
from atlassian import Insight
class Assets(Insight):
def get_object_aql(
self,
aql,
start=0,
results_per_page=25,
include_attributes=True
):
params = {"startAt": start, "maxResults": results_per_page, "includeAttributes": include_attributes}
url = self.url_joiner(self.api_root, "object/aql")
data = {"qlQuery": aql}
return self.post(
url,
data=data,
params=params
)
def get_object_aql_all(
self,
aql,
include_attributes=True
):
start = 0
results_per_page = 25
values = []
while True:
results = self.get_object_aql(
aql,
start=start,
results_per_page=results_per_page,
include_attributes=include_attributes
)
start = start + results_per_page
values.extend(results.get('values'))
if results['isLast']:
results['values'] = values
return results
But I'm also looking for a class that uses /jsm/assets
How about implementing that group ? ;) https://developer.atlassian.com/cloud/assets/rest/api-group-aql/#api-group-aql
I am open for pull requests