hiddenlayer-sdk 0.1.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. hiddenlayer/__init__.py +109 -0
  2. hiddenlayer/sdk/__init__.py +0 -0
  3. hiddenlayer/sdk/constants.py +14 -0
  4. hiddenlayer/sdk/enterprise/__init__.py +0 -0
  5. hiddenlayer/sdk/enterprise/enterprise_model_scan_api.py +55 -0
  6. hiddenlayer/sdk/exceptions.py +12 -0
  7. hiddenlayer/sdk/models.py +22 -0
  8. hiddenlayer/sdk/rest/__init__.py +49 -0
  9. hiddenlayer/sdk/rest/api/__init__.py +7 -0
  10. hiddenlayer/sdk/rest/api/aidr_predictive_api.py +308 -0
  11. hiddenlayer/sdk/rest/api/model_scan_api.py +591 -0
  12. hiddenlayer/sdk/rest/api/sensor_api.py +1966 -0
  13. hiddenlayer/sdk/rest/api_client.py +770 -0
  14. hiddenlayer/sdk/rest/api_response.py +21 -0
  15. hiddenlayer/sdk/rest/configuration.py +445 -0
  16. hiddenlayer/sdk/rest/exceptions.py +199 -0
  17. hiddenlayer/sdk/rest/models/__init__.py +30 -0
  18. hiddenlayer/sdk/rest/models/create_sensor_request.py +95 -0
  19. hiddenlayer/sdk/rest/models/file_info.py +110 -0
  20. hiddenlayer/sdk/rest/models/get_multipart_upload_response.py +97 -0
  21. hiddenlayer/sdk/rest/models/model.py +100 -0
  22. hiddenlayer/sdk/rest/models/model_query_response.py +101 -0
  23. hiddenlayer/sdk/rest/models/multipart_upload_part.py +93 -0
  24. hiddenlayer/sdk/rest/models/scan_model_request.py +87 -0
  25. hiddenlayer/sdk/rest/models/scan_results_v2.py +108 -0
  26. hiddenlayer/sdk/rest/models/sensor_sor_query_filter.py +108 -0
  27. hiddenlayer/sdk/rest/models/sensor_sor_query_request.py +109 -0
  28. hiddenlayer/sdk/rest/models/submission_response.py +95 -0
  29. hiddenlayer/sdk/rest/models/submission_v2.py +109 -0
  30. hiddenlayer/sdk/rest/models/validation_error_model.py +99 -0
  31. hiddenlayer/sdk/rest/models/validation_error_model_loc_inner.py +138 -0
  32. hiddenlayer/sdk/rest/rest.py +257 -0
  33. hiddenlayer/sdk/services/__init__.py +0 -0
  34. hiddenlayer/sdk/services/aidr_predictive.py +76 -0
  35. hiddenlayer/sdk/services/model.py +101 -0
  36. hiddenlayer/sdk/services/model_scan.py +414 -0
  37. hiddenlayer/sdk/utils.py +92 -0
  38. hiddenlayer/sdk/version.py +1 -0
  39. hiddenlayer_sdk-0.1.0.dist-info/LICENSE +201 -0
  40. hiddenlayer_sdk-0.1.0.dist-info/METADATA +320 -0
  41. hiddenlayer_sdk-0.1.0.dist-info/RECORD +43 -0
  42. hiddenlayer_sdk-0.1.0.dist-info/WHEEL +5 -0
  43. hiddenlayer_sdk-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,109 @@
