From 9110e04e140627ddb00bdb0151e5a92a609df921 Mon Sep 17 00:00:00 2001 From: Max Tepkeev Date: Sun, 24 Mar 2024 16:04:49 +0300 Subject: [PATCH] contact avatar support --- CHANGELOG.rst | 2 ++ docs/resources/contact.rst | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 74d3d4d..826cd25 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -21,6 +21,8 @@ Changelog - Support for ``issues_assigned`` and ``issues_authored`` relations in User object (`Issue #317 `__) - Original filename will be used as a filename for all uploaded files if a path was provided and filename wasn't set +- *Pro Edition:* Added support for RedmineUP Contact avatar add/update operations + (see `docs `__ for details) - *Pro Edition:* Added support for RedmineUP DealCategory ``create()``, ``update()``, ``delete()`` operations (see `docs `__ for details) - *Pro Edition:* RedmineUP CrmQuery resource now supports ``invoices`` and ``expenses`` relation attributes diff --git a/docs/resources/contact.rst b/docs/resources/contact.rst index b889754..9783d06 100644 --- a/docs/resources/contact.rst +++ b/docs/resources/contact.rst @@ -61,6 +61,14 @@ create - 1 - public - 2 - private + :param dict avatar: + .. raw:: html + + (optional). Avatar to be used for the contact as dict, accepted keys are: + + - path (required). Absolute file path or file-like object that should be uploaded. + - filename (optional). Required if a file-like object is provided. + :return: :ref:`Resource` object .. code-block:: python @@ -82,7 +90,8 @@ create ... is_company=False, ... address_attributes={'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'}, ... custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}], - ... visibility=0 + ... visibility=0, + ... avatar={'path': '/absolute/path/to/file.jpg'} ... ) >>> contact @@ -120,6 +129,7 @@ new >>> contact.address_attributes = {'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'} >>> contact.custom_fields = [{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}] >>> contact.visibility = 0 + >>> contact.avatar = {'path': '/absolute/path/to/file.jpg'} >>> contact.save() @@ -311,6 +321,14 @@ update - 1 - public - 2 - private + :param dict avatar: + .. raw:: html + + (optional). Avatar to be used for the contact as dict, accepted keys are: + + - path (required). Absolute file path or file-like object that should be uploaded. + - filename (optional). Required if a file-like object is provided. + :return: True .. code-block:: python @@ -332,7 +350,8 @@ update ... is_company=False, ... address_attributes={'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'}, ... custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}], - ... visibility=0 + ... visibility=0, + ... avatar={'path': '/absolute/path/to/file.jpg'} ... ) True @@ -367,6 +386,7 @@ save >>> contact.address_attributes = {'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'} >>> contact.custom_fields = [{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}] >>> contact.visibility = 0 + >>> contact.avatar = {'path': '/absolute/path/to/file.jpg'} >>> contact.save() @@ -390,7 +410,8 @@ save ... is_company=False, ... address_attributes={'street1': 'foo', 'street2': 'bar', 'city': 'Moscow', 'postcode': '111111', 'country_code': 'RU'}, ... custom_fields=[{'id': 1, 'value': 'foo'}, {'id': 2, 'value': 'bar'}], - ... visibility = 0 + ... visibility=0, + ... avatar={'path': '/absolute/path/to/file.jpg'} ... ) >>> contact