@@ -4575,13 +4575,29 @@ def sprints(
4575
4575
self .AGILE_BASE_URL ,
4576
4576
)
4577
4577
4578
- def sprints_by_name (self , id , extended = False ):
4578
+ def sprints_by_name (
4579
+ self , id : Union [str , int ], extended : bool = False , state : str = None
4580
+ ) -> Dict [str , Dict [str , Any ]]:
4581
+ """Get a dictionary of sprint Resources where the name of the sprint is the key.
4582
+
4583
+ Args:
4584
+ board_id (int): the board to get sprints from
4585
+ extended (bool): Deprecated.
4586
+ state (str): Filters results to sprints in specified states. Valid values: `future`, `active`, `closed`.
4587
+ You can define multiple states separated by commas
4588
+
4589
+ Returns:
4590
+ Dict[str, Dict[str, Any]]: dictionary of sprints with the sprint name as key
4591
+ """
4579
4592
sprints = {}
4580
- for s in self .sprints (id , extended = extended ):
4593
+ for s in self .sprints (id , extended = extended , state = state ):
4581
4594
if s .name not in sprints :
4582
4595
sprints [s .name ] = s .raw
4583
4596
else :
4584
- raise Exception
4597
+ raise JIRAError (
4598
+ f"There are multiple sprints defined with the name { s .name } on board id { id } ,\n "
4599
+ f"returning a dict with sprint names as a key, assumes unique names for each sprint"
4600
+ )
4585
4601
return sprints
4586
4602
4587
4603
def update_sprint (self , id , name = None , startDate = None , endDate = None , state = None ):
0 commit comments