File size: 10,609 Bytes
56d74b6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | Jira module
===========
Get issues from jql search result with all related fields
---------------------------------------------------------
.. code-block:: python
jql_request = 'project = DEMO AND status NOT IN (Closed, Resolved) ORDER BY issuekey'
issues = jira.jql(jql_request)
print(issues)
Reindex Jira
------------
.. code-block:: python
# Reindexing Jira
jira.reindex()
# Reindex status
jira.reindex_status()
# Reindex type
jira.reindex_with_type(indexing_type="BACKGROUND_PREFERRED")
"""
FOREGROUND - runs a lock/full reindexing
BACKGROUND - runs a background reindexing.
If JIRA fails to finish the background reindexing, respond with 409 Conflict (error message).
BACKGROUND_PREFERRED - If possible do a background reindexing.
If it's not possible (due to an inconsistent index), do a foreground reindexing.
"""
Manage users
------------
.. code-block:: python
# Get user
jira.user(account_id)
# Remove user
jira.user_remove(username)
# Deactivate user. Works from 8.3.0 release
jira.user_deactivate(username)
# Get web sudo cookies using normal http request
jira.user_get_websudo()
# Fuzzy search using emailAddress or displayName
jira.user_find_by_user_string(query, start=0, limit=50, include_inactive_users=False)
Manage groups
-------------
.. code-block:: python
# Create a group
jira.create_group(name)
# Delete a group
# If you delete a group and content is restricted to that group, the content will be hidden from all users
# To prevent this, use this parameter to specify a different group to transfer the restrictions
# (comments and worklogs only) to
jira.remove_group(name, swap_group=None)
# Get all users from group
jira.get_all_users_from_group(group, include_inactive_users=False, start=0, limit=50)
# Add given user to a group
jira.add_user_to_group(username, group_name)
# Remove given user from a group
jira.remove_user_from_group(username, group_name)
Manage projects
---------------
.. code-block:: python
# Get all projects
# Returns all projects which are visible for the currently logged in user.
jira.projects(included_archived=None)
# Get all project alternative call
# Returns all projects which are visible for the currently logged in user.
jira.get_all_projects(included_archived=None)
# Get project
jira.project(key)
# Get project components using project key
jira.get_project_components(key)
# Get a full representation of a the specified project's versions
jira.get_project_versions(key, expand=None)
# Returns all versions for the specified project. Results are paginated.
# Results can be ordered by the following fields: sequence, name, startDate, releaseDate.
# Results can be filtered by the following fields: query, status.
jira.get_project_versions_paginated(key, start=None, limit=None, order_by=None, expand=None, query=None, status=None)
# Add missing version to project
jira.add_version(key, project_id, version, is_archived=False, is_released=False)
# Get project leaders
jira.project_leaders()
# Get last project issuekey
jira.get_project_issuekey_last(project)
# Get all project issue keys
jira.get_project_issuekey_all(project)
# Get project issues count
jira.get_project_issues_count(project)
# Get all project issues
jira.get_all_project_issues(project, fields='*all', start=100, limit=500)
# Get all assignable users for project
jira.get_all_assignable_users_for_project(project_key, start=0, limit=50)
# Update a project
jira.update_project(project_key, data, expand='lead,description')
# Get project permission scheme
# Use 'expand' to get details (default is None)
jira.get_project_permission_scheme(project_id_or_key, expand='permissions,user,group,projectRole,field,all')
# Get the issue security scheme for project.
# Returned if the user has the administrator permission or if the scheme is used in a project in which the
# user has the administrative permission.
# Use only_levels=True for get the only levels entries
jira.get_project_issue_security_scheme(project_id_or_key, only_levels=False)
# Resource for associating notification schemes and projects.
# Gets a notification scheme associated with the project.
# Follow the documentation of /notificationscheme/{id} resource for all details about returned value.
# Use 'expand' to get details (default is None) possible values are notificationSchemeEvents,user,group,projectRole,field,all
jira.get_priority_scheme_of_project(project_key_or_id, expand=None)
Manage issues
-------------
.. code-block:: python
# Get issue by key
jira.issue(key)
# Get issue field value
jira.issue_field_value(key, field)
# Update issue field
fields = {'summary': 'New summary'}
jira.update_issue_field(key, fields)
# Get existing custom fields or find by filter
get_custom_fields(self, search=None, start=1, limit=50):
# Check issue exists
jira.issue_exists(issue_key)
# Check issue deleted
jira.issue_deleted(issue_key)
# Update issue
jira.issue_update(issue_key, fields)
# Create issue
jira.issue_create(fields)
# Issue create or update
jira.issue_create_or_update(fields)
# Get issue transitions
jira.get_issue_transitions(issue_key)
# Get status ID from name
jira.get_status_id_from_name(status_name)
# Get transition id to status name
jira.get_transition_id_to_status_name(issue_key, status_name)
# Transition issue
jira.issue_transition(issue_key, status)
# Set issue status
jira.set_issue_status(issue_key, status_name, fields=None)
# Set issue status by transition_id
jira.set_issue_status_by_transition_id(issue_key, transition_id)
# Get issue status
jira.get_issue_status(issue_key)
# Get Issue Link
jira.get_issue_link(link_id)
# Create Issue Link
data = {
"type": {"name": "Duplicate" },
"inwardIssue": { "key": "HSP-1"},
"outwardIssue": {"key": "MKY-1"},
"comment": { "body": "Linked related issue!",
"visibility": { "type": "group", "value": "jira-software-users" }
}
}
jira.create_issue_link(data)
# Remove Issue Link
jira.remove_issue_link(link_id)
# Create or Update Issue Remote Links
jira.create_or_update_issue_remote_links(issue_key, link_url, title, global_id=None, relationship=None)
# Get Issue Remote Link by link ID
jira.get_issue_remote_link_by_id(issue_key, link_id)
# Update Issue Remote Link by link ID
jira.update_issue_remote_link_by_id(issue_key, link_id, url, title, global_id=None, relationship=None)
# Delete Issue Remote Links
jira.delete_issue_remote_link_by_id(issue_key, link_id)
# Export Issues to csv
jira.csv(jql, all_fields=False)
Manage Boards
-------------
.. code-block:: python
# Create sprint
jira.jira.create_sprint(sprint_name, origin_board_id, start_datetime, end_datetime, goal)
# Rename sprint
jira.rename_sprint(sprint_id, name, start_date, end_date)
# Add/Move Issues to sprint
jira.add_issues_to_sprint(sprint_id, issues_list)
Attachments actions
-------------------
.. code-block:: python
# Add attachment to issue
jira.add_attachment(issue_key, filename)
Manage components
-----------------
.. code-block:: python
# Get component
jira.component(component_id)
# Create component
jira.create_component(component)
# Delete component
jira.delete_component(component_id)
Upload Jira plugin
------------------
.. code-block:: python
upload_plugin(plugin_path)
Issue link types
----------------
.. code-block:: python
# Get Issue link types
jira.get_issue_link_types():
# Create Issue link types
jira.create_issue_link_type(data):
"""Create a new issue link type.
:param data:
{
"name": "Duplicate",
"inward": "Duplicated by",
"outward": "Duplicates"
}
"""
# Get issue link type by id
jira.get_issue_link_type(issue_link_type_id):
# Delete issue link type
jira.delete_issue_link_type(issue_link_type_id):
# Update issue link type
jira.update_issue_link_type(issue_link_type_id, data):
Issue security schemes
----------------------
.. code-block:: python
# Get all security schemes.
# Returned if the user has the administrator permission or if the scheme is used in a project in which the
# user has the administrative permission.
jira.get_issue_security_schemes()
# Get issue security scheme.
# Returned if the user has the administrator permission or if the scheme is used in a project in which the
# user has the administrative permission.
# Use only_levels=True for get the only levels entries
jira.get_issue_security_scheme(scheme_id, only_levels=False)
TEMPO
----------------------
.. code-block:: python
# Find existing worklogs with the search parameters.
# Look at the tempo docs for additional information:
# https://www.tempo.io/server-api-documentation/timesheets#operation/searchWorklogs
# NOTE: check if you are using correct types for the parameters!
# :param from: string From Date
# :param to: string To Date
# :param worker: Array of strings
# :param taskId: Array of integers
# :param taskKey: Array of strings
# :param projectId: Array of integers
# :param projectKey: Array of strings
# :param teamId: Array of integers
# :param roleId: Array of integers
# :param accountId: Array of integers
# :param accountKey: Array of strings
# :param filterId: Array of integers
# :param customerId: Array of integers
# :param categoryId: Array of integers
# :param categoryTypeId: Array of integers
# :param epicKey: Array of strings
# :param updatedFrom: string
# :param includeSubtasks: boolean
# :param pageNo: integer
# :param maxResults: integer
# :param offset: integer
jira.tempo_4_timesheets_find_worklogs(**params)
# :PRIVATE:
# Get Tempo timesheet worklog by issue key or id.
jira.tempo_timesheets_get_worklogs_by_issue(issue)
|