@planqk/planqk-service-sdk 1.9.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.devcontainer/devcontainer.json +32 -0
- package/.devcontainer/post-create.sh +7 -0
- package/.env.template +4 -0
- package/.gitlab-ci.yml +103 -0
- package/.python-version +1 -0
- package/.releaserc.json +45 -0
- package/LICENSE +201 -0
- package/README-node.md +41 -0
- package/README-python.md +52 -0
- package/README.md +42 -21
- package/dist/auth.js +12 -19
- package/dist/client.d.ts +2 -12
- package/dist/client.js +5 -76
- package/dist/sdk/Client.d.ts +4 -3
- package/dist/sdk/Client.js +4 -8
- package/dist/sdk/api/errors/BadRequestError.d.ts +1 -1
- package/dist/sdk/api/errors/BadRequestError.js +18 -8
- package/dist/sdk/api/errors/ForbiddenError.d.ts +1 -1
- package/dist/sdk/api/errors/ForbiddenError.js +18 -8
- package/dist/sdk/api/errors/InternalServerError.d.ts +1 -1
- package/dist/sdk/api/errors/InternalServerError.js +18 -8
- package/dist/sdk/api/errors/NotFoundError.d.ts +1 -1
- package/dist/sdk/api/errors/NotFoundError.js +18 -8
- package/dist/sdk/api/errors/UnauthorizedError.d.ts +1 -1
- package/dist/sdk/api/errors/UnauthorizedError.js +18 -8
- package/dist/sdk/api/resources/index.d.ts +0 -3
- package/dist/sdk/api/resources/index.js +18 -11
- package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +65 -12
- package/dist/sdk/api/resources/serviceApi/client/Client.js +405 -261
- package/dist/sdk/api/resources/serviceApi/client/index.d.ts +1 -1
- package/dist/sdk/api/resources/serviceApi/client/index.js +0 -15
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +4 -1
- package/dist/sdk/api/resources/serviceApi/types/{GetInterimResultsResponse.d.ts → GetResultResponseEmbedded.d.ts} +3 -1
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.d.ts +7 -0
- package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.d.ts +1 -0
- package/dist/sdk/api/resources/serviceApi/types/index.d.ts +3 -1
- package/dist/sdk/api/resources/serviceApi/types/index.js +3 -1
- package/dist/sdk/api/types/HalLink.d.ts +21 -0
- package/dist/sdk/api/types/InputData.d.ts +1 -1
- package/dist/sdk/api/types/{InputRef.d.ts → InputDataRef.d.ts} +1 -1
- package/dist/sdk/api/types/InputParams.d.ts +1 -1
- package/dist/sdk/api/types/{Job.d.ts → ServiceExecution.d.ts} +2 -2
- package/dist/sdk/api/types/{JobStatus.d.ts → ServiceExecutionStatus.d.ts} +2 -2
- package/dist/sdk/api/types/{JobStatus.js → ServiceExecutionStatus.js} +2 -2
- package/dist/sdk/api/types/index.d.ts +4 -8
- package/dist/sdk/api/types/index.js +4 -8
- package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -0
- package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -5
- package/dist/sdk/core/fetcher/Fetcher.js +68 -112
- package/dist/sdk/core/fetcher/Supplier.js +2 -11
- package/dist/sdk/core/fetcher/createRequestUrl.d.ts +1 -0
- package/dist/sdk/core/fetcher/createRequestUrl.js +12 -0
- package/dist/sdk/core/fetcher/getFetchFn.d.ts +4 -0
- package/dist/sdk/core/fetcher/getFetchFn.js +57 -0
- package/dist/sdk/core/fetcher/getHeader.d.ts +1 -0
- package/dist/sdk/core/fetcher/getHeader.js +11 -0
- package/dist/sdk/core/fetcher/getRequestBody.d.ts +7 -0
- package/dist/sdk/core/fetcher/getRequestBody.js +11 -0
- package/dist/sdk/core/fetcher/getResponseBody.d.ts +1 -0
- package/dist/sdk/core/fetcher/getResponseBody.js +40 -0
- package/dist/sdk/core/fetcher/index.d.ts +1 -0
- package/dist/sdk/core/fetcher/index.js +3 -1
- package/dist/sdk/core/fetcher/makeRequest.d.ts +1 -0
- package/dist/sdk/core/fetcher/makeRequest.js +33 -0
- package/dist/sdk/core/fetcher/requestWithRetries.d.ts +1 -0
- package/dist/sdk/core/fetcher/requestWithRetries.js +20 -0
- package/dist/sdk/core/fetcher/signals.d.ts +11 -0
- package/dist/sdk/core/fetcher/signals.js +36 -0
- package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
- package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +232 -0
- package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
- package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +91 -0
- package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
- package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +214 -0
- package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
- package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.js +48 -0
- package/dist/sdk/core/index.d.ts +1 -0
- package/dist/sdk/core/index.js +1 -0
- package/dist/sdk/core/runtime/index.d.ts +1 -0
- package/dist/sdk/core/runtime/index.js +5 -0
- package/dist/sdk/core/runtime/runtime.d.ts +9 -0
- package/dist/sdk/core/runtime/runtime.js +92 -0
- package/dist/sdk/errors/PlanqkServiceApiError.js +2 -0
- package/dist/sdk/index.js +17 -7
- package/eslint.config.mjs +11 -0
- package/fern/fern.config.json +4 -0
- package/fern/generators.yml +25 -0
- package/fern/openapi/openapi.yml +342 -0
- package/notebooks/python-sdk.ipynb +280 -0
- package/package.json +27 -28
- package/planqk/__init__.py +0 -0
- package/planqk/service/__init__.py +1 -0
- package/planqk/service/_version.py +1 -0
- package/planqk/service/auth.py +30 -0
- package/planqk/service/client.py +151 -0
- package/planqk/service/sdk/__init__.py +48 -0
- package/planqk/service/sdk/client.py +152 -0
- package/planqk/service/sdk/core/__init__.py +47 -0
- package/planqk/service/sdk/core/api_error.py +17 -0
- package/planqk/service/sdk/core/client_wrapper.py +74 -0
- package/planqk/service/sdk/core/datetime_utils.py +30 -0
- package/planqk/service/sdk/core/file.py +70 -0
- package/planqk/service/sdk/core/http_client.py +575 -0
- package/planqk/service/sdk/core/jsonable_encoder.py +103 -0
- package/planqk/service/sdk/core/pydantic_utilities.py +323 -0
- package/planqk/service/sdk/core/query_encoder.py +60 -0
- package/planqk/service/sdk/core/remove_none_from_dict.py +11 -0
- package/planqk/service/sdk/core/request_options.py +35 -0
- package/planqk/service/sdk/core/serialization.py +276 -0
- package/planqk/service/sdk/environment.py +7 -0
- package/planqk/service/sdk/errors/__init__.py +15 -0
- package/planqk/service/sdk/errors/bad_request_error.py +9 -0
- package/planqk/service/sdk/errors/forbidden_error.py +9 -0
- package/planqk/service/sdk/errors/internal_server_error.py +9 -0
- package/planqk/service/sdk/errors/not_found_error.py +9 -0
- package/planqk/service/sdk/errors/unauthorized_error.py +9 -0
- package/planqk/service/sdk/service_api/__init__.py +15 -0
- package/planqk/service/sdk/service_api/client.py +1257 -0
- package/planqk/service/sdk/service_api/types/__init__.py +13 -0
- package/planqk/service/sdk/service_api/types/get_result_response.py +30 -0
- package/planqk/service/sdk/service_api/types/get_result_response_embedded.py +22 -0
- package/planqk/service/sdk/service_api/types/get_result_response_links.py +22 -0
- package/planqk/service/sdk/service_api/types/health_check_response.py +24 -0
- package/planqk/service/sdk/types/__init__.py +17 -0
- package/planqk/service/sdk/types/hal_link.py +59 -0
- package/planqk/service/sdk/types/input_data.py +5 -0
- package/planqk/service/sdk/types/input_data_ref.py +27 -0
- package/planqk/service/sdk/types/input_params.py +5 -0
- package/planqk/service/sdk/types/service_execution.py +34 -0
- package/planqk/service/sdk/types/service_execution_status.py +8 -0
- package/pyproject.toml +51 -0
- package/scripts/update-version.sh +6 -0
- package/src/client.ts +4 -78
- package/src/index.test.ts +43 -0
- package/src/sdk/Client.ts +4 -7
- package/src/sdk/api/errors/BadRequestError.ts +1 -1
- package/src/sdk/api/errors/ForbiddenError.ts +1 -1
- package/src/sdk/api/errors/InternalServerError.ts +1 -1
- package/src/sdk/api/errors/NotFoundError.ts +1 -1
- package/src/sdk/api/errors/UnauthorizedError.ts +1 -1
- package/src/sdk/api/resources/index.ts +0 -3
- package/src/sdk/api/resources/serviceApi/client/Client.ts +205 -32
- package/src/sdk/api/resources/serviceApi/client/index.ts +1 -1
- package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +4 -5
- package/src/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.ts +9 -0
- package/src/sdk/api/resources/serviceApi/types/GetResultResponseLinks.ts +9 -0
- package/src/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.ts +1 -0
- package/src/sdk/api/resources/serviceApi/types/index.ts +3 -1
- package/src/sdk/api/types/HalLink.ts +22 -0
- package/src/sdk/api/types/InputData.ts +1 -1
- package/src/sdk/api/types/{InputRef.ts → InputDataRef.ts} +1 -1
- package/src/sdk/api/types/InputParams.ts +1 -1
- package/src/sdk/api/types/{Job.ts → ServiceExecution.ts} +2 -2
- package/src/sdk/api/types/{JobStatus.ts → ServiceExecutionStatus.ts} +2 -2
- package/src/sdk/api/types/index.ts +4 -8
- package/src/sdk/core/fetcher/APIResponse.ts +1 -0
- package/src/sdk/core/fetcher/Fetcher.ts +55 -72
- package/src/sdk/core/fetcher/createRequestUrl.ts +10 -0
- package/src/sdk/core/fetcher/getFetchFn.ts +25 -0
- package/src/sdk/core/fetcher/getHeader.ts +8 -0
- package/src/sdk/core/fetcher/getRequestBody.ts +14 -0
- package/src/sdk/core/fetcher/getResponseBody.ts +32 -0
- package/src/sdk/core/fetcher/index.ts +1 -0
- package/src/sdk/core/fetcher/makeRequest.ts +44 -0
- package/src/sdk/core/fetcher/requestWithRetries.ts +21 -0
- package/src/sdk/core/fetcher/signals.ts +38 -0
- package/src/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +252 -0
- package/src/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +106 -0
- package/src/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +239 -0
- package/src/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +33 -0
- package/src/sdk/core/index.ts +1 -0
- package/src/sdk/core/runtime/index.ts +1 -0
- package/src/sdk/core/runtime/runtime.ts +126 -0
- package/tsconfig.json +15 -107
- package/uv.lock +1109 -0
- package/.eslintignore +0 -3
- package/.eslintrc +0 -7
- package/dist/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.d.ts +0 -9
- package/dist/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.d.ts +0 -13
- package/dist/sdk/api/resources/serviceApi/client/requests/index.d.ts +0 -2
- package/dist/sdk/api/resources/serviceApi/client/requests/index.js +0 -2
- package/dist/sdk/api/resources/statusApi/client/Client.d.ts +0 -28
- package/dist/sdk/api/resources/statusApi/client/Client.js +0 -97
- package/dist/sdk/api/resources/statusApi/client/index.d.ts +0 -1
- package/dist/sdk/api/resources/statusApi/client/index.js +0 -2
- package/dist/sdk/api/resources/statusApi/index.d.ts +0 -2
- package/dist/sdk/api/resources/statusApi/index.js +0 -18
- package/dist/sdk/api/resources/statusApi/types/index.d.ts +0 -1
- package/dist/sdk/api/resources/statusApi/types/index.js +0 -17
- package/dist/sdk/api/types/ArrayResponse.d.ts +0 -4
- package/dist/sdk/api/types/InterimResultResponse.d.ts +0 -4
- package/dist/sdk/api/types/InterimResultResponse.js +0 -5
- package/dist/sdk/api/types/Job.js +0 -5
- package/dist/sdk/api/types/NumberResponse.d.ts +0 -4
- package/dist/sdk/api/types/NumberResponse.js +0 -5
- package/dist/sdk/api/types/ObjectResponse.d.ts +0 -4
- package/dist/sdk/api/types/ObjectResponse.js +0 -5
- package/dist/sdk/api/types/StringResponse.d.ts +0 -4
- package/dist/sdk/api/types/StringResponse.js +0 -5
- package/jest.config.js +0 -12
- package/src/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.ts +0 -10
- package/src/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.ts +0 -15
- package/src/sdk/api/resources/serviceApi/client/requests/index.ts +0 -2
- package/src/sdk/api/resources/serviceApi/types/GetInterimResultsResponse.ts +0 -9
- package/src/sdk/api/resources/statusApi/client/Client.ts +0 -75
- package/src/sdk/api/resources/statusApi/client/index.ts +0 -1
- package/src/sdk/api/resources/statusApi/index.ts +0 -2
- package/src/sdk/api/resources/statusApi/types/index.ts +0 -1
- package/src/sdk/api/types/ArrayResponse.ts +0 -5
- package/src/sdk/api/types/InterimResultResponse.ts +0 -5
- package/src/sdk/api/types/NumberResponse.ts +0 -5
- package/src/sdk/api/types/ObjectResponse.ts +0 -5
- package/src/sdk/api/types/StringResponse.ts +0 -5
- package/tests/fixtures/complex-input.ts +0 -477
- package/tests/integration.test.ts +0 -92
- /package/dist/sdk/api/resources/serviceApi/{client/requests/GetInterimResultsRequest.js → types/GetResultResponseEmbedded.js} +0 -0
- /package/dist/sdk/api/resources/serviceApi/{client/requests/StartExecutionRequest.js → types/GetResultResponseLinks.js} +0 -0
- /package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.js +0 -0
- /package/dist/sdk/api/{resources/serviceApi/types/GetInterimResultsResponse.js → types/HalLink.js} +0 -0
- /package/dist/sdk/api/types/{ArrayResponse.js → InputDataRef.js} +0 -0
- /package/dist/sdk/api/types/{InputRef.js → ServiceExecution.js} +0 -0
|
@@ -0,0 +1,1257 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
5
|
+
from ..core.request_options import RequestOptions
|
|
6
|
+
from .types.health_check_response import HealthCheckResponse
|
|
7
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
8
|
+
from json.decoder import JSONDecodeError
|
|
9
|
+
from ..core.api_error import ApiError
|
|
10
|
+
from ..types.service_execution import ServiceExecution
|
|
11
|
+
from ..errors.bad_request_error import BadRequestError
|
|
12
|
+
from ..errors.unauthorized_error import UnauthorizedError
|
|
13
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
14
|
+
from ..errors.not_found_error import NotFoundError
|
|
15
|
+
from ..errors.internal_server_error import InternalServerError
|
|
16
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
17
|
+
from .types.get_result_response import GetResultResponse
|
|
18
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
19
|
+
|
|
20
|
+
# this is used as the default value for optional parameters
|
|
21
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ServiceApiClient:
|
|
25
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
26
|
+
self._client_wrapper = client_wrapper
|
|
27
|
+
|
|
28
|
+
def health_check(
|
|
29
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
30
|
+
) -> HealthCheckResponse:
|
|
31
|
+
"""
|
|
32
|
+
This method checks the health of the service.
|
|
33
|
+
|
|
34
|
+
Parameters
|
|
35
|
+
----------
|
|
36
|
+
request_options : typing.Optional[RequestOptions]
|
|
37
|
+
Request-specific configuration.
|
|
38
|
+
|
|
39
|
+
Returns
|
|
40
|
+
-------
|
|
41
|
+
HealthCheckResponse
|
|
42
|
+
OK
|
|
43
|
+
|
|
44
|
+
Examples
|
|
45
|
+
--------
|
|
46
|
+
from planqk_service import PlanqkServiceApi
|
|
47
|
+
|
|
48
|
+
client = PlanqkServiceApi(
|
|
49
|
+
token="YOUR_TOKEN",
|
|
50
|
+
)
|
|
51
|
+
client.service_api.health_check()
|
|
52
|
+
"""
|
|
53
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
54
|
+
method="GET",
|
|
55
|
+
request_options=request_options,
|
|
56
|
+
)
|
|
57
|
+
try:
|
|
58
|
+
if 200 <= _response.status_code < 300:
|
|
59
|
+
return typing.cast(
|
|
60
|
+
HealthCheckResponse,
|
|
61
|
+
parse_obj_as(
|
|
62
|
+
type_=HealthCheckResponse, # type: ignore
|
|
63
|
+
object_=_response.json(),
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
_response_json = _response.json()
|
|
67
|
+
except JSONDecodeError:
|
|
68
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
69
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
70
|
+
|
|
71
|
+
def execute(
|
|
72
|
+
self,
|
|
73
|
+
*,
|
|
74
|
+
request: typing.Dict[str, typing.Dict[str, typing.Optional[typing.Any]]],
|
|
75
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
76
|
+
) -> ServiceExecution:
|
|
77
|
+
"""
|
|
78
|
+
This method starts a service execution, which in turn is processed asynchronously by PLANQK.
|
|
79
|
+
The location header of the response contains the URL which can be used to query the status and the result of the service execution.
|
|
80
|
+
|
|
81
|
+
Parameters
|
|
82
|
+
----------
|
|
83
|
+
request : typing.Dict[str, typing.Dict[str, typing.Optional[typing.Any]]]
|
|
84
|
+
|
|
85
|
+
request_options : typing.Optional[RequestOptions]
|
|
86
|
+
Request-specific configuration.
|
|
87
|
+
|
|
88
|
+
Returns
|
|
89
|
+
-------
|
|
90
|
+
ServiceExecution
|
|
91
|
+
Service execution successfully submitted
|
|
92
|
+
|
|
93
|
+
Examples
|
|
94
|
+
--------
|
|
95
|
+
from planqk_service import PlanqkServiceApi
|
|
96
|
+
|
|
97
|
+
client = PlanqkServiceApi(
|
|
98
|
+
token="YOUR_TOKEN",
|
|
99
|
+
)
|
|
100
|
+
client.service_api.execute(
|
|
101
|
+
request={"key": {"key": "value"}},
|
|
102
|
+
)
|
|
103
|
+
"""
|
|
104
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
105
|
+
method="POST",
|
|
106
|
+
json=request,
|
|
107
|
+
request_options=request_options,
|
|
108
|
+
omit=OMIT,
|
|
109
|
+
)
|
|
110
|
+
try:
|
|
111
|
+
if 200 <= _response.status_code < 300:
|
|
112
|
+
return typing.cast(
|
|
113
|
+
ServiceExecution,
|
|
114
|
+
parse_obj_as(
|
|
115
|
+
type_=ServiceExecution, # type: ignore
|
|
116
|
+
object_=_response.json(),
|
|
117
|
+
),
|
|
118
|
+
)
|
|
119
|
+
if _response.status_code == 400:
|
|
120
|
+
raise BadRequestError(
|
|
121
|
+
typing.cast(
|
|
122
|
+
typing.Optional[typing.Any],
|
|
123
|
+
parse_obj_as(
|
|
124
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
125
|
+
object_=_response.json(),
|
|
126
|
+
),
|
|
127
|
+
)
|
|
128
|
+
)
|
|
129
|
+
if _response.status_code == 401:
|
|
130
|
+
raise UnauthorizedError(
|
|
131
|
+
typing.cast(
|
|
132
|
+
typing.Optional[typing.Any],
|
|
133
|
+
parse_obj_as(
|
|
134
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
135
|
+
object_=_response.json(),
|
|
136
|
+
),
|
|
137
|
+
)
|
|
138
|
+
)
|
|
139
|
+
if _response.status_code == 403:
|
|
140
|
+
raise ForbiddenError(
|
|
141
|
+
typing.cast(
|
|
142
|
+
typing.Optional[typing.Any],
|
|
143
|
+
parse_obj_as(
|
|
144
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
145
|
+
object_=_response.json(),
|
|
146
|
+
),
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
if _response.status_code == 404:
|
|
150
|
+
raise NotFoundError(
|
|
151
|
+
typing.cast(
|
|
152
|
+
typing.Optional[typing.Any],
|
|
153
|
+
parse_obj_as(
|
|
154
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
155
|
+
object_=_response.json(),
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
)
|
|
159
|
+
if _response.status_code == 500:
|
|
160
|
+
raise InternalServerError(
|
|
161
|
+
typing.cast(
|
|
162
|
+
typing.Optional[typing.Any],
|
|
163
|
+
parse_obj_as(
|
|
164
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
165
|
+
object_=_response.json(),
|
|
166
|
+
),
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
_response_json = _response.json()
|
|
170
|
+
except JSONDecodeError:
|
|
171
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
172
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
173
|
+
|
|
174
|
+
def get_status(
|
|
175
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
176
|
+
) -> ServiceExecution:
|
|
177
|
+
"""
|
|
178
|
+
This method checks the status of a service execution.
|
|
179
|
+
|
|
180
|
+
Parameters
|
|
181
|
+
----------
|
|
182
|
+
id : str
|
|
183
|
+
The id of a service execution
|
|
184
|
+
|
|
185
|
+
request_options : typing.Optional[RequestOptions]
|
|
186
|
+
Request-specific configuration.
|
|
187
|
+
|
|
188
|
+
Returns
|
|
189
|
+
-------
|
|
190
|
+
ServiceExecution
|
|
191
|
+
Ok
|
|
192
|
+
|
|
193
|
+
Examples
|
|
194
|
+
--------
|
|
195
|
+
from planqk_service import PlanqkServiceApi
|
|
196
|
+
|
|
197
|
+
client = PlanqkServiceApi(
|
|
198
|
+
token="YOUR_TOKEN",
|
|
199
|
+
)
|
|
200
|
+
client.service_api.get_status(
|
|
201
|
+
id="id",
|
|
202
|
+
)
|
|
203
|
+
"""
|
|
204
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
205
|
+
f"{jsonable_encoder(id)}",
|
|
206
|
+
method="GET",
|
|
207
|
+
request_options=request_options,
|
|
208
|
+
)
|
|
209
|
+
try:
|
|
210
|
+
if 200 <= _response.status_code < 300:
|
|
211
|
+
return typing.cast(
|
|
212
|
+
ServiceExecution,
|
|
213
|
+
parse_obj_as(
|
|
214
|
+
type_=ServiceExecution, # type: ignore
|
|
215
|
+
object_=_response.json(),
|
|
216
|
+
),
|
|
217
|
+
)
|
|
218
|
+
if _response.status_code == 401:
|
|
219
|
+
raise UnauthorizedError(
|
|
220
|
+
typing.cast(
|
|
221
|
+
typing.Optional[typing.Any],
|
|
222
|
+
parse_obj_as(
|
|
223
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
224
|
+
object_=_response.json(),
|
|
225
|
+
),
|
|
226
|
+
)
|
|
227
|
+
)
|
|
228
|
+
if _response.status_code == 403:
|
|
229
|
+
raise ForbiddenError(
|
|
230
|
+
typing.cast(
|
|
231
|
+
typing.Optional[typing.Any],
|
|
232
|
+
parse_obj_as(
|
|
233
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
234
|
+
object_=_response.json(),
|
|
235
|
+
),
|
|
236
|
+
)
|
|
237
|
+
)
|
|
238
|
+
if _response.status_code == 404:
|
|
239
|
+
raise NotFoundError(
|
|
240
|
+
typing.cast(
|
|
241
|
+
typing.Optional[typing.Any],
|
|
242
|
+
parse_obj_as(
|
|
243
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
244
|
+
object_=_response.json(),
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
)
|
|
248
|
+
if _response.status_code == 500:
|
|
249
|
+
raise InternalServerError(
|
|
250
|
+
typing.cast(
|
|
251
|
+
typing.Optional[typing.Any],
|
|
252
|
+
parse_obj_as(
|
|
253
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
254
|
+
object_=_response.json(),
|
|
255
|
+
),
|
|
256
|
+
)
|
|
257
|
+
)
|
|
258
|
+
_response_json = _response.json()
|
|
259
|
+
except JSONDecodeError:
|
|
260
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
261
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
262
|
+
|
|
263
|
+
def get_result(
|
|
264
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
265
|
+
) -> GetResultResponse:
|
|
266
|
+
"""
|
|
267
|
+
This method retrieves the result of a service execution.
|
|
268
|
+
|
|
269
|
+
Parameters
|
|
270
|
+
----------
|
|
271
|
+
id : str
|
|
272
|
+
The id of a service execution
|
|
273
|
+
|
|
274
|
+
request_options : typing.Optional[RequestOptions]
|
|
275
|
+
Request-specific configuration.
|
|
276
|
+
|
|
277
|
+
Returns
|
|
278
|
+
-------
|
|
279
|
+
GetResultResponse
|
|
280
|
+
Ok
|
|
281
|
+
|
|
282
|
+
Examples
|
|
283
|
+
--------
|
|
284
|
+
from planqk_service import PlanqkServiceApi
|
|
285
|
+
|
|
286
|
+
client = PlanqkServiceApi(
|
|
287
|
+
token="YOUR_TOKEN",
|
|
288
|
+
)
|
|
289
|
+
client.service_api.get_result(
|
|
290
|
+
id="id",
|
|
291
|
+
)
|
|
292
|
+
"""
|
|
293
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
294
|
+
f"{jsonable_encoder(id)}/result",
|
|
295
|
+
method="GET",
|
|
296
|
+
request_options=request_options,
|
|
297
|
+
)
|
|
298
|
+
try:
|
|
299
|
+
if 200 <= _response.status_code < 300:
|
|
300
|
+
return typing.cast(
|
|
301
|
+
GetResultResponse,
|
|
302
|
+
parse_obj_as(
|
|
303
|
+
type_=GetResultResponse, # type: ignore
|
|
304
|
+
object_=_response.json(),
|
|
305
|
+
),
|
|
306
|
+
)
|
|
307
|
+
if _response.status_code == 401:
|
|
308
|
+
raise UnauthorizedError(
|
|
309
|
+
typing.cast(
|
|
310
|
+
typing.Optional[typing.Any],
|
|
311
|
+
parse_obj_as(
|
|
312
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
313
|
+
object_=_response.json(),
|
|
314
|
+
),
|
|
315
|
+
)
|
|
316
|
+
)
|
|
317
|
+
if _response.status_code == 403:
|
|
318
|
+
raise ForbiddenError(
|
|
319
|
+
typing.cast(
|
|
320
|
+
typing.Optional[typing.Any],
|
|
321
|
+
parse_obj_as(
|
|
322
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
323
|
+
object_=_response.json(),
|
|
324
|
+
),
|
|
325
|
+
)
|
|
326
|
+
)
|
|
327
|
+
if _response.status_code == 404:
|
|
328
|
+
raise NotFoundError(
|
|
329
|
+
typing.cast(
|
|
330
|
+
typing.Optional[typing.Any],
|
|
331
|
+
parse_obj_as(
|
|
332
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
333
|
+
object_=_response.json(),
|
|
334
|
+
),
|
|
335
|
+
)
|
|
336
|
+
)
|
|
337
|
+
if _response.status_code == 500:
|
|
338
|
+
raise InternalServerError(
|
|
339
|
+
typing.cast(
|
|
340
|
+
typing.Optional[typing.Any],
|
|
341
|
+
parse_obj_as(
|
|
342
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
343
|
+
object_=_response.json(),
|
|
344
|
+
),
|
|
345
|
+
)
|
|
346
|
+
)
|
|
347
|
+
_response_json = _response.json()
|
|
348
|
+
except JSONDecodeError:
|
|
349
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
350
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
351
|
+
|
|
352
|
+
def get_result_file(
|
|
353
|
+
self,
|
|
354
|
+
id: str,
|
|
355
|
+
file: str,
|
|
356
|
+
*,
|
|
357
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
358
|
+
) -> typing.Iterator[bytes]:
|
|
359
|
+
"""
|
|
360
|
+
This method downloads a result file of a service execution.
|
|
361
|
+
|
|
362
|
+
Parameters
|
|
363
|
+
----------
|
|
364
|
+
id : str
|
|
365
|
+
The id of a service execution
|
|
366
|
+
|
|
367
|
+
file : str
|
|
368
|
+
The name of the result file
|
|
369
|
+
|
|
370
|
+
request_options : typing.Optional[RequestOptions]
|
|
371
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
372
|
+
|
|
373
|
+
Yields
|
|
374
|
+
------
|
|
375
|
+
typing.Iterator[bytes]
|
|
376
|
+
Ok
|
|
377
|
+
"""
|
|
378
|
+
with self._client_wrapper.httpx_client.stream(
|
|
379
|
+
f"{jsonable_encoder(id)}/result/{jsonable_encoder(file)}",
|
|
380
|
+
method="GET",
|
|
381
|
+
request_options=request_options,
|
|
382
|
+
) as _response:
|
|
383
|
+
try:
|
|
384
|
+
if 200 <= _response.status_code < 300:
|
|
385
|
+
_chunk_size = (
|
|
386
|
+
request_options.get("chunk_size", None)
|
|
387
|
+
if request_options is not None
|
|
388
|
+
else None
|
|
389
|
+
)
|
|
390
|
+
for _chunk in _response.iter_bytes(chunk_size=_chunk_size):
|
|
391
|
+
yield _chunk
|
|
392
|
+
return
|
|
393
|
+
_response.read()
|
|
394
|
+
if _response.status_code == 401:
|
|
395
|
+
raise UnauthorizedError(
|
|
396
|
+
typing.cast(
|
|
397
|
+
typing.Optional[typing.Any],
|
|
398
|
+
parse_obj_as(
|
|
399
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
400
|
+
object_=_response.json(),
|
|
401
|
+
),
|
|
402
|
+
)
|
|
403
|
+
)
|
|
404
|
+
if _response.status_code == 403:
|
|
405
|
+
raise ForbiddenError(
|
|
406
|
+
typing.cast(
|
|
407
|
+
typing.Optional[typing.Any],
|
|
408
|
+
parse_obj_as(
|
|
409
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
410
|
+
object_=_response.json(),
|
|
411
|
+
),
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
if _response.status_code == 404:
|
|
415
|
+
raise NotFoundError(
|
|
416
|
+
typing.cast(
|
|
417
|
+
typing.Optional[typing.Any],
|
|
418
|
+
parse_obj_as(
|
|
419
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
420
|
+
object_=_response.json(),
|
|
421
|
+
),
|
|
422
|
+
)
|
|
423
|
+
)
|
|
424
|
+
if _response.status_code == 500:
|
|
425
|
+
raise InternalServerError(
|
|
426
|
+
typing.cast(
|
|
427
|
+
typing.Optional[typing.Any],
|
|
428
|
+
parse_obj_as(
|
|
429
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
430
|
+
object_=_response.json(),
|
|
431
|
+
),
|
|
432
|
+
)
|
|
433
|
+
)
|
|
434
|
+
_response_json = _response.json()
|
|
435
|
+
except JSONDecodeError:
|
|
436
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
437
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
438
|
+
|
|
439
|
+
def get_logs(
|
|
440
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
441
|
+
) -> typing.List[str]:
|
|
442
|
+
"""
|
|
443
|
+
This method retrieves the log output of a service execution.
|
|
444
|
+
|
|
445
|
+
Parameters
|
|
446
|
+
----------
|
|
447
|
+
id : str
|
|
448
|
+
The id of a service execution
|
|
449
|
+
|
|
450
|
+
request_options : typing.Optional[RequestOptions]
|
|
451
|
+
Request-specific configuration.
|
|
452
|
+
|
|
453
|
+
Returns
|
|
454
|
+
-------
|
|
455
|
+
typing.List[str]
|
|
456
|
+
Ok
|
|
457
|
+
|
|
458
|
+
Examples
|
|
459
|
+
--------
|
|
460
|
+
from planqk_service import PlanqkServiceApi
|
|
461
|
+
|
|
462
|
+
client = PlanqkServiceApi(
|
|
463
|
+
token="YOUR_TOKEN",
|
|
464
|
+
)
|
|
465
|
+
client.service_api.get_logs(
|
|
466
|
+
id="id",
|
|
467
|
+
)
|
|
468
|
+
"""
|
|
469
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
470
|
+
f"{jsonable_encoder(id)}/log",
|
|
471
|
+
method="GET",
|
|
472
|
+
request_options=request_options,
|
|
473
|
+
)
|
|
474
|
+
try:
|
|
475
|
+
if 200 <= _response.status_code < 300:
|
|
476
|
+
return typing.cast(
|
|
477
|
+
typing.List[str],
|
|
478
|
+
parse_obj_as(
|
|
479
|
+
type_=typing.List[str], # type: ignore
|
|
480
|
+
object_=_response.json(),
|
|
481
|
+
),
|
|
482
|
+
)
|
|
483
|
+
if _response.status_code == 401:
|
|
484
|
+
raise UnauthorizedError(
|
|
485
|
+
typing.cast(
|
|
486
|
+
typing.Optional[typing.Any],
|
|
487
|
+
parse_obj_as(
|
|
488
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
489
|
+
object_=_response.json(),
|
|
490
|
+
),
|
|
491
|
+
)
|
|
492
|
+
)
|
|
493
|
+
if _response.status_code == 403:
|
|
494
|
+
raise ForbiddenError(
|
|
495
|
+
typing.cast(
|
|
496
|
+
typing.Optional[typing.Any],
|
|
497
|
+
parse_obj_as(
|
|
498
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
499
|
+
object_=_response.json(),
|
|
500
|
+
),
|
|
501
|
+
)
|
|
502
|
+
)
|
|
503
|
+
if _response.status_code == 404:
|
|
504
|
+
raise NotFoundError(
|
|
505
|
+
typing.cast(
|
|
506
|
+
typing.Optional[typing.Any],
|
|
507
|
+
parse_obj_as(
|
|
508
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
509
|
+
object_=_response.json(),
|
|
510
|
+
),
|
|
511
|
+
)
|
|
512
|
+
)
|
|
513
|
+
if _response.status_code == 500:
|
|
514
|
+
raise InternalServerError(
|
|
515
|
+
typing.cast(
|
|
516
|
+
typing.Optional[typing.Any],
|
|
517
|
+
parse_obj_as(
|
|
518
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
519
|
+
object_=_response.json(),
|
|
520
|
+
),
|
|
521
|
+
)
|
|
522
|
+
)
|
|
523
|
+
_response_json = _response.json()
|
|
524
|
+
except JSONDecodeError:
|
|
525
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
526
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
527
|
+
|
|
528
|
+
def cancel(
|
|
529
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
530
|
+
) -> ServiceExecution:
|
|
531
|
+
"""
|
|
532
|
+
This method cancels a service execution.
|
|
533
|
+
|
|
534
|
+
Parameters
|
|
535
|
+
----------
|
|
536
|
+
id : str
|
|
537
|
+
The id of a service execution
|
|
538
|
+
|
|
539
|
+
request_options : typing.Optional[RequestOptions]
|
|
540
|
+
Request-specific configuration.
|
|
541
|
+
|
|
542
|
+
Returns
|
|
543
|
+
-------
|
|
544
|
+
ServiceExecution
|
|
545
|
+
Ok
|
|
546
|
+
|
|
547
|
+
Examples
|
|
548
|
+
--------
|
|
549
|
+
from planqk_service import PlanqkServiceApi
|
|
550
|
+
|
|
551
|
+
client = PlanqkServiceApi(
|
|
552
|
+
token="YOUR_TOKEN",
|
|
553
|
+
)
|
|
554
|
+
client.service_api.cancel(
|
|
555
|
+
id="id",
|
|
556
|
+
)
|
|
557
|
+
"""
|
|
558
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
559
|
+
f"{jsonable_encoder(id)}/cancel",
|
|
560
|
+
method="PUT",
|
|
561
|
+
request_options=request_options,
|
|
562
|
+
)
|
|
563
|
+
try:
|
|
564
|
+
if 200 <= _response.status_code < 300:
|
|
565
|
+
return typing.cast(
|
|
566
|
+
ServiceExecution,
|
|
567
|
+
parse_obj_as(
|
|
568
|
+
type_=ServiceExecution, # type: ignore
|
|
569
|
+
object_=_response.json(),
|
|
570
|
+
),
|
|
571
|
+
)
|
|
572
|
+
if _response.status_code == 401:
|
|
573
|
+
raise UnauthorizedError(
|
|
574
|
+
typing.cast(
|
|
575
|
+
typing.Optional[typing.Any],
|
|
576
|
+
parse_obj_as(
|
|
577
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
578
|
+
object_=_response.json(),
|
|
579
|
+
),
|
|
580
|
+
)
|
|
581
|
+
)
|
|
582
|
+
if _response.status_code == 403:
|
|
583
|
+
raise ForbiddenError(
|
|
584
|
+
typing.cast(
|
|
585
|
+
typing.Optional[typing.Any],
|
|
586
|
+
parse_obj_as(
|
|
587
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
588
|
+
object_=_response.json(),
|
|
589
|
+
),
|
|
590
|
+
)
|
|
591
|
+
)
|
|
592
|
+
if _response.status_code == 404:
|
|
593
|
+
raise NotFoundError(
|
|
594
|
+
typing.cast(
|
|
595
|
+
typing.Optional[typing.Any],
|
|
596
|
+
parse_obj_as(
|
|
597
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
598
|
+
object_=_response.json(),
|
|
599
|
+
),
|
|
600
|
+
)
|
|
601
|
+
)
|
|
602
|
+
if _response.status_code == 500:
|
|
603
|
+
raise InternalServerError(
|
|
604
|
+
typing.cast(
|
|
605
|
+
typing.Optional[typing.Any],
|
|
606
|
+
parse_obj_as(
|
|
607
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
608
|
+
object_=_response.json(),
|
|
609
|
+
),
|
|
610
|
+
)
|
|
611
|
+
)
|
|
612
|
+
_response_json = _response.json()
|
|
613
|
+
except JSONDecodeError:
|
|
614
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
615
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
class AsyncServiceApiClient:
|
|
619
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
620
|
+
self._client_wrapper = client_wrapper
|
|
621
|
+
|
|
622
|
+
async def health_check(
|
|
623
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
624
|
+
) -> HealthCheckResponse:
|
|
625
|
+
"""
|
|
626
|
+
This method checks the health of the service.
|
|
627
|
+
|
|
628
|
+
Parameters
|
|
629
|
+
----------
|
|
630
|
+
request_options : typing.Optional[RequestOptions]
|
|
631
|
+
Request-specific configuration.
|
|
632
|
+
|
|
633
|
+
Returns
|
|
634
|
+
-------
|
|
635
|
+
HealthCheckResponse
|
|
636
|
+
OK
|
|
637
|
+
|
|
638
|
+
Examples
|
|
639
|
+
--------
|
|
640
|
+
import asyncio
|
|
641
|
+
|
|
642
|
+
from planqk_service import AsyncPlanqkServiceApi
|
|
643
|
+
|
|
644
|
+
client = AsyncPlanqkServiceApi(
|
|
645
|
+
token="YOUR_TOKEN",
|
|
646
|
+
)
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
async def main() -> None:
|
|
650
|
+
await client.service_api.health_check()
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
asyncio.run(main())
|
|
654
|
+
"""
|
|
655
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
656
|
+
method="GET",
|
|
657
|
+
request_options=request_options,
|
|
658
|
+
)
|
|
659
|
+
try:
|
|
660
|
+
if 200 <= _response.status_code < 300:
|
|
661
|
+
return typing.cast(
|
|
662
|
+
HealthCheckResponse,
|
|
663
|
+
parse_obj_as(
|
|
664
|
+
type_=HealthCheckResponse, # type: ignore
|
|
665
|
+
object_=_response.json(),
|
|
666
|
+
),
|
|
667
|
+
)
|
|
668
|
+
_response_json = _response.json()
|
|
669
|
+
except JSONDecodeError:
|
|
670
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
671
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
672
|
+
|
|
673
|
+
async def execute(
|
|
674
|
+
self,
|
|
675
|
+
*,
|
|
676
|
+
request: typing.Dict[str, typing.Dict[str, typing.Optional[typing.Any]]],
|
|
677
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
678
|
+
) -> ServiceExecution:
|
|
679
|
+
"""
|
|
680
|
+
This method starts a service execution, which in turn is processed asynchronously by PLANQK.
|
|
681
|
+
The location header of the response contains the URL which can be used to query the status and the result of the service execution.
|
|
682
|
+
|
|
683
|
+
Parameters
|
|
684
|
+
----------
|
|
685
|
+
request : typing.Dict[str, typing.Dict[str, typing.Optional[typing.Any]]]
|
|
686
|
+
|
|
687
|
+
request_options : typing.Optional[RequestOptions]
|
|
688
|
+
Request-specific configuration.
|
|
689
|
+
|
|
690
|
+
Returns
|
|
691
|
+
-------
|
|
692
|
+
ServiceExecution
|
|
693
|
+
Service execution successfully submitted
|
|
694
|
+
|
|
695
|
+
Examples
|
|
696
|
+
--------
|
|
697
|
+
import asyncio
|
|
698
|
+
|
|
699
|
+
from planqk_service import AsyncPlanqkServiceApi
|
|
700
|
+
|
|
701
|
+
client = AsyncPlanqkServiceApi(
|
|
702
|
+
token="YOUR_TOKEN",
|
|
703
|
+
)
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
async def main() -> None:
|
|
707
|
+
await client.service_api.execute(
|
|
708
|
+
request={"key": {"key": "value"}},
|
|
709
|
+
)
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
asyncio.run(main())
|
|
713
|
+
"""
|
|
714
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
715
|
+
method="POST",
|
|
716
|
+
json=request,
|
|
717
|
+
request_options=request_options,
|
|
718
|
+
omit=OMIT,
|
|
719
|
+
)
|
|
720
|
+
try:
|
|
721
|
+
if 200 <= _response.status_code < 300:
|
|
722
|
+
return typing.cast(
|
|
723
|
+
ServiceExecution,
|
|
724
|
+
parse_obj_as(
|
|
725
|
+
type_=ServiceExecution, # type: ignore
|
|
726
|
+
object_=_response.json(),
|
|
727
|
+
),
|
|
728
|
+
)
|
|
729
|
+
if _response.status_code == 400:
|
|
730
|
+
raise BadRequestError(
|
|
731
|
+
typing.cast(
|
|
732
|
+
typing.Optional[typing.Any],
|
|
733
|
+
parse_obj_as(
|
|
734
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
735
|
+
object_=_response.json(),
|
|
736
|
+
),
|
|
737
|
+
)
|
|
738
|
+
)
|
|
739
|
+
if _response.status_code == 401:
|
|
740
|
+
raise UnauthorizedError(
|
|
741
|
+
typing.cast(
|
|
742
|
+
typing.Optional[typing.Any],
|
|
743
|
+
parse_obj_as(
|
|
744
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
745
|
+
object_=_response.json(),
|
|
746
|
+
),
|
|
747
|
+
)
|
|
748
|
+
)
|
|
749
|
+
if _response.status_code == 403:
|
|
750
|
+
raise ForbiddenError(
|
|
751
|
+
typing.cast(
|
|
752
|
+
typing.Optional[typing.Any],
|
|
753
|
+
parse_obj_as(
|
|
754
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
755
|
+
object_=_response.json(),
|
|
756
|
+
),
|
|
757
|
+
)
|
|
758
|
+
)
|
|
759
|
+
if _response.status_code == 404:
|
|
760
|
+
raise NotFoundError(
|
|
761
|
+
typing.cast(
|
|
762
|
+
typing.Optional[typing.Any],
|
|
763
|
+
parse_obj_as(
|
|
764
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
765
|
+
object_=_response.json(),
|
|
766
|
+
),
|
|
767
|
+
)
|
|
768
|
+
)
|
|
769
|
+
if _response.status_code == 500:
|
|
770
|
+
raise InternalServerError(
|
|
771
|
+
typing.cast(
|
|
772
|
+
typing.Optional[typing.Any],
|
|
773
|
+
parse_obj_as(
|
|
774
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
775
|
+
object_=_response.json(),
|
|
776
|
+
),
|
|
777
|
+
)
|
|
778
|
+
)
|
|
779
|
+
_response_json = _response.json()
|
|
780
|
+
except JSONDecodeError:
|
|
781
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
782
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
783
|
+
|
|
784
|
+
async def get_status(
|
|
785
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
786
|
+
) -> ServiceExecution:
|
|
787
|
+
"""
|
|
788
|
+
This method checks the status of a service execution.
|
|
789
|
+
|
|
790
|
+
Parameters
|
|
791
|
+
----------
|
|
792
|
+
id : str
|
|
793
|
+
The id of a service execution
|
|
794
|
+
|
|
795
|
+
request_options : typing.Optional[RequestOptions]
|
|
796
|
+
Request-specific configuration.
|
|
797
|
+
|
|
798
|
+
Returns
|
|
799
|
+
-------
|
|
800
|
+
ServiceExecution
|
|
801
|
+
Ok
|
|
802
|
+
|
|
803
|
+
Examples
|
|
804
|
+
--------
|
|
805
|
+
import asyncio
|
|
806
|
+
|
|
807
|
+
from planqk_service import AsyncPlanqkServiceApi
|
|
808
|
+
|
|
809
|
+
client = AsyncPlanqkServiceApi(
|
|
810
|
+
token="YOUR_TOKEN",
|
|
811
|
+
)
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
async def main() -> None:
|
|
815
|
+
await client.service_api.get_status(
|
|
816
|
+
id="id",
|
|
817
|
+
)
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
asyncio.run(main())
|
|
821
|
+
"""
|
|
822
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
823
|
+
f"{jsonable_encoder(id)}",
|
|
824
|
+
method="GET",
|
|
825
|
+
request_options=request_options,
|
|
826
|
+
)
|
|
827
|
+
try:
|
|
828
|
+
if 200 <= _response.status_code < 300:
|
|
829
|
+
return typing.cast(
|
|
830
|
+
ServiceExecution,
|
|
831
|
+
parse_obj_as(
|
|
832
|
+
type_=ServiceExecution, # type: ignore
|
|
833
|
+
object_=_response.json(),
|
|
834
|
+
),
|
|
835
|
+
)
|
|
836
|
+
if _response.status_code == 401:
|
|
837
|
+
raise UnauthorizedError(
|
|
838
|
+
typing.cast(
|
|
839
|
+
typing.Optional[typing.Any],
|
|
840
|
+
parse_obj_as(
|
|
841
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
842
|
+
object_=_response.json(),
|
|
843
|
+
),
|
|
844
|
+
)
|
|
845
|
+
)
|
|
846
|
+
if _response.status_code == 403:
|
|
847
|
+
raise ForbiddenError(
|
|
848
|
+
typing.cast(
|
|
849
|
+
typing.Optional[typing.Any],
|
|
850
|
+
parse_obj_as(
|
|
851
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
852
|
+
object_=_response.json(),
|
|
853
|
+
),
|
|
854
|
+
)
|
|
855
|
+
)
|
|
856
|
+
if _response.status_code == 404:
|
|
857
|
+
raise NotFoundError(
|
|
858
|
+
typing.cast(
|
|
859
|
+
typing.Optional[typing.Any],
|
|
860
|
+
parse_obj_as(
|
|
861
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
862
|
+
object_=_response.json(),
|
|
863
|
+
),
|
|
864
|
+
)
|
|
865
|
+
)
|
|
866
|
+
if _response.status_code == 500:
|
|
867
|
+
raise InternalServerError(
|
|
868
|
+
typing.cast(
|
|
869
|
+
typing.Optional[typing.Any],
|
|
870
|
+
parse_obj_as(
|
|
871
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
872
|
+
object_=_response.json(),
|
|
873
|
+
),
|
|
874
|
+
)
|
|
875
|
+
)
|
|
876
|
+
_response_json = _response.json()
|
|
877
|
+
except JSONDecodeError:
|
|
878
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
879
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
880
|
+
|
|
881
|
+
async def get_result(
|
|
882
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
883
|
+
) -> GetResultResponse:
|
|
884
|
+
"""
|
|
885
|
+
This method retrieves the result of a service execution.
|
|
886
|
+
|
|
887
|
+
Parameters
|
|
888
|
+
----------
|
|
889
|
+
id : str
|
|
890
|
+
The id of a service execution
|
|
891
|
+
|
|
892
|
+
request_options : typing.Optional[RequestOptions]
|
|
893
|
+
Request-specific configuration.
|
|
894
|
+
|
|
895
|
+
Returns
|
|
896
|
+
-------
|
|
897
|
+
GetResultResponse
|
|
898
|
+
Ok
|
|
899
|
+
|
|
900
|
+
Examples
|
|
901
|
+
--------
|
|
902
|
+
import asyncio
|
|
903
|
+
|
|
904
|
+
from planqk_service import AsyncPlanqkServiceApi
|
|
905
|
+
|
|
906
|
+
client = AsyncPlanqkServiceApi(
|
|
907
|
+
token="YOUR_TOKEN",
|
|
908
|
+
)
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
async def main() -> None:
|
|
912
|
+
await client.service_api.get_result(
|
|
913
|
+
id="id",
|
|
914
|
+
)
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
asyncio.run(main())
|
|
918
|
+
"""
|
|
919
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
920
|
+
f"{jsonable_encoder(id)}/result",
|
|
921
|
+
method="GET",
|
|
922
|
+
request_options=request_options,
|
|
923
|
+
)
|
|
924
|
+
try:
|
|
925
|
+
if 200 <= _response.status_code < 300:
|
|
926
|
+
return typing.cast(
|
|
927
|
+
GetResultResponse,
|
|
928
|
+
parse_obj_as(
|
|
929
|
+
type_=GetResultResponse, # type: ignore
|
|
930
|
+
object_=_response.json(),
|
|
931
|
+
),
|
|
932
|
+
)
|
|
933
|
+
if _response.status_code == 401:
|
|
934
|
+
raise UnauthorizedError(
|
|
935
|
+
typing.cast(
|
|
936
|
+
typing.Optional[typing.Any],
|
|
937
|
+
parse_obj_as(
|
|
938
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
939
|
+
object_=_response.json(),
|
|
940
|
+
),
|
|
941
|
+
)
|
|
942
|
+
)
|
|
943
|
+
if _response.status_code == 403:
|
|
944
|
+
raise ForbiddenError(
|
|
945
|
+
typing.cast(
|
|
946
|
+
typing.Optional[typing.Any],
|
|
947
|
+
parse_obj_as(
|
|
948
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
949
|
+
object_=_response.json(),
|
|
950
|
+
),
|
|
951
|
+
)
|
|
952
|
+
)
|
|
953
|
+
if _response.status_code == 404:
|
|
954
|
+
raise NotFoundError(
|
|
955
|
+
typing.cast(
|
|
956
|
+
typing.Optional[typing.Any],
|
|
957
|
+
parse_obj_as(
|
|
958
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
959
|
+
object_=_response.json(),
|
|
960
|
+
),
|
|
961
|
+
)
|
|
962
|
+
)
|
|
963
|
+
if _response.status_code == 500:
|
|
964
|
+
raise InternalServerError(
|
|
965
|
+
typing.cast(
|
|
966
|
+
typing.Optional[typing.Any],
|
|
967
|
+
parse_obj_as(
|
|
968
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
969
|
+
object_=_response.json(),
|
|
970
|
+
),
|
|
971
|
+
)
|
|
972
|
+
)
|
|
973
|
+
_response_json = _response.json()
|
|
974
|
+
except JSONDecodeError:
|
|
975
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
976
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
977
|
+
|
|
978
|
+
async def get_result_file(
|
|
979
|
+
self,
|
|
980
|
+
id: str,
|
|
981
|
+
file: str,
|
|
982
|
+
*,
|
|
983
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
984
|
+
) -> typing.AsyncIterator[bytes]:
|
|
985
|
+
"""
|
|
986
|
+
This method downloads a result file of a service execution.
|
|
987
|
+
|
|
988
|
+
Parameters
|
|
989
|
+
----------
|
|
990
|
+
id : str
|
|
991
|
+
The id of a service execution
|
|
992
|
+
|
|
993
|
+
file : str
|
|
994
|
+
The name of the result file
|
|
995
|
+
|
|
996
|
+
request_options : typing.Optional[RequestOptions]
|
|
997
|
+
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.
|
|
998
|
+
|
|
999
|
+
Yields
|
|
1000
|
+
------
|
|
1001
|
+
typing.AsyncIterator[bytes]
|
|
1002
|
+
Ok
|
|
1003
|
+
"""
|
|
1004
|
+
async with self._client_wrapper.httpx_client.stream(
|
|
1005
|
+
f"{jsonable_encoder(id)}/result/{jsonable_encoder(file)}",
|
|
1006
|
+
method="GET",
|
|
1007
|
+
request_options=request_options,
|
|
1008
|
+
) as _response:
|
|
1009
|
+
try:
|
|
1010
|
+
if 200 <= _response.status_code < 300:
|
|
1011
|
+
_chunk_size = (
|
|
1012
|
+
request_options.get("chunk_size", None)
|
|
1013
|
+
if request_options is not None
|
|
1014
|
+
else None
|
|
1015
|
+
)
|
|
1016
|
+
async for _chunk in _response.aiter_bytes(chunk_size=_chunk_size):
|
|
1017
|
+
yield _chunk
|
|
1018
|
+
return
|
|
1019
|
+
await _response.aread()
|
|
1020
|
+
if _response.status_code == 401:
|
|
1021
|
+
raise UnauthorizedError(
|
|
1022
|
+
typing.cast(
|
|
1023
|
+
typing.Optional[typing.Any],
|
|
1024
|
+
parse_obj_as(
|
|
1025
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1026
|
+
object_=_response.json(),
|
|
1027
|
+
),
|
|
1028
|
+
)
|
|
1029
|
+
)
|
|
1030
|
+
if _response.status_code == 403:
|
|
1031
|
+
raise ForbiddenError(
|
|
1032
|
+
typing.cast(
|
|
1033
|
+
typing.Optional[typing.Any],
|
|
1034
|
+
parse_obj_as(
|
|
1035
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1036
|
+
object_=_response.json(),
|
|
1037
|
+
),
|
|
1038
|
+
)
|
|
1039
|
+
)
|
|
1040
|
+
if _response.status_code == 404:
|
|
1041
|
+
raise NotFoundError(
|
|
1042
|
+
typing.cast(
|
|
1043
|
+
typing.Optional[typing.Any],
|
|
1044
|
+
parse_obj_as(
|
|
1045
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1046
|
+
object_=_response.json(),
|
|
1047
|
+
),
|
|
1048
|
+
)
|
|
1049
|
+
)
|
|
1050
|
+
if _response.status_code == 500:
|
|
1051
|
+
raise InternalServerError(
|
|
1052
|
+
typing.cast(
|
|
1053
|
+
typing.Optional[typing.Any],
|
|
1054
|
+
parse_obj_as(
|
|
1055
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1056
|
+
object_=_response.json(),
|
|
1057
|
+
),
|
|
1058
|
+
)
|
|
1059
|
+
)
|
|
1060
|
+
_response_json = _response.json()
|
|
1061
|
+
except JSONDecodeError:
|
|
1062
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1063
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1064
|
+
|
|
1065
|
+
async def get_logs(
|
|
1066
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1067
|
+
) -> typing.List[str]:
|
|
1068
|
+
"""
|
|
1069
|
+
This method retrieves the log output of a service execution.
|
|
1070
|
+
|
|
1071
|
+
Parameters
|
|
1072
|
+
----------
|
|
1073
|
+
id : str
|
|
1074
|
+
The id of a service execution
|
|
1075
|
+
|
|
1076
|
+
request_options : typing.Optional[RequestOptions]
|
|
1077
|
+
Request-specific configuration.
|
|
1078
|
+
|
|
1079
|
+
Returns
|
|
1080
|
+
-------
|
|
1081
|
+
typing.List[str]
|
|
1082
|
+
Ok
|
|
1083
|
+
|
|
1084
|
+
Examples
|
|
1085
|
+
--------
|
|
1086
|
+
import asyncio
|
|
1087
|
+
|
|
1088
|
+
from planqk_service import AsyncPlanqkServiceApi
|
|
1089
|
+
|
|
1090
|
+
client = AsyncPlanqkServiceApi(
|
|
1091
|
+
token="YOUR_TOKEN",
|
|
1092
|
+
)
|
|
1093
|
+
|
|
1094
|
+
|
|
1095
|
+
async def main() -> None:
|
|
1096
|
+
await client.service_api.get_logs(
|
|
1097
|
+
id="id",
|
|
1098
|
+
)
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
asyncio.run(main())
|
|
1102
|
+
"""
|
|
1103
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1104
|
+
f"{jsonable_encoder(id)}/log",
|
|
1105
|
+
method="GET",
|
|
1106
|
+
request_options=request_options,
|
|
1107
|
+
)
|
|
1108
|
+
try:
|
|
1109
|
+
if 200 <= _response.status_code < 300:
|
|
1110
|
+
return typing.cast(
|
|
1111
|
+
typing.List[str],
|
|
1112
|
+
parse_obj_as(
|
|
1113
|
+
type_=typing.List[str], # type: ignore
|
|
1114
|
+
object_=_response.json(),
|
|
1115
|
+
),
|
|
1116
|
+
)
|
|
1117
|
+
if _response.status_code == 401:
|
|
1118
|
+
raise UnauthorizedError(
|
|
1119
|
+
typing.cast(
|
|
1120
|
+
typing.Optional[typing.Any],
|
|
1121
|
+
parse_obj_as(
|
|
1122
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1123
|
+
object_=_response.json(),
|
|
1124
|
+
),
|
|
1125
|
+
)
|
|
1126
|
+
)
|
|
1127
|
+
if _response.status_code == 403:
|
|
1128
|
+
raise ForbiddenError(
|
|
1129
|
+
typing.cast(
|
|
1130
|
+
typing.Optional[typing.Any],
|
|
1131
|
+
parse_obj_as(
|
|
1132
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1133
|
+
object_=_response.json(),
|
|
1134
|
+
),
|
|
1135
|
+
)
|
|
1136
|
+
)
|
|
1137
|
+
if _response.status_code == 404:
|
|
1138
|
+
raise NotFoundError(
|
|
1139
|
+
typing.cast(
|
|
1140
|
+
typing.Optional[typing.Any],
|
|
1141
|
+
parse_obj_as(
|
|
1142
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1143
|
+
object_=_response.json(),
|
|
1144
|
+
),
|
|
1145
|
+
)
|
|
1146
|
+
)
|
|
1147
|
+
if _response.status_code == 500:
|
|
1148
|
+
raise InternalServerError(
|
|
1149
|
+
typing.cast(
|
|
1150
|
+
typing.Optional[typing.Any],
|
|
1151
|
+
parse_obj_as(
|
|
1152
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1153
|
+
object_=_response.json(),
|
|
1154
|
+
),
|
|
1155
|
+
)
|
|
1156
|
+
)
|
|
1157
|
+
_response_json = _response.json()
|
|
1158
|
+
except JSONDecodeError:
|
|
1159
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1160
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1161
|
+
|
|
1162
|
+
async def cancel(
|
|
1163
|
+
self, id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1164
|
+
) -> ServiceExecution:
|
|
1165
|
+
"""
|
|
1166
|
+
This method cancels a service execution.
|
|
1167
|
+
|
|
1168
|
+
Parameters
|
|
1169
|
+
----------
|
|
1170
|
+
id : str
|
|
1171
|
+
The id of a service execution
|
|
1172
|
+
|
|
1173
|
+
request_options : typing.Optional[RequestOptions]
|
|
1174
|
+
Request-specific configuration.
|
|
1175
|
+
|
|
1176
|
+
Returns
|
|
1177
|
+
-------
|
|
1178
|
+
ServiceExecution
|
|
1179
|
+
Ok
|
|
1180
|
+
|
|
1181
|
+
Examples
|
|
1182
|
+
--------
|
|
1183
|
+
import asyncio
|
|
1184
|
+
|
|
1185
|
+
from planqk_service import AsyncPlanqkServiceApi
|
|
1186
|
+
|
|
1187
|
+
client = AsyncPlanqkServiceApi(
|
|
1188
|
+
token="YOUR_TOKEN",
|
|
1189
|
+
)
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
async def main() -> None:
|
|
1193
|
+
await client.service_api.cancel(
|
|
1194
|
+
id="id",
|
|
1195
|
+
)
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
asyncio.run(main())
|
|
1199
|
+
"""
|
|
1200
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1201
|
+
f"{jsonable_encoder(id)}/cancel",
|
|
1202
|
+
method="PUT",
|
|
1203
|
+
request_options=request_options,
|
|
1204
|
+
)
|
|
1205
|
+
try:
|
|
1206
|
+
if 200 <= _response.status_code < 300:
|
|
1207
|
+
return typing.cast(
|
|
1208
|
+
ServiceExecution,
|
|
1209
|
+
parse_obj_as(
|
|
1210
|
+
type_=ServiceExecution, # type: ignore
|
|
1211
|
+
object_=_response.json(),
|
|
1212
|
+
),
|
|
1213
|
+
)
|
|
1214
|
+
if _response.status_code == 401:
|
|
1215
|
+
raise UnauthorizedError(
|
|
1216
|
+
typing.cast(
|
|
1217
|
+
typing.Optional[typing.Any],
|
|
1218
|
+
parse_obj_as(
|
|
1219
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1220
|
+
object_=_response.json(),
|
|
1221
|
+
),
|
|
1222
|
+
)
|
|
1223
|
+
)
|
|
1224
|
+
if _response.status_code == 403:
|
|
1225
|
+
raise ForbiddenError(
|
|
1226
|
+
typing.cast(
|
|
1227
|
+
typing.Optional[typing.Any],
|
|
1228
|
+
parse_obj_as(
|
|
1229
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1230
|
+
object_=_response.json(),
|
|
1231
|
+
),
|
|
1232
|
+
)
|
|
1233
|
+
)
|
|
1234
|
+
if _response.status_code == 404:
|
|
1235
|
+
raise NotFoundError(
|
|
1236
|
+
typing.cast(
|
|
1237
|
+
typing.Optional[typing.Any],
|
|
1238
|
+
parse_obj_as(
|
|
1239
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1240
|
+
object_=_response.json(),
|
|
1241
|
+
),
|
|
1242
|
+
)
|
|
1243
|
+
)
|
|
1244
|
+
if _response.status_code == 500:
|
|
1245
|
+
raise InternalServerError(
|
|
1246
|
+
typing.cast(
|
|
1247
|
+
typing.Optional[typing.Any],
|
|
1248
|
+
parse_obj_as(
|
|
1249
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1250
|
+
object_=_response.json(),
|
|
1251
|
+
),
|
|
1252
|
+
)
|
|
1253
|
+
)
|
|
1254
|
+
_response_json = _response.json()
|
|
1255
|
+
except JSONDecodeError:
|
|
1256
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1257
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|