1
+ from typing import Optional
2
+
3
+ import requests
4
+ from requests.auth import HTTPBasicAuth
5
+
6
+ from hiddenlayer.sdk.rest.api_client import ApiClient
7
+ from hiddenlayer.sdk.rest.configuration import Configuration
8
+ from hiddenlayer.sdk.services.aidr_predictive import AIDRPredictive
9
+ from hiddenlayer.sdk.services.model import ModelAPI
10
+ from hiddenlayer.sdk.services.model_scan import ModelScanAPI
11
+ from hiddenlayer.sdk.utils import is_saas
12
+ from hiddenlayer.sdk.version import VERSION
13
+
14
+ __version__ = VERSION
15
+
16
+
17
+ class HiddenlayerServiceAuthError(Exception):
18
+ pass
19
+
20
+
21
+ class HiddenlayerUnsupportedPlatformError(Exception):
22
+ pass
23
+
24
+
25
+ class HiddenlayerServiceClient:
26
+ """
27
+ The Hiddenlayer Service Client is a client for the Hiddenlayer services REST API.
28
+ """
29
+
30
+ def __init__(
31
+ self,
32
+ *,
33
+ api_id: Optional[str] = None,
34
+ api_key: Optional[str] = None,
35
+ host: str = "https://api.us.hiddenlayer.ai",
36
+ ):
37
+ self.is_saas = is_saas(host)
38
+
39
+ if self.is_saas:
40
+ if not api_id:
41
+ raise EnvironmentError(
42
+ "`api_id` cannot be None when using the SaaS version of HiddenLayer."
43
+ )
44
+
45
+ if not api_key:
46
+ raise EnvironmentError(
47
+ "`api_key` cannot be None when using the SaaS version of HiddenLayer."
48
+ )
49
+
50
+ jwt_token = self._get_jwt(api_id=api_id, api_key=api_key)
51
+ self._config = Configuration(host=host, access_token=jwt_token)
52
+
53
+ else:
54
+ self._config = Configuration(host=host)
55
+
56
+ self._api_client = ApiClient(configuration=self._config)
57
+ self._aidr_predictive = AIDRPredictive(self._api_client)
58
+ self._model = ModelAPI(self._api_client)
59
+ self._model_scan = ModelScanAPI(self._api_client)
60
+
61
+ def _get_jwt(self, *, api_id: str, api_key: str) -> str:
62
+ "Get the JWT token to auth to the Hiddenlayer API."
63
+
64
+ token_url = (
65
+ "https://auth.hiddenlayer.ai/oauth2/token?grant_type=client_credentials"
66
+ )
67
+
68
+ resp = requests.post(token_url, auth=HTTPBasicAuth(api_id, api_key))
69
+
70
+ if not resp.ok:
71
+ raise HiddenlayerServiceAuthError(
72
+ f"Unable to get authentication credentials for the HiddenLayer API: {resp.status_code}: {resp.text}"
73
+ )
74
+
75
+ if "access_token" not in resp.json():
76
+ raise HiddenlayerServiceAuthError(
77
+ f"Unable to get authentication credentials for the HiddenLayer API - invalid response: {resp.json()}"
78
+ )
79
+
80
+ return resp.json()["access_token"]
81
+
82
+ @property
83
+ def config(self) -> Configuration:
84
+ return self._config
85
+
86
+ @property
87
+ def api_client(self) -> ApiClient:
88
+ return self._api_client
89
+
90
+ @property
91
+ def model_scanner(self) -> ModelScanAPI:
92
+ return self._model_scan
93
+
94
+ @property
95
+ def aidr_predictive(self) -> AIDRPredictive:
96
+ # If the platform is not SaaS, it's not supported
97
+ if not self.is_saas:
98
+ raise HiddenlayerUnsupportedPlatformError(
99
+ "AIDR for Predictive Models is currently only supported with the SaaS version of the platform."
100
+ )
101
+ return self._aidr_predictive
102
+
103
+ @property
104
+ def model(self) -> ModelAPI:
105
+ if not self.is_saas:
106
+ raise HiddenlayerUnsupportedPlatformError(
107
+ "Model management is currently only supported with the SaaS version of the platform."
108
+ )
109
+ return self._model
File without changes
@@ -0,0 +1,14 @@
1
+ from enum import Enum
2
+
3
+
4
+ class ScanStatus(str, Enum):
5
+ DONE = "done"
6
+ ACCEPTED = "accepted"
7
+ FAILED = "failed"
8
+ PENDING = "pending"
9
+ CREATED = "created"
10
+ RETRY = "retry"
11
+
12
+
13
+ class ApiErrors(str, Enum):
14
+ NON_ADHOC_SENSOR_DELETE = "only adhoc sensors may be deleted"
File without changes
@@ -0,0 +1,55 @@
1
+ """
2
+ This file is created because the Enterprise and SaaS APIs are not in sync.
3
+
4
+ When they are in sync, this file and related references can be deleted.
5
+ """
6
+ from typing import Dict, Optional
7
+
8
+ from hiddenlayer.sdk.rest.api_client import ApiClient
9
+ from hiddenlayer.sdk.rest.models.scan_results_v2 import ScanResultsV2
10
+
11
+
12
+ class EnterpriseModelScanApi:
13
+ def __init__(self, api_client: ApiClient):
14
+ self.api_client = api_client
15
+
16
+ def scan_model(self, sensor_id: str, data: Optional[bytes] = None, post_params: Optional[dict] = None):
17
+ _response_types_map: Dict[str, Optional[str]] = {
18
+ '201': "ScanResultsV2",
19
+ '400': None,
20
+ '422': "ValidationErrorModel",
21
+ }
22
+ resource_path = f"/api/v2/create/{sensor_id}"
23
+
24
+ response_data = self.api_client.call_api(
25
+ "POST",
26
+ self.api_client.configuration.host + resource_path,
27
+ body=data,
28
+ post_params=post_params,
29
+ header_params={"Content-Type": "octet-binary"}
30
+ )
31
+ response_data.read()
32
+
33
+ return self.api_client.response_deserialize(
34
+ response_data=response_data,
35
+ response_types_map=_response_types_map
36
+ ).data
37
+
38
+ def scan_status(self, sensor_id: str) -> ScanResultsV2:
39
+ _response_types_map: Dict[str, Optional[str]] = {
40
+ '200': "ScanResultsV2",
41
+ '400': None,
42
+ '404': None,
43
+ }
44
+ resource_path = f"/api/v2/status/{sensor_id}"
45
+
46
+ response_data = self.api_client.call_api(
47
+ "GET",
48
+ self.api_client.configuration.host + resource_path,
49
+ )
50
+ response_data.read()
51
+
52
+ return self.api_client.response_deserialize(
53
+ response_data=response_data,
54
+ response_types_map=_response_types_map
55
+ ).data
@@ -0,0 +1,12 @@
1
+ class HiddenlayerConflictError(Exception):
2
+ """Generic error class for API errors from a 409 error code."""
3
+
4
+ pass
5
+
6
+
7
+ class ModelDoesNotExistError(Exception):
8
+ pass
9
+
10
+
11
+ class IncompatibleModelError(Exception):
12
+ pass
@@ -0,0 +1,22 @@
1
+ from typing import Optional
2
+
3
+ from typing_extensions import Self
4
+
5
+ from hiddenlayer.sdk.rest.models import ScanResultsV2
6
+
7
+
8
+ class ScanResults(ScanResultsV2):
9
+ """This class exists because the ScanResults API doesn't return anything about the file name or path that was scanned."""
10
+
11
+ file_name: Optional[str] = None
12
+ file_path: Optional[str] = None
13
+ sensor_id: Optional[str] = None
14
+
15
+ @classmethod
16
+ def from_scanresultsv2(
17
+ cls, *, scan_results_v2: ScanResultsV2, sensor_id: Optional[str] = None
18
+ ) -> Self:
19
+ scan_results_dict = scan_results_v2.to_dict()
20
+ scan_results_dict["sensor_id"] = sensor_id
21
+
22
+ return cls(**scan_results_dict)
@@ -0,0 +1,49 @@
1
+ # coding: utf-8
2
+
3
+ # flake8: noqa
4
+
5
+ """
6
+ HiddenLayer ModelScan
7
+
8
+ HiddenLayer ModelScan API for scanning of models
9
+
10
+ The version of the OpenAPI document: 1
11
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
12
+
13
+ Do not edit the class manually.
14
+ """ # noqa: E501
15
+
16
+
17
+ __version__ = "1.0.0"
18
+
19
+ # import apis into sdk package
20
+ from hiddenlayer.sdk.rest.api.aidr_predictive_api import AidrPredictiveApi
21
+ from hiddenlayer.sdk.rest.api.model_scan_api import ModelScanApi
22
+ from hiddenlayer.sdk.rest.api.sensor_api import SensorApi
23
+
24
+ # import ApiClient
25
+ from hiddenlayer.sdk.rest.api_response import ApiResponse
26
+ from hiddenlayer.sdk.rest.api_client import ApiClient
27
+ from hiddenlayer.sdk.rest.configuration import Configuration
28
+ from hiddenlayer.sdk.rest.exceptions import OpenApiException
29
+ from hiddenlayer.sdk.rest.exceptions import ApiTypeError
30
+ from hiddenlayer.sdk.rest.exceptions import ApiValueError
31
+ from hiddenlayer.sdk.rest.exceptions import ApiKeyError
32
+ from hiddenlayer.sdk.rest.exceptions import ApiAttributeError
33
+ from hiddenlayer.sdk.rest.exceptions import ApiException
34
+
35
+ # import models into sdk package
36
+ from hiddenlayer.sdk.rest.models.create_sensor_request import CreateSensorRequest
37
+ from hiddenlayer.sdk.rest.models.file_info import FileInfo
38
+ from hiddenlayer.sdk.rest.models.get_multipart_upload_response import GetMultipartUploadResponse
39
+ from hiddenlayer.sdk.rest.models.model import Model
40
+ from hiddenlayer.sdk.rest.models.model_query_response import ModelQueryResponse
41
+ from hiddenlayer.sdk.rest.models.multipart_upload_part import MultipartUploadPart
42
+ from hiddenlayer.sdk.rest.models.scan_model_request import ScanModelRequest
43
+ from hiddenlayer.sdk.rest.models.scan_results_v2 import ScanResultsV2
44
+ from hiddenlayer.sdk.rest.models.sensor_sor_query_filter import SensorSORQueryFilter
45
+ from hiddenlayer.sdk.rest.models.sensor_sor_query_request import SensorSORQueryRequest
46
+ from hiddenlayer.sdk.rest.models.submission_response import SubmissionResponse
47
+ from hiddenlayer.sdk.rest.models.submission_v2 import SubmissionV2
48
+ from hiddenlayer.sdk.rest.models.validation_error_model import ValidationErrorModel
49
+ from hiddenlayer.sdk.rest.models.validation_error_model_loc_inner import ValidationErrorModelLocInner
@@ -0,0 +1,7 @@
1
+ # flake8: noqa
2
+
3
+ # import apis into api package
4
+ from hiddenlayer.sdk.rest.api.aidr_predictive_api import AidrPredictiveApi
5
+ from hiddenlayer.sdk.rest.api.model_scan_api import ModelScanApi
6
+ from hiddenlayer.sdk.rest.api.sensor_api import SensorApi
7
+
@@ -0,0 +1,308 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ HiddenLayer ModelScan
5
+
6
+ HiddenLayer ModelScan API for scanning of models
7
+
8
+ The version of the OpenAPI document: 1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from hiddenlayer.sdk.rest.models.submission_response import SubmissionResponse
20
+ from hiddenlayer.sdk.rest.models.submission_v2 import SubmissionV2
21
+
22
+ from hiddenlayer.sdk.rest.api_client import ApiClient, RequestSerialized
23
+ from hiddenlayer.sdk.rest.api_response import ApiResponse
24
+ from hiddenlayer.sdk.rest.rest import RESTResponseType
25
+
26
+
27
+ class AidrPredictiveApi:
28
+ """NOTE: This class is auto generated by OpenAPI Generator
29
+ Ref: https://openapi-generator.tech
30
+
31
+ Do not edit the class manually.
32
+ """
33
+
34
+ def __init__(self, api_client=None) -> None:
35
+ if api_client is None:
36
+ api_client = ApiClient.get_default()
37
+ self.api_client = api_client
38
+
39
+
40
+ @validate_call
41
+ def submit_vectors(
42
+ self,
43
+ submission_v2: SubmissionV2,
44
+ _request_timeout: Union[
45
+ None,
46
+ Annotated[StrictFloat, Field(gt=0)],
47
+ Tuple[
48
+ Annotated[StrictFloat, Field(gt=0)],
49
+ Annotated[StrictFloat, Field(gt=0)]
50
+ ]
51
+ ] = None,
52
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
53
+ _content_type: Optional[StrictStr] = None,
54
+ _headers: Optional[Dict[StrictStr, Any]] = None,
55
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
56
+ ) -> SubmissionResponse:
57
+ """Submit vectors
58
+
59
+
60
+ :param submission_v2: (required)
61
+ :type submission_v2: SubmissionV2
62
+ :param _request_timeout: timeout setting for this request. If one
63
+ number provided, it will be total request
64
+ timeout. It can also be a pair (tuple) of
65
+ (connection, read) timeouts.
66
+ :type _request_timeout: int, tuple(int, int), optional
67
+ :param _request_auth: set to override the auth_settings for an a single
68
+ request; this effectively ignores the
69
+ authentication in the spec for a single request.
70
+ :type _request_auth: dict, optional
71
+ :param _content_type: force content-type for the request.
72
+ :type _content_type: str, Optional
73
+ :param _headers: set to override the headers for a single
74
+ request; this effectively ignores the headers
75
+ in the spec for a single request.
76
+ :type _headers: dict, optional
77
+ :param _host_index: set to override the host_index for a single
78
+ request; this effectively ignores the host_index
79
+ in the spec for a single request.
80
+ :type _host_index: int, optional
81
+ :return: Returns the result object.
82
+ """ # noqa: E501
83
+
84
+ _param = self._submit_vectors_serialize(
85
+ submission_v2=submission_v2,
86
+ _request_auth=_request_auth,
87
+ _content_type=_content_type,
88
+ _headers=_headers,
89
+ _host_index=_host_index
90
+ )
91
+
92
+ _response_types_map: Dict[str, Optional[str]] = {
93
+ '200': "SubmissionResponse",
94
+ '422': "ValidationErrorModel",
95
+ }
96
+ response_data = self.api_client.call_api(
97
+ *_param,
98
+ _request_timeout=_request_timeout
99
+ )
100
+ response_data.read()
101
+ return self.api_client.response_deserialize(
102
+ response_data=response_data,
103
+ response_types_map=_response_types_map,
104
+ ).data
105
+
106
+
107
+ @validate_call
108
+ def submit_vectors_with_http_info(
109
+ self,
110
+ submission_v2: SubmissionV2,
111
+ _request_timeout: Union[
112
+ None,
113
+ Annotated[StrictFloat, Field(gt=0)],
114
+ Tuple[
115
+ Annotated[StrictFloat, Field(gt=0)],
116
+ Annotated[StrictFloat, Field(gt=0)]
117
+ ]
118
+ ] = None,
119
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
120
+ _content_type: Optional[StrictStr] = None,
121
+ _headers: Optional[Dict[StrictStr, Any]] = None,
122
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
123
+ ) -> ApiResponse[SubmissionResponse]:
124
+ """Submit vectors
125
+
126
+
127
+ :param submission_v2: (required)
128
+ :type submission_v2: SubmissionV2
129
+ :param _request_timeout: timeout setting for this request. If one
130
+ number provided, it will be total request
131
+ timeout. It can also be a pair (tuple) of
132
+ (connection, read) timeouts.
133
+ :type _request_timeout: int, tuple(int, int), optional
134
+ :param _request_auth: set to override the auth_settings for an a single
135
+ request; this effectively ignores the
136
+ authentication in the spec for a single request.
137
+ :type _request_auth: dict, optional
138
+ :param _content_type: force content-type for the request.
139
+ :type _content_type: str, Optional
140
+ :param _headers: set to override the headers for a single
141
+ request; this effectively ignores the headers
142
+ in the spec for a single request.
143
+ :type _headers: dict, optional
144
+ :param _host_index: set to override the host_index for a single
145
+ request; this effectively ignores the host_index
146
+ in the spec for a single request.
147
+ :type _host_index: int, optional
148
+ :return: Returns the result object.
149
+ """ # noqa: E501
150
+
151
+ _param = self._submit_vectors_serialize(
152
+ submission_v2=submission_v2,
153
+ _request_auth=_request_auth,
154
+ _content_type=_content_type,
155
+ _headers=_headers,
156
+ _host_index=_host_index
157
+ )
158
+
159
+ _response_types_map: Dict[str, Optional[str]] = {
160
+ '200': "SubmissionResponse",
161
+ '422': "ValidationErrorModel",
162
+ }
163
+ response_data = self.api_client.call_api(
164
+ *_param,
165
+ _request_timeout=_request_timeout
166
+ )
167
+ response_data.read()
168
+ return self.api_client.response_deserialize(
169
+ response_data=response_data,
170
+ response_types_map=_response_types_map,
171
+ )
172
+
173
+
174
+ @validate_call
175
+ def submit_vectors_without_preload_content(
176
+ self,
177
+ submission_v2: SubmissionV2,
178
+ _request_timeout: Union[
179
+ None,
180
+ Annotated[StrictFloat, Field(gt=0)],
181
+ Tuple[
182
+ Annotated[StrictFloat, Field(gt=0)],
183
+ Annotated[StrictFloat, Field(gt=0)]
184
+ ]
185
+ ] = None,
186
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
187
+ _content_type: Optional[StrictStr] = None,
188
+ _headers: Optional[Dict[StrictStr, Any]] = None,
189
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
190
+ ) -> RESTResponseType:
191
+ """Submit vectors
192
+
193
+
194
+ :param submission_v2: (required)
195
+ :type submission_v2: SubmissionV2
196
+ :param _request_timeout: timeout setting for this request. If one
197
+ number provided, it will be total request
198
+ timeout. It can also be a pair (tuple) of
199
+ (connection, read) timeouts.
200
+ :type _request_timeout: int, tuple(int, int), optional
201
+ :param _request_auth: set to override the auth_settings for an a single
202
+ request; this effectively ignores the
203
+ authentication in the spec for a single request.
204
+ :type _request_auth: dict, optional
205
+ :param _content_type: force content-type for the request.
206
+ :type _content_type: str, Optional
207
+ :param _headers: set to override the headers for a single
208
+ request; this effectively ignores the headers
209
+ in the spec for a single request.
210
+ :type _headers: dict, optional
211
+ :param _host_index: set to override the host_index for a single
212
+ request; this effectively ignores the host_index
213
+ in the spec for a single request.
214
+ :type _host_index: int, optional
215
+ :return: Returns the result object.
216
+ """ # noqa: E501
217
+
218
+ _param = self._submit_vectors_serialize(
219
+ submission_v2=submission_v2,
220
+ _request_auth=_request_auth,
221
+ _content_type=_content_type,
222
+ _headers=_headers,
223
+ _host_index=_host_index
224
+ )
225
+
226
+ _response_types_map: Dict[str, Optional[str]] = {
227
+ '200': "SubmissionResponse",
228
+ '422': "ValidationErrorModel",
229
+ }
230
+ response_data = self.api_client.call_api(
231
+ *_param,
232
+ _request_timeout=_request_timeout
233
+ )
234
+ return response_data.response
235
+
236
+
237
+ def _submit_vectors_serialize(
238
+ self,
239
+ submission_v2,
240
+ _request_auth,
241
+ _content_type,
242
+ _headers,
243
+ _host_index,
244
+ ) -> RequestSerialized:
245
+
246
+ _host = None
247
+
248
+ _collection_formats: Dict[str, str] = {
249
+ }
250
+
251
+ _path_params: Dict[str, str] = {}
252
+ _query_params: List[Tuple[str, str]] = []
253
+ _header_params: Dict[str, Optional[str]] = _headers or {}
254
+ _form_params: List[Tuple[str, str]] = []
255
+ _files: Dict[str, Union[str, bytes]] = {}
256
+ _body_params: Optional[bytes] = None
257
+
258
+ # process the path parameters
259
+ # process the query parameters
260
+ # process the header parameters
261
+ # process the form parameters
262
+ # process the body parameter
263
+ if submission_v2 is not None:
264
+ _body_params = submission_v2
265
+
266
+
267
+ # set the HTTP header `Accept`
268
+ _header_params['Accept'] = self.api_client.select_header_accept(
269
+ [
270
+ 'application/json'
271
+ ]
272
+ )
273
+
274
+ # set the HTTP header `Content-Type`
275
+ if _content_type:
276
+ _header_params['Content-Type'] = _content_type
277
+ else:
278
+ _default_content_type = (
279
+ self.api_client.select_header_content_type(
280
+ [
281
+ 'application/json'
282
+ ]
283
+ )
284
+ )
285
+ if _default_content_type is not None:
286
+ _header_params['Content-Type'] = _default_content_type
287
+
288
+ # authentication setting
289
+ _auth_settings: List[str] = [
290
+ 'BearerAuth'
291
+ ]
292
+
293
+ return self.api_client.param_serialize(
294
+ method='POST',
295
+ resource_path='/api/v2/submit',
296
+ path_params=_path_params,
297
+ query_params=_query_params,
298
+ header_params=_header_params,
299
+ body=_body_params,
300
+ post_params=_form_params,
301
+ files=_files,
302
+ auth_settings=_auth_settings,
303
+ collection_formats=_collection_formats,
304
+ _host=_host,
305
+ _request_auth=_request_auth
306
+ )
307
+
308
+