22import logging
33import re
44from warnings import warn
5-
5+ from deprecated import deprecated
66from requests import HTTPError
77
88from .errors import ApiNotFoundError , ApiPermissionError
@@ -4611,14 +4611,14 @@ def delete_agile_board_property(self, board_id, property_key):
46114611 )
46124612 return self .delete (url )
46134613
4614- # /rest/agile/1.0/board/{boardId}/settings
4614+ # /rest/agile/1.0/board/{boardId}/settings/refined-velocity
46154615 def get_agile_board_refined_velocity (self , board_id ):
46164616 """
46174617 Returns the estimation statistic settings of the board.
46184618 :param board_id:
46194619 :return:
46204620 """
4621- url = "/rest/agile/1.0/board/{boardId}/settings" .format (boardId = board_id )
4621+ url = "/rest/agile/1.0/board/{boardId}/settings/refined-velocity " .format (boardId = board_id )
46224622 return self .get (url )
46234623
46244624 def set_agile_board_refined_velocity (self , board_id , data ):
@@ -4628,9 +4628,121 @@ def set_agile_board_refined_velocity(self, board_id, data):
46284628 :param data:
46294629 :return:
46304630 """
4631- url = "/rest/agile/1.0/board/{boardId}/settings" .format (boardId = board_id )
4631+ url = "/rest/agile/1.0/board/{boardId}/settings/refined-velocity " .format (boardId = board_id )
46324632 return self .put (url , data = data )
46334633
4634+ # /rest/agile/1.0/board/{boardId}/sprint
4635+
4636+ def get_all_sprints_from_board (self , board_id , state = None , start = 0 , limit = 50 ):
4637+ """
4638+ Returns all sprints from a board, for a given board ID.
4639+ This only includes sprints that the user has permission to view.
4640+ :param board_id:
4641+ :param state: Filter results to sprints in specified states.
4642+ Valid values: future, active, closed.
4643+ You can define multiple states separated by commas, e.g. state=active,closed
4644+ :param start: The starting index of the returned sprints.
4645+ Base index: 0.
4646+ See the 'Pagination' section at the top of this page for more details.
4647+ :param limit: The maximum number of sprints to return per page.
4648+ Default: 50.
4649+ See the 'Pagination' section at the top of this page for more details.
4650+ :return:
4651+ """
4652+ params = {}
4653+ if start :
4654+ params ["startAt" ] = start
4655+ if limit :
4656+ params ["maxResults" ] = limit
4657+ if state :
4658+ params ["state" ] = state
4659+ url = "rest/agile/1.0/board/{boardId}/sprint" .format (boardId = board_id )
4660+ return self .get (url , params = params )
4661+
4662+ @deprecated (version = "3.42.0" , reason = "Use get_all_sprints_from_board instead" )
4663+ def get_all_sprint (self , board_id , state = None , start = 0 , limit = 50 ):
4664+ """
4665+ Returns all sprints from a board, for a given board ID.
4666+ :param board_id:
4667+ :param state:
4668+ :param start:
4669+ :param limit:
4670+ :return:
4671+ """
4672+ return self .get_all_sprints_from_board (board_id , state , start , limit )
4673+
4674+ def get_all_issues_for_sprint_in_board (
4675+ self , board_id , sprint_id , jql = "" , validateQuery = True , fields = "" , expand = "" , start = 0 , limit = 50
4676+ ):
4677+ """
4678+ Get all issues you have access to that belong to the sprint from the board.
4679+ Issue returned from this resource contains additional fields like: sprint, closedSprints, flagged and epic.
4680+ Issues are returned ordered by rank. JQL order has higher priority than default rank.
4681+ :param board_id:
4682+ :param sprint_id:
4683+ :param jql: Filter results using a JQL query.
4684+ If you define an order in your JQL query,
4685+ it will override the default order of the returned issues.
4686+ :param validateQuery: Specifies whether to validate the JQL query or not. Default: true.
4687+ :param fields: The list of fields to return for each issue.
4688+ By default, all navigable and Agile fields are returned.
4689+ :param expand: A comma-separated list of the parameters to expand.
4690+ :param start: The starting index of the returned issues.
4691+ Base index: 0.
4692+ See the 'Pagination' section at the top of this page for more details.
4693+ :param limit: The maximum number of issues to return per page.
4694+ Default: 50.
4695+ See the 'Pagination' section at the top of this page for more details.
4696+ Note, the total number of issues returned is limited by the property
4697+ 'jira.search.views.default.max' in your JIRA instance.
4698+ If you exceed this limit, your results will be truncated.
4699+ """
4700+ url = "/rest/agile/1.0/board/{boardId}/sprint/{sprintId}/issue" .format (boardId = board_id , sprintId = sprint_id )
4701+ params = {}
4702+ if jql :
4703+ params ["jql" ] = jql
4704+ if validateQuery :
4705+ params ["validateQuery" ] = validateQuery
4706+ if fields :
4707+ params ["fields" ] = fields
4708+ if expand :
4709+ params ["expand" ] = expand
4710+ if start :
4711+ params ["startAt" ] = start
4712+ if limit :
4713+ params ["maxResults" ] = limit
4714+ return self .get (url , params = params )
4715+
4716+ # /rest/agile/1.0/board/{boardId}/version
4717+ def get_all_versions_from_board (self , board_id , released = "true" , start = 0 , limit = 50 ):
4718+ """
4719+ Returns all versions from a board, for a given board ID.
4720+ This only includes versions that the user has permission to view.
4721+ Note, if the user does not have permission to view the board,
4722+ no versions will be returned at all.
4723+ Returned versions are ordered by the name of the project from which they belong and
4724+ then by sequence defined by user.
4725+ :param board_id:
4726+ :param released: Filter results to versions that are either released or
4727+ unreleased.Valid values: true, false.
4728+ :param start: The starting index of the returned versions.
4729+ Base index: 0.
4730+ See the 'Pagination' section at the top of this page for more details.
4731+ :param limit: The maximum number of versions to return per page.
4732+ Default: 50.
4733+ See the 'Pagination' section at the top of this page for more details.
4734+ :return:
4735+ """
4736+ params = {}
4737+ if released :
4738+ params ["released" ] = released
4739+ if start :
4740+ params ["startAt" ] = start
4741+ if limit :
4742+ params ["maxResults" ] = limit
4743+ url = "rest/agile/1.0/board/{boardId}/version" .format (boardId = board_id )
4744+ return self .get (url , params = params )
4745+
46344746 def create_sprint (self , name , board_id , start_date = None , end_date = None , goal = None ):
46354747 """
46364748 Create a sprint within a board.
@@ -4676,32 +4788,6 @@ def add_issues_to_sprint(self, sprint_id, issues):
46764788 data = dict (issues = issues )
46774789 return self .post (url , data = data )
46784790
4679- def get_all_sprint (self , board_id , state = None , start = 0 , limit = 50 ):
4680- """
4681- Returns all sprints from a board, for a given board ID.
4682- This only includes sprints that the user has permission to view.
4683- :param board_id:
4684- :param state: Filter results to sprints in specified states.
4685- Valid values: future, active, closed.
4686- You can define multiple states separated by commas, e.g. state=active,closed
4687- :param start: The starting index of the returned sprints.
4688- Base index: 0.
4689- See the 'Pagination' section at the top of this page for more details.
4690- :param limit: The maximum number of sprints to return per page.
4691- Default: 50.
4692- See the 'Pagination' section at the top of this page for more details.
4693- :return:
4694- """
4695- params = {}
4696- if start :
4697- params ["startAt" ] = start
4698- if limit :
4699- params ["maxResults" ] = limit
4700- if state :
4701- params ["state" ] = state
4702- url = "rest/agile/1.0/board/{boardId}/sprint" .format (boardId = board_id )
4703- return self .get (url , params = params )
4704-
47054791 def get_sprint (self , sprint_id ):
47064792 """
47074793 Returns the sprint for a given sprint ID.
0 commit comments