Skip to content

Commit f729ea4

Browse files
committed
product image support
1 parent 5fb3b17 commit f729ea4

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/resources/product.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ create
4242
:param string description: (optional). Product description.
4343
:param list tag_list: (optional). List of tags.
4444
:param list custom_fields: (optional). Custom fields as [{'id': 1, 'value': 'foo'}].
45+
:param dict image:
46+
.. raw:: html
47+
48+
(optional). Image to be used for the product as dict, accepted keys are:
49+
50+
- path (required). Absolute file path or file-like object that should be uploaded.
51+
- filename (optional). Required if a file-like object is provided.
52+
4553
:param list uploads:
4654
.. raw:: html
4755

@@ -67,6 +75,7 @@ create
6775
... description='product description',
6876
... tag_list=['foo', 'bar'],
6977
... custom_fields=[{'id': 1, 'value': '11'}],
78+
... image={'path': '/absolute/path/to/file.jpg'},
7079
... uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
7180
... )
7281
>>> product
@@ -98,6 +107,7 @@ new
98107
>>> product.description = 'product description'
99108
>>> product.tag_list = ['foo', 'bar']
100109
>>> product.custom_fields = [{'id': 1, 'value': '11'}]
110+
>>> product.image = {'path': '/absolute/path/to/file.jpg'}
101111
>>> product.uploads = [{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
102112
>>> product.save()
103113
<redminelib.resources.Product #123>
@@ -251,6 +261,14 @@ update
251261
:param string description: (optional). Product description.
252262
:param list tag_list: (optional). List of tags.
253263
:param list custom_fields: (optional). Custom fields as [{'id': 1, 'value': 'foo'}].
264+
:param dict image:
265+
.. raw:: html
266+
267+
(optional). Image to be used for the product as dict, accepted keys are:
268+
269+
- path (required). Absolute file path or file-like object that should be uploaded.
270+
- filename (optional). Required if a file-like object is provided.
271+
254272
:param list uploads:
255273
.. raw:: html
256274

@@ -277,6 +295,7 @@ update
277295
... description='product description',
278296
... tag_list=['foo', 'bar'],
279297
... custom_fields=[{'id': 1, 'value': '11'}],
298+
... image={'path': '/absolute/path/to/file.jpg'},
280299
... uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
281300
... )
282301
True
@@ -306,6 +325,7 @@ save
306325
>>> product.description = 'product description'
307326
>>> product.tag_list = ['foo', 'bar']
308327
>>> product.custom_fields = [{'id': 1, 'value': '11'}]
328+
>>> product.image = {'path': '/absolute/path/to/file.jpg'}
309329
>>> product.uploads = [{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
310330
>>> product.save()
311331
<redminelib.resources.Product #123>
@@ -325,6 +345,7 @@ save
325345
... description='product description',
326346
... tag_list=['foo', 'bar'],
327347
... custom_fields=[{'id': 1, 'value': '11'}],
348+
... image={'path': '/absolute/path/to/file.jpg'},
328349
... uploads=[{'path': '/absolute/path/to/file'}, {'path': BytesIO(b'I am content of file 2')}]
329350
... )
330351
>>> product

0 commit comments

Comments
 (0)