Issue Category

Supported by Redmine starting from version 1.3

Manager

All operations on the IssueCategory resource are provided by its manager. To get access to it you have to call redmine.issue_category where redmine is a configured redmine object. See the Configuration about how to configure redmine object.

Create methods

create

redminelib.managers.ResourceManager.create(**fields)

Creates new IssueCategory resource with given fields and saves it to the Redmine.

Parameters:
  • project_id (int or string) – (required). Id or identifier of issue category’s project.

  • name (string) – (required). Issue category name.

  • assigned_to_id (int) – (optional). The id of the user assigned to the category (new issues with this category will be assigned by default to this user).

Returns:

Resource object

>>> category = redmine.issue_category.create(project_id='vacation', name='woohoo', assigned_to_id=13)
>>> category
<redminelib.resources.IssueCategory #810 "woohoo">

new

redminelib.managers.ResourceManager.new()

Creates new empty IssueCategory resource but saves it to the Redmine only when save() is called, also calls pre_create() and post_create() methods of the Resource object. Valid attributes are the same as for create() method above.

Returns:

Resource object

>>> category = redmine.issue_category.new()
>>> category.project_id = 'vacation'
>>> category.name = 'woohoo'
>>> category.assigned_to_id = 13
>>> category.save()
<redminelib.resources.IssueCategory #810 "woohoo">

Read methods

get

redminelib.managers.ResourceManager.get(resource_id)

Returns single IssueCategory resource from Redmine by its id.

Parameters:

resource_id (int) – (required). Id of the issue category.

Returns:

Resource object

>>> category = redmine.issue_category.get(794)
>>> category
<redminelib.resources.IssueCategory #794 "Malibu">

all

Not supported by Redmine

filter

redminelib.managers.ResourceManager.filter(**filters)

Returns IssueCategory resources that match the given lookup parameters.

Parameters:
  • project_id (int or string) – (required). Get issue categories from the project with the given id, where id is either project id or project identifier.

  • limit (int) – (optional). How much resources to return.

  • offset (int) – (optional). Starting from what resource to return the other resources.

Returns:

ResourceSet object

>>> categories = redmine.issue_category.filter(project_id='vacation')
>>> categories
<redminelib.resultsets.ResourceSet object with IssueCategory resources>

Hint

You can also get issue categories from a Project resource object directly using issue_categories relation:

>>> project = redmine.project.get('vacation')
>>> project.issue_categories
<redminelib.resultsets.ResourceSet object with IssueCategory resources>

Update methods

update

redminelib.managers.ResourceManager.update(resource_id, **fields)

Updates values of given fields of an IssueCategory resource and saves them to the Redmine.

Parameters:
  • resource_id (int) – (required). Issue category id.

  • name (string) – (optional). Issue category name.

  • assigned_to_id (int) – (optional). The id of the user assigned to the category (new issues with this category will be assigned by default to this user).

Returns:

True

>>> redmine.issue_category.update(1, name='woohoo', assigned_to_id=13)
True

save

redminelib.resources.IssueCategory.save(**attrs)

Saves the current state of an IssueCategory resource to the Redmine. Attrs that can be changed are the same as for update() method above.

Returns:

Resource object

>>> category = redmine.issue_category.get(1)
>>> category.name = 'woohoo'
>>> category.assigned_to_id = 13
>>> category.save()
<redminelib.resources.IssueCategory #1 "woohoo">

New in version 2.1.0: Alternative syntax was introduced.

>>> category = redmine.issue_category.get(1).save(
...     name='woohoo',
...     assigned_to_id=13
... )
>>> category
<redminelib.resources.IssueCategory #1 "woohoo">

Delete methods

delete

redminelib.managers.ResourceManager.delete(resource_id, **params)

Deletes single IssueCategory resource from Redmine by its id.

Parameters:
  • resource_id (int) – (required). Issue category id.

  • reassign_to_id (int) – (optional). When there are issues assigned to the category you are deleting, this parameter lets you reassign these issues to the category with given id.

Returns:

True

>>> redmine.issue_category.delete(1, reassign_to_id=2)
True
redminelib.resources.IssueCategory.delete()

Deletes current IssueCategory resource object from Redmine.

Parameters:

reassign_to_id (int) – (optional). When there are issues assigned to the category you are deleting, this parameter lets you reassign these issues to the category with given id.

Returns:

True

>>> category = redmine.issue_category.get(794)
>>> category.delete(reassign_to_id=2)
True

Export

Not supported by Redmine