@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.
Files changed (221) hide show
  1. package/.devcontainer/devcontainer.json +32 -0
  2. package/.devcontainer/post-create.sh +7 -0
  3. package/.env.template +4 -0
  4. package/.gitlab-ci.yml +103 -0
  5. package/.python-version +1 -0
  6. package/.releaserc.json +45 -0
  7. package/LICENSE +201 -0
  8. package/README-node.md +41 -0
  9. package/README-python.md +52 -0
  10. package/README.md +42 -21
  11. package/dist/auth.js +12 -19
  12. package/dist/client.d.ts +2 -12
  13. package/dist/client.js +5 -76
  14. package/dist/sdk/Client.d.ts +4 -3
  15. package/dist/sdk/Client.js +4 -8
  16. package/dist/sdk/api/errors/BadRequestError.d.ts +1 -1
  17. package/dist/sdk/api/errors/BadRequestError.js +18 -8
  18. package/dist/sdk/api/errors/ForbiddenError.d.ts +1 -1
  19. package/dist/sdk/api/errors/ForbiddenError.js +18 -8
  20. package/dist/sdk/api/errors/InternalServerError.d.ts +1 -1
  21. package/dist/sdk/api/errors/InternalServerError.js +18 -8
  22. package/dist/sdk/api/errors/NotFoundError.d.ts +1 -1
  23. package/dist/sdk/api/errors/NotFoundError.js +18 -8
  24. package/dist/sdk/api/errors/UnauthorizedError.d.ts +1 -1
  25. package/dist/sdk/api/errors/UnauthorizedError.js +18 -8
  26. package/dist/sdk/api/resources/index.d.ts +0 -3
  27. package/dist/sdk/api/resources/index.js +18 -11
  28. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +65 -12
  29. package/dist/sdk/api/resources/serviceApi/client/Client.js +405 -261
  30. package/dist/sdk/api/resources/serviceApi/client/index.d.ts +1 -1
  31. package/dist/sdk/api/resources/serviceApi/client/index.js +0 -15
  32. package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +4 -1
  33. package/dist/sdk/api/resources/serviceApi/types/{GetInterimResultsResponse.d.ts → GetResultResponseEmbedded.d.ts} +3 -1
  34. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.d.ts +7 -0
  35. package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.d.ts +1 -0
  36. package/dist/sdk/api/resources/serviceApi/types/index.d.ts +3 -1
  37. package/dist/sdk/api/resources/serviceApi/types/index.js +3 -1
  38. package/dist/sdk/api/types/HalLink.d.ts +21 -0
  39. package/dist/sdk/api/types/InputData.d.ts +1 -1
  40. package/dist/sdk/api/types/{InputRef.d.ts → InputDataRef.d.ts} +1 -1
  41. package/dist/sdk/api/types/InputParams.d.ts +1 -1
  42. package/dist/sdk/api/types/{Job.d.ts → ServiceExecution.d.ts} +2 -2
  43. package/dist/sdk/api/types/{JobStatus.d.ts → ServiceExecutionStatus.d.ts} +2 -2
  44. package/dist/sdk/api/types/{JobStatus.js → ServiceExecutionStatus.js} +2 -2
  45. package/dist/sdk/api/types/index.d.ts +4 -8
  46. package/dist/sdk/api/types/index.js +4 -8
  47. package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -0
  48. package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -5
  49. package/dist/sdk/core/fetcher/Fetcher.js +68 -112
  50. package/dist/sdk/core/fetcher/Supplier.js +2 -11
  51. package/dist/sdk/core/fetcher/createRequestUrl.d.ts +1 -0
  52. package/dist/sdk/core/fetcher/createRequestUrl.js +12 -0
  53. package/dist/sdk/core/fetcher/getFetchFn.d.ts +4 -0
  54. package/dist/sdk/core/fetcher/getFetchFn.js +57 -0
  55. package/dist/sdk/core/fetcher/getHeader.d.ts +1 -0
  56. package/dist/sdk/core/fetcher/getHeader.js +11 -0
  57. package/dist/sdk/core/fetcher/getRequestBody.d.ts +7 -0
  58. package/dist/sdk/core/fetcher/getRequestBody.js +11 -0
  59. package/dist/sdk/core/fetcher/getResponseBody.d.ts +1 -0
  60. package/dist/sdk/core/fetcher/getResponseBody.js +40 -0
  61. package/dist/sdk/core/fetcher/index.d.ts +1 -0
  62. package/dist/sdk/core/fetcher/index.js +3 -1
  63. package/dist/sdk/core/fetcher/makeRequest.d.ts +1 -0
  64. package/dist/sdk/core/fetcher/makeRequest.js +33 -0
  65. package/dist/sdk/core/fetcher/requestWithRetries.d.ts +1 -0
  66. package/dist/sdk/core/fetcher/requestWithRetries.js +20 -0
  67. package/dist/sdk/core/fetcher/signals.d.ts +11 -0
  68. package/dist/sdk/core/fetcher/signals.js +36 -0
  69. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  70. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +232 -0
  71. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  72. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +91 -0
  73. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  74. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +214 -0
  75. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  76. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.js +48 -0
  77. package/dist/sdk/core/index.d.ts +1 -0
  78. package/dist/sdk/core/index.js +1 -0
  79. package/dist/sdk/core/runtime/index.d.ts +1 -0
  80. package/dist/sdk/core/runtime/index.js +5 -0
  81. package/dist/sdk/core/runtime/runtime.d.ts +9 -0
  82. package/dist/sdk/core/runtime/runtime.js +92 -0
  83. package/dist/sdk/errors/PlanqkServiceApiError.js +2 -0
  84. package/dist/sdk/index.js +17 -7
  85. package/eslint.config.mjs +11 -0
  86. package/fern/fern.config.json +4 -0
  87. package/fern/generators.yml +25 -0
  88. package/fern/openapi/openapi.yml +342 -0
  89. package/notebooks/python-sdk.ipynb +280 -0
  90. package/package.json +27 -28
  91. package/planqk/__init__.py +0 -0
  92. package/planqk/service/__init__.py +1 -0
  93. package/planqk/service/_version.py +1 -0
  94. package/planqk/service/auth.py +30 -0
  95. package/planqk/service/client.py +151 -0
  96. package/planqk/service/sdk/__init__.py +48 -0
  97. package/planqk/service/sdk/client.py +152 -0
  98. package/planqk/service/sdk/core/__init__.py +47 -0
  99. package/planqk/service/sdk/core/api_error.py +17 -0
  100. package/planqk/service/sdk/core/client_wrapper.py +74 -0
  101. package/planqk/service/sdk/core/datetime_utils.py +30 -0
  102. package/planqk/service/sdk/core/file.py +70 -0
  103. package/planqk/service/sdk/core/http_client.py +575 -0
  104. package/planqk/service/sdk/core/jsonable_encoder.py +103 -0
  105. package/planqk/service/sdk/core/pydantic_utilities.py +323 -0
  106. package/planqk/service/sdk/core/query_encoder.py +60 -0
  107. package/planqk/service/sdk/core/remove_none_from_dict.py +11 -0
  108. package/planqk/service/sdk/core/request_options.py +35 -0
  109. package/planqk/service/sdk/core/serialization.py +276 -0
  110. package/planqk/service/sdk/environment.py +7 -0
  111. package/planqk/service/sdk/errors/__init__.py +15 -0
  112. package/planqk/service/sdk/errors/bad_request_error.py +9 -0
  113. package/planqk/service/sdk/errors/forbidden_error.py +9 -0
  114. package/planqk/service/sdk/errors/internal_server_error.py +9 -0
  115. package/planqk/service/sdk/errors/not_found_error.py +9 -0
  116. package/planqk/service/sdk/errors/unauthorized_error.py +9 -0
  117. package/planqk/service/sdk/service_api/__init__.py +15 -0
  118. package/planqk/service/sdk/service_api/client.py +1257 -0
  119. package/planqk/service/sdk/service_api/types/__init__.py +13 -0
  120. package/planqk/service/sdk/service_api/types/get_result_response.py +30 -0
  121. package/planqk/service/sdk/service_api/types/get_result_response_embedded.py +22 -0
  122. package/planqk/service/sdk/service_api/types/get_result_response_links.py +22 -0
  123. package/planqk/service/sdk/service_api/types/health_check_response.py +24 -0
  124. package/planqk/service/sdk/types/__init__.py +17 -0
  125. package/planqk/service/sdk/types/hal_link.py +59 -0
  126. package/planqk/service/sdk/types/input_data.py +5 -0
  127. package/planqk/service/sdk/types/input_data_ref.py +27 -0
  128. package/planqk/service/sdk/types/input_params.py +5 -0
  129. package/planqk/service/sdk/types/service_execution.py +34 -0
  130. package/planqk/service/sdk/types/service_execution_status.py +8 -0
  131. package/pyproject.toml +51 -0
  132. package/scripts/update-version.sh +6 -0
  133. package/src/client.ts +4 -78
  134. package/src/index.test.ts +43 -0
  135. package/src/sdk/Client.ts +4 -7
  136. package/src/sdk/api/errors/BadRequestError.ts +1 -1
  137. package/src/sdk/api/errors/ForbiddenError.ts +1 -1
  138. package/src/sdk/api/errors/InternalServerError.ts +1 -1
  139. package/src/sdk/api/errors/NotFoundError.ts +1 -1
  140. package/src/sdk/api/errors/UnauthorizedError.ts +1 -1
  141. package/src/sdk/api/resources/index.ts +0 -3
  142. package/src/sdk/api/resources/serviceApi/client/Client.ts +205 -32
  143. package/src/sdk/api/resources/serviceApi/client/index.ts +1 -1
  144. package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +4 -5
  145. package/src/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.ts +9 -0
  146. package/src/sdk/api/resources/serviceApi/types/GetResultResponseLinks.ts +9 -0
  147. package/src/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.ts +1 -0
  148. package/src/sdk/api/resources/serviceApi/types/index.ts +3 -1
  149. package/src/sdk/api/types/HalLink.ts +22 -0
  150. package/src/sdk/api/types/InputData.ts +1 -1
  151. package/src/sdk/api/types/{InputRef.ts → InputDataRef.ts} +1 -1
  152. package/src/sdk/api/types/InputParams.ts +1 -1
  153. package/src/sdk/api/types/{Job.ts → ServiceExecution.ts} +2 -2
  154. package/src/sdk/api/types/{JobStatus.ts → ServiceExecutionStatus.ts} +2 -2
  155. package/src/sdk/api/types/index.ts +4 -8
  156. package/src/sdk/core/fetcher/APIResponse.ts +1 -0
  157. package/src/sdk/core/fetcher/Fetcher.ts +55 -72
  158. package/src/sdk/core/fetcher/createRequestUrl.ts +10 -0
  159. package/src/sdk/core/fetcher/getFetchFn.ts +25 -0
  160. package/src/sdk/core/fetcher/getHeader.ts +8 -0
  161. package/src/sdk/core/fetcher/getRequestBody.ts +14 -0
  162. package/src/sdk/core/fetcher/getResponseBody.ts +32 -0
  163. package/src/sdk/core/fetcher/index.ts +1 -0
  164. package/src/sdk/core/fetcher/makeRequest.ts +44 -0
  165. package/src/sdk/core/fetcher/requestWithRetries.ts +21 -0
  166. package/src/sdk/core/fetcher/signals.ts +38 -0
  167. package/src/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +252 -0
  168. package/src/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +106 -0
  169. package/src/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +239 -0
  170. package/src/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +33 -0
  171. package/src/sdk/core/index.ts +1 -0
  172. package/src/sdk/core/runtime/index.ts +1 -0
  173. package/src/sdk/core/runtime/runtime.ts +126 -0
  174. package/tsconfig.json +15 -107
  175. package/uv.lock +1109 -0
  176. package/.eslintignore +0 -3
  177. package/.eslintrc +0 -7
  178. package/dist/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.d.ts +0 -9
  179. package/dist/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.d.ts +0 -13
  180. package/dist/sdk/api/resources/serviceApi/client/requests/index.d.ts +0 -2
  181. package/dist/sdk/api/resources/serviceApi/client/requests/index.js +0 -2
  182. package/dist/sdk/api/resources/statusApi/client/Client.d.ts +0 -28
  183. package/dist/sdk/api/resources/statusApi/client/Client.js +0 -97
  184. package/dist/sdk/api/resources/statusApi/client/index.d.ts +0 -1
  185. package/dist/sdk/api/resources/statusApi/client/index.js +0 -2
  186. package/dist/sdk/api/resources/statusApi/index.d.ts +0 -2
  187. package/dist/sdk/api/resources/statusApi/index.js +0 -18
  188. package/dist/sdk/api/resources/statusApi/types/index.d.ts +0 -1
  189. package/dist/sdk/api/resources/statusApi/types/index.js +0 -17
  190. package/dist/sdk/api/types/ArrayResponse.d.ts +0 -4
  191. package/dist/sdk/api/types/InterimResultResponse.d.ts +0 -4
  192. package/dist/sdk/api/types/InterimResultResponse.js +0 -5
  193. package/dist/sdk/api/types/Job.js +0 -5
  194. package/dist/sdk/api/types/NumberResponse.d.ts +0 -4
  195. package/dist/sdk/api/types/NumberResponse.js +0 -5
  196. package/dist/sdk/api/types/ObjectResponse.d.ts +0 -4
  197. package/dist/sdk/api/types/ObjectResponse.js +0 -5
  198. package/dist/sdk/api/types/StringResponse.d.ts +0 -4
  199. package/dist/sdk/api/types/StringResponse.js +0 -5
  200. package/jest.config.js +0 -12
  201. package/src/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.ts +0 -10
  202. package/src/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.ts +0 -15
  203. package/src/sdk/api/resources/serviceApi/client/requests/index.ts +0 -2
  204. package/src/sdk/api/resources/serviceApi/types/GetInterimResultsResponse.ts +0 -9
  205. package/src/sdk/api/resources/statusApi/client/Client.ts +0 -75
  206. package/src/sdk/api/resources/statusApi/client/index.ts +0 -1
  207. package/src/sdk/api/resources/statusApi/index.ts +0 -2
  208. package/src/sdk/api/resources/statusApi/types/index.ts +0 -1
  209. package/src/sdk/api/types/ArrayResponse.ts +0 -5
  210. package/src/sdk/api/types/InterimResultResponse.ts +0 -5
  211. package/src/sdk/api/types/NumberResponse.ts +0 -5
  212. package/src/sdk/api/types/ObjectResponse.ts +0 -5
  213. package/src/sdk/api/types/StringResponse.ts +0 -5
  214. package/tests/fixtures/complex-input.ts +0 -477
  215. package/tests/integration.test.ts +0 -92
  216. /package/dist/sdk/api/resources/serviceApi/{client/requests/GetInterimResultsRequest.js → types/GetResultResponseEmbedded.js} +0 -0
  217. /package/dist/sdk/api/resources/serviceApi/{client/requests/StartExecutionRequest.js → types/GetResultResponseLinks.js} +0 -0
  218. /package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.js +0 -0
  219. /package/dist/sdk/api/{resources/serviceApi/types/GetInterimResultsResponse.js → types/HalLink.js} +0 -0
  220. /package/dist/sdk/api/types/{ArrayResponse.js → InputDataRef.js} +0 -0
  221. /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,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ InputData = typing.Dict[str, typing.Dict[str, typing.Optional[typing.Any]]]
