@planqk/planqk-api-sdk 1.3.6 → 1.6.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 (126) hide show
  1. package/.fossa.yml +1 -0
  2. package/.gitlab-ci.yml +21 -14
  3. package/.releaserc.json +2 -1
  4. package/dist/sdk/Client.d.ts +8 -0
  5. package/dist/sdk/Client.js +12 -2
  6. package/dist/sdk/api/resources/dataPools/client/Client.d.ts +4 -1
  7. package/dist/sdk/api/resources/dataPools/client/Client.js +57 -39
  8. package/dist/sdk/api/resources/dataPools/client/requests/AddDataPoolFileRequest.d.ts +1 -1
  9. package/dist/sdk/api/resources/dataPools/client/requests/CreateDataPoolRequest.d.ts +1 -0
  10. package/dist/sdk/api/resources/dataPools/client/requests/UpdateDataPoolRequest.d.ts +3 -0
  11. package/dist/sdk/api/resources/index.d.ts +3 -0
  12. package/dist/sdk/api/resources/index.js +4 -1
  13. package/dist/sdk/api/resources/serviceExecutions/client/Client.d.ts +90 -0
  14. package/dist/sdk/api/resources/serviceExecutions/client/Client.js +271 -0
  15. package/dist/sdk/api/resources/serviceExecutions/client/index.d.ts +1 -0
  16. package/dist/sdk/api/resources/serviceExecutions/index.d.ts +1 -0
  17. package/dist/sdk/api/resources/serviceExecutions/index.js +17 -0
  18. package/dist/sdk/api/resources/serviceJobs/client/Client.d.ts +138 -0
  19. package/dist/sdk/api/resources/serviceJobs/client/Client.js +489 -0
  20. package/dist/sdk/api/resources/serviceJobs/client/index.d.ts +2 -0
  21. package/dist/sdk/api/resources/serviceJobs/client/index.js +17 -0
  22. package/dist/sdk/api/resources/serviceJobs/client/requests/CreateServiceJobRequest.d.ts +15 -0
  23. package/dist/sdk/api/resources/serviceJobs/client/requests/CreateServiceJobRequest.js +5 -0
  24. package/dist/sdk/api/resources/serviceJobs/client/requests/index.d.ts +1 -0
  25. package/dist/sdk/api/resources/serviceJobs/client/requests/index.js +2 -0
  26. package/dist/sdk/api/resources/serviceJobs/index.d.ts +1 -0
  27. package/dist/sdk/api/resources/serviceJobs/index.js +17 -0
  28. package/dist/sdk/api/types/ActivityInstance.d.ts +20 -0
  29. package/dist/sdk/api/types/ActivityInstance.js +14 -0
  30. package/dist/sdk/api/types/DataPoolDto.d.ts +5 -0
  31. package/dist/sdk/api/types/DataPoolFileDto.d.ts +7 -0
  32. package/dist/sdk/api/types/LogEntry.d.ts +24 -0
  33. package/dist/sdk/api/types/LogEntry.js +16 -0
  34. package/dist/sdk/api/types/MetricDataPoint.d.ts +12 -0
  35. package/dist/sdk/api/types/MetricDataPoint.js +5 -0
  36. package/dist/sdk/api/types/ServiceExecutionDto.d.ts +21 -0
  37. package/dist/sdk/api/types/ServiceExecutionDto.js +17 -0
  38. package/dist/sdk/api/types/ServiceExecutionLogs.d.ts +5 -0
  39. package/dist/sdk/api/types/ServiceExecutionLogs.js +5 -0
  40. package/dist/sdk/api/types/ServiceExecutionMetrics.d.ts +23 -0
  41. package/dist/sdk/api/types/ServiceExecutionMetrics.js +5 -0
  42. package/dist/sdk/api/types/ServiceJobDto.d.ts +46 -0
  43. package/dist/sdk/api/types/ServiceJobDto.js +22 -0
  44. package/dist/sdk/api/types/VariableInstance.d.ts +9 -0
  45. package/dist/sdk/api/types/VariableInstance.js +5 -0
  46. package/dist/sdk/api/types/WorkflowInstance.d.ts +23 -0
  47. package/dist/sdk/api/types/WorkflowInstance.js +17 -0
  48. package/dist/sdk/api/types/WorkflowServiceExecutionDto.d.ts +8 -0
  49. package/dist/sdk/api/types/WorkflowServiceExecutionDto.js +5 -0
  50. package/dist/sdk/api/types/index.d.ts +10 -0
  51. package/dist/sdk/api/types/index.js +10 -0
  52. package/dist/sdk/core/exports.d.ts +1 -0
  53. package/dist/sdk/core/exports.js +17 -0
  54. package/dist/sdk/core/fetcher/Fetcher.d.ts +1 -1
  55. package/dist/sdk/core/fetcher/Fetcher.js +2 -2
  56. package/dist/sdk/core/fetcher/index.d.ts +5 -5
  57. package/dist/sdk/core/fetcher/index.js +5 -5
  58. package/dist/sdk/core/file/exports.d.ts +1 -0
  59. package/dist/sdk/core/file/exports.js +2 -0
  60. package/dist/sdk/core/file/file.d.ts +5 -0
  61. package/dist/sdk/core/file/file.js +185 -0
  62. package/dist/sdk/core/file/index.d.ts +2 -0
  63. package/dist/sdk/core/file/index.js +18 -0
  64. package/dist/sdk/core/file/types.d.ts +66 -0
  65. package/dist/sdk/core/file/types.js +2 -0
  66. package/dist/sdk/core/form-data-utils/FormDataWrapper.js +12 -3
  67. package/dist/sdk/core/index.d.ts +1 -1
  68. package/dist/sdk/core/index.js +2 -2
  69. package/dist/sdk/core/url/join.js +23 -3
  70. package/dist/sdk/exports.d.ts +1 -0
  71. package/dist/sdk/exports.js +17 -0
  72. package/dist/sdk/index.d.ts +1 -0
  73. package/dist/sdk/index.js +4 -0
  74. package/fern/fern.config.json +1 -1
  75. package/fern/generators.yml +9 -3
  76. package/fern/openapi/openapi.json +950 -54
  77. package/package.json +1 -1
  78. package/planqk/api/_version.py +1 -1
  79. package/pyproject.toml +1 -1
  80. package/requirements.txt +319 -0
  81. package/scripts/update-version.sh +2 -0
  82. package/src/index.test.ts +11 -0
  83. package/src/sdk/Client.ts +14 -0
  84. package/src/sdk/api/resources/dataPools/client/Client.ts +95 -75
  85. package/src/sdk/api/resources/dataPools/client/requests/AddDataPoolFileRequest.ts +1 -1
  86. package/src/sdk/api/resources/dataPools/client/requests/CreateDataPoolRequest.ts +1 -0
  87. package/src/sdk/api/resources/dataPools/client/requests/UpdateDataPoolRequest.ts +3 -0
  88. package/src/sdk/api/resources/index.ts +3 -0
  89. package/src/sdk/api/resources/serviceExecutions/client/Client.ts +323 -0
  90. package/src/sdk/api/resources/serviceExecutions/client/index.ts +1 -0
  91. package/src/sdk/api/resources/serviceExecutions/index.ts +1 -0
  92. package/src/sdk/api/resources/serviceJobs/client/Client.ts +581 -0
  93. package/src/sdk/api/resources/serviceJobs/client/index.ts +2 -0
  94. package/src/sdk/api/resources/serviceJobs/client/requests/CreateServiceJobRequest.ts +16 -0
  95. package/src/sdk/api/resources/serviceJobs/client/requests/index.ts +1 -0
  96. package/src/sdk/api/resources/serviceJobs/index.ts +1 -0
  97. package/src/sdk/api/types/ActivityInstance.ts +22 -0
  98. package/src/sdk/api/types/DataPoolDto.ts +5 -0
  99. package/src/sdk/api/types/DataPoolFileDto.ts +7 -0
  100. package/src/sdk/api/types/LogEntry.ts +26 -0
  101. package/src/sdk/api/types/MetricDataPoint.ts +13 -0
  102. package/src/sdk/api/types/ServiceExecutionDto.ts +23 -0
  103. package/src/sdk/api/types/ServiceExecutionLogs.ts +7 -0
  104. package/src/sdk/api/types/ServiceExecutionMetrics.ts +25 -0
  105. package/src/sdk/api/types/ServiceJobDto.ts +48 -0
  106. package/src/sdk/api/types/VariableInstance.ts +10 -0
  107. package/src/sdk/api/types/WorkflowInstance.ts +26 -0
  108. package/src/sdk/api/types/WorkflowServiceExecutionDto.ts +10 -0
  109. package/src/sdk/api/types/index.ts +10 -0
  110. package/src/sdk/core/exports.ts +1 -0
  111. package/src/sdk/core/fetcher/Fetcher.ts +3 -3
  112. package/src/sdk/core/fetcher/index.ts +5 -5
  113. package/src/sdk/core/file/exports.ts +1 -0
  114. package/src/sdk/core/file/file.ts +186 -0
  115. package/src/sdk/core/file/index.ts +2 -0
  116. package/src/sdk/core/file/types.ts +81 -0
  117. package/src/sdk/core/form-data-utils/FormDataWrapper.ts +12 -3
  118. package/src/sdk/core/index.ts +1 -1
  119. package/src/sdk/core/url/join.ts +28 -3
  120. package/src/sdk/exports.ts +1 -0
  121. package/src/sdk/index.ts +1 -0
  122. package/uv.lock +245 -228
  123. package/dist/sdk/core/file.d.ts +0 -1
  124. package/planqk/__init__.py +0 -0
  125. package/src/sdk/core/file.ts +0 -11
  126. /package/dist/sdk/{core/file.js → api/resources/serviceExecutions/client/index.js} +0 -0
