@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.
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,342 @@
1
+ openapi: 3.0.0
2
+ info:
3
+ version: "1.0"
4
+ title: PLANQK Service API
5
+ description: |
6
+ API description for a managed PLANQK Service.
7
+ paths:
8
+ /:
9
+ get:
10
+ tags:
11
+ - Service API
12
+ summary: Health checking endpoint
13
+ description: |
14
+ This method checks the health of the service.
15
+ operationId: healthCheck
16
+ responses:
17
+ "200":
18
+ description: OK
19
+ content:
20
+ application/json:
21
+ schema:
22
+ type: object
23
+ properties:
24
+ status:
25
+ type: string
26
+ description: Status of the service
27
+ example: "Service is up and running"
28
+ post:
29
+ tags:
30
+ - Service API
31
+ summary: Asynchronous execution of the service
32
+ description: |
33
+ This method starts a service execution, which in turn is processed asynchronously by PLANQK.
34
+ The location header of the response contains the URL which can be used to query the status and the result of the service execution.
35
+ operationId: execute
36
+ requestBody:
37
+ required: true
38
+ content:
39
+ application/json:
40
+ schema:
41
+ type: object
42
+ additionalProperties:
43
+ type: object
44
+ oneOf:
45
+ - required:
46
+ - data
47
+ properties:
48
+ data:
49
+ $ref: '#/components/schemas/InputData'
50
+ params:
51
+ $ref: '#/components/schemas/InputParams'
52
+ - required:
53
+ - dataRef
54
+ properties:
55
+ dataRef:
56
+ $ref: '#/components/schemas/InputDataRef'
57
+ params:
58
+ $ref: '#/components/schemas/InputParams'
59
+ responses:
60
+ "201":
61
+ description: Service execution successfully submitted
62
+ content:
63
+ application/json:
64
+ schema:
65
+ $ref: "#/components/schemas/ServiceExecution"
66
+ headers:
67
+ Location:
68
+ description: URL to query the status and the result of a service execution
69
+ schema:
70
+ type: string
71
+ "400":
72
+ description: Invalid input
73
+ "401":
74
+ description: Unauthorized
75
+ "403":
76
+ description: Forbidden
77
+ "404":
78
+ description: Not found
79
+ "500":
80
+ description: Internal server error
81
+ /{id}:
82
+ get:
83
+ tags:
84
+ - Service API
85
+ summary: Check the status of a service execution
86
+ description: |
87
+ This method checks the status of a service execution.
88
+ operationId: getStatus
89
+ parameters:
90
+ - in: path
91
+ name: id
92
+ required: true
93
+ description: The id of a service execution
94
+ schema:
95
+ type: string
96
+ responses:
97
+ "200":
98
+ description: Ok
99
+ content:
100
+ application/json:
101
+ schema:
102
+ $ref: "#/components/schemas/ServiceExecution"
103
+ "401":
104
+ description: Unauthorized
105
+ "403":
106
+ description: Forbidden
107
+ "404":
108
+ description: Not found
109
+ "500":
110
+ description: Internal server error
111
+ /{id}/result:
112
+ get:
113
+ tags:
114
+ - Service API
115
+ summary: Get the result of a service execution
116
+ description: |
117
+ This method retrieves the result of a service execution.
118
+ operationId: getResult
119
+ parameters:
120
+ - in: path
121
+ name: id
122
+ required: true
123
+ description: The id of a service execution
124
+ schema:
125
+ type: string
126
+ responses:
127
+ "200":
128
+ description: Ok
129
+ content:
130
+ application/json:
131
+ schema:
132
+ type: object
133
+ additionalProperties:
134
+ type: string
135
+ properties:
136
+ _links:
137
+ type: object
138
+ properties:
139
+ status:
140
+ $ref: '#/components/schemas/HALLink'
141
+ additionalProperties:
142
+ $ref: '#/components/schemas/HALLink'
143
+ _embedded:
144
+ type: object
145
+ properties:
146
+ status:
147
+ $ref: '#/components/schemas/ServiceExecution'
148
+ "401":
149
+ description: Unauthorized
150
+ "403":
151
+ description: Forbidden
152
+ "404":
153
+ description: Not found
154
+ "500":
155
+ description: Internal server error
156
+ /{id}/result/{file}:
157
+ get:
158
+ tags:
159
+ - Service API
160
+ summary: Download a result file of a service execution
161
+ description: |
162
+ This method downloads a result file of a service execution.
163
+ operationId: getResultFile
164
+ parameters:
165
+ - in: path
166
+ name: id
167
+ required: true
168
+ description: The id of a service execution
169
+ schema:
170
+ type: string
171
+ - in: path
172
+ name: file
173
+ required: true
174
+ description: The name of the result file
175
+ schema:
176
+ type: string
177
+ responses:
178
+ "200":
179
+ description: Ok
180
+ content:
181
+ application/octet-stream:
182
+ schema:
183
+ type: string
184
+ format: binary
185
+ "401":
186
+ description: Unauthorized
187
+ "403":
188
+ description: Forbidden
189
+ "404":
190
+ description: Not found
191
+ "500":
192
+ description: Internal server error
193
+ /{id}/log:
194
+ get:
195
+ tags:
196
+ - Service API
197
+ summary: Get the log output of a service execution
198
+ description: |
199
+ This method retrieves the log output of a service execution.
200
+ operationId: getLogs
201
+ parameters:
202
+ - in: path
203
+ name: id
204
+ required: true
205
+ description: The id of a service execution
206
+ schema:
207
+ type: string
208
+ responses:
209
+ "200":
210
+ description: Ok
211
+ content:
212
+ application/json:
213
+ schema:
214
+ type: array
215
+ items:
216
+ type: string
217
+ "401":
218
+ description: Unauthorized
219
+ "403":
220
+ description: Forbidden
221
+ "404":
222
+ description: Not found
223
+ "500":
224
+ description: Internal server error
225
+ /{id}/cancel:
226
+ put:
227
+ tags:
228
+ - Service API
229
+ summary: Cancel a service execution
230
+ description: |
231
+ This method cancels a service execution.
232
+ operationId: cancel
233
+ parameters:
234
+ - in: path
235
+ name: id
236
+ required: true
237
+ description: The id of a service execution
238
+ schema:
239
+ type: string
240
+ responses:
241
+ "200":
242
+ description: Ok
243
+ content:
244
+ application/json:
245
+ schema:
246
+ $ref: "#/components/schemas/ServiceExecution"
247
+ "401":
248
+ description: Unauthorized
249
+ "403":
250
+ description: Forbidden
251
+ "404":
252
+ description: Not found
253
+ "500":
254
+ description: Internal server error
255
+ components:
256
+ schemas:
257
+ InputData:
258
+ type: object
259
+ additionalProperties:
260
+ type: object
261
+ InputParams:
262
+ type: object
263
+ additionalProperties:
264
+ type: object
265
+ InputDataRef:
266
+ type: object
267
+ properties:
268
+ dataPoolId:
269
+ type: string
270
+ example: 87cb778e-ac43-11ec-b909-0242ac120002
271
+ dataSourceDescriptorId:
272
+ type: string
273
+ example: 87cb778e-ac43-11ec-b909-0242ac120002
274
+ fileId:
275
+ type: string
276
+ example: 87cb778e-ac43-11ec-b909-0242ac120002
277
+ required:
278
+ - dataPoolId
279
+ - dataSourceDescriptorId
280
+ - fileId
281
+ ServiceExecution:
282
+ type: object
283
+ properties:
284
+ id:
285
+ type: string
286
+ example: 87cb778e-ac43-11ec-b909-0242ac120002
287
+ status:
288
+ type: string
289
+ enum: [UNKNOWN, PENDING, RUNNING, SUCCEEDED, CANCELLED, FAILED]
290
+ example: SUCCEEDED
291
+ createdAt:
292
+ type: string
293
+ example: "2022-01-01 22:38:08"
294
+ startedAt:
295
+ type: string
296
+ example: "2022-01-01 22:39:08"
297
+ endedAt:
298
+ type: string
299
+ example: "2022-01-01 22:40:08"
300
+ # Representation of link as defined in HAL: https://datatracker.ietf.org/doc/html/draft-kelly-json-hal-11
301
+ HALLink:
302
+ type: object
303
+ properties:
304
+ href:
305
+ type: string
306
+ description: The URL of the link
307
+ templated:
308
+ type: boolean
309
+ description: Whether the link is templated (optional)
310
+ default: false
311
+ type:
312
+ type: string
313
+ description: The media type of the link (optional)
314
+ deprecation:
315
+ type: string
316
+ description: A URL that provides further information about the deprecation of the link (optional)
317
+ name:
318
+ type: string
319
+ description: The name of the link (optional)
320
+ profile:
321
+ type: string
322
+ description: A URL that provides further information about the profile of the link (optional)
323
+ title:
324
+ type: string
325
+ description: The title of the link (optional)
326
+ hreflang:
327
+ type: string
328
+ description: The language of the link's target resource (optional)
329
+
330
+ securitySchemes:
331
+ oauthClientCredentials:
332
+ type: oauth2
333
+ flows:
334
+ clientCredentials:
335
+ tokenUrl: https://gateway.platform.planqk.de/token
336
+ scopes: {}
337
+
338
+ servers:
339
+ - url: https://gateway.platform.planqk.de
340
+
341
+ security:
342
+ - oauthClientCredentials: []
@@ -0,0 +1,280 @@
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": [
7
+ "## Python SDK"
8
+ ]
9
+ },
10
+ {
11
+ "cell_type": "code",
12
+ "execution_count": null,
13
+ "metadata": {
14
+ "jupyter": {
15
+ "is_executing": true
16
+ }
17
+ },
18
+ "outputs": [],
19
+ "source": [
20
+ "import os\n",
21
+ "from dotenv import load_dotenv\n",
22
+ "\n",
23
+ "# Make a copy of .env.example and rename it to .env, place it in the \n",
24
+ "# root directory, and fill in the values.\n",
25
+ "\n",
26
+ "load_dotenv(override=True)\n",
27
+ "\n",
28
+ "token_endpoint = os.getenv(\"TOKEN_ENDPOINT\", None)\n",
29
+ "service_endpoint = os.getenv(\"SERVICE_ENDPOINT\", None)\n",
30
+ "consumer_key = os.getenv(\"CONSUMER_KEY\", None)\n",
31
+ "consumer_secret = os.getenv(\"CONSUMER_SECRET\", None)\n",
32
+ "\n",
33
+ "print(f\"Token endpoint: {token_endpoint}\")\n",
34
+ "print(f\"Service endpoint: {service_endpoint}\")\n",
35
+ "print(f\"Consumer key: {consumer_key}\")\n",
36
+ "print(f\"Consumer secret: {consumer_secret}\")"
37
+ ]
38
+ },
39
+ {
40
+ "cell_type": "markdown",
41
+ "metadata": {},
42
+ "source": [
43
+ "### Usage"
44
+ ]
45
+ },
46
+ {
47
+ "cell_type": "code",
48
+ "execution_count": null,
49
+ "metadata": {},
50
+ "outputs": [],
51
+ "source": [
52
+ "from planqk.service.client import PlanqkServiceClient\n",
53
+ "\n",
54
+ "# Create a client\n",
55
+ "client = PlanqkServiceClient(\n",
56
+ " service_endpoint, consumer_key, consumer_secret, token_endpoint\n",
57
+ ")\n",
58
+ "\n",
59
+ "# Start a service execution\n",
60
+ "data = {\"n_coin_tosses\": 3}\n",
61
+ "service_execution = client.run(request={\"data\": data})\n",
62
+ "\n",
63
+ "# Wait for the service execution to finish (blocking)\n",
64
+ "service_execution.wait_for_final_state()\n",
65
+ "\n",
66
+ "status = service_execution.status\n",
67
+ "ended_at = service_execution.ended_at\n",
68
+ "print(f\"Service execution finished at '{ended_at}' with status '{status}'\")"
69
+ ]
70
+ },
71
+ {
72
+ "cell_type": "code",
73
+ "execution_count": 3,
74
+ "metadata": {},
75
+ "outputs": [
76
+ {
77
+ "name": "stdout",
78
+ "output_type": "stream",
79
+ "text": [
80
+ "Service execution finished at '2025-03-14 06:35:36' with status 'SUCCEEDED'\n"
81
+ ]
82
+ }
83
+ ],
84
+ "source": [
85
+ "# You may perform other operations while waiting for the service execution to finish\n",
86
+ "while not service_execution.has_finished:\n",
87
+ " print(\"Waiting for service execution to finish...\")\n",
88
+ "\n",
89
+ "# Alternatively, you may poll the service execution status\n",
90
+ "while service_execution.status not in [\"SUCCEEDED\", \"FAILED\", \"CANCELLED\"]:\n",
91
+ " service_execution.refresh()\n",
92
+ "\n",
93
+ "status = service_execution.status\n",
94
+ "ended_at = service_execution.ended_at\n",
95
+ "print(f\"Service execution finished at '{ended_at}' with status '{status}'\")"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "code",
100
+ "execution_count": 13,
101
+ "metadata": {},
102
+ "outputs": [
103
+ {
104
+ "name": "stdout",
105
+ "output_type": "stream",
106
+ "text": [
107
+ "Service execution finished at '2025-03-14 06:35:36' with status 'SUCCEEDED'\n"
108
+ ]
109
+ }
110
+ ],
111
+ "source": [
112
+ "# Use the client to retrieve a service execution by its id\n",
113
+ "service_execution = client.get_service_execution(\"0030737b-35cb-46a8-88c2-f59d4885484d\")\n",
114
+ "\n",
115
+ "status = service_execution.status\n",
116
+ "ended_at = service_execution.ended_at\n",
117
+ "print(f\"Service execution finished at '{ended_at}' with status '{status}'\")"
118
+ ]
119
+ },
120
+ {
121
+ "cell_type": "code",
122
+ "execution_count": 14,
123
+ "metadata": {},
124
+ "outputs": [
125
+ {
126
+ "name": "stdout",
127
+ "output_type": "stream",
128
+ "text": [
129
+ "{'000': 10, '001': 7, '010': 18, '011': 14, '100': 16, '101': 7, '110': 14, '111': 14}\n"
130
+ ]
131
+ }
132
+ ],
133
+ "source": [
134
+ "# Retrieve the result\n",
135
+ "result = service_execution.result()\n",
136
+ "\n",
137
+ "print(result.counts)"
138
+ ]
139
+ },
140
+ {
141
+ "cell_type": "code",
142
+ "execution_count": 15,
143
+ "metadata": {},
144
+ "outputs": [
145
+ {
146
+ "name": "stdout",
147
+ "output_type": "stream",
148
+ "text": [
149
+ "...\n",
150
+ "PlanQK:Job:MultilineResult\n",
151
+ "2025-03-14 06:35:35.424 | DEBUG | qsharp.telemetry:callHandlers:1706 - In on_exit handler\n",
152
+ "2025-03-14 06:35:35.424 | DEBUG | qsharp.telemetry:callHandlers:1706 - Exiting telemetry thread\n",
153
+ "2025-03-14 06:35:35.424 | DEBUG | qsharp.telemetry:callHandlers:1706 - Sending telemetry request: b'[{\"ver\": 1, \"name\": \"Microsoft.ApplicationInsights.Metric\", \"time\": \"2025-03-14T06:35:35.424270Z\", \"sampleRate\": 100.0, \"iKey\": \"95d25b22-8b6d-448e-9677-78ad4047a95a\", \"tags\": {\"ai.device.locale\": \"en_US\", \"ai.device.osVersion\": \"#1 SMP PREEMPT_DYNAMIC Thu Jan 16 17:10:14 UTC 2025\"}, \"data\": {\"baseType\": \"MetricData\", \"baseData\": {\"ver\": 2, \"metrics\": [{\"name\": \"qsharp.import\", \"value\": 1, \"count\": 1}], \"properties\": {\"qsharp.version\": \"1.13.2\"}}}}]'\n",
154
+ "2025-03-14 06:35:36.073 | DEBUG | qsharp.telemetry:callHandlers:1706 - Telemetry response: 200\n"
155
+ ]
156
+ }
157
+ ],
158
+ "source": [
159
+ "# Retrieve service execution logs\n",
160
+ "logs = service_execution.logs()\n",
161
+ "\n",
162
+ "print(\"...\")\n",
163
+ "for log in logs[-5:]:\n",
164
+ " print(log)"
165
+ ]
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "execution_count": 11,
170
+ "metadata": {},
171
+ "outputs": [
172
+ {
173
+ "name": "stdout",
174
+ "output_type": "stream",
175
+ "text": [
176
+ "['hello.jpg', 'hello.txt', 'output.json']\n"
177
+ ]
178
+ }
179
+ ],
180
+ "source": [
181
+ "import os\n",
182
+ "\n",
183
+ "# List the result files\n",
184
+ "files = service_execution.result_files()\n",
185
+ "\n",
186
+ "# Download the result files\n",
187
+ "cwd = os.getcwd()\n",
188
+ "for file in files:\n",
189
+ " service_execution.download_result_file(file, cwd)\n",
190
+ "\n",
191
+ "print(files)"
192
+ ]
193
+ },
194
+ {
195
+ "cell_type": "code",
196
+ "execution_count": null,
197
+ "metadata": {},
198
+ "outputs": [],
199
+ "source": [
200
+ "# Alternatively, you may access the raw byte stream\n",
201
+ "file_stream = service_execution.result_file_stream(\"output.json\")\n",
202
+ "\n",
203
+ "with open(\"output.json\", \"wb\") as f:\n",
204
+ " for chunk in file_stream:\n",
205
+ " f.write(chunk)"
206
+ ]
207
+ },
208
+ {
209
+ "cell_type": "markdown",
210
+ "metadata": {},
211
+ "source": [
212
+ "### Use a Data Pool as Input Data"
213
+ ]
214
+ },
215
+ {
216
+ "cell_type": "code",
217
+ "execution_count": null,
218
+ "metadata": {},
219
+ "outputs": [],
220
+ "source": [
221
+ "import json\n",
222
+ "from planqk.service.sdk.types.input_data_ref import InputDataRef\n",
223
+ "\n",
224
+ "# Create a client\n",
225
+ "client = PlanqkServiceClient(\n",
226
+ " service_endpoint, consumer_key, consumer_secret, token_endpoint\n",
227
+ ")\n",
228
+ "\n",
229
+ "# Use the InputDataRef class to define a reference to a file in a data pool.\n",
230
+ "# Create a data pools, and upload a file called 'data.json'. Use the \"Copy File Reference\"\n",
231
+ "# button in the PLANQK Data Pool UI to copy the data pool id, data source descriptor id, and file id.\n",
232
+ "file_reference = {\n",
233
+ " \"dataPoolId\": \"9b943af3-ca78-4d6e-87fd-33129f5330a2\",\n",
234
+ " \"dataSourceDescriptorId\": \"a1e4f7ab-82d5-4158-98c3-3562635cedd2\",\n",
235
+ " \"fileId\": \"f9b5c9a2-0101-46a8-9958-383670a2cef4\",\n",
236
+ "}\n",
237
+ "\n",
238
+ "data = InputDataRef.model_validate(\n",
239
+ " {\n",
240
+ " \"data_pool_id\": file_reference[\"dataPoolId\"],\n",
241
+ " \"data_source_descriptor_id\": file_reference[\"dataSourceDescriptorId\"],\n",
242
+ " \"file_id\": file_reference[\"fileId\"],\n",
243
+ " }\n",
244
+ ")\n",
245
+ "params = {\"some_attribute\": True}\n",
246
+ "\n",
247
+ "# Start a service execution\n",
248
+ "service_execution = client.run({\"dataRef\": data, \"params\": params})\n",
249
+ "\n",
250
+ "# Wait for the service execution to finish (blocking)\n",
251
+ "service_execution.wait_for_final_state()\n",
252
+ "\n",
253
+ "status = service_execution.status\n",
254
+ "ended_at = service_execution.ended_at\n",
255
+ "print(f\"Service execution finished at '{ended_at}' with status '{status}'\")"
256
+ ]
257
+ }
258
+ ],
259
+ "metadata": {
260
+ "kernelspec": {
261
+ "display_name": ".venv",
262
+ "language": "python",
263
+ "name": "python3"
264
+ },
265
+ "language_info": {
266
+ "codemirror_mode": {
267
+ "name": "ipython",
268
+ "version": 3
269
+ },
270
+ "file_extension": ".py",
271
+ "mimetype": "text/x-python",
272
+ "name": "python",
273
+ "nbconvert_exporter": "python",
274
+ "pygments_lexer": "ipython3",
275
+ "version": "3.11.11"
276
+ }
277
+ },
278
+ "nbformat": 4,
279
+ "nbformat_minor": 2
280
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@planqk/planqk-service-sdk",
3
- "version": "1.9.0",
4
- "description": "Typescript SDK to execute PlanQK Managed Services.",
3
+ "version": "2.1.0",
4
+ "description": "SDK to interact with PLANQK Managed Services.",
5
5
  "author": "Kipu Quantum GmbH",
