Skip to content

Commit d386d41

Browse files
[TASKSCLOUD-445] - Deployed new 20.11 version.
1 parent 4199ef7 commit d386d41

14 files changed

+467
-17
lines changed

asposetaskscloud/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
from asposetaskscloud.models.storage_exist import StorageExist
7979
from asposetaskscloud.models.storage_file import StorageFile
8080
from asposetaskscloud.models.task import Task
81+
from asposetaskscloud.models.task_creation_request import TaskCreationRequest
8182
from asposetaskscloud.models.task_item import TaskItem
8283
from asposetaskscloud.models.task_link import TaskLink
8384
from asposetaskscloud.models.task_link_type import TaskLinkType
@@ -219,6 +220,7 @@
219220
from asposetaskscloud.models.requests.get_tasks_request import GetTasksRequest
220221
from asposetaskscloud.models.requests.post_task_request import PostTaskRequest
221222
from asposetaskscloud.models.requests.post_task_recurring_info_request import PostTaskRecurringInfoRequest
223+
from asposetaskscloud.models.requests.post_tasks_request import PostTasksRequest
222224
from asposetaskscloud.models.requests.put_move_task_request import PutMoveTaskRequest
223225
from asposetaskscloud.models.requests.put_move_task_to_sibling_request import PutMoveTaskToSiblingRequest
224226
from asposetaskscloud.models.requests.put_task_request import PutTaskRequest

asposetaskscloud/api/tasks_api.py

Lines changed: 133 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,15 @@ def __downcase_first_letter(self, s):
5757
def __request_token(self):
5858
config = self.api_client.configuration
5959
api_version = config.api_version
60+
request_url = ''
61+
host = ''
6062
config.api_version = ''
61-
request_url = "connect/token"
63+
if config.auth_url is not None:
64+
host = config.host
65+
config.host = config.auth_url
66+
else:
67+
request_url = "connect/token"
68+
6269
form_params = [('grant_type', 'client_credentials'), ('client_id', config.api_key['app_sid']),
6370
('client_secret', config.api_key['api_key'])]
6471

@@ -72,6 +79,8 @@ def __request_token(self):
7279
response_type='object',
7380
files={}, _return_http_data_only=True)
7481
access_token = data['access_token'] if six.PY3 else data['access_token'].encode('utf8')
82+
if config.auth_url is not None:
83+
config.host = host
7584
self.api_client.configuration.access_token = access_token
7685
self.api_client.configuration.api_version = api_version
7786

@@ -8869,8 +8878,129 @@ def post_task_recurring_info_with_http_info(self, request, **kwargs): # noqa: E
88698878
_request_timeout=params.get('_request_timeout'),
88708879
collection_formats=collection_formats)
88718880

