Skip to content

Commit c30fb88

Browse files
committed
20211123 update : add new apis.
1 parent 8ce2abc commit c30fb88

File tree

8 files changed

+566
-17
lines changed

8 files changed

+566
-17
lines changed

asposecellscloud/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self, host=None, header_name=None, header_value=None, cookie=None):
8383
self.host = host
8484
self.cookie = cookie
8585
# Set default User-Agent.
86-
self.user_agent = 'Swagger-Codegen/21.10/python'
86+
self.user_agent = 'Swagger-Codegen/21.11/python'
8787

8888
@property
8989
def user_agent(self):

asposecellscloud/apis/cells_api.py

Lines changed: 245 additions & 12 deletions
Large diffs are not rendered by default.

asposecellscloud/apis/lite_cells_api.py

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,3 +1621,253 @@ def post_watermark_with_http_info(self, file, text, color, **kwargs):
16211621
_preload_content=params.get('_preload_content', True),
16221622
_request_timeout=params.get('_request_timeout'),
16231623
collection_formats=collection_formats)
1624+
1625+
def post_compress(self, file, compress_level, **kwargs):
1626+
"""
1627+
This method makes a synchronous HTTP request by default. To make an
1628+
asynchronous HTTP request, please define a `callback` function
1629+
to be invoked when receiving the response.
1630+
>>> def callback_function(response):
1631+
>>> pprint(response)
1632+
>>>
1633+
>>> thread = api.post_compress(file, compress_level, callback=callback_function)
1634+
1635+
:param callback function: The callback function
1636+
for asynchronous request. (optional)
1637+
:param file file: File to upload (required)
1638+
:param int compress_level: (required)
1639+
:return: FilesResult
1640+
If the method is called asynchronously,
1641+
returns the request thread.
1642+
"""
1643+
kwargs['_return_http_data_only'] = True
1644+
self.check_access_token()
1645+
if kwargs.get('callback'):
1646+
return self.post_compress_with_http_info(file, compress_level, **kwargs)
1647+
else:
1648+
(data) = self.post_compress_with_http_info(file, compress_level, **kwargs)
1649+
return data
1650+
1651+
def post_compress_with_http_info(self, file, compress_level, **kwargs):
1652+
"""
1653+
This method makes a synchronous HTTP request by default. To make an
1654+
asynchronous HTTP request, please define a `callback` function
1655+
to be invoked when receiving the response.
1656+
>>> def callback_function(response):
1657+
>>> pprint(response)
1658+
>>>
1659+
>>> thread = api.post_compress_with_http_info(file, compress_level, callback=callback_function)
1660+
1661+
:param callback function: The callback function
1662+
for asynchronous request. (optional)
1663+
:param file file: File to upload (required)
1664+
:param int compress_level: (required)
1665+
:return: FilesResult
1666+
If the method is called asynchronously,
1667+
returns the request thread.
1668+
"""
1669+
1670+
all_params = ['file', 'compress_level']
1671+
all_params.append('callback')
1672+
all_params.append('_return_http_data_only')
1673+
all_params.append('_preload_content')
1674+
all_params.append('_request_timeout')
1675+
1676+
params = locals()
1677+
for key, val in iteritems(params['kwargs']):
1678+
if key not in all_params:
1679+
raise TypeError(
1680+
"Got an unexpected keyword argument '%s'"
1681+
" to method post_compress" % key
1682+
)
1683+
params[key] = val
1684+
del params['kwargs']
1685+
# verify the required parameter 'file' is set
1686+
if ('file' not in params) or (params['file'] is None):
1687+
raise ValueError("Missing the required parameter `file` when calling `post_compress`")
1688+
# verify the required parameter 'compress_level' is set
1689+
if ('compress_level' not in params) or (params['compress_level'] is None):
1690+
raise ValueError("Missing the required parameter `compress_level` when calling `post_compress`")
1691+
1692+
1693+
1694+
collection_formats = {}
1695+
1696+
path_params = {}
1697+
1698+
query_params = []
1699+
if 'compress_level' in params:
1700+
query_params.append(('compressLevel', params['compress_level']))
1701+
1702+
1703+
header_params = {}
1704+
1705+
form_params = []
1706+
local_var_files = {}
1707+
if 'file' in params:
1708+
1709+
if isinstance(params['file'],dict):
1710+
for filename , filecontext in params['file'].items():
1711+
local_var_files[filename] = filecontext
1712+
else:
1713+
local_var_files['File'] = params['file']
1714+
1715+
1716+
body_params = None
1717+
# HTTP header `Accept`
1718+
header_params['Accept'] = self.api_client.\
1719+
select_header_accept(['application/json'])
1720+
1721+
# HTTP header `Content-Type`
1722+
header_params['Content-Type'] = self.api_client.\
1723+
select_header_content_type(['multipart/form-data'])
1724+
1725+
# Authentication setting
1726+
auth_settings = []
1727+
1728+
return self.api_client.call_api('/cells/compress', 'POST',
1729+
path_params,
1730+
query_params,
1731+
header_params,
1732+
body=body_params,
1733+
post_params=form_params,
1734+
files=local_var_files,
1735+
response_type='FilesResult',
1736+
auth_settings=auth_settings,
1737+
callback=params.get('callback'),
1738+
_return_http_data_only=params.get('_return_http_data_only'),
1739+
_preload_content=params.get('_preload_content', True),
1740+
_request_timeout=params.get('_request_timeout'),
1741+
collection_formats=collection_formats)
1742+
1743+
def post_replace(self, file, text, newtext, **kwargs):
1744+
"""
1745+
This method makes a synchronous HTTP request by default. To make an
1746+
asynchronous HTTP request, please define a `callback` function
1747+
to be invoked when receiving the response.
1748+
>>> def callback_function(response):
1749+
>>> pprint(response)
1750+
>>>
1751+
>>> thread = api.post_replace(file, text, color, callback=callback_function)
1752+
1753+
:param callback function: The callback function
1754+
for asynchronous request. (optional)
1755+
:param file file: File to upload (required)
1756+
:param str text: (required)
1757+
:param str newtext: (required)
1758+
:param str password: (optional)
1759+
:param str sheet_name: (optional)
1760+
:return: FilesResult
1761+
If the method is called asynchronously,
1762+
returns the request thread.
1763+
"""
1764+
kwargs['_return_http_data_only'] = True
1765+
self.check_access_token()
1766+
if kwargs.get('callback'):
1767+
return self.post_replace_with_http_info(file, text, newtext, **kwargs)
1768+
else:
1769+
(data) = self.post_replace_with_http_info(file, text, newtext, **kwargs)
1770+
return data
1771+
1772+
def post_replace_with_http_info(self, file, text, newtext, **kwargs):
1773+
"""
1774+
This method makes a synchronous HTTP request by default. To make an
1775+
asynchronous HTTP request, please define a `callback` function
1776+
to be invoked when receiving the response.
1777+
>>> def callback_function(response):
1778+
>>> pprint(response)
1779+
>>>
1780+
>>> thread = api.post_replace_with_http_info(file, text, newtext, callback=callback_function)
1781+
1782+
:param callback function: The callback function
1783+
for asynchronous request. (optional)
1784+
:param file file: File to upload (required)
1785+
:param str text: (required)
1786+
:param str newtext: (required)
1787+
:param str password: (optional)
1788+
:param str sheet_name: (optional)
1789+
:return: FilesResult
1790+
If the method is called asynchronously,
1791+
returns the request thread.
1792+
"""
1793+
1794+
all_params = ['file', 'text', 'newtext','password','sheet_name']
1795+
all_params.append('callback')
1796+
all_params.append('_return_http_data_only')
1797+
all_params.append('_preload_content')
1798+
all_params.append('_request_timeout')
1799+
1800+
params = locals()
1801+
for key, val in iteritems(params['kwargs']):
1802+
if key not in all_params:
1803+
raise TypeError(
1804+
"Got an unexpected keyword argument '%s'"
1805+
" to method post_replace" % key
1806+
)
1807+
params[key] = val
1808+
del params['kwargs']
1809+
# verify the required parameter 'file' is set
1810+
if ('file' not in params) or (params['file'] is None):
1811+
raise ValueError("Missing the required parameter `file` when calling `post_replace`")
1812+
# verify the required parameter 'text' is set
1813+
if ('text' not in params) or (params['text'] is None):
1814+
raise ValueError("Missing the required parameter `text` when calling `post_replace`")
1815+
# verify the required parameter 'newtext' is set
1816+
if ('newtext' not in params) or (params['newtext'] is None):
1817+
raise ValueError("Missing the required parameter `newtext` when calling `post_replace`")
1818+
1819+
1820+
collection_formats = {}
1821+
1822+
path_params = {}
1823+
1824+
query_params = []
1825+
if 'text' in params:
1826+
query_params.append(('text', params['text']))
1827+
if 'newtext' in params:
1828+
query_params.append(('newtext', params['newtext']))
1829+
if 'password' in params:
1830+
query_params.append(('password', params['password']))
1831+
if 'sheet_name' in params:
1832+
query_params.append(('sheetname', params['sheet_name']))
1833+
1834+
1835+
header_params = {}
1836+
1837+
form_params = []
1838+
local_var_files = {}
1839+
if 'file' in params:
1840+
1841+
if isinstance(params['file'],dict):
1842+
for filename , filecontext in params['file'].items():
1843+
local_var_files[filename] = filecontext
1844+
else:
1845+
local_var_files['File'] = params['file']
1846+
1847+
1848+
body_params = None
1849+
# HTTP header `Accept`
1850+
header_params['Accept'] = self.api_client.\
1851+
select_header_accept(['application/json'])
1852+
1853+
# HTTP header `Content-Type`
1854+
header_params['Content-Type'] = self.api_client.\
1855+
select_header_content_type(['multipart/form-data'])
1856+
1857+
# Authentication setting
1858+
auth_settings = []
1859+
1860+
return self.api_client.call_api('/cells/replace', 'POST',
1861+
path_params,
1862+
query_params,
1863+
header_params,
1864+
body=body_params,
1865+
post_params=form_params,
1866+
files=local_var_files,
1867+
response_type='FilesResult',
1868+
auth_settings=auth_settings,
1869+
callback=params.get('callback'),
1870+
_return_http_data_only=params.get('_return_http_data_only'),
1871+
_preload_content=params.get('_preload_content', True),
1872+
_request_timeout=params.get('_request_timeout'),
1873+
collection_formats=collection_formats)

