@planqk/planqk-service-sdk 1.9.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. package/.devcontainer/devcontainer.json +32 -0
  2. package/.devcontainer/post-create.sh +7 -0
  3. package/.env.template +4 -0
  4. package/.gitlab-ci.yml +103 -0
  5. package/.python-version +1 -0
  6. package/.releaserc.json +45 -0
  7. package/LICENSE +201 -0
  8. package/README-node.md +41 -0
  9. package/README-python.md +52 -0
  10. package/README.md +42 -21
  11. package/dist/auth.js +12 -19
  12. package/dist/client.d.ts +2 -12
  13. package/dist/client.js +5 -76
  14. package/dist/sdk/Client.d.ts +4 -3
  15. package/dist/sdk/Client.js +4 -8
  16. package/dist/sdk/api/errors/BadRequestError.d.ts +1 -1
  17. package/dist/sdk/api/errors/BadRequestError.js +18 -8
  18. package/dist/sdk/api/errors/ForbiddenError.d.ts +1 -1
  19. package/dist/sdk/api/errors/ForbiddenError.js +18 -8
  20. package/dist/sdk/api/errors/InternalServerError.d.ts +1 -1
  21. package/dist/sdk/api/errors/InternalServerError.js +18 -8
  22. package/dist/sdk/api/errors/NotFoundError.d.ts +1 -1
  23. package/dist/sdk/api/errors/NotFoundError.js +18 -8
  24. package/dist/sdk/api/errors/UnauthorizedError.d.ts +1 -1
  25. package/dist/sdk/api/errors/UnauthorizedError.js +18 -8
  26. package/dist/sdk/api/resources/index.d.ts +0 -3
  27. package/dist/sdk/api/resources/index.js +18 -11
  28. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +65 -12
  29. package/dist/sdk/api/resources/serviceApi/client/Client.js +405 -261
  30. package/dist/sdk/api/resources/serviceApi/client/index.d.ts +1 -1
  31. package/dist/sdk/api/resources/serviceApi/client/index.js +0 -15
  32. package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +4 -1
  33. package/dist/sdk/api/resources/serviceApi/types/{GetInterimResultsResponse.d.ts → GetResultResponseEmbedded.d.ts} +3 -1
  34. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.d.ts +7 -0
  35. package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.d.ts +1 -0
  36. package/dist/sdk/api/resources/serviceApi/types/index.d.ts +3 -1
  37. package/dist/sdk/api/resources/serviceApi/types/index.js +3 -1
  38. package/dist/sdk/api/types/HalLink.d.ts +21 -0
  39. package/dist/sdk/api/types/InputData.d.ts +1 -1
  40. package/dist/sdk/api/types/{InputRef.d.ts → InputDataRef.d.ts} +1 -1
  41. package/dist/sdk/api/types/InputParams.d.ts +1 -1
  42. package/dist/sdk/api/types/{Job.d.ts → ServiceExecution.d.ts} +2 -2
  43. package/dist/sdk/api/types/{JobStatus.d.ts → ServiceExecutionStatus.d.ts} +2 -2
  44. package/dist/sdk/api/types/{JobStatus.js → ServiceExecutionStatus.js} +2 -2
  45. package/dist/sdk/api/types/index.d.ts +4 -8
  46. package/dist/sdk/api/types/index.js +4 -8
  47. package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -0
  48. package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -5
  49. package/dist/sdk/core/fetcher/Fetcher.js +68 -112
  50. package/dist/sdk/core/fetcher/Supplier.js +2 -11
  51. package/dist/sdk/core/fetcher/createRequestUrl.d.ts +1 -0
  52. package/dist/sdk/core/fetcher/createRequestUrl.js +12 -0
  53. package/dist/sdk/core/fetcher/getFetchFn.d.ts +4 -0
  54. package/dist/sdk/core/fetcher/getFetchFn.js +57 -0
  55. package/dist/sdk/core/fetcher/getHeader.d.ts +1 -0
  56. package/dist/sdk/core/fetcher/getHeader.js +11 -0
  57. package/dist/sdk/core/fetcher/getRequestBody.d.ts +7 -0
  58. package/dist/sdk/core/fetcher/getRequestBody.js +11 -0
  59. package/dist/sdk/core/fetcher/getResponseBody.d.ts +1 -0
  60. package/dist/sdk/core/fetcher/getResponseBody.js +40 -0
  61. package/dist/sdk/core/fetcher/index.d.ts +1 -0
  62. package/dist/sdk/core/fetcher/index.js +3 -1
  63. package/dist/sdk/core/fetcher/makeRequest.d.ts +1 -0
  64. package/dist/sdk/core/fetcher/makeRequest.js +33 -0
  65. package/dist/sdk/core/fetcher/requestWithRetries.d.ts +1 -0
  66. package/dist/sdk/core/fetcher/requestWithRetries.js +20 -0
  67. package/dist/sdk/core/fetcher/signals.d.ts +11 -0
  68. package/dist/sdk/core/fetcher/signals.js +36 -0
  69. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  70. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +232 -0
  71. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  72. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +91 -0
  73. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  74. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +214 -0
  75. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  76. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.js +48 -0
  77. package/dist/sdk/core/index.d.ts +1 -0
  78. package/dist/sdk/core/index.js +1 -0
  79. package/dist/sdk/core/runtime/index.d.ts +1 -0
  80. package/dist/sdk/core/runtime/index.js +5 -0
  81. package/dist/sdk/core/runtime/runtime.d.ts +9 -0
  82. package/dist/sdk/core/runtime/runtime.js +92 -0
  83. package/dist/sdk/errors/PlanqkServiceApiError.js +2 -0
  84. package/dist/sdk/index.js +17 -7
  85. package/eslint.config.mjs +11 -0
  86. package/fern/fern.config.json +4 -0
  87. package/fern/generators.yml +25 -0
  88. package/fern/openapi/openapi.yml +342 -0
  89. package/notebooks/python-sdk.ipynb +280 -0
  90. package/package.json +27 -28
  91. package/planqk/__init__.py +0 -0
  92. package/planqk/service/__init__.py +1 -0
  93. package/planqk/service/_version.py +1 -0
  94. package/planqk/service/auth.py +30 -0
  95. package/planqk/service/client.py +151 -0
  96. package/planqk/service/sdk/__init__.py +48 -0
  97. package/planqk/service/sdk/client.py +152 -0
  98. package/planqk/service/sdk/core/__init__.py +47 -0
  99. package/planqk/service/sdk/core/api_error.py +17 -0
  100. package/planqk/service/sdk/core/client_wrapper.py +74 -0
  101. package/planqk/service/sdk/core/datetime_utils.py +30 -0
  102. package/planqk/service/sdk/core/file.py +70 -0
  103. package/planqk/service/sdk/core/http_client.py +575 -0
  104. package/planqk/service/sdk/core/jsonable_encoder.py +103 -0
  105. package/planqk/service/sdk/core/pydantic_utilities.py +323 -0
  106. package/planqk/service/sdk/core/query_encoder.py +60 -0
  107. package/planqk/service/sdk/core/remove_none_from_dict.py +11 -0
  108. package/planqk/service/sdk/core/request_options.py +35 -0
  109. package/planqk/service/sdk/core/serialization.py +276 -0
  110. package/planqk/service/sdk/environment.py +7 -0
  111. package/planqk/service/sdk/errors/__init__.py +15 -0
  112. package/planqk/service/sdk/errors/bad_request_error.py +9 -0
  113. package/planqk/service/sdk/errors/forbidden_error.py +9 -0
  114. package/planqk/service/sdk/errors/internal_server_error.py +9 -0
  115. package/planqk/service/sdk/errors/not_found_error.py +9 -0
  116. package/planqk/service/sdk/errors/unauthorized_error.py +9 -0
  117. package/planqk/service/sdk/service_api/__init__.py +15 -0
  118. package/planqk/service/sdk/service_api/client.py +1257 -0
  119. package/planqk/service/sdk/service_api/types/__init__.py +13 -0
  120. package/planqk/service/sdk/service_api/types/get_result_response.py +30 -0
  121. package/planqk/service/sdk/service_api/types/get_result_response_embedded.py +22 -0
  122. package/planqk/service/sdk/service_api/types/get_result_response_links.py +22 -0
  123. package/planqk/service/sdk/service_api/types/health_check_response.py +24 -0
  124. package/planqk/service/sdk/types/__init__.py +17 -0
  125. package/planqk/service/sdk/types/hal_link.py +59 -0
  126. package/planqk/service/sdk/types/input_data.py +5 -0
  127. package/planqk/service/sdk/types/input_data_ref.py +27 -0
  128. package/planqk/service/sdk/types/input_params.py +5 -0
  129. package/planqk/service/sdk/types/service_execution.py +34 -0
  130. package/planqk/service/sdk/types/service_execution_status.py +8 -0
  131. package/pyproject.toml +51 -0
  132. package/scripts/update-version.sh +6 -0
  133. package/src/client.ts +4 -78
  134. package/src/index.test.ts +43 -0
  135. package/src/sdk/Client.ts +4 -7
  136. package/src/sdk/api/errors/BadRequestError.ts +1 -1
  137. package/src/sdk/api/errors/ForbiddenError.ts +1 -1
  138. package/src/sdk/api/errors/InternalServerError.ts +1 -1
  139. package/src/sdk/api/errors/NotFoundError.ts +1 -1
  140. package/src/sdk/api/errors/UnauthorizedError.ts +1 -1
  141. package/src/sdk/api/resources/index.ts +0 -3
  142. package/src/sdk/api/resources/serviceApi/client/Client.ts +205 -32
  143. package/src/sdk/api/resources/serviceApi/client/index.ts +1 -1
  144. package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +4 -5
  145. package/src/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.ts +9 -0
  146. package/src/sdk/api/resources/serviceApi/types/GetResultResponseLinks.ts +9 -0
  147. package/src/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.ts +1 -0
  148. package/src/sdk/api/resources/serviceApi/types/index.ts +3 -1
  149. package/src/sdk/api/types/HalLink.ts +22 -0
  150. package/src/sdk/api/types/InputData.ts +1 -1
  151. package/src/sdk/api/types/{InputRef.ts → InputDataRef.ts} +1 -1
  152. package/src/sdk/api/types/InputParams.ts +1 -1
  153. package/src/sdk/api/types/{Job.ts → ServiceExecution.ts} +2 -2
  154. package/src/sdk/api/types/{JobStatus.ts → ServiceExecutionStatus.ts} +2 -2
  155. package/src/sdk/api/types/index.ts +4 -8
  156. package/src/sdk/core/fetcher/APIResponse.ts +1 -0
  157. package/src/sdk/core/fetcher/Fetcher.ts +55 -72
  158. package/src/sdk/core/fetcher/createRequestUrl.ts +10 -0
  159. package/src/sdk/core/fetcher/getFetchFn.ts +25 -0
  160. package/src/sdk/core/fetcher/getHeader.ts +8 -0
  161. package/src/sdk/core/fetcher/getRequestBody.ts +14 -0
  162. package/src/sdk/core/fetcher/getResponseBody.ts +32 -0
  163. package/src/sdk/core/fetcher/index.ts +1 -0
  164. package/src/sdk/core/fetcher/makeRequest.ts +44 -0
  165. package/src/sdk/core/fetcher/requestWithRetries.ts +21 -0
  166. package/src/sdk/core/fetcher/signals.ts +38 -0
  167. package/src/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +252 -0
  168. package/src/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +106 -0
  169. package/src/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +239 -0
  170. package/src/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +33 -0
  171. package/src/sdk/core/index.ts +1 -0
  172. package/src/sdk/core/runtime/index.ts +1 -0
  173. package/src/sdk/core/runtime/runtime.ts +126 -0
  174. package/tsconfig.json +15 -107
  175. package/uv.lock +1109 -0
  176. package/.eslintignore +0 -3
  177. package/.eslintrc +0 -7
  178. package/dist/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.d.ts +0 -9
  179. package/dist/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.d.ts +0 -13
  180. package/dist/sdk/api/resources/serviceApi/client/requests/index.d.ts +0 -2
  181. package/dist/sdk/api/resources/serviceApi/client/requests/index.js +0 -2
  182. package/dist/sdk/api/resources/statusApi/client/Client.d.ts +0 -28
  183. package/dist/sdk/api/resources/statusApi/client/Client.js +0 -97
  184. package/dist/sdk/api/resources/statusApi/client/index.d.ts +0 -1
  185. package/dist/sdk/api/resources/statusApi/client/index.js +0 -2
  186. package/dist/sdk/api/resources/statusApi/index.d.ts +0 -2
  187. package/dist/sdk/api/resources/statusApi/index.js +0 -18
  188. package/dist/sdk/api/resources/statusApi/types/index.d.ts +0 -1
  189. package/dist/sdk/api/resources/statusApi/types/index.js +0 -17
  190. package/dist/sdk/api/types/ArrayResponse.d.ts +0 -4
  191. package/dist/sdk/api/types/InterimResultResponse.d.ts +0 -4
  192. package/dist/sdk/api/types/InterimResultResponse.js +0 -5
  193. package/dist/sdk/api/types/Job.js +0 -5
  194. package/dist/sdk/api/types/NumberResponse.d.ts +0 -4
  195. package/dist/sdk/api/types/NumberResponse.js +0 -5
  196. package/dist/sdk/api/types/ObjectResponse.d.ts +0 -4
  197. package/dist/sdk/api/types/ObjectResponse.js +0 -5
  198. package/dist/sdk/api/types/StringResponse.d.ts +0 -4
  199. package/dist/sdk/api/types/StringResponse.js +0 -5
  200. package/jest.config.js +0 -12
  201. package/src/sdk/api/resources/serviceApi/client/requests/GetInterimResultsRequest.ts +0 -10
  202. package/src/sdk/api/resources/serviceApi/client/requests/StartExecutionRequest.ts +0 -15
  203. package/src/sdk/api/resources/serviceApi/client/requests/index.ts +0 -2
  204. package/src/sdk/api/resources/serviceApi/types/GetInterimResultsResponse.ts +0 -9
  205. package/src/sdk/api/resources/statusApi/client/Client.ts +0 -75
  206. package/src/sdk/api/resources/statusApi/client/index.ts +0 -1
  207. package/src/sdk/api/resources/statusApi/index.ts +0 -2
  208. package/src/sdk/api/resources/statusApi/types/index.ts +0 -1
  209. package/src/sdk/api/types/ArrayResponse.ts +0 -5
  210. package/src/sdk/api/types/InterimResultResponse.ts +0 -5
  211. package/src/sdk/api/types/NumberResponse.ts +0 -5
  212. package/src/sdk/api/types/ObjectResponse.ts +0 -5
  213. package/src/sdk/api/types/StringResponse.ts +0 -5
  214. package/tests/fixtures/complex-input.ts +0 -477
  215. package/tests/integration.test.ts +0 -92
  216. /package/dist/sdk/api/resources/serviceApi/{client/requests/GetInterimResultsRequest.js → types/GetResultResponseEmbedded.js} +0 -0
  217. /package/dist/sdk/api/resources/serviceApi/{client/requests/StartExecutionRequest.js → types/GetResultResponseLinks.js} +0 -0
  218. /package/dist/sdk/api/resources/{statusApi → serviceApi}/types/HealthCheckResponse.js +0 -0
  219. /package/dist/sdk/api/{resources/serviceApi/types/GetInterimResultsResponse.js → types/HalLink.js} +0 -0
  220. /package/dist/sdk/api/types/{ArrayResponse.js → InputDataRef.js} +0 -0
  221. /package/dist/sdk/api/types/{InputRef.js → ServiceExecution.js} +0 -0