8881+
def post_tasks(self, request, **kwargs): # noqa: E501
8882+
"""Create multiple tasks by single request. # noqa: E501
8883+
8884+
This method makes a synchronous HTTP request by default. To make an
8885+
asynchronous HTTP request, please pass is_async=True
8886+
8887+
:param is_async bool
8888+
:param name str : The name of the file. (required)
8889+
:param requests list[TaskCreationRequest] : Requests to create tasks. (required)
8890+
:param file_name str : The name of the project document to save changes to.
8891+
:param storage str : The document storage.
8892+
:param folder str : The document folder.
8893+
:return: TaskItemsResponse
8894+
If the method is called asynchronously,
8895+
returns the request thread.
8896+
"""
8897+
kwargs['_return_http_data_only'] = True
8898+
try:
8899+
if kwargs.get('is_async'):
8900+
return self.post_tasks_with_http_info(request, **kwargs) # noqa: E501
8901+
(data) = self.post_tasks_with_http_info(request, **kwargs) # noqa: E501
8902+
return data
8903+
except ApiException as e:
8904+
if e.status == 401:
8905+
self.__request_token()
8906+
if kwargs.get('is_async'):
8907+
return self.post_tasks_with_http_info(request, **kwargs) # noqa: E501
8908+
(data) = self.post_tasks_with_http_info(request, **kwargs) # noqa: E501
8909+
return data
8910+
8911+
def post_tasks_with_http_info(self, request, **kwargs): # noqa: E501
8912+
"""Create multiple tasks by single request. # noqa: E501
8913+
8914+
This method makes a synchronous HTTP request by default. To make an
8915+
asynchronous HTTP request, please pass is_async=True
8916+
8917+
:param is_async bool
8918+
:param request post_tasks_request object with parameters
8919+
:return: TaskItemsResponse
8920+
If the method is called asynchronously,
8921+
returns the request thread.
8922+
"""
8923+
8924+
params = locals()
8925+
params['is_async'] = ''
8926+
params['_return_http_data_only'] = False
8927+
params['_preload_content'] = True
8928+
params['_request_timeout'] = ''
8929+
for key, val in six.iteritems(params['kwargs']):
8930+
if key not in params:
8931+
raise TypeError(
8932+
"Got an unexpected keyword argument '%s'"
8933+
" to method post_tasks" % key
8934+
)
8935+
params[key] = val
8936+
del params['kwargs']
8937+
# verify the required parameter 'name' is set
8938+
if request.name is None:
8939+
raise ValueError("Missing the required parameter `name` when calling `post_tasks`") # noqa: E501
8940+
# verify the required parameter 'requests' is set
8941+
if request.requests is None:
8942+
raise ValueError("Missing the required parameter `requests` when calling `post_tasks`") # noqa: E501
8943+
8944+
collection_formats = {}
8945+
path = '/tasks/{name}/tasks/batch'
8946+
path_params = {}
8947+
if request.name is not None:
8948+
path_params[self.__downcase_first_letter('name')] = request.name # noqa: E501
8949+
8950+
query_params = []
8951+
if '{' + self.__downcase_first_letter('fileName') + '}' in path:
8952+
path = path.replace('{' + self.__downcase_first_letter('fileName' + '}'), request.file_name if request.file_name is not None else '')
8953+
else:
8954+
if request.file_name is not None:
8955+
query_params.append((self.__downcase_first_letter('fileName'), request.file_name)) # noqa: E501
8956+
if '{' + self.__downcase_first_letter('storage') + '}' in path:
8957+
path = path.replace('{' + self.__downcase_first_letter('storage' + '}'), request.storage if request.storage is not None else '')
8958+
else:
8959+
if request.storage is not None:
8960+
query_params.append((self.__downcase_first_letter('storage'), request.storage)) # noqa: E501
8961+
if '{' + self.__downcase_first_letter('folder') + '}' in path:
8962+
path = path.replace('{' + self.__downcase_first_letter('folder' + '}'), request.folder if request.folder is not None else '')
8963+
else:
8964+
if request.folder is not None:
8965+
query_params.append((self.__downcase_first_letter('folder'), request.folder)) # noqa: E501
8966+
8967+
header_params = {}
8968+
8969+
form_params = []
8970+
local_var_files = []
8971+
8972+
body_params = None
8973+
if request.requests is not None:
8974+
body_params = request.requests
8975+
# HTTP header `Accept`
8976+
header_params['Accept'] = self.api_client.select_header_accept(
8977+
['application/json']) # noqa: E501
8978+
8979+
# HTTP header `Content-Type`
8980+
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
8981+
['application/json']) # noqa: E501
8982+
8983+
# Authentication setting
8984+
auth_settings = ['JWT'] # noqa: E501
8985+
8986+
return self.api_client.call_api(
8987+
path, 'POST',
8988+
path_params,
8989+
query_params,
8990+
header_params,
8991+
body=body_params,
8992+
post_params=form_params,
8993+
files=local_var_files,
8994+
response_type='TaskItemsResponse', # noqa: E501
8995+
auth_settings=auth_settings,
8996+
is_async=params.get('is_async'),
8997+
_return_http_data_only=params.get('_return_http_data_only'),
8998+
_preload_content=params.get('_preload_content', True),
8999+
_request_timeout=params.get('_request_timeout'),
9000+
collection_formats=collection_formats)
9001+
88729002
def put_move_task(self, request, **kwargs): # noqa: E501
8873-
"""Move one task to another parent task # noqa: E501
9003+
"""Move one task to another parent task. # noqa: E501
88749004
88759005
This method makes a synchronous HTTP request by default. To make an
88769006
asynchronous HTTP request, please pass is_async=True
@@ -8901,7 +9031,7 @@ def put_move_task(self, request, **kwargs): # noqa: E501
89019031
return data
89029032

