Skip to content

Commit

Permalink
/v2/inv-playbook/task/form/submit args fix (#62)
Browse files Browse the repository at this point in the history
* swagger auto code gen

* add rn

* lock setuptools on 44.1.1

* lock setuptools on 44.0.0

* lock setuptools-scm==5.0.2

* lock all requirments versions

* print pip version

* drop py2 support

* rm py27 ev

* add models

* revert get latest report removal

* revert swagger changes

* revert md file changes

* bump version to 3.0.0
  • Loading branch information
Itay4 authored Apr 19, 2021
1 parent 2a9feb3 commit 13f2d3c
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Setup Python
command: |
pyenv versions
pyenv global 2.7.18 3.8.3 3.7.8
pyenv global 3.8.3 3.7.8
- run:
name: tox build
command: |
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
[PyPI History][1]

[1]: https://pypi.org/project/demisto-py/#history
## 3.0.0
* Drop support for Python 2. demisto-py now requires Python 3.7 or later. Pin to demisto-py <2.0.24 to maintain 2.7 support.
* Fixed bug in arguments required for the route: `/v2/inv-playbook/task/form/submit`.

## 2.0.23
* Support for adding feed indicators via the route: `/indicators/feed/json`.

Expand Down
36 changes: 12 additions & 24 deletions demisto_client/demisto_api/api/default_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6474,55 +6474,51 @@ def simple_complete_task_with_http_info(self, **kwargs): # noqa: E501
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

def submit_task_form(self, investigation_id, task_id, answers, file, **kwargs): # noqa: E501
def submit_task_form(self, investigation_id, task_id, answers, **kwargs): # noqa: E501
"""Complete a task # noqa: E501
Submit a data collection task with given answers and multiple file attachments # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.submit_task_form(investigation_id, task_id, answers, file, async_req=True)
>>> thread = api.submit_task_form(investigation_id, task_id, answers, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str investigation_id: investigation ID (required)
:param str task_id: Task Id (required)
:param file answers: the answers to the task form. Answers are keyed by numerical question id (required)
:param file file: Files to attach to the task (required)
:param str file_names: file names separated by %###% (only if files provided)
:param str file_comments: file comment separated by %###% (only if files provided)
:param str answers: the answers to the task form. Answers are keyed by numerical question id (required)
:param file file: Files to attach to the task
:return: InvestigationPlaybook
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.submit_task_form_with_http_info(investigation_id, task_id, answers, file, **kwargs) # noqa: E501
return self.submit_task_form_with_http_info(investigation_id, task_id, answers, **kwargs) # noqa: E501
else:
(data) = self.submit_task_form_with_http_info(investigation_id, task_id, answers, file, **kwargs) # noqa: E501
(data) = self.submit_task_form_with_http_info(investigation_id, task_id, answers, **kwargs) # noqa: E501
return data

def submit_task_form_with_http_info(self, investigation_id, task_id, answers, file, **kwargs): # noqa: E501
def submit_task_form_with_http_info(self, investigation_id, task_id, answers, **kwargs): # noqa: E501
"""Complete a task # noqa: E501
Submit a data collection task with given answers and multiple file attachments # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.submit_task_form_with_http_info(investigation_id, task_id, answers, file, async_req=True)
>>> thread = api.submit_task_form_with_http_info(investigation_id, task_id, answers, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str investigation_id: investigation ID (required)
:param str task_id: Task Id (required)
:param file answers: the answers to the task form. Answers are keyed by numerical question id (required)
:param file file: Files to attach to the task (required)
:param str file_names: file names separated by %###% (only if files provided)
:param str file_comments: file comment separated by %###% (only if files provided)
:param str answers: the answers to the task form. Answers are keyed by numerical question id (required)
:param file file: Files to attach to the task
:return: InvestigationPlaybook
If the method is called asynchronously,
returns the request thread.
"""

all_params = ['investigation_id', 'task_id', 'answers', 'file', 'file_names', 'file_comments'] # noqa: E501
all_params = ['investigation_id', 'task_id', 'answers', 'file'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
Expand All @@ -6549,10 +6545,6 @@ def submit_task_form_with_http_info(self, investigation_id, task_id, answers, fi
if ('answers' not in params or
params['answers'] is None):
raise ValueError("Missing the required parameter `answers` when calling `submit_task_form`") # noqa: E501
# verify the required parameter 'file' is set
if ('file' not in params or
params['file'] is None):
raise ValueError("Missing the required parameter `file` when calling `submit_task_form`") # noqa: E501

collection_formats = {}

Expand All @@ -6569,13 +6561,9 @@ def submit_task_form_with_http_info(self, investigation_id, task_id, answers, fi
if 'task_id' in params:
form_params.append(('taskId', params['task_id'])) # noqa: E501
if 'answers' in params:
local_var_files['answers'] = params['answers'] # noqa: E501
form_params.append(('answers', params['answers'])) # noqa: E501
if 'file' in params:
local_var_files['file'] = params['file'] # noqa: E501
if 'file_names' in params:
form_params.append(('fileNames', params['file_names'])) # noqa: E501
if 'file_comments' in params:
form_params.append(('fileComments', params['file_comments'])) # noqa: E501

body_params = None
# HTTP header `Accept`
Expand Down
16 changes: 6 additions & 10 deletions docs/DefaultApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -3218,7 +3218,7 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)

# **submit_task_form**
> InvestigationPlaybook submit_task_form(investigation_id, task_id, answers, file, file_names=file_names, file_comments=file_comments)
> InvestigationPlaybook submit_task_form(investigation_id, task_id, answers, file=file)
Complete a task

Expand All @@ -3236,14 +3236,12 @@ from pprint import pprint
api_instance = demisto_client.configure(base_url="https://YOUR_DEMISTO_SERVER", api_key="YOUR_API_KEY")
investigation_id = 'investigation_id_example' # str | investigation ID
task_id = 'task_id_example' # str | Task Id
answers = '/path/to/file.txt' # file | the answers to the task form. Answers are keyed by numerical question id
file = '/path/to/file.txt' # file | Files to attach to the task
file_names = 'file_names_example' # str | file names separated by %###% (only if files provided) (optional)
file_comments = 'file_comments_example' # str | file comment separated by %###% (only if files provided) (optional)
answers = 'answers_example' # str | the answers to the task form. Answers are keyed by numerical question id
file = '/path/to/file.txt' # file | Files to attach to the task (optional)

try:
# Complete a task
api_response = api_instance.submit_task_form(investigation_id, task_id, answers, file, file_names=file_names, file_comments=file_comments)
api_response = api_instance.submit_task_form(investigation_id, task_id, answers, file=file)
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->submit_task_form: %s\n" % e)
Expand All @@ -3255,10 +3253,8 @@ Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**investigation_id** | **str**| investigation ID |
**task_id** | **str**| Task Id |
**answers** | **file**| the answers to the task form. Answers are keyed by numerical question id |
**file** | **file**| Files to attach to the task |
**file_names** | **str**| file names separated by %###% (only if files provided) | [optional]
**file_comments** | **str**| file comment separated by %###% (only if files provided) | [optional]
**answers** | **str**| the answers to the task form. Answers are keyed by numerical question id |
**file** | **file**| Files to attach to the task | [optional]

### Return type

Expand Down
18 changes: 2 additions & 16 deletions server_api_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@
"required": true
},
{
"type": "file",
"type": "string",
"description": "the answers to the task form. Answers are keyed by numerical question id",
"name": "answers",
"in": "formData",
Expand All @@ -1868,19 +1868,6 @@
"type": "file",
"description": "Files to attach to the task",
"name": "file",
"in": "formData",
"required": true
},
{
"type": "string",
"description": "file names separated by %###% (only if files provided)",
"name": "fileNames",
"in": "formData"
},
{
"type": "string",
"description": "file comment separated by %###% (only if files provided)",
"name": "fileComments",
"in": "formData"
}
],
Expand Down Expand Up @@ -9918,5 +9905,4 @@
"csrf_token": []
}
]
}

}
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27, py37, py38
envlist = py37, py38

[testenv]
deps=-r{toxinidir}/requirements.txt
Expand Down

0 comments on commit 13f2d3c

Please sign in to comment.