@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
@@ -5,8 +5,9 @@
5
5
  import * as environments from "../../../../environments";
6
6
  import * as core from "../../../../core";
7
7
  import * as PlanqkServiceApi from "../../../index";
8
- import * as errors from "../../../../errors";
8
+ import * as errors from "../../../../errors/index";
9
9
  import urlJoin from "url-join";
10
+ import * as stream from "stream";
10
11
 
11
12
  export declare namespace ServiceApi {
12
13
  interface Options {
@@ -15,8 +16,12 @@ export declare namespace ServiceApi {
15
16
  }
16
17
 
17
18
  interface RequestOptions {
19
+ /** The maximum time to wait for a response in seconds. */
18
20
  timeoutInSeconds?: number;
21
+ /** The number of times to retry the request. Defaults to 2. */
19
22
  maxRetries?: number;
23
+ /** A hook to abort the request. */
24
+ abortSignal?: AbortSignal;
20
25
  }
21
26
  }
22
27
 
@@ -24,7 +29,67 @@ export class ServiceApi {
24
29
  constructor(protected readonly _options: ServiceApi.Options) {}
25
30
 
26
31
  /**
27
- * This method starts an execution of the service, which in turn is processed asynchronously by the platform. The location header of the response contains the URL which can be used to query the status and the result of the execution.
32
+ * This method checks the health of the service.
33
+ *
34
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @example
37
+ * await client.serviceApi.healthCheck()
38
+ */
39
+ public async healthCheck(
40
+ requestOptions?: ServiceApi.RequestOptions
41
+ ): Promise<PlanqkServiceApi.HealthCheckResponse> {
42
+ const _response = await core.fetcher({
43
+ url:
44
+ (await core.Supplier.get(this._options.environment)) ??
45
+ environments.PlanqkServiceApiEnvironment.Default,
46
+ method: "GET",
47
+ headers: {
48
+ Authorization: await this._getAuthorizationHeader(),
49
+ "X-Fern-Language": "JavaScript",
50
+ "X-Fern-Runtime": core.RUNTIME.type,
51
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
52
+ },
53
+ contentType: "application/json",
54
+ requestType: "json",
55
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
56
+ maxRetries: requestOptions?.maxRetries,
57
+ withCredentials: true,
58
+ abortSignal: requestOptions?.abortSignal,
59
+ });
60
+ if (_response.ok) {
61
+ return _response.body as PlanqkServiceApi.HealthCheckResponse;
62
+ }
63
+
64
+ if (_response.error.reason === "status-code") {
65
+ throw new errors.PlanqkServiceApiError({
66
+ statusCode: _response.error.statusCode,
67
+ body: _response.error.body,
68
+ });
69
+ }
70
+
71
+ switch (_response.error.reason) {
72
+ case "non-json":
73
+ throw new errors.PlanqkServiceApiError({
74
+ statusCode: _response.error.statusCode,
75
+ body: _response.error.rawBody,
76
+ });
77
+ case "timeout":
78
+ throw new errors.PlanqkServiceApiTimeoutError();
79
+ case "unknown":
80
+ throw new errors.PlanqkServiceApiError({
81
+ message: _response.error.errorMessage,
82
+ });
83
+ }
84
+ }
85
+
86
+ /**
87
+ * This method starts a service execution, which in turn is processed asynchronously by PLANQK.
88
+ * The location header of the response contains the URL which can be used to query the status and the result of the service execution.
89
+ *
90
+ * @param {Record<string, Record<string, any>>} request
91
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
92
+ *
28
93
  * @throws {@link PlanqkServiceApi.BadRequestError}
29
94
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
30
95
  * @throws {@link PlanqkServiceApi.ForbiddenError}
@@ -32,12 +97,16 @@ export class ServiceApi {
32
97
  * @throws {@link PlanqkServiceApi.InternalServerError}
33
98
  *
34
99
  * @example
35
- * await planqkServiceApi.serviceApi.startExecution({})
100
+ * await client.serviceApi.execute({
101
+ * "key": {
102
+ * "key": "value"
103
+ * }
104
+ * })
36
105
  */
37
- public async startExecution(
38
- request: PlanqkServiceApi.StartExecutionRequest = {},
106
+ public async execute(
107
+ request: Record<string, Record<string, any>>,
39
108
  requestOptions?: ServiceApi.RequestOptions
40
- ): Promise<PlanqkServiceApi.Job> {
109
+ ): Promise<PlanqkServiceApi.ServiceExecution> {
41
110
  const _response = await core.fetcher({
42
111
  url:
43
112
  (await core.Supplier.get(this._options.environment)) ??
@@ -46,15 +115,19 @@ export class ServiceApi {
46
115
  headers: {
47
116
  Authorization: await this._getAuthorizationHeader(),
48
117
  "X-Fern-Language": "JavaScript",
118
+ "X-Fern-Runtime": core.RUNTIME.type,
119
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
49
120
  },
50
121
  contentType: "application/json",
122
+ requestType: "json",
51
123
  body: request,
52
124
  timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
53
125
  maxRetries: requestOptions?.maxRetries,
54
126
  withCredentials: true,
127
+ abortSignal: requestOptions?.abortSignal,
55
128
  });
56
129
  if (_response.ok) {
57
- return _response.body as PlanqkServiceApi.Job;
130
+ return _response.body as PlanqkServiceApi.ServiceExecution;
58
131
  }
59
132
 
60
133
  if (_response.error.reason === "status-code") {
@@ -93,34 +166,45 @@ export class ServiceApi {
93
166
  }
94
167
 
95
168
  /**
96
- * Checks the status of a service execution.
169
+ * This method checks the status of a service execution.
170
+ *
171
+ * @param {string} id - The id of a service execution
172
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
173
+ *
97
174
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
98
175
  * @throws {@link PlanqkServiceApi.ForbiddenError}
99
176
  * @throws {@link PlanqkServiceApi.NotFoundError}
100
177
  * @throws {@link PlanqkServiceApi.InternalServerError}
101
178
  *
102
179
  * @example
103
- * await planqkServiceApi.serviceApi.getStatus("id")
180
+ * await client.serviceApi.getStatus("id")
104
181
  */
105
- public async getStatus(id: string, requestOptions?: ServiceApi.RequestOptions): Promise<PlanqkServiceApi.Job> {
182
+ public async getStatus(
183
+ id: string,
184
+ requestOptions?: ServiceApi.RequestOptions
185
+ ): Promise<PlanqkServiceApi.ServiceExecution> {
106
186
  const _response = await core.fetcher({
107
187
  url: urlJoin(
108
188
  (await core.Supplier.get(this._options.environment)) ??
109
189
  environments.PlanqkServiceApiEnvironment.Default,
110
- `${id}`
190
+ `${encodeURIComponent(id)}`
111
191
  ),
112
192
  method: "GET",
113
193
  headers: {
114
194
  Authorization: await this._getAuthorizationHeader(),
115
195
  "X-Fern-Language": "JavaScript",
196
+ "X-Fern-Runtime": core.RUNTIME.type,
197
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
116
198
  },
117
199
  contentType: "application/json",
200
+ requestType: "json",
118
201
  timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
119
202
  maxRetries: requestOptions?.maxRetries,
120
203
  withCredentials: true,
204
+ abortSignal: requestOptions?.abortSignal,
121
205
  });
122
206
  if (_response.ok) {
123
- return _response.body as PlanqkServiceApi.Job;
207
+ return _response.body as PlanqkServiceApi.ServiceExecution;
124
208
  }
125
209
 
126
210
  if (_response.error.reason === "status-code") {
@@ -157,11 +241,18 @@ export class ServiceApi {
157
241
  }
158
242
 
159
243
  /**
160
- * Gets the result of a service execution.
244
+ * This method retrieves the result of a service execution.
245
+ *
246
+ * @param {string} id - The id of a service execution
247
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
248
+ *
161
249
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
162
250
  * @throws {@link PlanqkServiceApi.ForbiddenError}
163
251
  * @throws {@link PlanqkServiceApi.NotFoundError}
164
252
  * @throws {@link PlanqkServiceApi.InternalServerError}
253
+ *
254
+ * @example
255
+ * await client.serviceApi.getResult("id")
165
256
  */
166
257
  public async getResult(
167
258
  id: string,
@@ -171,17 +262,21 @@ export class ServiceApi {
171
262
  url: urlJoin(
172
263
  (await core.Supplier.get(this._options.environment)) ??
173
264
  environments.PlanqkServiceApiEnvironment.Default,
174
- `${id}/result`
265
+ `${encodeURIComponent(id)}/result`
175
266
  ),
176
267
  method: "GET",
177
268
  headers: {
178
269
  Authorization: await this._getAuthorizationHeader(),
179
270
  "X-Fern-Language": "JavaScript",
271
+ "X-Fern-Runtime": core.RUNTIME.type,
272
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
180
273
  },
181
274
  contentType: "application/json",
275
+ requestType: "json",
182
276
  timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
183
277
  maxRetries: requestOptions?.maxRetries,
184
278
  withCredentials: true,
279
+ abortSignal: requestOptions?.abortSignal,
185
280
  });
186
281
  if (_response.ok) {
187
282
  return _response.body as PlanqkServiceApi.GetResultResponse;
@@ -221,42 +316,112 @@ export class ServiceApi {
221
316
  }
222
317
 
223
318
  /**
224
- * Gets the last or a list of interim results of a service execution.
319
+ * This method downloads a result file of a service execution.
225
320
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
226
321
  * @throws {@link PlanqkServiceApi.ForbiddenError}
227
322
  * @throws {@link PlanqkServiceApi.NotFoundError}
228
323
  * @throws {@link PlanqkServiceApi.InternalServerError}
229
324
  */
230
- public async getInterimResults(
325
+ public async getResultFile(
231
326
  id: string,
232
- request: PlanqkServiceApi.GetInterimResultsRequest = {},
327
+ file: string,
233
328
  requestOptions?: ServiceApi.RequestOptions
234
- ): Promise<PlanqkServiceApi.GetInterimResultsResponse> {
235
- const { last } = request;
236
- const _queryParams: Record<string, string | string[]> = {};
237
- if (last != null) {
238
- _queryParams["last"] = last.toString();
329
+ ): Promise<stream.Readable> {
330
+ const _response = await core.fetcher<stream.Readable>({
331
+ url: urlJoin(
332
+ (await core.Supplier.get(this._options.environment)) ??
333
+ environments.PlanqkServiceApiEnvironment.Default,
334
+ `${encodeURIComponent(id)}/result/${encodeURIComponent(file)}`
335
+ ),
336
+ method: "GET",
337
+ headers: {
338
+ Authorization: await this._getAuthorizationHeader(),
339
+ "X-Fern-Language": "JavaScript",
340
+ "X-Fern-Runtime": core.RUNTIME.type,
341
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
342
+ },
343
+ contentType: "application/json",
344
+ requestType: "json",
345
+ responseType: "streaming",
346
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
347
+ maxRetries: requestOptions?.maxRetries,
348
+ withCredentials: true,
349
+ abortSignal: requestOptions?.abortSignal,
350
+ });
351
+ if (_response.ok) {
352
+ return _response.body;
353
+ }
354
+
355
+ if (_response.error.reason === "status-code") {
356
+ switch (_response.error.statusCode) {
357
+ case 401:
358
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body as any);
359
+ case 403:
360
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body as any);
361
+ case 404:
362
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body as any);
363
+ case 500:
364
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body as any);
365
+ default:
366
+ throw new errors.PlanqkServiceApiError({
367
+ statusCode: _response.error.statusCode,
368
+ body: _response.error.body,
369
+ });
370
+ }
239
371
  }
240
372
 
373
+ switch (_response.error.reason) {
374
+ case "non-json":
375
+ throw new errors.PlanqkServiceApiError({
376
+ statusCode: _response.error.statusCode,
377
+ body: _response.error.rawBody,
378
+ });
379
+ case "timeout":
380
+ throw new errors.PlanqkServiceApiTimeoutError();
381
+ case "unknown":
382
+ throw new errors.PlanqkServiceApiError({
383
+ message: _response.error.errorMessage,
384
+ });
385
+ }
386
+ }
387
+
388
+ /**
389
+ * This method retrieves the log output of a service execution.
390
+ *
391
+ * @param {string} id - The id of a service execution
392
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
393
+ *
394
+ * @throws {@link PlanqkServiceApi.UnauthorizedError}
395
+ * @throws {@link PlanqkServiceApi.ForbiddenError}
396
+ * @throws {@link PlanqkServiceApi.NotFoundError}
397
+ * @throws {@link PlanqkServiceApi.InternalServerError}
398
+ *
399
+ * @example
400
+ * await client.serviceApi.getLogs("id")
401
+ */
402
+ public async getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): Promise<string[]> {
241
403
  const _response = await core.fetcher({
242
404
  url: urlJoin(
243
405
  (await core.Supplier.get(this._options.environment)) ??
244
406
  environments.PlanqkServiceApiEnvironment.Default,
245
- `${id}/interim-results`
407
+ `${encodeURIComponent(id)}/log`
246
408
  ),
247
409
  method: "GET",
248
410
  headers: {
249
411
  Authorization: await this._getAuthorizationHeader(),
250
412
  "X-Fern-Language": "JavaScript",
413
+ "X-Fern-Runtime": core.RUNTIME.type,
414
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
251
415
  },
252
416
  contentType: "application/json",
253
- queryParameters: _queryParams,
417
+ requestType: "json",
254
418
  timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
255
419
  maxRetries: requestOptions?.maxRetries,
256
420
  withCredentials: true,
421
+ abortSignal: requestOptions?.abortSignal,
257
422
  });
258
423
  if (_response.ok) {
259
- return _response.body as PlanqkServiceApi.GetInterimResultsResponse;
424
+ return _response.body as string[];
260
425
  }
261
426
 
262
427
  if (_response.error.reason === "status-code") {
@@ -293,37 +458,45 @@ export class ServiceApi {
293
458
  }
294
459
 
295
460
  /**
296
- * Cancels a running service execution.
461
+ * This method cancels a service execution.
462
+ *
463
+ * @param {string} id - The id of a service execution
464
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
465
+ *
297
466
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
298
467
  * @throws {@link PlanqkServiceApi.ForbiddenError}
299
468
  * @throws {@link PlanqkServiceApi.NotFoundError}
300
469
  * @throws {@link PlanqkServiceApi.InternalServerError}
301
470
  *
302
471
  * @example
303
- * await planqkServiceApi.serviceApi.cancelExecution("id")
472
+ * await client.serviceApi.cancel("id")
304
473
  */
305
- public async cancelExecution(
474
+ public async cancel(
306
475
  id: string,
307
476
  requestOptions?: ServiceApi.RequestOptions
308
- ): Promise<PlanqkServiceApi.Job> {
477
+ ): Promise<PlanqkServiceApi.ServiceExecution> {
309
478
  const _response = await core.fetcher({
310
479
  url: urlJoin(
311
480
  (await core.Supplier.get(this._options.environment)) ??
312
481
  environments.PlanqkServiceApiEnvironment.Default,
313
- `${id}/cancel`
482
+ `${encodeURIComponent(id)}/cancel`
314
483
  ),
315
484
  method: "PUT",
316
485
  headers: {
317
486
  Authorization: await this._getAuthorizationHeader(),
318
487
  "X-Fern-Language": "JavaScript",
488
+ "X-Fern-Runtime": core.RUNTIME.type,
489
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
319
490
  },
320
491
  contentType: "application/json",
492
+ requestType: "json",
321
493
  timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
322
494
  maxRetries: requestOptions?.maxRetries,
323
495
  withCredentials: true,
496
+ abortSignal: requestOptions?.abortSignal,
324
497
  });
325
498
  if (_response.ok) {
326
- return _response.body as PlanqkServiceApi.Job;
499
+ return _response.body as PlanqkServiceApi.ServiceExecution;
327
500
  }
328
501
 
329
502
  if (_response.error.reason === "status-code") {
@@ -359,7 +532,7 @@ export class ServiceApi {
359
532
  }
360
533
  }
361
534
 
362
- protected async _getAuthorizationHeader() {
535
+ protected async _getAuthorizationHeader(): Promise<string> {
363
536
  return `Bearer ${await core.Supplier.get(this._options.token)}`;
364
537
  }
365
538
  }
@@ -1 +1 @@
1
- export * from "./requests";
1
+ export {};
@@ -4,8 +4,7 @@
4
4
 
5
5
  import * as PlanqkServiceApi from "../../../index";
6
6
 
7
- export type GetResultResponse =
8
- | PlanqkServiceApi.ObjectResponse
9
- | PlanqkServiceApi.StringResponse
10
- | PlanqkServiceApi.NumberResponse
11
- | PlanqkServiceApi.ArrayResponse;
7
+ export interface GetResultResponse {
8
+ _links?: PlanqkServiceApi.GetResultResponseLinks;
9
+ _embedded?: PlanqkServiceApi.GetResultResponseEmbedded;
10
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+
5
+ import * as PlanqkServiceApi from "../../../index";
6
+
7
+ export interface GetResultResponseEmbedded {
8
+ status?: PlanqkServiceApi.ServiceExecution;
9
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+
5
+ import * as PlanqkServiceApi from "../../../index";
6
+
7
+ export interface GetResultResponseLinks {
8
+ status?: PlanqkServiceApi.HalLink;
9
+ }
@@ -3,5 +3,6 @@
3
3
  */
4
4
 
5
5
  export interface HealthCheckResponse {
6
+ /** Status of the service */
6
7
  status?: string;
7
8
  }
@@ -1,2 +1,4 @@
1
+ export * from "./HealthCheckResponse";
2
+ export * from "./GetResultResponseLinks";
3
+ export * from "./GetResultResponseEmbedded";
1
4
  export * from "./GetResultResponse";
2
- export * from "./GetInterimResultsResponse";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+
5
+ export interface HalLink {
6
+ /** The URL of the link */
7
+ href?: string;
8
+ /** Whether the link is templated (optional) */
9
+ templated?: boolean;
10
+ /** The media type of the link (optional) */
11
+ type?: string;
12
+ /** A URL that provides further information about the deprecation of the link (optional) */
13
+ deprecation?: string;
14
+ /** The name of the link (optional) */
15
+ name?: string;
16
+ /** A URL that provides further information about the profile of the link (optional) */
17
+ profile?: string;
18
+ /** The title of the link (optional) */
19
+ title?: string;
20
+ /** The language of the link's target resource (optional) */
21
+ hreflang?: string;
22
+ }
@@ -2,4 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- export type InputData = Record<string, any>;
5
+ export type InputData = Record<string, Record<string, any>>;
@@ -2,7 +2,7 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- export interface InputRef {
5
+ export interface InputDataRef {
6
6
  dataPoolId: string;
7
7
  dataSourceDescriptorId: string;
8
8
  fileId: string;
@@ -2,4 +2,4 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- export type InputParams = Record<string, any>;
5
+ export type InputParams = Record<string, Record<string, any>>;
@@ -4,9 +4,9 @@
4
4
 
5
5
  import * as PlanqkServiceApi from "../index";
6
6
 
7
- export interface Job {
7
+ export interface ServiceExecution {
8
8
  id?: string;
9
- status?: PlanqkServiceApi.JobStatus;
9
+ status?: PlanqkServiceApi.ServiceExecutionStatus;
10
10
  createdAt?: string;
11
11
  startedAt?: string;
12
12
  endedAt?: string;
@@ -2,9 +2,9 @@
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
4
 
5
- export type JobStatus = "UNKNOWN" | "PENDING" | "RUNNING" | "SUCCEEDED" | "CANCELLED" | "FAILED";
5
+ export type ServiceExecutionStatus = "UNKNOWN" | "PENDING" | "RUNNING" | "SUCCEEDED" | "CANCELLED" | "FAILED";
6
6
 
7
- export const JobStatus = {
7
+ export const ServiceExecutionStatus = {
8
8
  Unknown: "UNKNOWN",
9
9
  Pending: "PENDING",
10
10
  Running: "RUNNING",
@@ -1,10 +1,6 @@
1
1
  export * from "./InputData";
2
2
  export * from "./InputParams";
3
- export * from "./InputRef";
4
- export * from "./InterimResultResponse";
5
- export * from "./ObjectResponse";
6
- export * from "./StringResponse";
7
- export * from "./NumberResponse";
8
- export * from "./ArrayResponse";
9
- export * from "./JobStatus";
10
- export * from "./Job";
3
+ export * from "./InputDataRef";
4
+ export * from "./ServiceExecutionStatus";
5
+ export * from "./ServiceExecution";
6
+ export * from "./HalLink";
@@ -3,6 +3,7 @@ export type APIResponse<Success, Failure> = SuccessfulResponse<Success> | Failed
3
3
  export interface SuccessfulResponse<T> {
4
4
  ok: true;
5
5
  body: T;
6
+ headers?: Record<string, any>;
6
7
  }
7
8
 
8
9
  export interface FailedResponse<T> {