Skip to content

Commit a26453f

Browse files
committed
Updated sources
1 parent 1be858b commit a26453f

9 files changed

Lines changed: 180 additions & 18 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2003-2018 Aspose Pty Ltd
3+
Copyright (c) 2003-2021 Aspose Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

groupdocs_annotation_cloud/api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ def __init__(self, configuration, header_name=None, header_value=None,
7474
self.configuration = configuration
7575
self.pool = None
7676
self.rest_client = rest.RESTClientObject(configuration)
77-
self.default_headers = {'x-groupdocs-client': 'python sdk', 'x-groupdocs-version': '21.2'}
77+
self.default_headers = {'x-groupdocs-client': 'python sdk', 'x-groupdocs-version': '21.6'}
7878
if header_name is not None:
7979
self.default_headers[header_name] = header_value
8080
self.cookie = cookie
8181
# Set default User-Agent.
82-
self.user_agent = 'python sdk 21.2'
82+
self.user_agent = 'python sdk 21.6'
8383

8484
def __del__(self):
8585
if self.pool is not None:

groupdocs_annotation_cloud/api_exception.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,16 @@ def __init__(self, status=None, reason=None, http_resp=None):
4141
data = json.loads(http_resp.data)
4242

4343
error = data.get("error")
44-
error_api = data.get("Error")
4544

4645
if error is not None:
47-
self.message = error
48-
elif error_api is not None:
49-
self.message = error_api.get("Message") if error_api.get("Message") is not None else http_resp.data
46+
self.message = error if type(error) is str else error.get("message")
5047
else:
51-
self.message = http_resp.data
48+
message = data.get("message")
49+
if message is not None:
50+
self.message = message
51+
self.code = data.get("code")
52+
else:
53+
self.message = http_resp.data
5254
except ValueError:
5355
self.message = http_resp.data
5456
else:

groupdocs_annotation_cloud/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,6 @@ def to_debug_report(self):
202202
return "Python SDK Debug Report:\n"\
203203
"OS: {env}\n"\
204204
"Python Version: {pyversion}\n"\
205-
"Version of the API: 21.2\n"\
206-
"SDK Package Version: 21.2".\
205+
"Version of the API: 21.6\n"\
206+
"SDK Package Version: 21.6".\
207207
format(env=sys.platform, pyversion=sys.version)

groupdocs_annotation_cloud/models/annotate_options.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class AnnotateOptions(object):
4848
'first_page': 'int',
4949
'last_page': 'int',
5050
'only_annotated_pages': 'bool',
51-
'output_path': 'str'
51+
'output_path': 'str',
52+
'fonts_path': 'str'
5253
}
5354

5455
attribute_map = {
@@ -57,10 +58,11 @@ class AnnotateOptions(object):
5758
'first_page': 'FirstPage',
5859
'last_page': 'LastPage',
5960
'only_annotated_pages': 'OnlyAnnotatedPages',
60-
'output_path': 'OutputPath'
61+
'output_path': 'OutputPath',
62+
'fonts_path': 'FontsPath'
6163
}
6264

63-
def __init__(self, file_info=None, annotations=None, first_page=None, last_page=None, only_annotated_pages=None, output_path=None, **kwargs): # noqa: E501
65+
def __init__(self, file_info=None, annotations=None, first_page=None, last_page=None, only_annotated_pages=None, output_path=None, fonts_path=None, **kwargs): # noqa: E501
6466
"""Initializes new instance of AnnotateOptions""" # noqa: E501
6567

