@planqk/planqk-service-sdk 1.9.1 → 2.1.1
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,13 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .get_result_response import GetResultResponse
|
|
4
|
+
from .get_result_response_embedded import GetResultResponseEmbedded
|
|
5
|
+
from .get_result_response_links import GetResultResponseLinks
|
|
6
|
+
from .health_check_response import HealthCheckResponse
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"GetResultResponse",
|
|
10
|
+
"GetResultResponseEmbedded",
|
|
11
|
+
"GetResultResponseLinks",
|
|
12
|
+
"HealthCheckResponse",
|
|
13
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing_extensions
|
|
5
|
+
import typing
|
|
6
|
+
from .get_result_response_links import GetResultResponseLinks
|
|
7
|
+
from ...core.serialization import FieldMetadata
|
|
8
|
+
from .get_result_response_embedded import GetResultResponseEmbedded
|
|
9
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
10
|
+
import pydantic
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class GetResultResponse(UniversalBaseModel):
|
|
14
|
+
links: typing_extensions.Annotated[
|
|
15
|
+
typing.Optional[GetResultResponseLinks], FieldMetadata(alias="_links")
|
|
16
|
+
] = None
|
|
17
|
+
embedded: typing_extensions.Annotated[
|
|
18
|
+
typing.Optional[GetResultResponseEmbedded], FieldMetadata(alias="_embedded")
|
|
19
|
+
] = None
|
|
20
|
+
|
|
21
|
+
if IS_PYDANTIC_V2:
|
|
22
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
23
|
+
extra="allow", frozen=True
|
|
24
|
+
) # type: ignore # Pydantic v2
|
|
25
|
+
else:
|
|
26
|
+
|
|
27
|
+
class Config:
|
|
28
|
+
frozen = True
|
|
29
|
+
smart_union = True
|
|
30
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from ...types.service_execution import ServiceExecution
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GetResultResponseEmbedded(UniversalBaseModel):
|
|
11
|
+
status: typing.Optional[ServiceExecution] = None
|
|
12
|
+
|
|
13
|
+
if IS_PYDANTIC_V2:
|
|
14
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
15
|
+
extra="allow", frozen=True
|
|
16
|
+
) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from ...types.hal_link import HalLink
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import pydantic
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class GetResultResponseLinks(UniversalBaseModel):
|
|
11
|
+
status: typing.Optional[HalLink] = None
|
|
12
|
+
|
|
13
|
+
if IS_PYDANTIC_V2:
|
|
14
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
15
|
+
extra="allow", frozen=True
|
|
16
|
+
) # type: ignore # Pydantic v2
|
|
17
|
+
else:
|
|
18
|
+
|
|
19
|
+
class Config:
|
|
20
|
+
frozen = True
|
|
21
|
+
smart_union = True
|
|
22
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ...core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HealthCheckResponse(UniversalBaseModel):
|
|
10
|
+
status: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
Status of the service
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
if IS_PYDANTIC_V2:
|
|
16
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
17
|
+
extra="allow", frozen=True
|
|
18
|
+
) # type: ignore # Pydantic v2
|
|
19
|
+
else:
|
|
20
|
+
|
|
21
|
+
class Config:
|
|
22
|
+
frozen = True
|
|
23
|
+
smart_union = True
|
|
24
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .hal_link import HalLink
|
|
4
|
+
from .input_data import InputData
|
|
5
|
+
from .input_data_ref import InputDataRef
|
|
6
|
+
from .input_params import InputParams
|
|
7
|
+
from .service_execution import ServiceExecution
|
|
8
|
+
from .service_execution_status import ServiceExecutionStatus
|
|
9
|
+
|
|
10
|
+
__all__ = [
|
|
11
|
+
"HalLink",
|
|
12
|
+
"InputData",
|
|
13
|
+
"InputDataRef",
|
|
14
|
+
"InputParams",
|
|
15
|
+
"ServiceExecution",
|
|
16
|
+
"ServiceExecutionStatus",
|
|
17
|
+
]
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
import pydantic
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class HalLink(UniversalBaseModel):
|
|
10
|
+
href: typing.Optional[str] = pydantic.Field(default=None)
|
|
11
|
+
"""
|
|
12
|
+
The URL of the link
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
templated: typing.Optional[bool] = pydantic.Field(default=None)
|
|
16
|
+
"""
|
|
17
|
+
Whether the link is templated (optional)
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
type: typing.Optional[str] = pydantic.Field(default=None)
|
|
21
|
+
"""
|
|
22
|
+
The media type of the link (optional)
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
deprecation: typing.Optional[str] = pydantic.Field(default=None)
|
|
26
|
+
"""
|
|
27
|
+
A URL that provides further information about the deprecation of the link (optional)
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
name: typing.Optional[str] = pydantic.Field(default=None)
|
|
31
|
+
"""
|
|
32
|
+
The name of the link (optional)
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
profile: typing.Optional[str] = pydantic.Field(default=None)
|
|
36
|
+
"""
|
|
37
|
+
A URL that provides further information about the profile of the link (optional)
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
title: typing.Optional[str] = pydantic.Field(default=None)
|
|
41
|
+
"""
|
|
42
|
+
The title of the link (optional)
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
hreflang: typing.Optional[str] = pydantic.Field(default=None)
|
|
46
|
+
"""
|
|
47
|
+
The language of the link's target resource (optional)
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
if IS_PYDANTIC_V2:
|
|
51
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
52
|
+
extra="allow", frozen=True
|
|
53
|
+
) # type: ignore # Pydantic v2
|
|
54
|
+
else:
|
|
55
|
+
|
|
56
|
+
class Config:
|
|
57
|
+
frozen = True
|
|
58
|
+
smart_union = True
|
|
59
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing_extensions
|
|
5
|
+
from ..core.serialization import FieldMetadata
|
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
7
|
+
import typing
|
|
8
|
+
import pydantic
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class InputDataRef(UniversalBaseModel):
|
|
12
|
+
data_pool_id: typing_extensions.Annotated[str, FieldMetadata(alias="dataPoolId")]
|
|
13
|
+
data_source_descriptor_id: typing_extensions.Annotated[
|
|
14
|
+
str, FieldMetadata(alias="dataSourceDescriptorId")
|
|
15
|
+
]
|
|
16
|
+
file_id: typing_extensions.Annotated[str, FieldMetadata(alias="fileId")]
|
|
17
|
+
|
|
18
|
+
if IS_PYDANTIC_V2:
|
|
19
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
20
|
+
extra="allow", frozen=True
|
|
21
|
+
) # type: ignore # Pydantic v2
|
|
22
|
+
else:
|
|
23
|
+
|
|
24
|
+
class Config:
|
|
25
|
+
frozen = True
|
|
26
|
+
smart_union = True
|
|
27
|
+
extra = pydantic.Extra.allow
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from ..core.pydantic_utilities import UniversalBaseModel
|
|
4
|
+
import typing
|
|
5
|
+
from .service_execution_status import ServiceExecutionStatus
|
|
6
|
+
import typing_extensions
|
|
7
|
+
from ..core.serialization import FieldMetadata
|
|
8
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2
|
|
9
|
+
import pydantic
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ServiceExecution(UniversalBaseModel):
|
|
13
|
+
id: typing.Optional[str] = None
|
|
14
|
+
status: typing.Optional[ServiceExecutionStatus] = None
|
|
15
|
+
created_at: typing_extensions.Annotated[
|
|
16
|
+
typing.Optional[str], FieldMetadata(alias="createdAt")
|
|
17
|
+
] = None
|
|
18
|
+
started_at: typing_extensions.Annotated[
|
|
19
|
+
typing.Optional[str], FieldMetadata(alias="startedAt")
|
|
20
|
+
] = None
|
|
21
|
+
ended_at: typing_extensions.Annotated[
|
|
22
|
+
typing.Optional[str], FieldMetadata(alias="endedAt")
|
|
23
|
+
] = None
|
|
24
|
+
|
|
25
|
+
if IS_PYDANTIC_V2:
|
|
26
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(
|
|
27
|
+
extra="allow", frozen=True
|
|
28
|
+
) # type: ignore # Pydantic v2
|
|
29
|
+
else:
|
|
30
|
+
|
|
31
|
+
class Config:
|
|
32
|
+
frozen = True
|
|
33
|
+
smart_union = True
|
|
34
|
+
extra = pydantic.Extra.allow
|
package/pyproject.toml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "planqk-service-sdk"
|
|
3
|
+
version = "2.1.1"
|
|
4
|
+
description = "SDK to interact with PLANQK Managed Services."
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "Kipu Quantum GmbH", email = "info@kipu-quantum.com" },
|
|
7
|
+
]
|
|
8
|
+
maintainers = [
|
|
9
|
+
{ name = "Michael Wurster", email = "michael.wurster@kipu-quantum.com" },
|
|
10
|
+
]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"License :: OSI Approved :: Apache Software License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
]
|
|
16
|
+
readme = "README-python.md"
|
|
17
|
+
license = { file = "LICENSE" }
|
|
18
|
+
requires-python = ">=3.9"
|
|
19
|
+
dependencies = [
|
|
20
|
+
"authlib>=1.5.1",
|
|
21
|
+
"httpx>=0.28.1",
|
|
22
|
+
"pydantic>=2.5.0,<2.10",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[dependency-groups]
|
|
26
|
+
dev = [
|
|
27
|
+
"ipykernel>=6.29.5",
|
|
28
|
+
"pylint>=3.3.5",
|
|
29
|
+
"pytest>=8.3.5",
|
|
30
|
+
"pytest-dotenv>=0.5.2",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://kipu-quantum.com/platform"
|
|
35
|
+
Documentation = "https://docs.planqk.de"
|
|
36
|
+
Repository = "https://gitlab.com/planqk-foss/planqk-service-sdk"
|
|
37
|
+
Issues = "https://gitlab.com/planqk-foss/planqk-service-sdk/-/issues"
|
|
38
|
+
Changelog = "https://gitlab.com/planqk-foss/planqk-service-sdk/-/releases"
|
|
39
|
+
|
|
40
|
+
[build-system]
|
|
41
|
+
requires = ["setuptools >= 61.0", "wheel", "twine"]
|
|
42
|
+
build-backend = "setuptools.build_meta"
|
|
43
|
+
|
|
44
|
+
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html
|
|
45
|
+
[tool.setuptools.packages.find]
|
|
46
|
+
include = ["planqk*"]
|
|
47
|
+
|
|
48
|
+
[tool.pylint.MASTER]
|
|
49
|
+
ignore-paths = '^planqk/service/sdk/.*$'
|
|
50
|
+
max-line-length = 120
|
|
51
|
+
disable = ['missing-module-docstring', 'missing-class-docstring', 'missing-function-docstring']
|
package/src/client.ts
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import {DEFAULT_TOKEN_ENDPOINT, PlanqkServiceAuth} from './auth'
|
|
2
|
-
import {PlanqkServiceApiClient} from
|
|
3
|
-
import {
|
|
4
|
-
GetInterimResultsRequest,
|
|
5
|
-
GetInterimResultsResponse,
|
|
6
|
-
GetResultResponse,
|
|
7
|
-
HealthCheckResponse,
|
|
8
|
-
Job,
|
|
9
|
-
JobStatus,
|
|
10
|
-
NotFoundError,
|
|
11
|
-
StartExecutionRequest,
|
|
12
|
-
} from './sdk/api'
|
|
13
|
-
import {ServiceApi} from './sdk/api/resources/serviceApi/client/Client'
|
|
2
|
+
import {PlanqkServiceApiClient} from "./sdk";
|
|
3
|
+
import {ServiceApi} from "./sdk/api/resources/serviceApi/client/Client";
|
|
14
4
|
|
|
15
5
|
export class PlanqkServiceClient {
|
|
16
6
|
private _api: PlanqkServiceApiClient
|
|
@@ -30,71 +20,7 @@ export class PlanqkServiceClient {
|
|
|
30
20
|
}
|
|
31
21
|
}
|
|
32
22
|
|
|
33
|
-
public
|
|
34
|
-
return this._api.serviceApi
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public getInterimResults(jobId: string, request: GetInterimResultsRequest = {}, requestOptions?: ServiceApi.RequestOptions): Promise<GetInterimResultsResponse> {
|
|
38
|
-
return this._api.serviceApi.getInterimResults(jobId, request, requestOptions)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
public async getResult(jobId: string, requestOptions?: ServiceApi.RequestOptions): Promise<GetResultResponse> {
|
|
42
|
-
await this.waitForFinalState(jobId)
|
|
43
|
-
return this.doGetResultWithRetries(jobId, requestOptions)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public getStatus(jobId: string, requestOptions?: ServiceApi.RequestOptions): Promise<Job> {
|
|
47
|
-
return this._api.serviceApi.getStatus(jobId, requestOptions)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public healthCheck(requestOptions?: ServiceApi.RequestOptions): Promise<HealthCheckResponse> {
|
|
51
|
-
return this._api.statusApi.healthCheck(requestOptions)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public startExecution(request: StartExecutionRequest = {}, requestOptions?: ServiceApi.RequestOptions): Promise<Job> {
|
|
55
|
-
return this._api.serviceApi.startExecution(request, requestOptions)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
private async doGetResultWithRetries(jobId: string, requestOptions?: ServiceApi.RequestOptions, retries: number = 5, delay: number = 1000): Promise<GetResultResponse> {
|
|
59
|
-
try {
|
|
60
|
-
return await this._api.serviceApi.getResult(jobId, requestOptions)
|
|
61
|
-
} catch (error) {
|
|
62
|
-
if (error instanceof NotFoundError) {
|
|
63
|
-
if (retries === 0) throw error
|
|
64
|
-
// Wait for the specified delay
|
|
65
|
-
await new Promise(resolve => {
|
|
66
|
-
setTimeout(resolve, delay)
|
|
67
|
-
})
|
|
68
|
-
// Double the delay, but cap it at 16 seconds
|
|
69
|
-
const newDelay = Math.min(delay * 2, 16_000)
|
|
70
|
-
return this.doGetResultWithRetries(jobId, requestOptions, retries - 1, newDelay)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
throw error
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
private async doWaitForFinalState(jobId: string, timeout?: number, waitTime: number = 5, startTime: number = Date.now()): Promise<void> {
|
|
78
|
-
const job = await this.getStatus(jobId)
|
|
79
|
-
if (this.jobHasFinished(job)) return
|
|
80
|
-
|
|
81
|
-
const elapsedTime = Date.now() - startTime
|
|
82
|
-
if (timeout !== undefined && elapsedTime >= timeout * 1000) {
|
|
83
|
-
throw new Error(`Timeout while waiting for job '${jobId}'.`)
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
await new Promise(resolve => {
|
|
87
|
-
setTimeout(resolve, waitTime * 1000)
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
await this.doWaitForFinalState(jobId, timeout, waitTime, startTime)
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
private jobHasFinished(job: Job): boolean {
|
|
94
|
-
return (job.status === JobStatus.Succeeded || job.status === JobStatus.Failed || job.status === JobStatus.Cancelled)
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private async waitForFinalState(jobId: string, timeout?: number, wait: number = 5): Promise<void> {
|
|
98
|
-
await this.doWaitForFinalState(jobId, timeout, wait)
|
|
23
|
+
public api(): ServiceApi {
|
|
24
|
+
return this._api.serviceApi
|
|
99
25
|
}
|
|
100
26
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
import {test} from 'vitest'
|
|
3
|
+
import 'dotenv/config'
|
|
4
|
+
import {PlanqkServiceClient} from "./client";
|
|
5
|
+
|
|
6
|
+
test.skip('adds 1 + 2 to equal 3', {timeout: 5 * 60 * 1000}, async () => {
|
|
7
|
+
const tokenEndpoint = process.env.TOKEN_ENDPOINT
|
|
8
|
+
const serviceEndpoint = process.env.SERVICE_ENDPOINT
|
|
9
|
+
const consumerKey = process.env.CONSUMER_KEY
|
|
10
|
+
const consumerSecret = process.env.CONSUMER_SECRET
|
|
11
|
+
|
|
12
|
+
console.log(`Token endpoint: ${tokenEndpoint}`)
|
|
13
|
+
console.log(`Service endpoint: ${serviceEndpoint}`)
|
|
14
|
+
console.log(`Consumer key: ${consumerKey}`)
|
|
15
|
+
console.log(`Consumer secret: ${consumerSecret}`)
|
|
16
|
+
|
|
17
|
+
const client = new PlanqkServiceClient(serviceEndpoint!, consumerKey, consumerSecret, tokenEndpoint);
|
|
18
|
+
await client.api().healthCheck()
|
|
19
|
+
|
|
20
|
+
// prepare your input data and parameters
|
|
21
|
+
const data = {input: {a: 1, b: 2}};
|
|
22
|
+
const params = {param1: "value1", param2: "value2"};
|
|
23
|
+
|
|
24
|
+
// execute the service
|
|
25
|
+
let serviceExecution = await client.api().execute({data, params})
|
|
26
|
+
console.log(serviceExecution)
|
|
27
|
+
|
|
28
|
+
// retrieve the status of a service execution
|
|
29
|
+
serviceExecution = await client.api().getStatus(serviceExecution.id!);
|
|
30
|
+
|
|
31
|
+
// wait for the service execution to finish
|
|
32
|
+
const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"];
|
|
33
|
+
while (!finalStates.includes(serviceExecution.status!)) {
|
|
34
|
+
serviceExecution = await client.api().getStatus(serviceExecution.id!);
|
|
35
|
+
}
|
|
36
|
+
console.log(serviceExecution)
|
|
37
|
+
|
|
38
|
+
// retrieve the result
|
|
39
|
+
await client.api().getResult(serviceExecution.id!)
|
|
40
|
+
|
|
41
|
+
// retrieve the logs
|
|
42
|
+
await client.api().getLogs(serviceExecution.id!)
|
|
43
|
+
})
|
package/src/sdk/Client.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import * as environments from "./environments";
|
|
6
6
|
import * as core from "./core";
|
|
7
|
-
import { StatusApi } from "./api/resources/statusApi/client/Client";
|
|
8
7
|
import { ServiceApi } from "./api/resources/serviceApi/client/Client";
|
|
9
8
|
|
|
10
9
|
export declare namespace PlanqkServiceApiClient {
|
|
@@ -14,20 +13,18 @@ export declare namespace PlanqkServiceApiClient {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
interface RequestOptions {
|
|
16
|
+
/** The maximum time to wait for a response in seconds. */
|
|
17
17
|
timeoutInSeconds?: number;
|
|
18
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
18
19
|
maxRetries?: number;
|
|
20
|
+
/** A hook to abort the request. */
|
|
21
|
+
abortSignal?: AbortSignal;
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
24
|
|
|
22
25
|
export class PlanqkServiceApiClient {
|
|
23
26
|
constructor(protected readonly _options: PlanqkServiceApiClient.Options) {}
|
|
24
27
|
|
|
25
|
-
protected _statusApi: StatusApi | undefined;
|
|
26
|
-
|
|
27
|
-
public get statusApi(): StatusApi {
|
|
28
|
-
return (this._statusApi ??= new StatusApi(this._options));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
28
|
protected _serviceApi: ServiceApi | undefined;
|
|
32
29
|
|
|
33
30
|
public get serviceApi(): ServiceApi {
|