Version¶
Supported by Redmine starting from version 1.3
Manager¶
All operations on the Version resource are provided by its manager. To get access
to it you have to call redmine.version
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 Version resource with given fields and saves it to the Redmine.
- Parameters:
project_id (int or string) – (required). Id or identifier of version’s project.
name (string) – (required). Version name.
status (string) – (optional). Status of the version, one of:
open (default)
locked
closed
sharing (string) – (optional). Version sharing, one of:
none (default)
descendants
hierarchy
tree
system
due_date (string or date object) – (optional). Expiration date.
description (string) – (optional). Version description.
wiki_page_title (string) – (optional). Version wiki page title.
- Returns:
Resource object
>>> version = redmine.version.create(
... project_id='vacation',
... name='Vacation',
... status='open',
... sharing='none',
... due_date=datetime.date(2014, 1, 30),
... description='my vacation',
... wiki_page_title='Vacation'
... )
>>> version
<redminelib.resources.Version #235 "Vacation">
new¶
- redminelib.managers.ResourceManager.new()
Creates new empty Version resource but saves it to the Redmine only when
save()
is called, also callspre_create()
andpost_create()
methods of the Resource object. Valid attributes are the same as forcreate()
method above.- Returns:
Resource object
>>> version = redmine.version.new()
>>> version.project_id = 'vacation'
>>> version.name = 'Vacation'
>>> version.status = 'open'
>>> version.sharing = 'none'
>>> version.due_date = datetime.date(2014, 1, 30)
>>> version.description = 'my vacation'
>>> version.wiki_page_title = 'Vacation'
>>> version.save()
<redminelib.resources.Version #235 "Vacation">
Read methods¶
get¶
- redminelib.managers.ResourceManager.get(resource_id)
Returns single Version resource from Redmine by its id.
- Parameters:
resource_id (int) – (required). Id of the version.
- Returns:
Resource object
>>> version = redmine.version.get(1)
>>> version
<redminelib.resources.Version #1 "Release 1">
all¶
Not supported by Redmine
filter¶
- redminelib.managers.ResourceManager.filter(**filters)
Returns Version resources that match the given lookup parameters.
- Parameters:
project_id (int or string) – (required). Id or identifier of version’s project.
limit (int) – (optional). How much resources to return.
offset (int) – (optional). Starting from what resource to return the other resources.
- Returns:
ResourceSet object
>>> versions = redmine.version.filter(project_id='vacation')
>>> versions
<redminelib.resultsets.ResourceSet object with Versions resources>
Hint
You can also get versions from a Project resource object directly using versions
relation:
>>> project = redmine.project.get('vacation')
>>> project.versions
<redminelib.resultsets.ResourceSet object with Version resources>
Update methods¶
update¶
- redminelib.managers.ResourceManager.update(resource_id, **fields)
Updates values of given fields of a Version resource and saves them to the Redmine.
- Parameters:
resource_id (int) – (required). Version id.
name (string) – (optional). Version name.
status (string) – (optional). Status of the version, one of:
open (default)
locked
closed
sharing (string) – (optional). Version sharing, one of:
none (default)
descendants
hierarchy
tree
system
due_date (string or date object) – (optional). Expiration date.
description (string) – (optional). Version description.
wiki_page_title (string) – (optional). Version wiki page title.
- Returns:
True
>>> redmine.version.update(
... 1,
... name='Vacation',
... status='open',
... sharing='none',
... due_date=datetime.date(2014, 1, 30),
... description='my vacation',
... wiki_page_title='Vacation'
... )
True
save¶
- redminelib.resources.Version.save(**attrs)
Saves the current state of a Version resource to the Redmine. Attrs that can be changed are the same as for
update()
method above.- Returns:
Resource object
>>> version = redmine.version.get(1)
>>> version.name = 'Vacation'
>>> version.status = 'open'
>>> version.sharing = 'none'
>>> version.due_date = datetime.date(2014, 1, 30)
>>> version.description = 'my vacation'
>>> version.wiki_page_title = 'Vacation'
>>> version.save()
<redminelib.resources.Version #1 "Vacation">
Added in version 2.1.0: Alternative syntax was introduced.
>>> version = redmine.version.get(1).save(
... name='Vacation',
... status='open',
... sharing='none',
... due_date=datetime.date(2014, 1, 30),
... description='my vacation',
... wiki_page_title='Vacation'
... )
>>> version
<redminelib.resources.Version #1 "Vacation">
Delete methods¶
delete¶
- redminelib.managers.ResourceManager.delete(resource_id)
Deletes single Version resource from Redmine by its id.
- Parameters:
resource_id (int) – (required). Version id.
- Returns:
True
>>> redmine.version.delete(1)
True
- redminelib.resources.Version.delete()
Deletes current Version resource object from Redmine.
- Returns:
True
>>> version = redmine.version.get(1)
>>> version.delete()
True
Export¶
Not supported by Redmine