Skip to content

Commit 9110e04

Browse files
committed
contact avatar support
1 parent 70772a8 commit 9110e04

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Changelog
2121
- Support for ``issues_assigned`` and ``issues_authored`` relations in User object
2222
(`Issue #317 <https://github.com/maxtepkeev/python-redmine/issues/317>`__)
2323
- Original filename will be used as a filename for all uploaded files if a path was provided and filename wasn't set
24+
- *Pro Edition:* Added support for RedmineUP Contact avatar add/update operations
25+
(see `docs <https://python-redmine.com/resources/contact.html#create-methods>`__ for details)
2426
- *Pro Edition:* Added support for RedmineUP DealCategory ``create()``, ``update()``, ``delete()`` operations
2527
(see `docs <https://python-redmine.com/resources/deal_category.html#create-methods>`__ for details)
2628
- *Pro Edition:* RedmineUP CrmQuery resource now supports ``invoices`` and ``expenses`` relation attributes

docs/resources/contact.rst

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ create
6161
- 1 - public
6262
- 2 - private
6363

64+
:param dict avatar:
65+
.. raw:: html
66+
67+
(optional). Avatar to be used for the contact as dict, accepted keys are:
68+
69+
- path (required). Absolute file path or file-like object that should be uploaded.
70+
- filename (optional). Required if a file-like object is provided.
71+
6472
:return: :ref:`Resource` object
6573

6674
.. code-block:: python
@@ -82,7 +90,8 @@ create
8290
... is_company=False,
8391
... address_attributes={'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'},
8492
... custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}],
85-
... visibility=0
93+
... visibility=0,
94+
... avatar={'path': '/absolute/path/to/file.jpg'}
8695
... )
8796
>>> contact
8897
<redminelib.resources.Contact #1 "Ivan Ivanov">
@@ -120,6 +129,7 @@ new
120129
>>> contact.address_attributes = {'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'}
121130
>>> contact.custom_fields = [{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}]
122131
>>> contact.visibility = 0
132+
>>> contact.avatar = {'path': '/absolute/path/to/file.jpg'}
123133
>>> contact.save()
124134
<redminelib.resources.Contact #1 "Ivan Ivanov">
125135
@@ -311,6 +321,14 @@ update
311321
- 1 - public
312322
- 2 - private
313323

324+
:param dict avatar:
325+
.. raw:: html
326+
327+
(optional). Avatar to be used for the contact as dict, accepted keys are:
328+
329+
- path (required). Absolute file path or file-like object that should be uploaded.
330+
- filename (optional). Required if a file-like object is provided.
331+
314332
:return: True
315333

316334
.. code-block:: python
@@ -332,7 +350,8 @@ update
332350
... is_company=False,
333351
... address_attributes={'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'},
334352
... custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}],
335-
... visibility=0
353+
... visibility=0,
354+
... avatar={'path': '/absolute/path/to/file.jpg'}
336355
... )
337356
True
338357
@@ -367,6 +386,7 @@ save
367386
>>> contact.address_attributes = {'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'}
368387
>>> contact.custom_fields = [{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}]
369388
>>> contact.visibility = 0
389+
>>> contact.avatar = {'path': '/absolute/path/to/file.jpg'}
370390
>>> contact.save()
371391
<redminelib.resources.Contact #12345 "Ivan Ivanov">
372392
@@ -390,7 +410,8 @@ save
390410
... is_company=False,
391411
... address_attributes={'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'},
392412
... custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}],
393-
... visibility = 0
413+
... visibility=0,
414+
... avatar={'path': '/absolute/path/to/file.jpg'}
394415
... )
395416
>>> contact
396417
<redminelib.resources.Contact #12345 "Ivan Ivanov">

0 commit comments

Comments
 (0)