8
8
9
9
10
10
class Insight (AtlassianRestAPI ):
11
-
12
11
"""Insight for Jira API wrapper."""
13
12
14
13
# https://insight-javadoc.riada.io/insight-javadoc-8.6/insight-rest/
@@ -285,21 +284,21 @@ def get_object(self, object_id):
285
284
url = self .url_joiner (self .api_root , "object/{id}" .format (id = object_id ))
286
285
return self .get (url )
287
286
288
- def update_object (self , object_id , object_type_id , attributes , has_avatar = False , avatar_UUID = "" ):
287
+ def update_object (self , object_id , object_type_id , attributes , has_avatar = False , avatar_uuid = "" ):
289
288
"""
290
289
Update an existing object in Insight
291
290
292
291
:param object_id:
293
292
:param object_type_id:
294
293
:param attributes:
295
294
:param has_avatar:
296
- :param avatar_UUID :
295
+ :param avatar_uuid :
297
296
:return:
298
297
"""
299
298
body = {
300
299
"attributes" : attributes ,
301
300
"objectTypeId" : object_type_id ,
302
- "avatarUUID" : avatar_UUID ,
301
+ "avatarUUID" : avatar_uuid ,
303
302
"hasAvatar" : has_avatar ,
304
303
}
305
304
url = self .url_joiner (self .api_root , "object/{id}" .format (id = object_id ))
@@ -337,7 +336,7 @@ def get_object_history(self, object_id, asc=False, abbreviate=True):
337
336
params = {"asc" : asc , "abbreviate" : abbreviate }
338
337
url = self .url_joiner (self .api_root , "object/{id}/history" .format (id = object_id ))
339
338
return self .get (url , params = params )
340
-
339
+
341
340
@deprecated (version = "3.29.0" , reason = "Use get_object_reference_info()" )
342
341
def get_object_referenceinfo (self , object_id ):
343
342
"""Let's use the get_object_reference_info()"""
@@ -354,65 +353,71 @@ def get_object_reference_info(self, object_id):
354
353
url = self .url_joiner (self .api_root , "object/{id}/referenceinfo" .format (id = object_id ))
355
354
return self .get (url )
356
355
357
- def create_object (self , objectTypeId , attributes , hasAvatar = False , avatarUUID = "" ):
356
+ def create_object (self , object_type_id , attributes , has_avatar = False , avatar_uuid = "" ):
358
357
"""
359
358
Create a new object in Insight
360
359
361
- :param objectTypeId :
360
+ :param object_type_id :
362
361
:param attributes:
363
- :param hasAvatar :
364
- :param avatarUUID :
362
+ :param has_avatar :
363
+ :param avatar_uuid :
365
364
:return:
366
365
:return:
367
366
"""
368
367
data = {
369
368
"attributes" : attributes ,
370
- "objectTypeId" : objectTypeId ,
371
- "avatarUUID" : avatarUUID ,
372
- "hasAvatar" : hasAvatar ,
369
+ "objectTypeId" : object_type_id ,
370
+ "avatarUUID" : avatar_uuid ,
371
+ "hasAvatar" : has_avatar ,
373
372
}
374
373
url = self .url_joiner (self .api_root , "object/create" )
375
374
return self .post (url , data = data )
376
375
377
376
def create_object_navlist_iql (
378
377
self ,
379
378
iql ,
380
- objectTypeId ,
381
- resultsPerPage ,
382
- orderByTypeAttrId ,
383
- objectId ,
384
- objectSchemaId ,
385
- includeAttributes ,
386
- attributesToDisplay ,
379
+ object_type_id ,
380
+ results_per_page ,
381
+ order_by_type_attr_id ,
382
+ object_id ,
383
+ object_schema_id ,
384
+ include_attributes ,
385
+ attributes_to_display ,
387
386
page = 1 ,
388
387
asc = 0 ,
389
388
):
390
389
"""
391
- A filter object that is used to find a paginatad result set based on an object type and an IQL query
390
+ A filter object that is used to find a paginated result set based on an object type and an IQL query
392
391
393
392
:param iql:
394
- :param objectTypeId :
393
+ :param object_type_id :
395
394
:param page:
396
- :param resultsPerPage :
397
- :param orderByTypeAttrId :
395
+ :param results_per_page :
396
+ :param order_by_type_attr_id :
398
397
:param asc:
399
- :param objectId :
400
- :param objectSchemaId :
401
- :param includeAttributes :
402
- :param attributesToDisplay :
398
+ :param object_id :
399
+ :param object_schema_id :
400
+ :param include_attributes :
401
+ :param attributes_to_display :
403
402
:return:
404
403
"""
405
- data = {"objectTypeId" : objectTypeId , "iql" : iql , "resultsPerPage" : resultsPerPage , "page" : page , "asc" : asc }
406
- if attributesToDisplay is not None :
407
- data ["attributesToDisplay" ] = attributesToDisplay
408
- if includeAttributes is not None :
409
- data ["includeAttributes" ] = includeAttributes
410
- if objectSchemaId is not None :
411
- data ["objectSchemaId" ] = objectSchemaId
412
- if orderByTypeAttrId is not None :
413
- data ["orderByTypeAttrId" ] = orderByTypeAttrId
414
- if objectId is not None :
415
- data ["objectId" ] = objectId
404
+ data = {
405
+ "objectTypeId" : object_type_id ,
406
+ "iql" : iql ,
407
+ "resultsPerPage" : results_per_page ,
408
+ "page" : page ,
409
+ "asc" : asc ,
410
+ }
411
+ if attributes_to_display is not None :
412
+ data ["attributesToDisplay" ] = attributes_to_display
413
+ if include_attributes is not None :
414
+ data ["includeAttributes" ] = include_attributes
415
+ if object_schema_id is not None :
416
+ data ["objectSchemaId" ] = object_schema_id
417
+ if order_by_type_attr_id is not None :
418
+ data ["orderByTypeAttrId" ] = order_by_type_attr_id
419
+ if object_id is not None :
420
+ data ["objectId" ] = object_id
416
421
url = self .url_joiner (self .api_root , "iql/objects" )
417
422
return self .post (url , data = data )
418
423
@@ -494,7 +499,67 @@ def get_object_schema_object_types_flat(self, schema_id):
494
499
"""
495
500
raise NotImplementedError
496
501
497
- # Objecttype
498
- # Objecttypeattribute
499
- # Progress
500
- # Config
502
+ def get_object_type_attributes (
503
+ self ,
504
+ type_id ,
505
+ only_value_editable = None ,
506
+ order_by_name = None ,
507
+ query = None ,
508
+ include_values_exist = None ,
509
+ exclude_parent_attributes = None ,
510
+ include_children = None ,
511
+ order_by_required = None ,
512
+ ):
513
+ """
514
+ Find all attributes for this object type
515
+ https://developer.atlassian.com/cloud/insight/rest/api-group-objecttype/#api-objecttype-id-attributes-get
516
+ Args:
517
+ type_id (str): id of the object type
518
+ only_value_editable (bool, optional): only return editable values, defaults to None (Use API default)
519
+ order_by_name (bool, optional): values, defaults to None (Use API default)
520
+ query (str, optional): Not documented in API, defaults to None (Use API default)
521
+ include_values_exist (bool, optional): Include only where values exist, defaults to None (Use API default)
522
+ exclude_parent_attributes (bool, optional): Exclude parent attributes, defaults to None (Use API default)
523
+ include_children (bool, optional): include attributes from children, defaults to None (Use API default)
524
+ order_by_required (bool, optional): Order by required fields, defaults to None (Use API default)
525
+ """
526
+
527
+ kwargs = locals ().items ()
528
+ params = dict ()
529
+ params .update ({k : v for k , v in kwargs if v is not None and k not in ["self" , "type_id" ]})
530
+
531
+ return self .get (
532
+ "{0}objecttype/{1}/attributes" .format (self .api_root , type_id ),
533
+ headers = self .experimental_headers ,
534
+ params = params ,
535
+ )
536
+
537
+ ### Objecttype
538
+ # TODO: Post objecttype {id} position:
539
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-objecttype/#api-objecttype-id-position-post
540
+ # TODO: Post objecttype create:
541
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-objecttype/#api-objecttype-create-post
542
+
543
+ ### Insight ObjectTypeAttribute API
544
+ # TODO: Post objecttypeattribute {objectTypeId}:
545
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-objecttypeattribute/#api-objecttypeattribute-objecttypeid-post
546
+ # TODO: Put objecttypeattribute {objectTypeId} {id}:
547
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-objecttypeattribute/#api-objecttypeattribute-objecttypeid-id-put
548
+ # TODO: Delete objecttypeattribute {id}:
549
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-objecttypeattribute/#api-objecttypeattribute-id-delete
550
+
551
+ ### Insight Progress API
552
+ # TODO: Get progress category imports {id}:
553
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-progress/#api-progress-category-imports-id-get
554
+
555
+ ### Insight Config API
556
+ # TODO: Get config statustype:
557
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-config/#api-config-statustype-get
558
+ # TODO: Post config statustype:
559
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-config/#api-config-statustype-post
560
+ # TODO: Get config statustype {id}:
561
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-config/#api-config-statustype-id-get
562
+ # TODO: Put config statustype {id}:
563
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-config/#api-config-statustype-id-put
564
+ # TODO: Delete config statustype {id}:
565
+ # https://developer.atlassian.com/cloud/insight/rest/api-group-config/#api-config-statustype-id-delete
0 commit comments