Note¶
Requires Pro Edition and CRM plugin >= 3.3.0.
Manager¶
All operations on the Note resource are provided by its manager. To get access to
it you have to call redmine.note
where redmine
is a configured redmine object.
See the Configuration about how to configure redmine object.
Create methods¶
Added in version 2.4.0.
create¶
- redminelib.managers.ResourceManager.create(**fields)
Creates new Note resource with given fields and saves it to the CRM plugin.
- Parameters:
project_id (int or string) – (required). Id or identifier of note’s project.
source_type (string) – (required). Resource type, note will belong to: Contact or Deal.
source_id (int) – (required). Id of the resource, note will belong to, depending on the chosen source_type.
content (string) – (optional). Note content.
subject (string) – (optional). Note subject.
type_id (int) – (optional). Note type id (will default to Note if not set):
0 - email
1 - call
2 - meeting
created_on (string or date object) – (optional). Date when note was created.
note_time (string) – (optional). Time when note was created.
uploads (list) – (optional). Uploads as [{'': ''}, ...], accepted keys are:
path (required). Absolute file path or file-like object that should be uploaded.
filename (optional). Name of the file after upload.
description (optional). Description of the file.
content_type (optional). Content type of the file.
- Returns:
Resource object
>>> note = redmine.note.create(
... project_id='vacation',
... source_type='Contact',
... source_id=12,
... subject='note subject',
... content='note content',
... type_id=3,
... created_on='2023-01-10',
... note_time='11:11',
... uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
... )
>>> note
<redminelib.resources.Note #123>
new¶
- redminelib.managers.ResourceManager.new()
Creates new empty Note resource but saves it to the CRM plugin 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
>>> note = redmine.note.new()
>>> note.project_id = 'vacation'
>>> note.source_type = 'Contact'
>>> note.source_id = 12
>>> note.subject = 'note subject'
>>> note.content = 'note content'
>>> note.type_id = 3
>>> note.created_on = '2023-01-10'
>>> note.note_time = '11:11'
>>> note.uploads = [{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
>>> note.save()
<redminelib.resources.Note #123>
Read methods¶
get¶
- redminelib.managers.ResourceManager.get(resource_id)
Returns single Note resource from the CRM plugin by its id.
- Parameters:
resource_id (int) – (required). Id of the note.
- Returns:
Resource object
>>> note = redmine.note.get(12345)
>>> note
<redminelib.resources.Note #12345>
all¶
Not supported by CRM plugin
filter¶
Not supported by CRM plugin
Update methods¶
Added in version 2.4.0.
update¶
- redminelib.managers.ResourceManager.update(resource_id, **fields)
Updates values of given fields of a Note resource and saves them to the CRM plugin.
- Parameters:
resource_id (int) – (required). Note id.
content (string) – (optional). Note content.
subject (string) – (optional). Note subject.
type_id (int) – (optional). Note type id (will default to Note if not set):
0 - email
1 - call
2 - meeting
created_on (string or date object) – (optional). Date when note was created.
note_time (string) – (optional). Time when note was created.
uploads (list) – (optional). Uploads as [{'': ''}, ...], accepted keys are:
path (required). Absolute file path or file-like object that should be uploaded.
filename (optional). Name of the file after upload.
description (optional). Description of the file.
content_type (optional). Content type of the file.
- Returns:
True
>>> redmine.note.update(
... 123,
... subject='note subject',
... content='note content',
... type_id=3,
... created_on='2023-01-10',
... note_time='11:11',
... uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
... )
True
save¶
- redminelib.resources.Note.save(**attrs)
Saves the current state of a Note resource to the CRM plugin. Attrs that can be changed are the same as for
update()
method above.- Returns:
Resource object
>>> note = redmine.note.get(123)
>>> note.subject = 'note subject'
>>> note.content = 'note content'
>>> note.type_id = 3
>>> note.created_on = '2023-01-10'
>>> note.note_time = '11:11'
>>> note.uploads = [{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
>>> note.save()
<redminelib.resources.Note #123>
Added in version 2.1.0: Alternative syntax was introduced.
>>> note = redmine.note.get(123).save(
... subject='note subject',
... content='note content',
... type_id=3,
... created_on='2023-01-10',
... note_time='11:11',
... uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
... )
>>> note
<redminelib.resources.Note #123>
Delete methods¶
Added in version 2.4.0.
delete¶
- redminelib.managers.ResourceManager.delete(resource_id)
Deletes single Note resource from the CRM plugin by its id.
- Parameters:
resource_id (int) – (required). Note id.
- Returns:
True
>>> redmine.note.delete(123)
True
- redminelib.resources.Note.delete()
Deletes current Note resource object from the CRM plugin.
- Returns:
True
>>> note = redmine.note.get(1)
>>> note.delete()
True
Export¶
Not supported by CRM plugin