asposecellscloud/configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ def __init__(self):
103103
self.proxy = None
104104
# Safe chars for path_param
105105
self.safe_chars_for_path_param = '/'
106-
# self.proxy = 'https://127.0.0.1:8888'
107-
# self.ssl_ca_cert = 'C://projects//FiddlerRoot.pem'
106+
108107
@property
109108
def logger_file(self):
110109
"""
@@ -256,5 +255,5 @@ def to_debug_report(self):
256255
"OS: {env}\n"\
257256
"Python Version: {pyversion}\n"\
258257
"Version of the API: 21.9\n"\
259-
"SDK Package Version: 21.10".\
258+
"SDK Package Version: 21.11".\
260259
format(env=sys.platform, pyversion=sys.version)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from setuptools import setup, find_packages
55

66
NAME = "asposecellscloud"
7-
VERSION = "21.10"
7+
VERSION = "21.11"
88
# To install the library, run the following
99
#
1010
# python setup.py install

test/test_cells_compress_api.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# coding: utf-8
2+
3+
from __future__ import absolute_import
4+
5+
import os
6+
import sys
7+
import unittest
8+
import warnings
9+
10+
ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..")
11+
sys.path.append(ABSPATH)
12+
import asposecellscloud
13+
from asposecellscloud.rest import ApiException
14+
from asposecellscloud.apis.lite_cells_api import LiteCellsApi
15+
import AuthUtil
16+
17+
global_api = None
18+
class TestCellsCompressApi(unittest.TestCase):
19+
""" CellsApi unit test stubs """
20+
21+
def setUp(self):
22+
warnings.simplefilter('ignore', ResourceWarning)
23+
global global_api
24+
if global_api is None:
25+
global_api = asposecellscloud.apis.lite_cells_api.LiteCellsApi(AuthUtil.GetClientId(),AuthUtil.GetClientSecret(),"v3.0",AuthUtil.GetBaseUrl())
26+
self.api = global_api
27+
28+
def tearDown(self):
29+
pass
30+
31+
def test_cells_compress(self):
32+
assemblytest = os.path.dirname(os.path.realpath(__file__)) + "/../TestData/" + "assemblytest.xlsx"
33+
datasource = os.path.dirname(os.path.realpath(__file__)) + "/../TestData/" + "datasource.xlsx"
34+
result = self.api.post_compress({ "assemblytest.xlsx" :assemblytest, "datasource.xlsx":datasource},88)
35+
# print(result)
36+
pass
37+
if __name__ == '__main__':
38+
unittest.main()

test/test_cells_workbook_api.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,19 @@ def test_cells_workbook_delete_workbook_background(self):
555555
result = self.api.cells_workbook_delete_workbook_background(name, folder=folder)
556556
self.assertEqual(result.code,200)
557557
pass
558+
def test_cells_workbook_pagecount(self):
559+
"""
560+
Test case for cells_worksheets_put_worksheet_freeze_panes
558561
562+
Set freeze panes
563+
"""
564+
name = "Book1.xlsx"
565+
566+
folder = "PythonTest"
567+
result = AuthUtil.Ready(self.api, name, folder)
568+
self.assertTrue(len(result.uploaded)>0)
569+
result = self.api.cells_workbook_get_page_count(name, folder=folder)
570+
self.assertGreater(result,0)
571+
pass
559572
if __name__ == '__main__':
560573
unittest.main()

test/test_cells_worksheets_api.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,22 @@ def test_cells_worksheets_delete_worksheets(self):
629629
result = self.api.cells_worksheets_delete_worksheets(name, match_condition_request, folder=folder)
630630
self.assertEqual(result.code,200)
631631
pass
632+
633+
def test_cells_worksheets_pagecount(self):
634+
"""
635+
Test case for cells_worksheets_put_worksheet_freeze_panes
636+
637+
Set freeze panes
638+
"""
639+
name = "Book1.xlsx"
640+
sheet_name ="Sheet1"
641+
642+
folder = "PythonTest"
643+
result = AuthUtil.Ready(self.api, name, folder)
644+
self.assertTrue(len(result.uploaded)>0)
645+
result = self.api.cells_worksheets_get_page_count(name,sheet_name, folder=folder)
646+
self.assertGreater(result,0)
647+
pass
632648

633649
if __name__ == '__main__':
634650
unittest.main()

0 commit comments

Comments
 (0)