Skip to content

Commit f0b1a97

Browse files
committed
finish importer API
1 parent d1c4620 commit f0b1a97

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

ThreadFixProApi/Networks/_utils/_importer.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,25 @@ def __init__(self, host, api_key, verify_ssl, timeout, headers, user_agent, cert
2121
the private key and the certificate) or as a tuple of both file’s path
2222
:param debug: Prints requests and responses, useful for debugging.
2323
"""
24-
super().__init__(host, api_key, verify_ssl, timeout, headers, user_agent, cert, debug)
24+
super().__init__(host, api_key, verify_ssl, timeout, headers, user_agent, cert, debug)
25+
26+
def queue_scan_upload(self, file_path):
27+
"""
28+
Queues a scan for upload
29+
:param file_path: Path to the scan file to be uploaded.
30+
"""
31+
return super().request('POST', '/api/importer', files={'file': open(file_path, 'rb')})
32+
33+
def import_latest_scan_for_remote_provider(self, provider_id):
34+
"""
35+
Imports the latest scan into the remote provider specified
36+
:param provider_id: ID of remote provider to import the scan to.
37+
"""
38+
return super().request('POST', f'/api/importer/remoteprovider/{provider_id}/importLatest')
39+
40+
def request_latest_scan_or_ececute_scan_for_provider(self, provider_id):
41+
"""
42+
Gets the latests scan or executes it for the provider
43+
:param provider_id: ID of remote provider to import the scan to.
44+
"""
45+
return super().request('POST', f'/api/importer/remoteprovider/{provider_id}/requestScan')

0 commit comments

Comments
 (0)