@@ -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,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ InputParams = typing.Dict[str, typing.Dict[str, typing.Optional[typing.Any]]]
@@ -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
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ ServiceExecutionStatus = typing.Union[
6
+ typing.Literal["UNKNOWN", "PENDING", "RUNNING", "SUCCEEDED", "CANCELLED", "FAILED"],
7
+ typing.Any,
8
+ ]
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']
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env sh
2
+
3
+ version=${1:-0.0.0}
4
+
5
+ sed -i "s/^__version__ = .*$/__version__ = \"${version}\"/g" planqk/service/_version.py
6
+ sed -i "s/^version = .*$/version = \"${version}\"/g" pyproject.toml
package/src/client.ts CHANGED
@@ -1,16 +1,6 @@
1
1
  import {DEFAULT_TOKEN_ENDPOINT, PlanqkServiceAuth} from './auth'
2
- import {PlanqkServiceApiClient} from './sdk'
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 cancelExecution(jobId: string, requestOptions?: ServiceApi.RequestOptions): Promise<Job> {
34
- return this._api.serviceApi.cancelExecution(jobId, requestOptions)
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 {
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- import * as errors from "../../errors";
5
+ import * as errors from "../../errors/index";
6
6
 
7
7
  export class BadRequestError extends errors.PlanqkServiceApiError {
8
8
  constructor(body?: any) {
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- import * as errors from "../../errors";
5
+ import * as errors from "../../errors/index";
6
6
 
7
7
  export class ForbiddenError extends errors.PlanqkServiceApiError {
8
8
  constructor(body?: any) {
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- import * as errors from "../../errors";
5
+ import * as errors from "../../errors/index";
6
6
 
7
7
  export class InternalServerError extends errors.PlanqkServiceApiError {
8
8
  constructor(body?: any) {
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- import * as errors from "../../errors";
5
+ import * as errors from "../../errors/index";
6
6
 
7
7
  export class NotFoundError extends errors.PlanqkServiceApiError {
8
8
  constructor(body?: any) {
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- import * as errors from "../../errors";
5
+ import * as errors from "../../errors/index";
6
6
 
7
7
  export class UnauthorizedError extends errors.PlanqkServiceApiError {
8
8
  constructor(body?: any) {
@@ -1,5 +1,2 @@
1
- export * as statusApi from "./statusApi";
2
- export * from "./statusApi/types";
3
1
  export * as serviceApi from "./serviceApi";
4
2
  export * from "./serviceApi/types";
5
- export * from "./serviceApi/client/requests";