Skip to content

Commit 48adda5

Browse files
Merge branch 'master' into release
2 parents 418d7c0 + 00b493c commit 48adda5

File tree

12 files changed

+638
-6
lines changed

12 files changed

+638
-6
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ Python Cloud SDK wraps Aspose.Words Cloud API so you could seamlessly integrate
1616
- [Convert a document to desired file format](https://docs.aspose.cloud/display/wordscloud/Convert+Document+to+Destination+Format+with+Detailed+Settings+and+Save+Result+to+Storage) along with detailed settings.
1717
- Convert an encrypted PDF document into Word document format.
1818

19+
## Enhancements in Version 24.6
20+
21+
- Added the 'TranslateNodeId' method to transalate a node id to a node path.
22+
23+
1924
## Enhancements in Version 24.5
2025

2126
- Added the support of multistorage operations. Saving a file as a result of an operation can be performed in a specific storage, when, used file path in the next format '@storage:path/to/file.doc'.

asposewordscloud/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
from asposewordscloud.models.text_save_options_data import TextSaveOptionsData
259259
from asposewordscloud.models.tiff_save_options_data import TiffSaveOptionsData
260260
from asposewordscloud.models.time_zone_info_data import TimeZoneInfoData
261+
from asposewordscloud.models.translate_node_id_response import TranslateNodeIdResponse
261262
from asposewordscloud.models.user_information import UserInformation
262263
from asposewordscloud.models.watermark_data_image import WatermarkDataImage
263264
from asposewordscloud.models.watermark_data_text import WatermarkDataText

asposewordscloud/api_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ class ApiClient(object):
323323
'TextSaveOptionsData, _': asposewordscloud.models.TextSaveOptionsData,
324324
'TiffSaveOptionsData, _': asposewordscloud.models.TiffSaveOptionsData,
325325
'TimeZoneInfoData, _': asposewordscloud.models.TimeZoneInfoData,
326+
'TranslateNodeIdResponse, _': asposewordscloud.models.TranslateNodeIdResponse,
326327
'UserInformation, _': asposewordscloud.models.UserInformation,
327328
'WatermarkDataImage, _': asposewordscloud.models.WatermarkDataImage,
328329
'WatermarkDataText, _': asposewordscloud.models.WatermarkDataText,
@@ -347,12 +348,12 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
347348

348349
self.pool = None
349350
self.rest_client = rest.RESTClientObject(configuration)
350-
self.default_headers = {'x-aspose-client': 'python sdk', 'x-aspose-client-version': '24.5'}
351+
self.default_headers = {'x-aspose-client': 'python sdk', 'x-aspose-client-version': '24.6'}
351352
if header_name is not None:
352353
self.default_headers[header_name] = header_value
353354
self.cookie = cookie
354355
# Set default User-Agent.
355-
self.user_agent = 'python sdk 24.5'
356+
self.user_agent = 'python sdk 24.6'
356357

357358
def __del__(self):
358359
if not self.pool is None:

asposewordscloud/apis/words_api.py

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23519,6 +23519,163 @@ def split_document_online_with_http_info(self, request, **kwargs): # noqa: E501
2351923519
collection_formats=http_params['collection_formats']))
2352023520

2352123521

