@@ -6160,6 +6160,201 @@ def get_issues_without_epic(
61606160 params ["maxResults" ] = limit
61616161 return self .get (url , params = params )
61626162
6163+ # rest/agile/1.0/epic/{epicIdOrKey}
6164+ def get_epic (self , epic_id_or_key : T_id ) -> T_resp_json :
6165+ """
6166+ Returns the epic for a given epic ID or key.
6167+ The user needs to have permission to view the epic.
6168+
6169+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-getEpic
6170+ :param epic_id_or_key: int/str: The ID or key of the epic
6171+ :return: Dictionary of response received from the API
6172+ """
6173+ resource = f"epic/{ epic_id_or_key } "
6174+ url = self .get_agile_resource_url (resource )
6175+ return self .get (url )
6176+
6177+ def update_partially_epic (self , epic_id_or_key : T_id , data : dict ) -> T_resp_json :
6178+ """
6179+ Performs a partial update of an epic.
6180+ A partial update means that fields not present in the request JSON will not be updated.
6181+
6182+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-partiallyUpdateEpic
6183+ :param epic_id_or_key: int/str: The ID or key of the epic
6184+ :param data: dict: Fields to update, e.g. {"name": "New name", "done": true}
6185+ :return: Dictionary of response received from the API
6186+ """
6187+ resource = f"epic/{ epic_id_or_key } "
6188+ url = self .get_agile_resource_url (resource )
6189+ return self .post (url , data = data )
6190+
6191+ def get_issues_in_epic (
6192+ self ,
6193+ epic_id_or_key : T_id ,
6194+ jql : str = "" ,
6195+ validate_query : str = "" ,
6196+ fields : str = "*all" ,
6197+ expand : str = "" ,
6198+ start : int = 0 ,
6199+ limit : int = 50 ,
6200+ ) -> T_resp_json :
6201+ """
6202+ Returns all issues that belong to an epic, for a given epic ID or key.
6203+ This only includes issues that the user has permission to view.
6204+ By default, the returned issues are ordered by rank.
6205+
6206+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-getIssuesForEpic
6207+ :param epic_id_or_key: int/str: The ID or key of the epic
6208+ :param jql: Filter results using a JQL query.
6209+ :param validate_query: Whether to validate the JQL query.
6210+ :param fields: list of fields, for example: ['priority', 'summary', 'customfield_10007']
6211+ :param expand: A comma-separated list of the parameters to expand.
6212+ :param start: The starting index of the returned issues. Base index: 0.
6213+ :param limit: The maximum number of issues to return per page. Default: 50.
6214+ :return: Dictionary of response received from the API
6215+ """
6216+ resource = f"epic/{ epic_id_or_key } /issue"
6217+ url = self .get_agile_resource_url (resource )
6218+ params : dict = {}
6219+ if jql :
6220+ params ["jql" ] = jql
6221+ if validate_query :
6222+ params ["validateQuery" ] = validate_query
6223+ if fields :
6224+ params ["fields" ] = fields
6225+ if expand :
6226+ params ["expand" ] = expand
6227+ if start :
6228+ params ["startAt" ] = start
6229+ if limit :
6230+ params ["maxResults" ] = limit
6231+ return self .get (url , params = params )
6232+
6233+ def move_issues_to_epic (self , epic_id_or_key : T_id , issues : List [T_id ]) -> T_resp_json :
6234+ """
6235+ Moves issues to an epic, for a given epic ID or key.
6236+ Issues can only be moved to epics that the user has permission to view.
6237+
6238+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-moveIssuesToEpic
6239+ :param epic_id_or_key: int/str: The ID or key of the epic
6240+ :param issues: list: List of issue keys or IDs, e.g. ['APA-1', 'APA-2']
6241+ :return: Dictionary of response received from the API
6242+ """
6243+ resource = f"epic/{ epic_id_or_key } /issue"
6244+ url = self .get_agile_resource_url (resource )
6245+ data = dict (issues = issues )
6246+ return self .post (url , data = data )
6247+
6248+ def rank_epics (
6249+ self ,
6250+ epic_id_or_key : T_id ,
6251+ rank_before_epic : Optional [str ] = None ,
6252+ rank_after_epic : Optional [str ] = None ,
6253+ rank_custom_field_id : Optional [T_id ] = None ,
6254+ ) -> T_resp_json :
6255+ """
6256+ Updates the rank of an epic.
6257+
6258+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-rankEpics
6259+ :param epic_id_or_key: int/str: The ID or key of the epic
6260+ :param rank_before_epic: The epic the given epic should be placed before
6261+ :param rank_after_epic: The epic the given epic should be placed after
6262+ :param rank_custom_field_id: The number of the custom field Rank
6263+ :return: Dictionary of response received from the API
6264+ """
6265+ resource = f"epic/{ epic_id_or_key } /rank"
6266+ url = self .get_agile_resource_url (resource )
6267+ data : dict = {}
6268+ if rank_before_epic :
6269+ data ["rankBeforeEpic" ] = rank_before_epic
6270+ if rank_after_epic :
6271+ data ["rankAfterEpic" ] = rank_after_epic
6272+ if rank_custom_field_id :
6273+ data ["rankCustomFieldId" ] = rank_custom_field_id
6274+ return self .put (url , data = data )
6275+
6276+ def get_issues_not_in_epic (
6277+ self ,
6278+ jql : str = "" ,
6279+ validate_query : str = "" ,
6280+ fields : str = "*all" ,
6281+ expand : str = "" ,
6282+ start : int = 0 ,
6283+ limit : int = 50 ,
6284+ ) -> T_resp_json :
6285+ """
6286+ Returns all issues that do not belong to any epic.
6287+ This only includes issues that the user has permission to view.
6288+ By default, the returned issues are ordered by rank.
6289+
6290+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-getIssuesWithoutEpic
6291+ :param jql: Filter results using a JQL query.
6292+ :param validate_query: Whether to validate the JQL query.
6293+ :param fields: list of fields, for example: ['priority', 'summary', 'customfield_10007']
6294+ :param expand: A comma-separated list of the parameters to expand.
6295+ :param start: The starting index of the returned issues. Base index: 0.
6296+ :param limit: The maximum number of issues to return per page. Default: 50.
6297+ :return: Dictionary of response received from the API
6298+ """
6299+ resource = "epic/none/issue"
6300+ url = self .get_agile_resource_url (resource )
6301+ params : dict = {}
6302+ if jql :
6303+ params ["jql" ] = jql
6304+ if validate_query :
6305+ params ["validateQuery" ] = validate_query
6306+ if fields :
6307+ params ["fields" ] = fields
6308+ if expand :
6309+ params ["expand" ] = expand
6310+ if start :
6311+ params ["startAt" ] = start
6312+ if limit :
6313+ params ["maxResults" ] = limit
6314+ return self .get (url , params = params )
6315+
6316+ def remove_issues_from_epic (self , issues : List [T_id ]) -> T_resp_json :
6317+ """
6318+ Removes issues from any epic.
6319+
6320+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/epic-removeIssuesFromEpic
6321+ :param issues: list: List of issue keys or IDs, e.g. ['APA-1', 'APA-2']
6322+ :return: Dictionary of response received from the API
6323+ """
6324+ resource = "epic/none/issue"
6325+ url = self .get_agile_resource_url (resource )
6326+ data = dict (issues = issues )
6327+ return self .post (url , data = data )
6328+
6329+ # rest/agile/1.0/issue/{issueIdOrKey}/estimation
6330+ def get_issue_estimation (self , issue_id_or_key : T_id , board_id : T_id ) -> T_resp_json :
6331+ """
6332+ Returns the estimation of the issue for a given board.
6333+
6334+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/issue-getIssueEstimationForBoard
6335+ :param issue_id_or_key: int/str: The ID or key of the issue
6336+ :param board_id: int: The ID of the board
6337+ :return: Dictionary of conversion received from the API
6338+ """
6339+ resource = f"issue/{ issue_id_or_key } /estimation"
6340+ url = self .get_agile_resource_url (resource )
6341+ params = {"boardId" : board_id }
6342+ return self .get (url , params = params )
6343+
6344+ def set_issue_estimation (self , issue_id_or_key : T_id , board_id : T_id , value : str ) -> T_resp_json :
6345+ """
6346+ Updates the estimation of the issue for a given board.
6347+
6348+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/issue-estimateIssueForBoard
6349+ :param issue_id_or_key: int/str: The ID or key of the issue
6350+ :param board_id: int: The ID of the board
6351+ :param value: str: The value to set for the estimation
6352+ :return: Dictionary of response received from the API
6353+ """
6354+ resource = f"issue/{ issue_id_or_key } /estimation"
6355+ url = self .get_agile_resource_url (resource )
6356+ return self .put (url , params = {"boardId" : board_id }, data = {"value" : value })
6357+
61636358 # rest/agile/1.0/board/{boardId}/project
61646359 def get_all_projects_associated_with_board (self , board_id : T_id , start : int = 0 , limit : int = 50 ) -> T_resp_json :
61656360 """
@@ -6504,6 +6699,139 @@ def update_partially_sprint(self, sprint_id: T_id, data: dict) -> T_resp_json:
65046699 url = self .get_agile_resource_url (resource )
65056700 return self .post (url , data = data )
65066701
6702+ def update_sprint (self , sprint_id : T_id , data : dict ) -> T_resp_json :
6703+ """
6704+ Performs a full update of a sprint.
6705+ A full update means that fields not present in the request JSON will be set to their default values.
6706+
6707+ Sprints that are in a closed state cannot be updated.
6708+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint-updateSprint
6709+ :param sprint_id: int/str: The ID of the sprint
6710+ :param data: dict: Sprint fields, e.g. {"name": "new name", "state": "active"}
6711+ :return: Dictionary of response received from the API
6712+ """
6713+ resource = f"sprint/{ sprint_id } "
6714+ url = self .get_agile_resource_url (resource )
6715+ return self .put (url , data = data )
6716+
6717+ def swap_sprint (self , sprint_id : T_id , sprint_to_swap_with : T_id ) -> T_resp_json :
6718+ """
6719+ Swaps the values of two sprints, for a given sprint ID.
6720+ The sprints must be originally scheduled on the same board.
6721+
6722+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint-swapSprint
6723+ :param sprint_id: int/str: The ID of the sprint
6724+ :param sprint_to_swap_with: int: The ID of the sprint to swap with
6725+ :return: Dictionary of response received from the API
6726+ """
6727+ resource = f"sprint/{ sprint_id } /swap"
6728+ url = self .get_agile_resource_url (resource )
6729+ return self .post (url , data = {"sprintToSwapWith" : sprint_to_swap_with })
6730+
6731+ def unmap_sprints (self , sprint_ids : List [T_id ]) -> T_resp_json :
6732+ """
6733+ Unmaps sprints from boards, for a list of sprint IDs (experimental).
6734+
6735+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint-unmapSprints
6736+ :param sprint_ids: list: List of sprint IDs, e.g. [37, 42]
6737+ :return: Dictionary of response received from the API
6738+ """
6739+ resource = "sprint/unmap"
6740+ url = self .get_agile_resource_url (resource )
6741+ return self .put (url , data = {"sprintIds" : sprint_ids })
6742+
6743+ def unmap_all_sprints (self ) -> T_resp_json :
6744+ """
6745+ Unmaps all sprints from boards (experimental).
6746+
6747+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint-unmapAllSprints
6748+ :return: Dictionary of response received from the API
6749+ """
6750+ resource = "sprint/unmap-all"
6751+ url = self .get_agile_resource_url (resource )
6752+ return self .put (url )
6753+
6754+ # rest/agile/1.0/sprint/{sprintId}/properties
6755+ def get_sprint_properties (self , sprint_id : T_id ) -> T_resp_json :
6756+ """
6757+ Returns the keys of all properties for the sprint.
6758+
6759+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint/{sprintId}/properties-getPropertiesKeys
6760+ :param sprint_id: int/str: The ID of the sprint
6761+ :return: Dictionary of response received from the API
6762+ """
6763+ resource = f"sprint/{ sprint_id } /properties"
6764+ url = self .get_agile_resource_url (resource )
6765+ return self .get (url )
6766+
6767+ def get_sprint_property (self , sprint_id : T_id , property_key : str ) -> T_resp_json :
6768+ """
6769+ Returns the value of the property for the sprint.
6770+
6771+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint/{sprintId}/properties-getProperty
6772+ :param sprint_id: int/str: The ID of the sprint
6773+ :param property_key: str: The key of the property
6774+ :return: Dictionary of response received from the API
6775+ """
6776+ resource = f"sprint/{ sprint_id } /properties/{ property_key } "
6777+ url = self .get_agile_resource_url (resource )
6778+ return self .get (url )
6779+
6780+ def set_sprint_property (self , sprint_id : T_id , property_key : str , value ) -> T_resp_json :
6781+ """
6782+ Sets the value of the specified sprint's property.
6783+
6784+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint/{sprintId}/properties-setProperty
6785+ :param sprint_id: int/str: The ID of the sprint
6786+ :param property_key: str: The key of the property
6787+ :param value: The value to set
6788+ :return: Dictionary of response received from the API
6789+ """
6790+ resource = f"sprint/{ sprint_id } /properties/{ property_key } "
6791+ url = self .get_agile_resource_url (resource )
6792+ return self .put (url , data = value )
6793+
6794+ def delete_sprint_property (self , sprint_id : T_id , property_key : str ) -> T_resp_json :
6795+ """
6796+ Removes the property from the sprint.
6797+
6798+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/sprint/{sprintId}/properties-deleteProperty
6799+ :param sprint_id: int/str: The ID of the sprint
6800+ :param property_key: str: The key of the property
6801+ :return: Dictionary of response received from the API
6802+ """
6803+ resource = f"sprint/{ sprint_id } /properties/{ property_key } "
6804+ url = self .get_agile_resource_url (resource )
6805+ return self .delete (url )
6806+
6807+ # rest/agile/1.0/issue/{issueIdOrKey}
6808+ def get_agile_issue (
6809+ self ,
6810+ issue_id_or_key : T_id ,
6811+ fields : str = "*all" ,
6812+ expand : Optional [str ] = None ,
6813+ update_history : bool = False ,
6814+ ) -> T_resp_json :
6815+ """
6816+ Returns a single issue from the Agile API, for a given issue ID or key.
6817+ The issue includes Agile fields like sprint, closedSprints, flagged, and epic.
6818+
6819+ https://docs.atlassian.com/jira-software/REST/9.17.0/#agile/1.0/issue-getIssue
6820+ :param issue_id_or_key: int/str: The ID or key of the issue
6821+ :param fields: Comma-separated list of issue fields
6822+ :param expand: A comma-separated list of the parameters to expand
6823+ :param update_history: Whether to update the user's issue history
6824+ :return: Dictionary of response received from the API
6825+ """
6826+ resource = f"issue/{ issue_id_or_key } "
6827+ url = self .get_agile_resource_url (resource )
6828+ params : dict = {"fields" : fields }
6829+ if expand :
6830+ params ["expand" ] = expand
6831+ if update_history :
6832+ params ["updateHistory" ] = update_history
6833+ return self .get (url , params = params )
6834+
65076835 def get_sprint_issues (self , sprint_id : T_id , start : T_id , limit : T_id ) -> T_resp_json :
65086836 """
65096837 Returns all issues in a sprint, for a given sprint ID.
0 commit comments