6
6
  "contributors": [
7
7
  "Wurster, Michael <michael.wurster@kipu-quantum.com>"
@@ -11,41 +11,40 @@
11
11
  "type": "git",
12
12
  "url": "git+https://gitlab.com/planqk-foss/planqk-service-sdk.git"
13
13
  },
14
- "keywords": [
15
- "planqk"
16
- ],
17
14
  "main": "dist/index.js",
18
15
  "types": "dist/index.d.ts",
19
16
  "scripts": {
20
17
  "build": "shx rm -rf dist && tsc -b",
21
- "lint": "eslint . --ext .ts --config .eslintrc",
22
- "test": "jest --coverage"
18
+ "lint": "eslint",
19
+ "test": "vitest"
20
+ },
21
+ "dependencies": {
22
+ "form-data": "^4",
23
+ "form-data-encoder": "^4",
24
+ "formdata-node": "^6",
25
+ "js-base64": "^3",
26
+ "node-fetch": "^3",
27
+ "qs": "^6",
28
+ "readable-stream": "^4",
29
+ "simple-oauth2": "^5",
30
+ "url-join": "^5"
23
31
  },
24
32
  "devDependencies": {
25
- "@types/jest": "^29.5.11",
26
- "@types/qs": "^6.9.10",
27
- "@types/simple-oauth2": "^5.0.7",
28
- "@types/url-join": "^4.0.3",
29
- "dotenv": "^16.3.1",
30
- "eslint": "^8.55.0",
31
- "eslint-config-oclif": "^5.0.0",
32
- "eslint-config-oclif-typescript": "^3.0.26",
33
- "jest": "^29.7.0",
33
+ "@types/node": "^22",
34
+ "@types/node-fetch": "^2",
35
+ "@types/qs": "^6",
36
+ "@types/simple-oauth2": "^5",
37
+ "@types/url-join": "^4",
38
+ "dotenv": "^16",
39
+ "eslint": "^9",
34
40
  "shx": "^0.3.4",
35
- "ts-jest": "^29.1.1",
36
- "typescript": "^4.6.4"
37
- },
38
- "dependencies": {
39
- "@ungap/url-search-params": "^0.2.2",
40
- "axios": "^0.27.2",
41
- "form-data": "^4.0.0",
42
- "js-base64": "^3.7.5",
43
- "qs": "^6.11.2",
44
- "simple-oauth2": "^5.0.0",
45
- "url-join": "^4.0.1"
41
+ "typescript": "^5",
42
+ "typescript-eslint": "^8",
43
+ "vitest": "^3"
46
44
  },
47
45
  "private": false,
48
46
  "publishConfig": {
49
47
  "access": "public"
50
- }
48
+ },
49
+ "readme": "./README-node.md"
51
50
  }
File without changes
@@ -0,0 +1 @@
1
+ from ._version import __version__