Issue Relation

Supported by Redmine starting from version 1.3

Manager

All operations on the IssueRelation resource are provided by it’s manager. To get access to it you have to call redmine.issue_relation 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 IssueRelation resource with given fields and saves it to the Redmine.

Parameters:
  • issue_id (int) – (required). Creates a relation for the issue of given id.
  • issue_to_id (int) – (required). Id of the related issue.
  • relation_type (string) – (required). Type of the relation, one of:
    • relates
    • duplicates
    • duplicated
    • blocks
    • blocked
    • precedes
    • follows
    • copied_to
    • copied_from
  • delay (int) – (optional). Delay in days for a “precedes” or “follows” relation.
Returns:

Resource object

>>> relation = redmine.issue_relation.create(
...     issue_id=12345,
...     issue_to_id=54321,
...     relation_type='precedes',
...     delay=5
... )
>>> relation
<redminelib.resources.IssueRelation #667>

new

redminelib.managers.ResourceManager.new()

Creates new empty IssueRelation 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
>>> relation = redmine.issue_relation.new()
>>> relation.issue_id = 12345
>>> relation.issue_to_id = 54321
>>> relation.relation_type = 'precedes'
>>> relation.delay = 5
>>> relation.save()
True

Read methods

get

redminelib.managers.ResourceManager.get(resource_id)

Returns single IssueRelation resource from Redmine by it’s id.

Parameters:resource_id (int) – (required). Id of the issue relation.
Returns:Resource object
>>> relation = redmine.issue_relation.get(606)
>>> relation
<redminelib.resources.IssueRelation #606>

all

Not supported by Redmine

filter

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

Returns IssueRelation resources that match the given lookup parameters.

Parameters:
  • issue_id (int) – (required). Get relations from the issue with given id.
  • limit (int) – (optional). How much resources to return.
  • offset (int) – (optional). Starting from what resource to return the other resources.
Returns:

ResourceSet object

>>> relations = redmine.issue_relation.filter(issue_id=6543)
>>> relations
<redminelib.resultsets.ResourceSet object with IssueRelation resources>

Hint

You can also get issue relations from an Issue resource object directly using relations relation:

>>> issue = redmine.issue.get(6543)
>>> issue.relations
<redminelib.resultsets.ResourceSet object with IssueRelation resources>

Update methods

Not supported by Redmine

Delete methods

delete

redminelib.managers.ResourceManager.delete(resource_id)

Deletes single IssueRelation resource from Redmine by it’s id.

Parameters:resource_id (int) – (required). Issue relation id.
Returns:True
>>> redmine.issue_relation.delete(1)
True
redminelib.resources.IssueRelation.delete()

Deletes current IssueRelation resource object from Redmine.

Returns:True
>>> relation = redmine.issue_relation.get(1)
>>> relation.delete()
True

Export

Not supported by Redmine