Issues

Reported issues

Use Issues objects to manipulate issues the authenticated user reported. The gitlab.Gitlab.issues manager object provides helper functions.

Examples

List the issues:

issues = gl.issues.list()

Use the state and label parameters to filter the results. Use the order_by and sort attributes to sort the results:

open_issues = gl.issues.list(state='opened')
closed_issues = gl.issues.list(state='closed')
tagged_issues = gl.issues.list(labels=['foo', 'bar'])

Group issues

Use GroupIssue objects to manipulate issues. The gitlab.Gitlab.project_issues and Group.issues manager objects provide helper functions.

Examples

List the group issues:

issues = gl.group_issues.list(group_id=1)
# or
issues = group.issues.list()
# Filter using the state, labels and milestone parameters
issues = group.issues.list(milestone='1.0', state='opened')
# Order using the order_by and sort parameters
issues = group.issues.list(order_by='created_at', sort='desc')

Project issues

Use ProjectIssue objects to manipulate issues. The gitlab.Gitlab.project_issues and Project.issues manager objects provide helper functions.

Examples

List the project issues:

issues = gl.project_issues.list(project_id=1)
# or
issues = project.issues.list()
# Filter using the state, labels and milestone parameters
issues = project.issues.list(milestone='1.0', state='opened')
# Order using the order_by and sort parameters
issues = project.issues.list(order_by='created_at', sort='desc')

Get a project issue:

issue = gl.project_issues.get(issue_id, project_id=1)
# or
issue = project.issues.get(issue_id)

Create a new issue:

issue = gl.project_issues.create({'title': 'I have a bug',
                                  'description': 'Something useful here.'},
                                 project_id=1)
# or
issue = project.issues.create({'title': 'I have a bug',
                               'description': 'Something useful here.'})

Update an issue:

issue.labels = ['foo', 'bar']
issue.save()

Close / reopen an issue:

# close an issue
issue.state_event = 'close'
issue.save()
# reopen it
issue.state_event = 'reopen'
issue.save()

Delete an issue:

gl.project_issues.delete(issue_id, project_id=1)
# or
project.issues.delete(issue_id)
# pr
issue.delete()

Subscribe / unsubscribe from an issue:

issue.subscribe()
issue.unsubscribe()

Move an issue to another project:

issue.move(new_project_id)

Make an issue as todo:

issue.todo()

Get time tracking stats:

issue.time_stats()

Set a time estimate for an issue:

issue.set_time_estimate({'duration': '3h30m'})

Reset a time estimate for an issue:

issue.reset_time_estimate()

Add spent time for an issue:

issue.add_time_spent({'duration': '3h30m'})

Reset spent time for an issue:

issue.reset_time_spent()