@@ -0,0 +1,581 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+
5
+ import * as environments from "../../../../environments.js";
6
+ import * as core from "../../../../core/index.js";
7
+ import * as PlanqkApi from "../../../index.js";
8
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js";
9
+ import * as errors from "../../../../errors/index.js";
10
+
11
+ export declare namespace ServiceJobs {
12
+ export interface Options {
13
+ environment?: core.Supplier<environments.PlanqkApiEnvironment | string>;
14
+ /** Specify a custom URL to connect the client to. */
15
+ baseUrl?: core.Supplier<string>;
16
+ apiKey: core.Supplier<string>;
17
+ /** Override the X-OrganizationId header */
18
+ organizationId?: core.Supplier<string | undefined>;
19
+ /** Additional headers to include in requests. */
20
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
21
+ }
22
+
23
+ export interface RequestOptions {
24
+ /** The maximum time to wait for a response in seconds. */
25
+ timeoutInSeconds?: number;
26
+ /** The number of times to retry the request. Defaults to 2. */
27
+ maxRetries?: number;
28
+ /** A hook to abort the request. */
29
+ abortSignal?: AbortSignal;
30
+ /** Override the X-OrganizationId header */
31
+ organizationId?: string | undefined;
32
+ /** Additional query string parameters to include in the request. */
33
+ queryParams?: Record<string, unknown>;
34
+ /** Additional headers to include in the request. */
35
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * Run your created services in a job-based manner. Service jobs allow you to execute services with specific parameters and track their execution status, costs, logs, metrics, and results.
41
+ */
42
+ export class ServiceJobs {
43
+ protected readonly _options: ServiceJobs.Options;
44
+
45
+ constructor(_options: ServiceJobs.Options) {
46
+ this._options = _options;
47
+ }
48
+
49
+ /**
50
+ * Cancel a specific service job (identified by its ID). Only service jobs that are pending or currently running can be cancelled.
51
+ *
52
+ * @param {string} id
53
+ * @param {ServiceJobs.RequestOptions} requestOptions - Request-specific configuration.
54
+ *
55
+ * @throws {@link PlanqkApi.UnauthorizedError}
56
+ * @throws {@link PlanqkApi.ForbiddenError}
57
+ * @throws {@link PlanqkApi.NotFoundError}
58
+ * @throws {@link PlanqkApi.InternalServerError}
59
+ *
60
+ * @example
61
+ * await client.serviceJobs.cancelServiceJob("id")
62
+ */
63
+ public cancelServiceJob(id: string, requestOptions?: ServiceJobs.RequestOptions): core.HttpResponsePromise<void> {
64
+ return core.HttpResponsePromise.fromPromise(this.__cancelServiceJob(id, requestOptions));
65
+ }
66
+
67
+ private async __cancelServiceJob(
68
+ id: string,
69
+ requestOptions?: ServiceJobs.RequestOptions,
70
+ ): Promise<core.WithRawResponse<void>> {
71
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
72
+ this._options?.headers,
73
+ mergeOnlyDefinedHeaders({
74
+ "X-OrganizationId": requestOptions?.organizationId ?? this._options?.organizationId,
75
+ ...(await this._getCustomAuthorizationHeaders()),
76
+ }),
77
+ requestOptions?.headers,
78
+ );
79
+ const _response = await core.fetcher({
80
+ url: core.url.join(
81
+ (await core.Supplier.get(this._options.baseUrl)) ??
82
+ (await core.Supplier.get(this._options.environment)) ??
83
+ environments.PlanqkApiEnvironment.Default,
84
+ `service-jobs/${encodeURIComponent(id)}/cancel`,
85
+ ),
86
+ method: "PUT",
87
+ headers: _headers,
88
+ queryParameters: requestOptions?.queryParams,
89
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
90
+ maxRetries: requestOptions?.maxRetries,
91
+ withCredentials: true,
92
+ abortSignal: requestOptions?.abortSignal,
93
+ });
94
+ if (_response.ok) {
95
+ return { data: undefined, rawResponse: _response.rawResponse };
96
+ }
97
+
98
+ if (_response.error.reason === "status-code") {
99
+ switch (_response.error.statusCode) {
100
+ case 401:
101
+ throw new PlanqkApi.UnauthorizedError(_response.error.body as any, _response.rawResponse);
102
+ case 403:
103
+ throw new PlanqkApi.ForbiddenError(_response.error.body as any, _response.rawResponse);
104
+ case 404:
105
+ throw new PlanqkApi.NotFoundError(_response.error.body as any, _response.rawResponse);
106
+ case 500:
107
+ throw new PlanqkApi.InternalServerError(_response.error.body as any, _response.rawResponse);
108
+ default:
109
+ throw new errors.PlanqkApiError({
110
+ statusCode: _response.error.statusCode,
111
+ body: _response.error.body,
112
+ rawResponse: _response.rawResponse,
113
+ });
114
+ }
115
+ }
116
+
117
+ switch (_response.error.reason) {
118
+ case "non-json":
119
+ throw new errors.PlanqkApiError({
120
+ statusCode: _response.error.statusCode,
121
+ body: _response.error.rawBody,
122
+ rawResponse: _response.rawResponse,
123
+ });
124
+ case "timeout":
125
+ throw new errors.PlanqkApiTimeoutError("Timeout exceeded when calling PUT /service-jobs/{id}/cancel.");
126
+ case "unknown":
127
+ throw new errors.PlanqkApiError({
128
+ message: _response.error.errorMessage,
129
+ rawResponse: _response.rawResponse,
130
+ });
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Get a list of all service jobs for the current user or organization.
136
+ *
137
+ * @param {ServiceJobs.RequestOptions} requestOptions - Request-specific configuration.
138
+ *
139
+ * @throws {@link PlanqkApi.UnauthorizedError}
140
+ * @throws {@link PlanqkApi.ForbiddenError}
141
+ * @throws {@link PlanqkApi.NotFoundError}
142
+ * @throws {@link PlanqkApi.InternalServerError}
143
+ *
144
+ * @example
145
+ * await client.serviceJobs.getServiceJobs()
146
+ */
147
+ public getServiceJobs(
148
+ requestOptions?: ServiceJobs.RequestOptions,
149
+ ): core.HttpResponsePromise<PlanqkApi.ServiceJobDto[]> {
150
+ return core.HttpResponsePromise.fromPromise(this.__getServiceJobs(requestOptions));
151
+ }
152
+
153
+ private async __getServiceJobs(
154
+ requestOptions?: ServiceJobs.RequestOptions,
155
+ ): Promise<core.WithRawResponse<PlanqkApi.ServiceJobDto[]>> {
156
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
157
+ this._options?.headers,
158
+ mergeOnlyDefinedHeaders({
159
+ "X-OrganizationId": requestOptions?.organizationId ?? this._options?.organizationId,
160
+ ...(await this._getCustomAuthorizationHeaders()),
161
+ }),
162
+ requestOptions?.headers,
163
+ );
164
+ const _response = await core.fetcher({
165
+ url: core.url.join(
166
+ (await core.Supplier.get(this._options.baseUrl)) ??
167
+ (await core.Supplier.get(this._options.environment)) ??
168
+ environments.PlanqkApiEnvironment.Default,
169
+ "service-jobs",
170
+ ),
171
+ method: "GET",
172
+ headers: _headers,
173
+ queryParameters: requestOptions?.queryParams,
174
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
175
+ maxRetries: requestOptions?.maxRetries,
176
+ withCredentials: true,
177
+ abortSignal: requestOptions?.abortSignal,
178
+ });
179
+ if (_response.ok) {
180
+ return { data: _response.body as PlanqkApi.ServiceJobDto[], rawResponse: _response.rawResponse };
181
+ }
182
+
183
+ if (_response.error.reason === "status-code") {
184
+ switch (_response.error.statusCode) {
185
+ case 401:
186
+ throw new PlanqkApi.UnauthorizedError(_response.error.body as any, _response.rawResponse);
187
+ case 403:
188
+ throw new PlanqkApi.ForbiddenError(_response.error.body as any, _response.rawResponse);
189
+ case 404:
190
+ throw new PlanqkApi.NotFoundError(_response.error.body as any, _response.rawResponse);
191
+ case 500:
192
+ throw new PlanqkApi.InternalServerError(_response.error.body as any, _response.rawResponse);
193
+ default:
194
+ throw new errors.PlanqkApiError({
195
+ statusCode: _response.error.statusCode,
196
+ body: _response.error.body,
197
+ rawResponse: _response.rawResponse,
198
+ });
199
+ }
200
+ }
201
+
202
+ switch (_response.error.reason) {
203
+ case "non-json":
204
+ throw new errors.PlanqkApiError({
205
+ statusCode: _response.error.statusCode,
206
+ body: _response.error.rawBody,
207
+ rawResponse: _response.rawResponse,
208
+ });
209
+ case "timeout":
210
+ throw new errors.PlanqkApiTimeoutError("Timeout exceeded when calling GET /service-jobs.");
211
+ case "unknown":
212
+ throw new errors.PlanqkApiError({
213
+ message: _response.error.errorMessage,
214
+ rawResponse: _response.rawResponse,
215
+ });
216
+ }
217
+ }
218
+
219
+ /**
220
+ * Create and start a new service job.
221
+ *
222
+ * @param {PlanqkApi.CreateServiceJobRequest} request
223
+ * @param {ServiceJobs.RequestOptions} requestOptions - Request-specific configuration.
224
+ *
225
+ * @throws {@link PlanqkApi.BadRequestError}
226
+ * @throws {@link PlanqkApi.UnauthorizedError}
227
+ * @throws {@link PlanqkApi.ForbiddenError}
228
+ * @throws {@link PlanqkApi.NotFoundError}
229
+ * @throws {@link PlanqkApi.InternalServerError}
230
+ *
231
+ * @example
232
+ * await client.serviceJobs.createServiceJob()
233
+ */
234
+ public createServiceJob(
235
+ request: PlanqkApi.CreateServiceJobRequest = {},
236
+ requestOptions?: ServiceJobs.RequestOptions,
237
+ ): core.HttpResponsePromise<PlanqkApi.ServiceJobDto> {
238
+ return core.HttpResponsePromise.fromPromise(this.__createServiceJob(request, requestOptions));
239
+ }
240
+
241
+ private async __createServiceJob(
242
+ request: PlanqkApi.CreateServiceJobRequest = {},
243
+ requestOptions?: ServiceJobs.RequestOptions,
244
+ ): Promise<core.WithRawResponse<PlanqkApi.ServiceJobDto>> {
245
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
246
+ this._options?.headers,
247
+ mergeOnlyDefinedHeaders({
248
+ "X-OrganizationId": requestOptions?.organizationId ?? this._options?.organizationId,
249
+ ...(await this._getCustomAuthorizationHeaders()),
250
+ }),
251
+ requestOptions?.headers,
252
+ );
253
+ const _response = await core.fetcher({
254
+ url: core.url.join(
255
+ (await core.Supplier.get(this._options.baseUrl)) ??
256
+ (await core.Supplier.get(this._options.environment)) ??
257
+ environments.PlanqkApiEnvironment.Default,
258
+ "service-jobs",
259
+ ),
260
+ method: "POST",
261
+ headers: _headers,
262
+ contentType: "application/json",
263
+ queryParameters: requestOptions?.queryParams,
264
+ requestType: "json",
265
+ body: request,
266
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
267
+ maxRetries: requestOptions?.maxRetries,
268
+ withCredentials: true,
269
+ abortSignal: requestOptions?.abortSignal,
270
+ });
271
+ if (_response.ok) {
272
+ return { data: _response.body as PlanqkApi.ServiceJobDto, rawResponse: _response.rawResponse };
273
+ }
274
+
275
+ if (_response.error.reason === "status-code") {
276
+ switch (_response.error.statusCode) {
277
+ case 400:
278
+ throw new PlanqkApi.BadRequestError(_response.error.body as any, _response.rawResponse);
279
+ case 401:
280
+ throw new PlanqkApi.UnauthorizedError(_response.error.body as any, _response.rawResponse);
281
+ case 403:
282
+ throw new PlanqkApi.ForbiddenError(_response.error.body as any, _response.rawResponse);
283
+ case 404:
284
+ throw new PlanqkApi.NotFoundError(_response.error.body as any, _response.rawResponse);
285
+ case 500:
286
+ throw new PlanqkApi.InternalServerError(_response.error.body as any, _response.rawResponse);
287
+ default:
288
+ throw new errors.PlanqkApiError({
289
+ statusCode: _response.error.statusCode,
290
+ body: _response.error.body,
291
+ rawResponse: _response.rawResponse,
292
+ });
293
+ }
294
+ }
295
+
296
+ switch (_response.error.reason) {
297
+ case "non-json":
298
+ throw new errors.PlanqkApiError({
299
+ statusCode: _response.error.statusCode,
300
+ body: _response.error.rawBody,
301
+ rawResponse: _response.rawResponse,
302
+ });
303
+ case "timeout":
304
+ throw new errors.PlanqkApiTimeoutError("Timeout exceeded when calling POST /service-jobs.");
305
+ case "unknown":
306
+ throw new errors.PlanqkApiError({
307
+ message: _response.error.errorMessage,
308
+ rawResponse: _response.rawResponse,
309
+ });
310
+ }
311
+ }
312
+
313
+ /**
314
+ * Get a specific service job (identified by its ID).
315
+ *
316
+ * @param {string} id
317
+ * @param {ServiceJobs.RequestOptions} requestOptions - Request-specific configuration.
318
+ *
319
+ * @throws {@link PlanqkApi.UnauthorizedError}
320
+ * @throws {@link PlanqkApi.ForbiddenError}
321
+ * @throws {@link PlanqkApi.NotFoundError}
322
+ * @throws {@link PlanqkApi.InternalServerError}
323
+ *
324
+ * @example
325
+ * await client.serviceJobs.getServiceJob("id")
326
+ */
327
+ public getServiceJob(
328
+ id: string,
329
+ requestOptions?: ServiceJobs.RequestOptions,
330
+ ): core.HttpResponsePromise<PlanqkApi.ServiceJobDto> {
331
+ return core.HttpResponsePromise.fromPromise(this.__getServiceJob(id, requestOptions));
332
+ }
333
+
334
+ private async __getServiceJob(
335
+ id: string,
336
+ requestOptions?: ServiceJobs.RequestOptions,
337
+ ): Promise<core.WithRawResponse<PlanqkApi.ServiceJobDto>> {
338
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
339
+ this._options?.headers,
340
+ mergeOnlyDefinedHeaders({
341
+ "X-OrganizationId": requestOptions?.organizationId ?? this._options?.organizationId,
342
+ ...(await this._getCustomAuthorizationHeaders()),
343
+ }),
344
+ requestOptions?.headers,
345
+ );
346
+ const _response = await core.fetcher({
347
+ url: core.url.join(
348
+ (await core.Supplier.get(this._options.baseUrl)) ??
349
+ (await core.Supplier.get(this._options.environment)) ??
350
+ environments.PlanqkApiEnvironment.Default,
351
+ `service-jobs/${encodeURIComponent(id)}`,
352
+ ),
353
+ method: "GET",
354
+ headers: _headers,
355
+ queryParameters: requestOptions?.queryParams,
356
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
357
+ maxRetries: requestOptions?.maxRetries,
358
+ withCredentials: true,
359
+ abortSignal: requestOptions?.abortSignal,
360
+ });
361
+ if (_response.ok) {
362
+ return { data: _response.body as PlanqkApi.ServiceJobDto, rawResponse: _response.rawResponse };
363
+ }
364
+
365
+ if (_response.error.reason === "status-code") {
366
+ switch (_response.error.statusCode) {
367
+ case 401:
368
+ throw new PlanqkApi.UnauthorizedError(_response.error.body as any, _response.rawResponse);
369
+ case 403:
370
+ throw new PlanqkApi.ForbiddenError(_response.error.body as any, _response.rawResponse);
371
+ case 404:
372
+ throw new PlanqkApi.NotFoundError(_response.error.body as any, _response.rawResponse);
373
+ case 500:
374
+ throw new PlanqkApi.InternalServerError(_response.error.body as any, _response.rawResponse);
375
+ default:
376
+ throw new errors.PlanqkApiError({
377
+ statusCode: _response.error.statusCode,
378
+ body: _response.error.body,
379
+ rawResponse: _response.rawResponse,
380
+ });
381
+ }
382
+ }
383
+
384
+ switch (_response.error.reason) {
385
+ case "non-json":
386
+ throw new errors.PlanqkApiError({
387
+ statusCode: _response.error.statusCode,
388
+ body: _response.error.rawBody,
389
+ rawResponse: _response.rawResponse,
390
+ });
391
+ case "timeout":
392
+ throw new errors.PlanqkApiTimeoutError("Timeout exceeded when calling GET /service-jobs/{id}.");
393
+ case "unknown":
394
+ throw new errors.PlanqkApiError({
395
+ message: _response.error.errorMessage,
396
+ rawResponse: _response.rawResponse,
397
+ });
398
+ }
399
+ }
400
+
401
+ /**
402
+ * Get the results for a specific service job (identified by its ID). If the service job has not completed yet or no results are available, a HTTP 204 (No Content) response is returned with a Retry-After header.
403
+ *
404
+ * @param {string} id
405
+ * @param {ServiceJobs.RequestOptions} requestOptions - Request-specific configuration.
406
+ *
407
+ * @throws {@link PlanqkApi.UnauthorizedError}
408
+ * @throws {@link PlanqkApi.ForbiddenError}
409
+ * @throws {@link PlanqkApi.NotFoundError}
410
+ * @throws {@link PlanqkApi.InternalServerError}
411
+ *
412
+ * @example
413
+ * await client.serviceJobs.getServiceJobResults("id")
414
+ */
415
+ public getServiceJobResults(
416
+ id: string,
417
+ requestOptions?: ServiceJobs.RequestOptions,
418
+ ): core.HttpResponsePromise<Record<string, any>> {
419
+ return core.HttpResponsePromise.fromPromise(this.__getServiceJobResults(id, requestOptions));
420
+ }
421
+
422
+ private async __getServiceJobResults(
423
+ id: string,
424
+ requestOptions?: ServiceJobs.RequestOptions,
425
+ ): Promise<core.WithRawResponse<Record<string, any>>> {
426
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
427
+ this._options?.headers,
428
+ mergeOnlyDefinedHeaders({
429
+ "X-OrganizationId": requestOptions?.organizationId ?? this._options?.organizationId,
430
+ ...(await this._getCustomAuthorizationHeaders()),
431
+ }),
432
+ requestOptions?.headers,
433
+ );
434
+ const _response = await core.fetcher({
435
+ url: core.url.join(
436
+ (await core.Supplier.get(this._options.baseUrl)) ??
437
+ (await core.Supplier.get(this._options.environment)) ??
438
+ environments.PlanqkApiEnvironment.Default,
439
+ `service-jobs/${encodeURIComponent(id)}/results`,
440
+ ),
441
+ method: "GET",
442
+ headers: _headers,
443
+ queryParameters: requestOptions?.queryParams,
444
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
445
+ maxRetries: requestOptions?.maxRetries,
446
+ withCredentials: true,
447
+ abortSignal: requestOptions?.abortSignal,
448
+ });
449
+ if (_response.ok) {
450
+ return { data: _response.body as Record<string, any>, rawResponse: _response.rawResponse };
451
+ }
452
+
453
+ if (_response.error.reason === "status-code") {
454
+ switch (_response.error.statusCode) {
455
+ case 401:
456
+ throw new PlanqkApi.UnauthorizedError(_response.error.body as any, _response.rawResponse);
457
+ case 403:
458
+ throw new PlanqkApi.ForbiddenError(_response.error.body as any, _response.rawResponse);
459
+ case 404:
460
+ throw new PlanqkApi.NotFoundError(_response.error.body as any, _response.rawResponse);
461
+ case 500:
462
+ throw new PlanqkApi.InternalServerError(_response.error.body as any, _response.rawResponse);
463
+ default:
464
+ throw new errors.PlanqkApiError({
465
+ statusCode: _response.error.statusCode,
466
+ body: _response.error.body,
467
+ rawResponse: _response.rawResponse,
468
+ });
469
+ }
470
+ }
471
+
472
+ switch (_response.error.reason) {
473
+ case "non-json":
474
+ throw new errors.PlanqkApiError({
475
+ statusCode: _response.error.statusCode,
476
+ body: _response.error.rawBody,
477
+ rawResponse: _response.rawResponse,
478
+ });
479
+ case "timeout":
480
+ throw new errors.PlanqkApiTimeoutError("Timeout exceeded when calling GET /service-jobs/{id}/results.");
481
+ case "unknown":
482
+ throw new errors.PlanqkApiError({
483
+ message: _response.error.errorMessage,
484
+ rawResponse: _response.rawResponse,
485
+ });
486
+ }
487
+ }
488
+
489
+ /**
490
+ * Get the logs for a specific service job (identified by its ID). If the service job has not started yet or no logs are available, a HTTP 204 (No Content) response is returned with a Retry-After header.
491
+ *
492
+ * @param {string} id
493
+ * @param {ServiceJobs.RequestOptions} requestOptions - Request-specific configuration.
494
+ *
495
+ * @throws {@link PlanqkApi.UnauthorizedError}
496
+ * @throws {@link PlanqkApi.ForbiddenError}
497
+ * @throws {@link PlanqkApi.NotFoundError}
498
+ * @throws {@link PlanqkApi.InternalServerError}
499
+ *
500
+ * @example
501
+ * await client.serviceJobs.getServiceJobLogs("id")
502
+ */
503
+ public getServiceJobLogs(
504
+ id: string,
505
+ requestOptions?: ServiceJobs.RequestOptions,
506
+ ): core.HttpResponsePromise<PlanqkApi.ServiceExecutionLogs> {
507
+ return core.HttpResponsePromise.fromPromise(this.__getServiceJobLogs(id, requestOptions));
508
+ }
509
+
510
+ private async __getServiceJobLogs(
511
+ id: string,
512
+ requestOptions?: ServiceJobs.RequestOptions,
513
+ ): Promise<core.WithRawResponse<PlanqkApi.ServiceExecutionLogs>> {
514
+ let _headers: core.Fetcher.Args["headers"] = mergeHeaders(
515
+ this._options?.headers,
516
+ mergeOnlyDefinedHeaders({
517
+ "X-OrganizationId": requestOptions?.organizationId ?? this._options?.organizationId,
518
+ ...(await this._getCustomAuthorizationHeaders()),
519
+ }),
520
+ requestOptions?.headers,
521
+ );
522
+ const _response = await core.fetcher({
523
+ url: core.url.join(
524
+ (await core.Supplier.get(this._options.baseUrl)) ??
525
+ (await core.Supplier.get(this._options.environment)) ??
526
+ environments.PlanqkApiEnvironment.Default,
527
+ `service-jobs/${encodeURIComponent(id)}/logs`,
528
+ ),
529
+ method: "GET",
530
+ headers: _headers,
531
+ queryParameters: requestOptions?.queryParams,
532
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
533
+ maxRetries: requestOptions?.maxRetries,
534
+ withCredentials: true,
535
+ abortSignal: requestOptions?.abortSignal,
536
+ });
537
+ if (_response.ok) {
538
+ return { data: _response.body as PlanqkApi.ServiceExecutionLogs, rawResponse: _response.rawResponse };
539
+ }
540
+
541
+ if (_response.error.reason === "status-code") {
542
+ switch (_response.error.statusCode) {
543
+ case 401:
544
+ throw new PlanqkApi.UnauthorizedError(_response.error.body as any, _response.rawResponse);
545
+ case 403:
546
+ throw new PlanqkApi.ForbiddenError(_response.error.body as any, _response.rawResponse);
547
+ case 404:
548
+ throw new PlanqkApi.NotFoundError(_response.error.body as any, _response.rawResponse);
549
+ case 500:
550
+ throw new PlanqkApi.InternalServerError(_response.error.body as any, _response.rawResponse);
551
+ default:
552
+ throw new errors.PlanqkApiError({
553
+ statusCode: _response.error.statusCode,
554
+ body: _response.error.body,
555
+ rawResponse: _response.rawResponse,
556
+ });
557
+ }
558
+ }
559
+
560
+ switch (_response.error.reason) {
561
+ case "non-json":
562
+ throw new errors.PlanqkApiError({
563
+ statusCode: _response.error.statusCode,
564
+ body: _response.error.rawBody,
565
+ rawResponse: _response.rawResponse,
566
+ });
567
+ case "timeout":
568
+ throw new errors.PlanqkApiTimeoutError("Timeout exceeded when calling GET /service-jobs/{id}/logs.");
569
+ case "unknown":
570
+ throw new errors.PlanqkApiError({
571
+ message: _response.error.errorMessage,
572
+ rawResponse: _response.rawResponse,
573
+ });
574
+ }
575
+ }
576
+
577
+ protected async _getCustomAuthorizationHeaders() {
578
+ const apiKeyValue = await core.Supplier.get(this._options.apiKey);
579
+ return { "X-Auth-Token": apiKeyValue };
580
+ }
581
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ export * from "./requests/index.js";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+
5
+ /**
6
+ * @example
7
+ * {}
8
+ */
9
+ export interface CreateServiceJobRequest {
10
+ /** The ID fo the service for which the job is created. */
11
+ serviceId?: string;
12
+ /** Input data for the service job. This can be any JSON object that the service expects as input. The structure and content of this object depend on the specific service being executed. */
13
+ input?: Record<string, any>;
14
+ /** List of tags associated with the service job. Tags are saved in lowercase and can be used for filtering and searching. */
15
+ tags?: string[];
16
+ }
@@ -0,0 +1 @@
1
+ export { type CreateServiceJobRequest } from "./CreateServiceJobRequest.js";
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,22 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+
5
+ export interface ActivityInstance {
6
+ id?: string;
7
+ modelId?: string;
8
+ name?: string;
9
+ type?: string;
10
+ startTime?: string;
11
+ endTime?: string;
12
+ state?: ActivityInstance.State;
13
+ }
14
+
15
+ export namespace ActivityInstance {
16
+ export type State = "PENDING" | "RUNNING" | "COMPLETED";
17
+ export const State = {
18
+ Pending: "PENDING",
19
+ Running: "RUNNING",
20
+ Completed: "COMPLETED",
21
+ } as const;
22
+ }
@@ -5,10 +5,15 @@
5
5
  export interface DataPoolDto {
6
6
  /** The access permission role for this entity of the current user */
7
7
  currentUserPermission?: DataPoolDto.CurrentUserPermission;
8
+ /** Unique identifier of the data pool. */
8
9
  id?: string;
10
+ /** Name of the data pool. */
9
11
  name?: string;
12
+ /** Short description of the data pool. */
10
13
  shortDescription?: string;
14
+ /** Detailed description of the data pool. */
11
15
  description?: string;
16
+ /** Timestamp when the data pool was created. */
12
17
  createdAt?: string;
13
18
  }
14
19
 
@@ -3,11 +3,18 @@
3
3
  */
4
4
 
5
5
  export interface DataPoolFileDto {
6
+ /** Unique identifier of the data pool file. */
6
7
  id?: string;
8
+ /** Unique identifier of the data pool. */
7
9
  dataPoolId?: string;
10
+ /** The name of the file. */
8
11
  name?: string;
12
+ /** The full path of the file in the data pool. */
9
13
  fullPath?: string;
14
+ /** The content type of the file. */
10
15
  contentType?: string;
16
+ /** The size of the file in bytes. */
11
17
  contentLength?: number;
18
+ /** Timestamp when the file was created. */
12
19
  createdAt?: string;
13
20
  }