@@ -18,22 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
18
18
  }) : function(o, v) {
19
19
  o["default"] = v;
20
20
  });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
37
38
  var __importDefault = (this && this.__importDefault) || function (mod) {
38
39
  return (mod && mod.__esModule) ? mod : { "default": mod };
39
40
  };
@@ -42,14 +43,69 @@ exports.ServiceApi = void 0;
42
43
  const environments = __importStar(require("../../../../environments"));
43
44
  const core = __importStar(require("../../../../core"));
44
45
  const PlanqkServiceApi = __importStar(require("../../../index"));
45
- const errors = __importStar(require("../../../../errors"));
46
+ const errors = __importStar(require("../../../../errors/index"));
46
47
  const url_join_1 = __importDefault(require("url-join"));
47
48
  class ServiceApi {
49
+ _options;
48
50
  constructor(_options) {
49
51
  this._options = _options;
50
52
  }
51
53
  /**
52
- * 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.
54
+ * This method checks the health of the service.
55
+ *
56
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
57
+ *
58
+ * @example
59
+ * await client.serviceApi.healthCheck()
60
+ */
61
+ async healthCheck(requestOptions) {
62
+ const _response = await core.fetcher({
63
+ url: (await core.Supplier.get(this._options.environment)) ??
64
+ environments.PlanqkServiceApiEnvironment.Default,
65
+ method: "GET",
66
+ headers: {
67
+ Authorization: await this._getAuthorizationHeader(),
68
+ "X-Fern-Language": "JavaScript",
69
+ "X-Fern-Runtime": core.RUNTIME.type,
70
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
71
+ },
72
+ contentType: "application/json",
73
+ requestType: "json",
74
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
75
+ maxRetries: requestOptions?.maxRetries,
76
+ withCredentials: true,
77
+ abortSignal: requestOptions?.abortSignal,
78
+ });
79
+ if (_response.ok) {
80
+ return _response.body;
81
+ }
82
+ if (_response.error.reason === "status-code") {
83
+ throw new errors.PlanqkServiceApiError({
84
+ statusCode: _response.error.statusCode,
85
+ body: _response.error.body,
86
+ });
87
+ }
88
+ switch (_response.error.reason) {
89
+ case "non-json":
90
+ throw new errors.PlanqkServiceApiError({
91
+ statusCode: _response.error.statusCode,
92
+ body: _response.error.rawBody,
93
+ });
94
+ case "timeout":
95
+ throw new errors.PlanqkServiceApiTimeoutError();
96
+ case "unknown":
97
+ throw new errors.PlanqkServiceApiError({
98
+ message: _response.error.errorMessage,
99
+ });
100
+ }
101
+ }
102
+ /**
103
+ * This method starts a service execution, which in turn is processed asynchronously by PLANQK.
104
+ * The location header of the response contains the URL which can be used to query the status and the result of the service execution.
105
+ *
106
+ * @param {Record<string, Record<string, any>>} request
107
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
53
109
  * @throws {@link PlanqkServiceApi.BadRequestError}
54
110
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
55
111
  * @throws {@link PlanqkServiceApi.ForbiddenError}
@@ -57,305 +113,393 @@ class ServiceApi {
57
113
  * @throws {@link PlanqkServiceApi.InternalServerError}
58
114
  *
59
115
  * @example
60
- * await planqkServiceApi.serviceApi.startExecution({})
116
+ * await client.serviceApi.execute({
117
+ * "key": {
118
+ * "key": "value"
119
+ * }
120
+ * })
61
121
  */
62
- startExecution(request = {}, requestOptions) {
63
- var _a;
64
- return __awaiter(this, void 0, void 0, function* () {
65
- const _response = yield core.fetcher({
66
- url: (_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PlanqkServiceApiEnvironment.Default,
67
- method: "POST",
68
- headers: {
69
- Authorization: yield this._getAuthorizationHeader(),
70
- "X-Fern-Language": "JavaScript",
71
- },
72
- contentType: "application/json",
73
- body: request,
74
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
75
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
76
- withCredentials: true,
77
- });
78
- if (_response.ok) {
79
- return _response.body;
80
- }
81
- if (_response.error.reason === "status-code") {
82
- switch (_response.error.statusCode) {
83
- case 400:
84
- throw new PlanqkServiceApi.BadRequestError(_response.error.body);
85
- case 401:
86
- throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
87
- case 403:
88
- throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
89
- case 404:
90
- throw new PlanqkServiceApi.NotFoundError(_response.error.body);
91
- case 500:
92
- throw new PlanqkServiceApi.InternalServerError(_response.error.body);
93
- default:
94
- throw new errors.PlanqkServiceApiError({
95
- statusCode: _response.error.statusCode,
96
- body: _response.error.body,
97
- });
98
- }
99
- }
100
- switch (_response.error.reason) {
101
- case "non-json":
122
+ async execute(request, requestOptions) {
123
+ const _response = await core.fetcher({
124
+ url: (await core.Supplier.get(this._options.environment)) ??
125
+ environments.PlanqkServiceApiEnvironment.Default,
126
+ method: "POST",
127
+ headers: {
128
+ Authorization: await this._getAuthorizationHeader(),
129
+ "X-Fern-Language": "JavaScript",
130
+ "X-Fern-Runtime": core.RUNTIME.type,
131
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
132
+ },
133
+ contentType: "application/json",
134
+ requestType: "json",
135
+ body: request,
136
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
137
+ maxRetries: requestOptions?.maxRetries,
138
+ withCredentials: true,
139
+ abortSignal: requestOptions?.abortSignal,
140
+ });
141
+ if (_response.ok) {
142
+ return _response.body;
143
+ }
144
+ if (_response.error.reason === "status-code") {
145
+ switch (_response.error.statusCode) {
146
+ case 400:
147
+ throw new PlanqkServiceApi.BadRequestError(_response.error.body);
148
+ case 401:
149
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
150
+ case 403:
151
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
152
+ case 404:
153
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body);
154
+ case 500:
155
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body);
156
+ default:
102
157
  throw new errors.PlanqkServiceApiError({
103
158
  statusCode: _response.error.statusCode,
104
- body: _response.error.rawBody,
105
- });
106
- case "timeout":
107
- throw new errors.PlanqkServiceApiTimeoutError();
108
- case "unknown":
109
- throw new errors.PlanqkServiceApiError({
110
- message: _response.error.errorMessage,
159
+ body: _response.error.body,
111
160
  });
112
161
  }
113
- });
162
+ }
163
+ switch (_response.error.reason) {
164
+ case "non-json":
165
+ throw new errors.PlanqkServiceApiError({
166
+ statusCode: _response.error.statusCode,
167
+ body: _response.error.rawBody,
168
+ });
169
+ case "timeout":
170
+ throw new errors.PlanqkServiceApiTimeoutError();
171
+ case "unknown":
172
+ throw new errors.PlanqkServiceApiError({
173
+ message: _response.error.errorMessage,
174
+ });
175
+ }
114
176
  }
115
177
  /**
116
- * Checks the status of a service execution.
178
+ * This method checks the status of a service execution.
179
+ *
180
+ * @param {string} id - The id of a service execution
181
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
182
+ *
117
183
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
118
184
  * @throws {@link PlanqkServiceApi.ForbiddenError}
119
185
  * @throws {@link PlanqkServiceApi.NotFoundError}
120
186
  * @throws {@link PlanqkServiceApi.InternalServerError}
121
187
  *
122
188
  * @example
123
- * await planqkServiceApi.serviceApi.getStatus("id")
189
+ * await client.serviceApi.getStatus("id")
124
190
  */
125
- getStatus(id, requestOptions) {
126
- var _a;
127
- return __awaiter(this, void 0, void 0, function* () {
128
- const _response = yield core.fetcher({
129
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PlanqkServiceApiEnvironment.Default, `${id}`),
130
- method: "GET",
131
- headers: {
132
- Authorization: yield this._getAuthorizationHeader(),
133
- "X-Fern-Language": "JavaScript",
134
- },
135
- contentType: "application/json",
136
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
137
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
138
- withCredentials: true,
139
- });
140
- if (_response.ok) {
141
- return _response.body;
142
- }
143
- if (_response.error.reason === "status-code") {
144
- switch (_response.error.statusCode) {
145
- case 401:
146
- throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
147
- case 403:
148
- throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
149
- case 404:
150
- throw new PlanqkServiceApi.NotFoundError(_response.error.body);
151
- case 500:
152
- throw new PlanqkServiceApi.InternalServerError(_response.error.body);
153
- default:
154
- throw new errors.PlanqkServiceApiError({
155
- statusCode: _response.error.statusCode,
156
- body: _response.error.body,
157
- });
158
- }
159
- }
160
- switch (_response.error.reason) {
161
- case "non-json":
191
+ async getStatus(id, requestOptions) {
192
+ const _response = await core.fetcher({
193
+ url: (0, url_join_1.default)((await core.Supplier.get(this._options.environment)) ??
194
+ environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}`),
195
+ method: "GET",
196
+ headers: {
197
+ Authorization: await this._getAuthorizationHeader(),
198
+ "X-Fern-Language": "JavaScript",
199
+ "X-Fern-Runtime": core.RUNTIME.type,
200
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
201
+ },
202
+ contentType: "application/json",
203
+ requestType: "json",
204
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
205
+ maxRetries: requestOptions?.maxRetries,
206
+ withCredentials: true,
207
+ abortSignal: requestOptions?.abortSignal,
208
+ });
209
+ if (_response.ok) {
210
+ return _response.body;
211
+ }
212
+ if (_response.error.reason === "status-code") {
213
+ switch (_response.error.statusCode) {
214
+ case 401:
215
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
216
+ case 403:
217
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
218
+ case 404:
219
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body);
220
+ case 500:
221
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body);
222
+ default:
162
223
  throw new errors.PlanqkServiceApiError({
163
224
  statusCode: _response.error.statusCode,
164
- body: _response.error.rawBody,
165
- });
166
- case "timeout":
167
- throw new errors.PlanqkServiceApiTimeoutError();
168
- case "unknown":
169
- throw new errors.PlanqkServiceApiError({
170
- message: _response.error.errorMessage,
225
+ body: _response.error.body,
171
226
  });
172
227
  }
173
- });
228
+ }
229
+ switch (_response.error.reason) {
230
+ case "non-json":
231
+ throw new errors.PlanqkServiceApiError({
232
+ statusCode: _response.error.statusCode,
233
+ body: _response.error.rawBody,
234
+ });
235
+ case "timeout":
236
+ throw new errors.PlanqkServiceApiTimeoutError();
237
+ case "unknown":
238
+ throw new errors.PlanqkServiceApiError({
239
+ message: _response.error.errorMessage,
240
+ });
241
+ }
174
242
  }
175
243
  /**
176
- * 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
+ *
177
249
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
178
250
  * @throws {@link PlanqkServiceApi.ForbiddenError}
179
251
  * @throws {@link PlanqkServiceApi.NotFoundError}
180
252
  * @throws {@link PlanqkServiceApi.InternalServerError}
253
+ *
254
+ * @example
255
+ * await client.serviceApi.getResult("id")
181
256
  */
182
- getResult(id, requestOptions) {
183
- var _a;
184
- return __awaiter(this, void 0, void 0, function* () {
185
- const _response = yield core.fetcher({
186
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PlanqkServiceApiEnvironment.Default, `${id}/result`),
187
- method: "GET",
188
- headers: {
189
- Authorization: yield this._getAuthorizationHeader(),
190
- "X-Fern-Language": "JavaScript",
191
- },
192
- contentType: "application/json",
193
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
194
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
195
- withCredentials: true,
196
- });
197
- if (_response.ok) {
198
- return _response.body;
199
- }
200
- if (_response.error.reason === "status-code") {
201
- switch (_response.error.statusCode) {
202
- case 401:
203
- throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
204
- case 403:
205
- throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
206
- case 404:
207
- throw new PlanqkServiceApi.NotFoundError(_response.error.body);
208
- case 500:
209
- throw new PlanqkServiceApi.InternalServerError(_response.error.body);
210
- default:
211
- throw new errors.PlanqkServiceApiError({
212
- statusCode: _response.error.statusCode,
213
- body: _response.error.body,
214
- });
215
- }
216
- }
217
- switch (_response.error.reason) {
218
- case "non-json":
257
+ async getResult(id, requestOptions) {
258
+ const _response = await core.fetcher({
259
+ url: (0, url_join_1.default)((await core.Supplier.get(this._options.environment)) ??
260
+ environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/result`),
261
+ method: "GET",
262
+ headers: {
263
+ Authorization: await this._getAuthorizationHeader(),
264
+ "X-Fern-Language": "JavaScript",
265
+ "X-Fern-Runtime": core.RUNTIME.type,
266
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
267
+ },
268
+ contentType: "application/json",
269
+ requestType: "json",
270
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
271
+ maxRetries: requestOptions?.maxRetries,
272
+ withCredentials: true,
273
+ abortSignal: requestOptions?.abortSignal,
274
+ });
275
+ if (_response.ok) {
276
+ return _response.body;
277
+ }
278
+ if (_response.error.reason === "status-code") {
279
+ switch (_response.error.statusCode) {
280
+ case 401:
281
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
282
+ case 403:
283
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
284
+ case 404:
285
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body);
286
+ case 500:
287
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body);
288
+ default:
219
289
  throw new errors.PlanqkServiceApiError({
220
290
  statusCode: _response.error.statusCode,
221
- body: _response.error.rawBody,
222
- });
223
- case "timeout":
224
- throw new errors.PlanqkServiceApiTimeoutError();
225
- case "unknown":
226
- throw new errors.PlanqkServiceApiError({
227
- message: _response.error.errorMessage,
291
+ body: _response.error.body,
228
292
  });
229
293
  }
230
- });
294
+ }
295
+ switch (_response.error.reason) {
296
+ case "non-json":
297
+ throw new errors.PlanqkServiceApiError({
298
+ statusCode: _response.error.statusCode,
299
+ body: _response.error.rawBody,
300
+ });
301
+ case "timeout":
302
+ throw new errors.PlanqkServiceApiTimeoutError();
303
+ case "unknown":
304
+ throw new errors.PlanqkServiceApiError({
305
+ message: _response.error.errorMessage,
306
+ });
307
+ }
231
308
  }