89039033
def put_move_task_with_http_info(self, request, **kwargs): # noqa: E501
8904-
"""Move one task to another parent task # noqa: E501
9034+
"""Move one task to another parent task. # noqa: E501
89059035
89069036
This method makes a synchronous HTTP request by default. To make an
89079037
asynchronous HTTP request, please pass is_async=True

asposetaskscloud/api_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7777

7878
self.pool = ThreadPool()
7979
self.rest_client = rest.RESTClientObject(configuration)
80-
self.default_headers = {'x-aspose-client': 'python sdk', 'x-aspose-version': '20.8'}
80+
self.default_headers = {'x-aspose-client': 'python sdk', 'x-aspose-version': '20.11'}
8181
if header_name is not None:
8282
self.default_headers[header_name] = header_value
8383
self.cookie = cookie
8484
# Set default User-Agent.
85-
self.user_agent = 'python sdk 20.8'
85+
self.user_agent = 'python sdk 20.11'
8686

8787
def __del__(self):
8888
self.pool.close()
@@ -154,11 +154,11 @@ def __call_api(
154154
body = self.sanitize_for_serialization(body)
155155

156156
# request url
157-
url = ''
158-
if six.PY3:
159-
url = self.configuration.host + '/' + self.configuration.api_version + resource_path
160-
else:
161-
url = (self.configuration.host + '/' + self.configuration.api_version + resource_path).encode('utf8')
157+
url = self.configuration.host
158+
if resource_path:
159+
url = url + '/' + self.configuration.api_version + resource_path
160+
if not six.PY3:
161+
url = url.encode('utf8')
162162

163163
# perform request and return response
164164
response_data = self.request(

asposetaskscloud/configuration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ def __init__(self):
6363
self.api_version = "v3.0"
6464
# Temp file folder for downloading files
6565
self.temp_folder_path = None
66+
# Optional detached auth url
67+
self.auth_url = None
6668

6769
# Authentication Settings
6870
# dict to store API key(s)
@@ -262,5 +264,5 @@ def to_debug_report(self):
262264
"OS: {env}\n"\
263265
"Python Version: {pyversion}\n"\
264266
"Version of the API: 3.0\n"\
265-
"SDK Package Version: 20.8.0".\
267+
"SDK Package Version: 20.11.0".\
266268
format(env=sys.platform, pyversion=sys.version)

asposetaskscloud/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
from asposetaskscloud.models.storage_exist import StorageExist
7272
from asposetaskscloud.models.storage_file import StorageFile
7373
from asposetaskscloud.models.task import Task
74+
from asposetaskscloud.models.task_creation_request import TaskCreationRequest
7475
from asposetaskscloud.models.task_item import TaskItem
7576
from asposetaskscloud.models.task_link import TaskLink
7677
from asposetaskscloud.models.task_link_type import TaskLinkType

asposetaskscloud/models/requests/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
from asposetaskscloud.models.requests.get_tasks_request import GetTasksRequest
7777
from asposetaskscloud.models.requests.post_task_request import PostTaskRequest
7878
from asposetaskscloud.models.requests.post_task_recurring_info_request import PostTaskRecurringInfoRequest
79+
from asposetaskscloud.models.requests.post_tasks_request import PostTasksRequest
7980
from asposetaskscloud.models.requests.put_move_task_request import PutMoveTaskRequest
8081
from asposetaskscloud.models.requests.put_move_task_to_sibling_request import PutMoveTaskToSiblingRequest
8182
from asposetaskscloud.models.requests.put_task_request import PutTaskRequest
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# coding: utf-8
2+
# --------------------------------------------------------------------------------
3+
# <copyright company="Aspose" file="post_tasks_request.py">
4+
# Copyright (c) 2020 Aspose.Tasks 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+
# coding: utf-8
26+
# --------------------------------------------------------------------------------
27+
28+
29+
class PostTasksRequest(object):
30+
"""
31+
Request model for post_tasks operation.
32+
Initializes a new instance.
33+
:param name The name of the file.
34+
:param requests Requests to create tasks.
35+
:param file_name The name of the project document to save changes to.
36+
:param storage The document storage.
37+
:param folder The document folder.
38+
"""
39+
40+
def __init__(self, name, requests, file_name=None, storage=None, folder=None):
41+
self.name = name
42+
self.requests = requests
43+
self.file_name = file_name
44+
self.storage = storage
45+
self.folder = folder
46+
47+

0 commit comments

Comments
 (0)