23522+
def translate_node_id(self, request, **kwargs): # noqa: E501
23523+
"""Translate a node id to a node path. # noqa: E501
23524+
23525+
This method makes a synchronous HTTP request by default. To make an
23526+
asynchronous HTTP request, please pass is_async=True
23527+
23528+
:param is_async bool
23529+
:param name str : The filename of the input document. (required)
23530+
:param node_id str : The node identifier. Identifier examples: id0.0.0. (required)
23531+
:param folder str : Original document folder.
23532+
:param storage str : Original document storage.
23533+
:param load_encoding str : Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
23534+
:param password str : Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
23535+
:param encrypted_password str : Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
23536+
:return: TranslateNodeIdResponse
23537+
If the method is called asynchronously,
23538+
returns the request thread.
23539+
"""
23540+
try:
23541+
if kwargs.get('is_async'):
23542+
return self.translate_node_id_with_http_info(request, **kwargs) # noqa: E501
23543+
data = self.translate_node_id_with_http_info(request, **kwargs) # noqa: E501
23544+
return data
23545+
except ApiException as e:
23546+
if e.status == 401:
23547+
self.api_client.request_token()
23548+
if kwargs.get('is_async'):
23549+
return self.translate_node_id_with_http_info(request, **kwargs) # noqa: E501
23550+
data = self.translate_node_id_with_http_info(request, **kwargs) # noqa: E501
23551+
return data
23552+
23553+
def translate_node_id_with_http_info(self, request, **kwargs): # noqa: E501
23554+
"""Translate a node id to a node path. # noqa: E501
23555+
23556+
This method makes a synchronous HTTP request by default. To make an
23557+
asynchronous HTTP request, please pass is_async=True
23558+
23559+
:param is_async bool
23560+
:param request TranslateNodeIdRequest object with parameters
23561+
:return: TranslateNodeIdResponse
23562+
If the method is called asynchronously,
23563+
returns the request thread.
23564+
"""
23565+
23566+
params = locals()
23567+
params['is_async'] = ''
23568+
params['_preload_content'] = True
23569+
params['_request_timeout'] = self.timeout
23570+
for key, val in six.iteritems(params['kwargs']):
23571+
if key not in params:
23572+
raise TypeError(
23573+
"Got an unexpected keyword argument '%s'"
23574+
" to method translate_node_id" % key
23575+
)
23576+
params[key] = val
23577+
del params['kwargs']
23578+
http_params = request.create_http_request(self.api_client, self)
23579+
23580+
# Authentication setting
23581+
auth_settings = ['JWT'] # noqa: E501
23582+
23583+
self.api_client.handle_password(http_params, self)
23584+
23585+
return request.deserialize_response(self.api_client, self.api_client.call_api(
23586+
http_params['path'],
23587+
http_params['method'],
23588+
http_params['query_params'],
23589+
http_params['header_params'],
23590+
body=None,
23591+
post_params=http_params['form_params'],
23592+
response_type=http_params['response_type'], # noqa: E501
23593+
auth_settings=auth_settings,
23594+
is_async=params.get('is_async'),
23595+
_preload_content=params.get('_preload_content', True),
23596+
_request_timeout=params.get('_request_timeout'),
23597+
collection_formats=http_params['collection_formats']))
23598+
23599+
23600+
def translate_node_id_online(self, request, **kwargs): # noqa: E501
23601+
"""Translate a node id to a node path. # noqa: E501
23602+
23603+
This method makes a synchronous HTTP request by default. To make an
23604+
asynchronous HTTP request, please pass is_async=True
23605+
23606+
:param is_async bool
23607+
:param document file : The document. (required)
23608+
:param node_id str : The node identifier. Identifier examples: id0.0.0. (required)
23609+
:param load_encoding str : Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
23610+
:param password str : Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
23611+
:param encrypted_password str : Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
23612+
:return: TranslateNodeIdResponse
23613+
If the method is called asynchronously,
23614+
returns the request thread.
23615+
"""
23616+
try:
23617+
if kwargs.get('is_async'):
23618+
return self.translate_node_id_online_with_http_info(request, **kwargs) # noqa: E501
23619+
data = self.translate_node_id_online_with_http_info(request, **kwargs) # noqa: E501
23620+
return data
23621+
except ApiException as e:
23622+
if e.status == 401:
23623+
self.api_client.request_token()
23624+
if kwargs.get('is_async'):
23625+
return self.translate_node_id_online_with_http_info(request, **kwargs) # noqa: E501
23626+
data = self.translate_node_id_online_with_http_info(request, **kwargs) # noqa: E501
23627+
return data
23628+
23629+
def translate_node_id_online_with_http_info(self, request, **kwargs): # noqa: E501
23630+
"""Translate a node id to a node path. # noqa: E501
23631+
23632+
This method makes a synchronous HTTP request by default. To make an
23633+
asynchronous HTTP request, please pass is_async=True
23634+
23635+
:param is_async bool
23636+
:param request TranslateNodeIdOnlineRequest object with parameters
23637+
:return: TranslateNodeIdResponse
23638+
If the method is called asynchronously,
23639+
returns the request thread.
23640+
"""
23641+
23642+
params = locals()
23643+
params['is_async'] = ''
23644+
params['_preload_content'] = True
23645+
params['_request_timeout'] = self.timeout
23646+
for key, val in six.iteritems(params['kwargs']):
23647+
if key not in params:
23648+
raise TypeError(
23649+
"Got an unexpected keyword argument '%s'"
23650+
" to method translate_node_id_online" % key
23651+
)
23652+
params[key] = val
23653+
del params['kwargs']
23654+
http_params = request.create_http_request(self.api_client, self)
23655+
23656+
# HTTP header `Accept`
23657+
http_params['header_params']['Accept'] = self.api_client.select_header_accept(
23658+
['application/xml', 'application/json']) # noqa: E501
23659+
# Authentication setting
23660+
auth_settings = ['JWT'] # noqa: E501
23661+
23662+
self.api_client.handle_password(http_params, self)
23663+
23664+
return request.deserialize_response(self.api_client, self.api_client.call_api(
23665+
http_params['path'],
23666+
http_params['method'],
23667+
http_params['query_params'],
23668+
http_params['header_params'],
23669+
body=None,
23670+
post_params=http_params['form_params'],
23671+
response_type=http_params['response_type'], # noqa: E501
23672+
auth_settings=auth_settings,
23673+
is_async=params.get('is_async'),
23674+
_preload_content=params.get('_preload_content', True),
23675+
_request_timeout=params.get('_request_timeout'),
23676+
collection_formats=http_params['collection_formats']))
23677+
23678+
2352223679
def unprotect_document(self, request, **kwargs): # noqa: E501
2352323680
"""Removes protection from the document. # noqa: E501
2352423681

asposewordscloud/configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,6 @@ def to_debug_report(self):
262262
return "Python SDK Debug Report:\n"\
263263
"OS: {env}\n"\
264264
"Python Version: {pyversion}\n"\
265-
"Version of the API: 24.5\n"\
266-
"SDK Package Version: 24.5".\
265+
"Version of the API: 24.6\n"\
266+
"SDK Package Version: 24.6".\
267267
format(env=sys.platform, pyversion=sys.version)

asposewordscloud/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@
253253
from asposewordscloud.models.text_save_options_data import TextSaveOptionsData
254254
from asposewordscloud.models.tiff_save_options_data import TiffSaveOptionsData
255255
from asposewordscloud.models.time_zone_info_data import TimeZoneInfoData
256+
from asposewordscloud.models.translate_node_id_response import TranslateNodeIdResponse
256257
from asposewordscloud.models.user_information import UserInformation
257258
from asposewordscloud.models.watermark_data_image import WatermarkDataImage
258259
from asposewordscloud.models.watermark_data_text import WatermarkDataText

asposewordscloud/models/requests/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@
291291
from asposewordscloud.models.requests.search_online_request import SearchOnlineRequest
292292
from asposewordscloud.models.requests.split_document_request import SplitDocumentRequest
293293
from asposewordscloud.models.requests.split_document_online_request import SplitDocumentOnlineRequest
294+
from asposewordscloud.models.requests.translate_node_id_request import TranslateNodeIdRequest
295+
from asposewordscloud.models.requests.translate_node_id_online_request import TranslateNodeIdOnlineRequest
294296
from asposewordscloud.models.requests.unprotect_document_request import UnprotectDocumentRequest
295297
from asposewordscloud.models.requests.unprotect_document_online_request import UnprotectDocumentOnlineRequest
296298
from asposewordscloud.models.requests.update_bookmark_request import UpdateBookmarkRequest
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# coding: utf-8
2+
# -----------------------------------------------------------------------------------
3+
# <copyright company="Aspose" file="translate_node_id_online_request.py">
4+
# Copyright (c) 2024 Aspose.Words for Cloud
5+
# </copyright>
6+
# <summary>
7+
# Permission is hereby granted, free of charge, to any person obtaining a copy
8+
# of this software and associated documentation files (the "Software"), to deal
9+
# in the Software without restriction, including without limitation the rights
10+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
# copies of the Software, and to permit persons to whom the Software is
12+
# furnished to do so, subject to the following conditions:
13+
#
14+
# The above copyright notice and this permission notice shall be included in all
15+
# copies or substantial portions of the Software.
16+
#
17+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
# SOFTWARE.
24+
# </summary>
25+
# -----------------------------------------------------------------------------------
26+
import json
27+
28+
from six.moves.urllib.parse import quote
29+
from asposewordscloud import *
30+
from asposewordscloud.models import *
31+
from asposewordscloud.models.requests import *
32+
from asposewordscloud.models.responses import *
33+
34+
class TranslateNodeIdOnlineRequest(BaseRequestObject):
35+
"""
36+
Request model for translate_node_id_online operation.
37+
Initializes a new instance.
38+
:param document The document.
39+
:param node_id The node identifier. Identifier examples: id0.0.0.
40+
:param load_encoding Encoding that will be used to load an HTML (or TXT) document if the encoding is not specified in HTML.
41+
:param password Password of protected Word document. Use the parameter to pass a password via SDK. SDK encrypts it automatically. We don't recommend to use the parameter to pass a plain password for direct call of API.
42+
:param encrypted_password Password of protected Word document. Use the parameter to pass an encrypted password for direct calls of API. See SDK code for encyption details.
43+
"""
44+
45+
def __init__(self, document, node_id, load_encoding=None, password=None, encrypted_password=None):
46+
self.document = document
47+
self.node_id = node_id
48+
self.load_encoding = load_encoding
49+
self.password = password
50+
self.encrypted_password = encrypted_password
51+
52+
def create_http_request(self, api_client, encryptor):
53+
# verify the required parameter 'document' is set
54+
if self.document is None:
55+
raise ValueError("Missing the required parameter `document` when calling `translate_node_id_online`") # noqa: E501
56+
# verify the required parameter 'node_id' is set
57+
if self.node_id is None:
58+
raise ValueError("Missing the required parameter `node_id` when calling `translate_node_id_online`") # noqa: E501
59+
60+
path = '/v4.0/words/online/get/translate/{nodeId}'
61+
path_params = {}
62+
if self.node_id is not None:
63+
path_params['nodeId'] = self.node_id # noqa: E501
64+
else:
65+
path_params['nodeId'] = '' # noqa: E501
66+
67+
# path parameters
68+
collection_formats = {}
69+
if path_params:
70+
path_params = api_client.sanitize_for_serialization(path_params)
71+
path_params = api_client.parameters_to_tuples(path_params, collection_formats)
72+
for k, v in path_params:
73+
# specified safe chars, encode everything
74+
path = path.replace(
75+
'{%s}' % k,
76+
quote(str(v), safe=api_client.configuration.safe_chars_for_path_param)
77+
)
78+
79+
# remove optional path parameters
80+
path = path.replace('//', '/')
81+
82+
query_params = []
83+
if self.load_encoding is not None:
84+
query_params.append(('loadEncoding', self.load_encoding)) # noqa: E501
85+
if self.password is not None:
86+
query_params.append(('password', self.password)) # noqa: E501
87+
if self.encrypted_password is not None:
88+
query_params.append(('encryptedPassword', self.encrypted_password)) # noqa: E501
89+
90+
header_params = {}
91+
# HTTP header `Content-Type`
92+
header_params['Content-Type'] = api_client.select_header_content_type( # noqa: E501
93+
['multipart/form-data']) # noqa: E501
94+
95+
file_content_params = []
96+
form_params = []
97+
if self.document is not None:
98+
form_params.append(['document', self.document, 'file']) # noqa: E501
99+
100+
for file_content_value in file_content_params:
101+
file_content_value.encryptPassword(encryptor)
102+
if file_content_value.source == 'Request':
103+
form_params.append([file_content_value.reference, file_content_value.content, 'file']) # noqa: E501
104+
105+
return {
106+
"method": "PUT",
107+
"path": path,
108+
"body": None,
109+
"query_params": query_params,
110+
"header_params": header_params,
111+
"form_params": form_params,
112+
"collection_formats": collection_formats,
113+
"response_type": 'TranslateNodeIdResponse' # noqa: E501
114+
}
115+
116+
def get_response_type(self):
117+
return 'TranslateNodeIdResponse' # noqa: E501
118+
119+
def deserialize_response(self, api_client, response):
120+
return api_client.deserialize(response.data, response.getheaders(), TranslateNodeIdResponse)

0 commit comments

Comments
 (0)