6668
self._file_info = None
@@ -69,6 +71,7 @@ def __init__(self, file_info=None, annotations=None, first_page=None, last_page=
6971
self._last_page = None
7072
self._only_annotated_pages = None
7173
self._output_path = None
74+
self._fonts_path = None
7275

7376
if file_info is not None:
7477
self.file_info = file_info
@@ -82,6 +85,8 @@ def __init__(self, file_info=None, annotations=None, first_page=None, last_page=
8285
self.only_annotated_pages = only_annotated_pages
8386
if output_path is not None:
8487
self.output_path = output_path
88+
if fonts_path is not None:
89+
self.fonts_path = fonts_path
8590

8691
@property
8792
def file_info(self):
@@ -232,6 +237,30 @@ def output_path(self, output_path):
232237
:type: str
233238
"""
234239
self._output_path = output_path
240+
241+
@property
242+
def fonts_path(self):
243+
"""
244+
Gets the fonts_path. # noqa: E501
245+
246+
The path to directory containing custom fonts in storage # noqa: E501
247+
248+
:return: The fonts_path. # noqa: E501
249+
:rtype: str
250+
"""
251+
return self._fonts_path
252+
253+
@fonts_path.setter
254+
def fonts_path(self, fonts_path):
255+
"""
256+
Sets the fonts_path.
257+
258+
The path to directory containing custom fonts in storage # noqa: E501
259+
260+
:param fonts_path: The fonts_path. # noqa: E501
261+
:type: str
262+
"""
263+
self._fonts_path = fonts_path
235264

236265
def to_dict(self):
237266
"""Returns the model properties as a dict"""

groupdocs_annotation_cloud/models/annotation_info.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ class AnnotationInfo(object):
6868
'font_size': 'float',
6969
'opacity': 'float',
7070
'angle': 'float',
71+
'z_index': 'int',
7172
'url': 'str',
7273
'image_path': 'str'
7374
}
@@ -98,11 +99,12 @@ class AnnotationInfo(object):
9899
'font_size': 'FontSize',
99100
'opacity': 'Opacity',
100101
'angle': 'Angle',
102+
'z_index': 'ZIndex',
101103
'url': 'Url',
102104
'image_path': 'ImagePath'
103105
}
104106

105-
def __init__(self, id=None, text=None, text_to_replace=None, horizontal_alignment=None, vertical_alignment=None, creator_id=None, creator_name=None, creator_email=None, box=None, points=None, page_number=None, annotation_position=None, svg_path=None, type=None, replies=None, created_on=None, font_color=None, pen_color=None, pen_width=None, pen_style=None, background_color=None, font_family=None, font_size=None, opacity=None, angle=None, url=None, image_path=None, **kwargs): # noqa: E501
107+
def __init__(self, id=None, text=None, text_to_replace=None, horizontal_alignment=None, vertical_alignment=None, creator_id=None, creator_name=None, creator_email=None, box=None, points=None, page_number=None, annotation_position=None, svg_path=None, type=None, replies=None, created_on=None, font_color=None, pen_color=None, pen_width=None, pen_style=None, background_color=None, font_family=None, font_size=None, opacity=None, angle=None, z_index=None, url=None, image_path=None, **kwargs): # noqa: E501
106108
"""Initializes new instance of AnnotationInfo""" # noqa: E501
107109

108110
self._id = None
@@ -130,6 +132,7 @@ def __init__(self, id=None, text=None, text_to_replace=None, horizontal_alignmen
130132
self._font_size = None
131133
self._opacity = None
132134
self._angle = None
135+
self._z_index = None
133136
self._url = None
134137
self._image_path = None
135138

@@ -183,6 +186,8 @@ def __init__(self, id=None, text=None, text_to_replace=None, horizontal_alignmen
183186
self.opacity = opacity
184187
if angle is not None:
185188
self.angle = angle
189+
if z_index is not None:
190+
self.z_index = z_index
186191
if url is not None:
187192
self.url = url
188193
if image_path is not None:
@@ -834,6 +839,32 @@ def angle(self, angle):
834839
"""
835840
self._angle = angle
836841

842+
@property
843+
def z_index(self):
844+
"""
845+
Gets the z_index. # noqa: E501
846+
847+
Gets or sets z-index. Default value is 0 The z-index property specifies the stack order of an element. # noqa: E501
848+
849+
:return: The z_index. # noqa: E501
850+
:rtype: int
851+
"""
852+
return self._z_index
853+
854+
@z_index.setter
855+
def z_index(self, z_index):
856+
"""
857+
Sets the z_index.
858+
859+
Gets or sets z-index. Default value is 0 The z-index property specifies the stack order of an element. # noqa: E501
860+
861+
:param z_index: The z_index. # noqa: E501
862+
:type: int
863+
"""
864+
if z_index is None:
865+
raise ValueError("Invalid value for `z_index`, must not be `None`") # noqa: E501
866+
self._z_index = z_index
867+
837868
@property
838869
def url(self):
839870
"""

groupdocs_annotation_cloud/models/preview_options.py

Lines changed: 94 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ class PreviewOptions(object):
4848
'page_numbers': 'list[int]',
4949
'width': 'int',
5050
'height': 'int',
51-
'render_comments': 'bool'
51+
'resolution': 'int',
52+
'render_comments': 'bool',
53+
'render_annotations': 'bool',
54+
'fonts_path': 'str'
5255
}
5356

5457
attribute_map = {
@@ -57,18 +60,24 @@ class PreviewOptions(object):
5760
'page_numbers': 'PageNumbers',
5861
'width': 'Width',
5962
'height': 'Height',
60-
'render_comments': 'RenderComments'
63+
'resolution': 'Resolution',
64+
'render_comments': 'RenderComments',
65+
'render_annotations': 'RenderAnnotations',
66+
'fonts_path': 'FontsPath'
6167
}
6268

63-
def __init__(self, file_info=None, format=None, page_numbers=None, width=None, height=None, render_comments=None, **kwargs): # noqa: E501
69+
def __init__(self, file_info=None, format=None, page_numbers=None, width=None, height=None, resolution=None, render_comments=None, render_annotations=None, fonts_path=None, **kwargs): # noqa: E501
6470
"""Initializes new instance of PreviewOptions""" # noqa: E501
6571

6672
self._file_info = None
6773
self._format = None
6874
self._page_numbers = None
6975
self._width = None
7076
self._height = None
77+
self._resolution = None
7178
self._render_comments = None
79+
self._render_annotations = None
80+
self._fonts_path = None
7281

7382
if file_info is not None:
7483
self.file_info = file_info
@@ -80,8 +89,14 @@ def __init__(self, file_info=None, format=None, page_numbers=None, width=None, h
8089
self.width = width
8190
if height is not None:
8291
self.height = height
92+
if resolution is not None:
93+
self.resolution = resolution
8394
if render_comments is not None:
8495
self.render_comments = render_comments
96+
if render_annotations is not None:
97+
self.render_annotations = render_annotations
98+
if fonts_path is not None:
99+
self.fonts_path = fonts_path
85100

86101
@property
87102
def file_info(self):
@@ -217,6 +232,32 @@ def height(self, height):
217232
raise ValueError("Invalid value for `height`, must not be `None`") # noqa: E501
218233
self._height = height
219234

235+
@property
236+
def resolution(self):
237+
"""
238+
Gets the resolution. # noqa: E501
239+
240+
Gets or sets the resolution for generated images, in dots per inch. The default value is 96. # noqa: E501
241+
242+
:return: The resolution. # noqa: E501
243+
:rtype: int
244+
"""
245+
return self._resolution
246+
247+
@resolution.setter
248+
def resolution(self, resolution):
249+
"""
250+
Sets the resolution.
251+
252+
Gets or sets the resolution for generated images, in dots per inch. The default value is 96. # noqa: E501
253+
254+
:param resolution: The resolution. # noqa: E501
255+
:type: int
256+
"""
257+
if resolution is None:
258+
raise ValueError("Invalid value for `resolution`, must not be `None`") # noqa: E501
259+
self._resolution = resolution
260+
220261
@property
221262
def render_comments(self):
222263
"""
@@ -242,6 +283,56 @@ def render_comments(self, render_comments):
242283
if render_comments is None:
243284
raise ValueError("Invalid value for `render_comments`, must not be `None`") # noqa: E501
244285
self._render_comments = render_comments
286+
287+
@property
288+
def render_annotations(self):
289+
"""
290+
Gets the render_annotations. # noqa: E501
291+
292+
The property that controls whether annotations will be generated on the preview. Default State - true. # noqa: E501
293+
294+
:return: The render_annotations. # noqa: E501
295+
:rtype: bool
296+
"""
297+
return self._render_annotations
298+
299+
@render_annotations.setter
300+
def render_annotations(self, render_annotations):
301+
"""
302+
Sets the render_annotations.
303+
304+
The property that controls whether annotations will be generated on the preview. Default State - true. # noqa: E501
305+
306+
:param render_annotations: The render_annotations. # noqa: E501
307+
:type: bool
308+
"""
309+
if render_annotations is None:
310+
raise ValueError("Invalid value for `render_annotations`, must not be `None`") # noqa: E501
311+
self._render_annotations = render_annotations
312+
313+
@property
314+
def fonts_path(self):
315+
"""
316+
Gets the fonts_path. # noqa: E501
317+
318+
The path to directory containing custom fonts in storage # noqa: E501
319+
320+
:return: The fonts_path. # noqa: E501
321+
:rtype: str
322+
"""
323+
return self._fonts_path
324+
325+
@fonts_path.setter
326+
def fonts_path(self, fonts_path):
327+
"""
328+
Sets the fonts_path.
329+
330+
The path to directory containing custom fonts in storage # noqa: E501
331+
332+
:param fonts_path: The fonts_path. # noqa: E501
333+
:type: str
334+
"""
335+
self._fonts_path = fonts_path
245336

246337
def to_dict(self):
247338
"""Returns the model properties as a dict"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from setuptools import setup, find_packages # noqa: H301
77

88
NAME = "groupdocs-annotation-cloud"
9-
VERSION = "21.2"
9+
VERSION = "21.6"
1010

1111
# Append current time to the version when publishing to test environment
1212
if "--test" in sys.argv:

test/info/test_info_api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,14 @@ def test_get_info(self):
5454
self.assertEqual(file_info.file_path, response.path)
5555
self.assertGreater(len(response.pages), 0)
5656

57+
def test_get_info_returns_file_not_found(self):
58+
file_info = FileInfo()
59+
file_info.file_path = "somefolder\\not-exist.docx"
60+
61+
request = GetInfoRequest(file_info)
62+
with self.assertRaises(ApiException) as context:
63+
self.info_api.get_info(request)
64+
self.assertEqual("Specified file not found", context.exception.message)
65+
5766
if __name__ == '__main__':
5867
unittest.main()

0 commit comments

Comments
 (0)