232
309
  /**
233
- * Gets the last or a list of interim results of a service execution.
310
+ * This method downloads a result file of a service execution.
234
311
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
235
312
  * @throws {@link PlanqkServiceApi.ForbiddenError}
236
313
  * @throws {@link PlanqkServiceApi.NotFoundError}
237
314
  * @throws {@link PlanqkServiceApi.InternalServerError}
238
315
  */
239
- getInterimResults(id, request = {}, requestOptions) {
240
- var _a;
241
- return __awaiter(this, void 0, void 0, function* () {
242
- const { last } = request;
243
- const _queryParams = {};
244
- if (last != null) {
245
- _queryParams["last"] = last.toString();
246
- }
247
- const _response = yield core.fetcher({
248
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PlanqkServiceApiEnvironment.Default, `${id}/interim-results`),
249
- method: "GET",
250
- headers: {
251
- Authorization: yield this._getAuthorizationHeader(),
252
- "X-Fern-Language": "JavaScript",
253
- },
254
- contentType: "application/json",
255
- queryParameters: _queryParams,
256
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
257
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
258
- withCredentials: true,
259
- });
260
- if (_response.ok) {
261
- return _response.body;
262
- }
263
- if (_response.error.reason === "status-code") {
264
- switch (_response.error.statusCode) {
265
- case 401:
266
- throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
267
- case 403:
268
- throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
269
- case 404:
270
- throw new PlanqkServiceApi.NotFoundError(_response.error.body);
271
- case 500:
272
- throw new PlanqkServiceApi.InternalServerError(_response.error.body);
273
- default:
274
- throw new errors.PlanqkServiceApiError({
275
- statusCode: _response.error.statusCode,
276
- body: _response.error.body,
277
- });
278
- }
279
- }
280
- switch (_response.error.reason) {
281
- case "non-json":
316
+ async getResultFile(id, file, requestOptions) {
317
+ const _response = await core.fetcher({
318
+ url: (0, url_join_1.default)((await core.Supplier.get(this._options.environment)) ??
319
+ environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/result/${encodeURIComponent(file)}`),
320
+ method: "GET",
321
+ headers: {
322
+ Authorization: await this._getAuthorizationHeader(),
323
+ "X-Fern-Language": "JavaScript",
324
+ "X-Fern-Runtime": core.RUNTIME.type,
325
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
326
+ },
327
+ contentType: "application/json",
328
+ requestType: "json",
329
+ responseType: "streaming",
330
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
331
+ maxRetries: requestOptions?.maxRetries,
332
+ withCredentials: true,
333
+ abortSignal: requestOptions?.abortSignal,
334
+ });
335
+ if (_response.ok) {
336
+ return _response.body;
337
+ }
338
+ if (_response.error.reason === "status-code") {
339
+ switch (_response.error.statusCode) {
340
+ case 401:
341
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
342
+ case 403:
343
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
344
+ case 404:
345
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body);
346
+ case 500:
347
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body);
348
+ default:
282
349
  throw new errors.PlanqkServiceApiError({
283
350
  statusCode: _response.error.statusCode,
284
- body: _response.error.rawBody,
285
- });
286
- case "timeout":
287
- throw new errors.PlanqkServiceApiTimeoutError();
288
- case "unknown":
289
- throw new errors.PlanqkServiceApiError({
290
- message: _response.error.errorMessage,
351
+ body: _response.error.body,
291
352
  });
292
353
  }
293
- });
354
+ }
355
+ switch (_response.error.reason) {
356
+ case "non-json":
357
+ throw new errors.PlanqkServiceApiError({
358
+ statusCode: _response.error.statusCode,
359
+ body: _response.error.rawBody,
360
+ });
361
+ case "timeout":
362
+ throw new errors.PlanqkServiceApiTimeoutError();
363
+ case "unknown":
364
+ throw new errors.PlanqkServiceApiError({
365
+ message: _response.error.errorMessage,
366
+ });
367
+ }
294
368
  }
295
369
  /**
296
- * Cancels a running service execution.
370
+ * This method retrieves the log output of a service execution.
371
+ *
372
+ * @param {string} id - The id of a service execution
373
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
374
+ *
297
375
  * @throws {@link PlanqkServiceApi.UnauthorizedError}
298
376
  * @throws {@link PlanqkServiceApi.ForbiddenError}
299
377
  * @throws {@link PlanqkServiceApi.NotFoundError}
300
378
  * @throws {@link PlanqkServiceApi.InternalServerError}
301
379
  *
302
380
  * @example
303
- * await planqkServiceApi.serviceApi.cancelExecution("id")
381
+ * await client.serviceApi.getLogs("id")
304
382
  */
305
- cancelExecution(id, requestOptions) {
306
- var _a;
307
- return __awaiter(this, void 0, void 0, function* () {
308
- const _response = yield core.fetcher({
309
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PlanqkServiceApiEnvironment.Default, `${id}/cancel`),
310
- method: "PUT",
311
- headers: {
312
- Authorization: yield this._getAuthorizationHeader(),
313
- "X-Fern-Language": "JavaScript",
314
- },
315
- contentType: "application/json",
316
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
317
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
318
- withCredentials: true,
319
- });
320
- if (_response.ok) {
321
- return _response.body;
322
- }
323
- if (_response.error.reason === "status-code") {
324
- switch (_response.error.statusCode) {
325
- case 401:
326
- throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
327
- case 403:
328
- throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
329
- case 404:
330
- throw new PlanqkServiceApi.NotFoundError(_response.error.body);
331
- case 500:
332
- throw new PlanqkServiceApi.InternalServerError(_response.error.body);
333
- default:
334
- throw new errors.PlanqkServiceApiError({
335
- statusCode: _response.error.statusCode,
336
- body: _response.error.body,
337
- });
338
- }
339
- }
340
- switch (_response.error.reason) {
341
- case "non-json":
383
+ async getLogs(id, requestOptions) {
384
+ const _response = await core.fetcher({
385
+ url: (0, url_join_1.default)((await core.Supplier.get(this._options.environment)) ??
386
+ environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/log`),
387
+ method: "GET",
388
+ headers: {
389
+ Authorization: await this._getAuthorizationHeader(),
390
+ "X-Fern-Language": "JavaScript",
391
+ "X-Fern-Runtime": core.RUNTIME.type,
392
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
393
+ },
394
+ contentType: "application/json",
395
+ requestType: "json",
396
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
397
+ maxRetries: requestOptions?.maxRetries,
398
+ withCredentials: true,
399
+ abortSignal: requestOptions?.abortSignal,
400
+ });
401
+ if (_response.ok) {
402
+ return _response.body;
403
+ }
404
+ if (_response.error.reason === "status-code") {
405
+ switch (_response.error.statusCode) {
406
+ case 401:
407
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
408
+ case 403:
409
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
410
+ case 404:
411
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body);
412
+ case 500:
413
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body);
414
+ default:
342
415
  throw new errors.PlanqkServiceApiError({
343
416
  statusCode: _response.error.statusCode,
344
- body: _response.error.rawBody,
417
+ body: _response.error.body,
345
418
  });
346
- case "timeout":
347
- throw new errors.PlanqkServiceApiTimeoutError();
348
- case "unknown":
419
+ }
420
+ }
421
+ switch (_response.error.reason) {
422
+ case "non-json":
423
+ throw new errors.PlanqkServiceApiError({
424
+ statusCode: _response.error.statusCode,
425
+ body: _response.error.rawBody,
426
+ });
427
+ case "timeout":
428
+ throw new errors.PlanqkServiceApiTimeoutError();
429
+ case "unknown":
430
+ throw new errors.PlanqkServiceApiError({
431
+ message: _response.error.errorMessage,
432
+ });
433
+ }
434
+ }
435
+ /**
436
+ * This method cancels a service execution.
437
+ *
438
+ * @param {string} id - The id of a service execution
439
+ * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
440
+ *
441
+ * @throws {@link PlanqkServiceApi.UnauthorizedError}
442
+ * @throws {@link PlanqkServiceApi.ForbiddenError}
443
+ * @throws {@link PlanqkServiceApi.NotFoundError}
444
+ * @throws {@link PlanqkServiceApi.InternalServerError}
445
+ *
446
+ * @example
447
+ * await client.serviceApi.cancel("id")
448
+ */
449
+ async cancel(id, requestOptions) {
450
+ const _response = await core.fetcher({
451
+ url: (0, url_join_1.default)((await core.Supplier.get(this._options.environment)) ??
452
+ environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/cancel`),
453
+ method: "PUT",
454
+ headers: {
455
+ Authorization: await this._getAuthorizationHeader(),
456
+ "X-Fern-Language": "JavaScript",
457
+ "X-Fern-Runtime": core.RUNTIME.type,
458
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
459
+ },
460
+ contentType: "application/json",
461
+ requestType: "json",
462
+ timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
463
+ maxRetries: requestOptions?.maxRetries,
464
+ withCredentials: true,
465
+ abortSignal: requestOptions?.abortSignal,
466
+ });
467
+ if (_response.ok) {
468
+ return _response.body;
469
+ }
470
+ if (_response.error.reason === "status-code") {
471
+ switch (_response.error.statusCode) {
472
+ case 401:
473
+ throw new PlanqkServiceApi.UnauthorizedError(_response.error.body);
474
+ case 403:
475
+ throw new PlanqkServiceApi.ForbiddenError(_response.error.body);
476
+ case 404:
477
+ throw new PlanqkServiceApi.NotFoundError(_response.error.body);
478
+ case 500:
479
+ throw new PlanqkServiceApi.InternalServerError(_response.error.body);
480
+ default:
349
481
  throw new errors.PlanqkServiceApiError({
350
- message: _response.error.errorMessage,
482
+ statusCode: _response.error.statusCode,
483
+ body: _response.error.body,
351
484
  });
352
485
  }
353
- });
486
+ }
487
+ switch (_response.error.reason) {
488
+ case "non-json":
489
+ throw new errors.PlanqkServiceApiError({
490
+ statusCode: _response.error.statusCode,
491
+ body: _response.error.rawBody,
492
+ });
493
+ case "timeout":
494
+ throw new errors.PlanqkServiceApiTimeoutError();
495
+ case "unknown":
496
+ throw new errors.PlanqkServiceApiError({
497
+ message: _response.error.errorMessage,
498
+ });
499
+ }
354
500
  }
355
- _getAuthorizationHeader() {
356
- return __awaiter(this, void 0, void 0, function* () {
357
- return `Bearer ${yield core.Supplier.get(this._options.token)}`;
358
- });
501
+ async _getAuthorizationHeader() {
502
+ return `Bearer ${await core.Supplier.get(this._options.token)}`;
359
503
  }
360
504
  }
361
505
  exports.ServiceApi = ServiceApi;