@planqk/planqk-service-sdk 2.1.1 → 2.2.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 (173) hide show
  1. package/.gitlab-ci.yml +8 -39
  2. package/README-node.md +16 -12
  3. package/README.md +30 -41
  4. package/dist/sdk/Client.d.ts +10 -4
  5. package/dist/sdk/Client.js +46 -4
  6. package/dist/sdk/api/index.d.ts +2 -3
  7. package/dist/sdk/api/index.js +2 -3
  8. package/dist/sdk/api/resources/index.d.ts +2 -2
  9. package/dist/sdk/api/resources/index.js +2 -2
  10. package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +41 -55
  11. package/dist/sdk/api/resources/serviceApi/client/Client.js +131 -227
  12. package/dist/sdk/api/resources/serviceApi/index.d.ts +2 -2
  13. package/dist/sdk/api/resources/serviceApi/index.js +2 -2
  14. package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +13 -3
  15. package/dist/sdk/api/resources/serviceApi/types/index.d.ts +1 -4
  16. package/dist/sdk/api/resources/serviceApi/types/index.js +1 -4
  17. package/dist/sdk/api/types/ServiceExecution.d.ts +12 -2
  18. package/dist/sdk/api/types/ServiceExecution.js +12 -0
  19. package/dist/sdk/api/types/index.d.ts +2 -6
  20. package/dist/sdk/api/types/index.js +2 -6
  21. package/dist/sdk/core/auth/BasicAuth.js +3 -3
  22. package/dist/sdk/core/auth/index.d.ts +2 -2
  23. package/dist/sdk/core/auth/index.js +4 -4
  24. package/dist/sdk/core/base64.d.ts +2 -0
  25. package/dist/sdk/core/base64.js +26 -0
  26. package/dist/sdk/core/fetcher/APIResponse.d.ts +10 -0
  27. package/dist/sdk/core/fetcher/BinaryResponse.d.ts +20 -0
  28. package/dist/sdk/core/fetcher/BinaryResponse.js +17 -0
  29. package/dist/sdk/core/fetcher/Fetcher.d.ts +5 -4
  30. package/dist/sdk/core/fetcher/Fetcher.js +41 -22
  31. package/dist/sdk/core/fetcher/Headers.d.ts +2 -0
  32. package/dist/sdk/core/fetcher/Headers.js +85 -0
  33. package/dist/sdk/core/fetcher/HttpResponsePromise.d.ts +58 -0
  34. package/dist/sdk/core/fetcher/HttpResponsePromise.js +94 -0
  35. package/dist/sdk/core/fetcher/RawResponse.d.ts +29 -0
  36. package/dist/sdk/core/fetcher/RawResponse.js +44 -0
  37. package/dist/sdk/core/fetcher/ResponseWithBody.d.ts +4 -0
  38. package/dist/sdk/core/fetcher/ResponseWithBody.js +6 -0
  39. package/dist/sdk/core/fetcher/createRequestUrl.d.ts +1 -1
  40. package/dist/sdk/core/fetcher/createRequestUrl.js +3 -7
  41. package/dist/sdk/core/fetcher/getErrorResponseBody.d.ts +1 -0
  42. package/dist/sdk/core/fetcher/getErrorResponseBody.js +32 -0
  43. package/dist/sdk/core/fetcher/getFetchFn.d.ts +1 -4
  44. package/dist/sdk/core/fetcher/getFetchFn.js +1 -52
  45. package/dist/sdk/core/fetcher/getRequestBody.js +2 -1
  46. package/dist/sdk/core/fetcher/getResponseBody.js +34 -30
  47. package/dist/sdk/core/fetcher/index.d.ts +9 -5
  48. package/dist/sdk/core/fetcher/index.js +13 -7
  49. package/dist/sdk/core/fetcher/makeRequest.js +3 -3
  50. package/dist/sdk/core/fetcher/requestWithRetries.js +14 -5
  51. package/dist/sdk/core/headers.d.ts +3 -0
  52. package/dist/sdk/core/headers.js +29 -0
  53. package/dist/sdk/core/index.d.ts +5 -3
  54. package/dist/sdk/core/index.js +28 -3
  55. package/dist/sdk/core/json.d.ts +15 -0
  56. package/dist/sdk/core/json.js +24 -0
  57. package/dist/sdk/core/runtime/index.d.ts +1 -1
  58. package/dist/sdk/core/runtime/index.js +2 -2
  59. package/dist/sdk/core/runtime/runtime.d.ts +1 -1
  60. package/dist/sdk/core/runtime/runtime.js +49 -40
  61. package/dist/sdk/core/url/index.d.ts +2 -0
  62. package/dist/sdk/core/url/index.js +7 -0
  63. package/dist/sdk/core/url/join.d.ts +1 -0
  64. package/dist/sdk/core/url/join.js +49 -0
  65. package/dist/sdk/core/url/qs.d.ts +6 -0
  66. package/dist/sdk/core/url/qs.js +67 -0
  67. package/dist/sdk/errors/PlanqkServiceApiError.d.ts +4 -1
  68. package/dist/sdk/errors/PlanqkServiceApiError.js +7 -8
  69. package/dist/sdk/errors/PlanqkServiceApiTimeoutError.d.ts +1 -1
  70. package/dist/sdk/errors/PlanqkServiceApiTimeoutError.js +2 -2
  71. package/dist/sdk/errors/index.d.ts +2 -2
  72. package/dist/sdk/errors/index.js +4 -4
  73. package/dist/sdk/index.d.ts +4 -4
  74. package/dist/sdk/index.js +9 -9
  75. package/fern/fern.config.json +1 -1
  76. package/fern/generators.yml +2 -2
  77. package/fern/openapi/openapi.yml +41 -131
  78. package/notebooks/python-sdk.ipynb +1 -1
  79. package/package.json +2 -3
  80. package/planqk/service/_version.py +1 -1
  81. package/pyproject.toml +1 -1
  82. package/src/index.test.ts +29 -16
  83. package/src/sdk/Client.ts +27 -7
  84. package/src/sdk/api/index.ts +2 -3
  85. package/src/sdk/api/resources/index.ts +2 -2
  86. package/src/sdk/api/resources/serviceApi/client/Client.ts +223 -250
  87. package/src/sdk/api/resources/serviceApi/index.ts +2 -2
  88. package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +15 -3
  89. package/src/sdk/api/resources/serviceApi/types/index.ts +1 -4
  90. package/src/sdk/api/types/ServiceExecution.ts +13 -3
  91. package/src/sdk/api/types/index.ts +2 -6
  92. package/src/sdk/core/auth/BasicAuth.ts +3 -3
  93. package/src/sdk/core/auth/index.ts +2 -2
  94. package/src/sdk/core/base64.ts +27 -0
  95. package/src/sdk/core/fetcher/APIResponse.ts +11 -0
  96. package/src/sdk/core/fetcher/BinaryResponse.ts +36 -0
  97. package/src/sdk/core/fetcher/Fetcher.ts +46 -26
  98. package/src/sdk/core/fetcher/Headers.ts +93 -0
  99. package/src/sdk/core/fetcher/HttpResponsePromise.ts +116 -0
  100. package/src/sdk/core/fetcher/RawResponse.ts +61 -0
  101. package/src/sdk/core/fetcher/ResponseWithBody.ts +7 -0
  102. package/src/sdk/core/fetcher/createRequestUrl.ts +4 -8
  103. package/src/sdk/core/fetcher/getErrorResponseBody.ts +32 -0
  104. package/src/sdk/core/fetcher/getFetchFn.ts +2 -24
  105. package/src/sdk/core/fetcher/getRequestBody.ts +3 -1
  106. package/src/sdk/core/fetcher/getResponseBody.ts +38 -27
  107. package/src/sdk/core/fetcher/index.ts +9 -5
  108. package/src/sdk/core/fetcher/makeRequest.ts +2 -2
  109. package/src/sdk/core/fetcher/requestWithRetries.ts +18 -6
  110. package/src/sdk/core/fetcher/signals.ts +1 -1
  111. package/src/sdk/core/headers.ts +35 -0
  112. package/src/sdk/core/index.ts +5 -3
  113. package/src/sdk/core/json.ts +27 -0
  114. package/src/sdk/core/runtime/index.ts +1 -1
  115. package/src/sdk/core/runtime/runtime.ts +60 -53
  116. package/src/sdk/core/url/index.ts +2 -0
  117. package/src/sdk/core/url/join.ts +55 -0
  118. package/src/sdk/core/url/qs.ts +74 -0
  119. package/src/sdk/errors/PlanqkServiceApiError.ts +21 -11
  120. package/src/sdk/errors/PlanqkServiceApiTimeoutError.ts +2 -2
  121. package/src/sdk/errors/index.ts +2 -2
  122. package/src/sdk/index.ts +4 -4
  123. package/dist/sdk/api/errors/BadRequestError.d.ts +0 -7
  124. package/dist/sdk/api/errors/BadRequestError.js +0 -51
  125. package/dist/sdk/api/errors/ForbiddenError.d.ts +0 -7
  126. package/dist/sdk/api/errors/ForbiddenError.js +0 -51
  127. package/dist/sdk/api/errors/InternalServerError.d.ts +0 -7
  128. package/dist/sdk/api/errors/InternalServerError.js +0 -51
  129. package/dist/sdk/api/errors/NotFoundError.d.ts +0 -7
  130. package/dist/sdk/api/errors/NotFoundError.js +0 -51
  131. package/dist/sdk/api/errors/UnauthorizedError.d.ts +0 -7
  132. package/dist/sdk/api/errors/UnauthorizedError.js +0 -51
  133. package/dist/sdk/api/errors/index.d.ts +0 -5
  134. package/dist/sdk/api/errors/index.js +0 -21
  135. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.d.ts +0 -7
  136. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.js +0 -5
  137. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.d.ts +0 -7
  138. package/dist/sdk/api/resources/serviceApi/types/GetResultResponseLinks.js +0 -5
  139. package/dist/sdk/api/resources/serviceApi/types/HealthCheckResponse.d.ts +0 -7
  140. package/dist/sdk/api/resources/serviceApi/types/HealthCheckResponse.js +0 -5
  141. package/dist/sdk/api/types/InputData.d.ts +0 -4
  142. package/dist/sdk/api/types/InputData.js +0 -5
  143. package/dist/sdk/api/types/InputDataRef.d.ts +0 -8
  144. package/dist/sdk/api/types/InputDataRef.js +0 -5
  145. package/dist/sdk/api/types/InputParams.d.ts +0 -4
  146. package/dist/sdk/api/types/InputParams.js +0 -5
  147. package/dist/sdk/api/types/ServiceExecutionStatus.d.ts +0 -12
  148. package/dist/sdk/api/types/ServiceExecutionStatus.js +0 -14
  149. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -30
  150. package/dist/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -232
  151. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -21
  152. package/dist/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -91
  153. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -31
  154. package/dist/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -214
  155. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -18
  156. package/dist/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -48
  157. package/src/sdk/api/errors/BadRequestError.ts +0 -16
  158. package/src/sdk/api/errors/ForbiddenError.ts +0 -16
  159. package/src/sdk/api/errors/InternalServerError.ts +0 -16
  160. package/src/sdk/api/errors/NotFoundError.ts +0 -16
  161. package/src/sdk/api/errors/UnauthorizedError.ts +0 -16
  162. package/src/sdk/api/errors/index.ts +0 -5
  163. package/src/sdk/api/resources/serviceApi/types/GetResultResponseEmbedded.ts +0 -9
  164. package/src/sdk/api/resources/serviceApi/types/GetResultResponseLinks.ts +0 -9
  165. package/src/sdk/api/resources/serviceApi/types/HealthCheckResponse.ts +0 -8
  166. package/src/sdk/api/types/InputData.ts +0 -5
  167. package/src/sdk/api/types/InputDataRef.ts +0 -9
  168. package/src/sdk/api/types/InputParams.ts +0 -5
  169. package/src/sdk/api/types/ServiceExecutionStatus.ts +0 -14
  170. package/src/sdk/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +0 -252
  171. package/src/sdk/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +0 -106
  172. package/src/sdk/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +0 -239
  173. package/src/sdk/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +0 -33
package/.gitlab-ci.yml CHANGED
@@ -1,9 +1,5 @@
1
1
  variables:
2
2
  TWINE_USERNAME: __token__
3
- DATADOG_STATIC_ANALYZER_URL: "https://github.com/DataDog/datadog-static-analyzer/releases/latest/download/datadog-static-analyzer-x86_64-unknown-linux-gnu.zip"
4
- DATADOG_OSV_SCANNER_URL: "https://github.com/DataDog/osv-scanner/releases/latest/download/osv-scanner_linux_amd64.zip"
5
- DATADOG_ENV: "ci"
6
- DATADOG_SERVICE: "planqk-service-sdk"
7
3
  UV_VERSION: 0.6
8
4
  PYTHON_VERSION: 3.11
9
5
  BASE_LAYER: bookworm-slim
@@ -17,41 +13,6 @@ stages:
17
13
  - commit-release-check
18
14
  - release-package
19
15
 
20
- datadog-static-analyzer:
21
- stage: commit-test
22
- rules:
23
- - if: '$CI_COMMIT_MESSAGE =~ /^chore\(release\):/'
24
- when: never
25
- - if: '$CI_PIPELINE_SOURCE == "web"'
26
- - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
27
- image: node:lts
28
- before_script:
29
- - npm install -g @datadog/datadog-ci
30
- - curl -L $DATADOG_STATIC_ANALYZER_URL > /tmp/datadog-static-analyzer.zip
31
- - unzip /tmp/datadog-static-analyzer.zip -d /tmp
32
- - mv /tmp/datadog-static-analyzer /usr/local/datadog-static-analyzer
33
- script:
34
- - /usr/local/datadog-static-analyzer -i . -o /tmp/report.sarif -f sarif
35
- - datadog-ci sarif upload /tmp/report.sarif --service "$DATADOG_SERVICE" --env "$DATADOG_ENV"
36
-
37
- datadog-sbom-analyzer:
38
- stage: commit-test
39
- rules:
40
- - if: '$CI_COMMIT_MESSAGE =~ /^chore\(release\):/'
41
- when: never
42
- - if: '$CI_PIPELINE_SOURCE == "web"'
43
- - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
44
- image: node:lts
45
- before_script:
46
- - npm install -g @datadog/datadog-ci
47
- - mkdir /osv-scanner
48
- - curl -L -o /osv-scanner/osv-scanner.zip $DATADOG_OSV_SCANNER_URL
49
- - unzip /osv-scanner/osv-scanner.zip -d /osv-scanner
50
- - chmod 755 /osv-scanner/osv-scanner
51
- script:
52
- - /osv-scanner/osv-scanner --skip-git -r --experimental-only-packages --format=cyclonedx-1-5 --paths-relative-to-scan-dir --output=/tmp/sbom.json .
53
- - datadog-ci sbom upload --service "$DATADOG_SERVICE" --env "$DATADOG_ENV" /tmp/sbom.json
54
-
55
16
  semantic-release:
56
17
  stage: commit-release-check
57
18
  rules:
@@ -59,6 +20,13 @@ semantic-release:
59
20
  when: never
60
21
  - if: '$CI_PIPELINE_SOURCE == "web"'
61
22
  - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
23
+ variables:
24
+ ## Use the gitlab user to create the release commit
25
+ ## https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#git-environment-variables
26
+ GIT_AUTHOR_NAME: "$GITLAB_USER_NAME"
27
+ GIT_AUTHOR_EMAIL: "$GITLAB_USER_EMAIL"
28
+ GIT_COMMITTER_NAME: "$GITLAB_USER_NAME"
29
+ GIT_COMMITTER_EMAIL: "$GITLAB_USER_EMAIL"
62
30
  image: node:lts
63
31
  before_script:
64
32
  - apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
@@ -95,6 +63,7 @@ publish-node-sdk:
95
63
  - npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
96
64
  script:
97
65
  - npm ci
66
+ - cp README-node.md README.md
98
67
  - npm run build
99
68
  - npm publish
100
69
  cache:
package/README-node.md CHANGED
@@ -17,25 +17,29 @@ const consumerSecret = "..."
17
17
 
18
18
  const client = new PlanqkServiceClient(serviceEndpoint, consumerKey, consumerSecret)
19
19
 
20
- // prepare your input data and parameters
21
- const data = {input: {a: 1, b: 2}};
22
- const params = {param1: "value1", param2: "value2"};
20
+ // List all service executions
21
+ const serviceExecutions = await client.api().getServiceExecutions()
23
22
 
24
- // execute the service
25
- let serviceExecution = await client.api().execute({data, params})
23
+ // Start a new service execution
24
+ const data = {n_coin_tosses: 2}
25
+ const params = {shots: 100}
26
+ let serviceExecution = await client.api().startExecution({data, params}, {timeoutInSeconds: 60})
26
27
 
27
- // retrieve the status of a service execution
28
- serviceExecution = await client.api().getStatus(serviceExecution.id!);
28
+ // Check the status of the service execution
29
+ serviceExecution = await client.api().getStatus(serviceExecution.id!)
29
30
 
30
- // wait for the service execution to finish
31
- const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"];
31
+ // Wait for the service execution to finish
32
+ const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"]
32
33
  while (!finalStates.includes(serviceExecution.status!)) {
33
- serviceExecution = await client.api().getStatus(serviceExecution.id!);
34
+ serviceExecution = await client.api().getStatus(serviceExecution.id!)
34
35
  }
35
36
 
36
- // retrieve the result
37
+ // Get the result of the service execution
37
38
  const result = await client.api().getResult(serviceExecution.id!)
38
39
 
39
- // retrieve the logs
40
+ // Get the logs of the service execution
40
41
  const logs = await client.api().getLogs(serviceExecution.id!)
42
+
43
+ // Cancel the service execution if it is still pending or running
44
+ await client.api().cancelExecution(serviceExecution.id!)
41
45
  ```
package/README.md CHANGED
@@ -1,56 +1,45 @@
1
- # planqk-service-sdk
1
+ # PLANQK Service SDK
2
2
 
3
- This repository contains the SDK clients to execute PLANQK Managed Services.
4
- The clients are generated from a very general [OpenAPI](https://swagger.io/specification) description using [Fern](https://buildwithfern.com).
5
- The generated clients are a baseline, and the idea is to adapt and extend them to our specific needs.
3
+ ## Installation
6
4
 
7
- ## Generate the SDK clients with Fern
8
-
9
- > <https://buildwithfern.com/docs/getting-started>
10
-
11
- ```bash
12
- npm install -g fern-api
13
- fern upgrade
14
- fern generate
15
- ```
16
-
17
- ## Python Setup
18
-
19
- To create a new virtual environment and install the dependencies, run:
5
+ The package can be installed using `npm`:
20
6
 
21
7
  ```bash
22
- uv venv
23
- source .venv/bin/activate
24
-
25
- uv sync
26
- ```
27
-
28
- Update dependencies and lock files:
29
-
30
- ```bash
31
- uv sync -U
8
+ npm install @planqk/planqk-service-sdk
32
9
  ```
33
10
 
34
- ## How to update the Python client?
11
+ ## Usage
35
12
 
36
- After generating the SDK clients with Fern, the Python client needs to be copied manually.
13
+ ```typescript
14
+ const serviceEndpoint = "..."
15
+ const consumerKey = "..."
16
+ const consumerSecret = "..."
37
17
 
38
- Copy the content of `./generated/python` to `./planqk/service/sdk`.
39
- Make sure you overwrite any existing files.
40
- It is recommended to remove the old files first.
18
+ const client = new PlanqkServiceClient(serviceEndpoint, consumerKey, consumerSecret)
41
19
 
42
- Next, check by executing `pytest` if the changes are compatible with our wrapper.
20
+ // List all service executions
21
+ const serviceExecutions = await client.api().getServiceExecutions()
43
22
 
44
- ## How to update the TypeScript client?
23
+ // Start a new service execution
24
+ const data = {n_coin_tosses: 2}
25
+ const params = {shots: 100}
26
+ let serviceExecution = await client.api().startExecution({data, params}, {timeoutInSeconds: 60})
45
27
 
46
- After generating the SDK clients with Fern, the TypeScript client needs to be copied manually.
28
+ // Check the status of the service execution
29
+ serviceExecution = await client.api().getStatus(serviceExecution.id!)
47
30
 
48
- Copy the content of `./generated/typescript` to `./typescript/src/sdk`.
49
- Make sure you overwrite any existing files.
50
- It is recommended to remove the old files first.
31
+ // Wait for the service execution to finish
32
+ const finalStates = ["SUCCEEDED", "CANCELLED", "FAILED"]
33
+ while (!finalStates.includes(serviceExecution.status!)) {
34
+ serviceExecution = await client.api().getStatus(serviceExecution.id!)
35
+ }
51
36
 
52
- Next, check by executing `npm test` if the changes are compatible with our wrapper.
37
+ // Get the result of the service execution
38
+ const result = await client.api().getResult(serviceExecution.id!)
53
39
 
54
- ## License
40
+ // Get the logs of the service execution
41
+ const logs = await client.api().getLogs(serviceExecution.id!)
55
42
 
56
- Apache-2.0 | Copyright 2023-2024 Kipu Quantum GmbH
43
+ // Cancel the service execution if it is still pending or running
44
+ await client.api().cancelExecution(serviceExecution.id!)
45
+ ```
@@ -1,13 +1,17 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as environments from "./environments";
5
- import * as core from "./core";
6
- import { ServiceApi } from "./api/resources/serviceApi/client/Client";
4
+ import * as environments from "./environments.js";
5
+ import * as core from "./core/index.js";
6
+ import { ServiceApi } from "./api/resources/serviceApi/client/Client.js";
7
7
  export declare namespace PlanqkServiceApiClient {
8
8
  interface Options {
9
9
  environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
10
12
  token: core.Supplier<core.BearerToken>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
11
15
  }
12
16
  interface RequestOptions {
13
17
  /** The maximum time to wait for a response in seconds. */
@@ -16,11 +20,13 @@ export declare namespace PlanqkServiceApiClient {
16
20
  maxRetries?: number;
17
21
  /** A hook to abort the request. */
18
22
  abortSignal?: AbortSignal;
23
+ /** Additional headers to include in the request. */
24
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
19
25
  }
20
26
  }
21
27
  export declare class PlanqkServiceApiClient {
22
28
  protected readonly _options: PlanqkServiceApiClient.Options;
23
- constructor(_options: PlanqkServiceApiClient.Options);
24
29
  protected _serviceApi: ServiceApi | undefined;
30
+ constructor(_options: PlanqkServiceApiClient.Options);
25
31
  get serviceApi(): ServiceApi;
26
32
  }
@@ -2,17 +2,59 @@
2
2
  /**
3
3
  * This file was auto-generated by Fern from our API Definition.
4
4
  */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
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
+ })();
5
38
  Object.defineProperty(exports, "__esModule", { value: true });
6
39
  exports.PlanqkServiceApiClient = void 0;
7
- const Client_1 = require("./api/resources/serviceApi/client/Client");
40
+ const core = __importStar(require("./core/index.js"));
41
+ const headers_js_1 = require("./core/headers.js");
42
+ const Client_js_1 = require("./api/resources/serviceApi/client/Client.js");
8
43
  class PlanqkServiceApiClient {
9
44
  _options;
45
+ _serviceApi;
10
46
  constructor(_options) {
11
- this._options = _options;
47
+ this._options = {
48
+ ..._options,
49
+ headers: (0, headers_js_1.mergeHeaders)({
50
+ "X-Fern-Language": "JavaScript",
51
+ "X-Fern-Runtime": core.RUNTIME.type,
52
+ "X-Fern-Runtime-Version": core.RUNTIME.version,
53
+ }, _options?.headers),
54
+ };
12
55
  }
13
- _serviceApi;
14
56
  get serviceApi() {
15
- return (this._serviceApi ??= new Client_1.ServiceApi(this._options));
57
+ return (this._serviceApi ??= new Client_js_1.ServiceApi(this._options));
16
58
  }
17
59
  }
18
60
  exports.PlanqkServiceApiClient = PlanqkServiceApiClient;
@@ -1,3 +1,2 @@
1
- export * from "./resources";
2
- export * from "./types";
3
- export * from "./errors";
1
+ export * from "./resources/index.js";
2
+ export * from "./types/index.js";
@@ -14,6 +14,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./resources"), exports);
18
- __exportStar(require("./types"), exports);
19
- __exportStar(require("./errors"), exports);
17
+ __exportStar(require("./resources/index.js"), exports);
18
+ __exportStar(require("./types/index.js"), exports);
@@ -1,2 +1,2 @@
1
- export * as serviceApi from "./serviceApi";
2
- export * from "./serviceApi/types";
1
+ export * as serviceApi from "./serviceApi/index.js";
2
+ export * from "./serviceApi/types/index.js";
@@ -37,5 +37,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.serviceApi = void 0;
40
- exports.serviceApi = __importStar(require("./serviceApi"));
41
- __exportStar(require("./serviceApi/types"), exports);
40
+ exports.serviceApi = __importStar(require("./serviceApi/index.js"));
41
+ __exportStar(require("./serviceApi/types/index.js"), exports);
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as environments from "../../../../environments";
5
- import * as core from "../../../../core";
6
- import * as PlanqkServiceApi from "../../../index";
7
- import * as stream from "stream";
4
+ import * as environments from "../../../../environments.js";
5
+ import * as core from "../../../../core/index.js";
6
+ import * as PlanqkServiceApi from "../../../index.js";
8
7
  export declare namespace ServiceApi {
9
8
  interface Options {
10
9
  environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
10
+ /** Specify a custom URL to connect the client to. */
11
+ baseUrl?: core.Supplier<string>;
11
12
  token: core.Supplier<core.BearerToken>;
13
+ /** Additional headers to include in requests. */
14
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
12
15
  }
13
16
  interface RequestOptions {
14
17
  /** The maximum time to wait for a response in seconds. */
@@ -17,108 +20,91 @@ export declare namespace ServiceApi {
17
20
  maxRetries?: number;
18
21
  /** A hook to abort the request. */
19
22
  abortSignal?: AbortSignal;
23
+ /** Additional headers to include in the request. */
24
+ headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
20
25
  }
21
26
  }
22
27
  export declare class ServiceApi {
23
28
  protected readonly _options: ServiceApi.Options;
24
29
  constructor(_options: ServiceApi.Options);
25
30
  /**
26
- * This method checks the health of the service.
31
+ * Retrieves a list of all service executions.
32
+ * The response includes links to each service execution, allowing for further queries on their status and results.
27
33
  *
28
34
  * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
29
35
  *
30
36
  * @example
31
- * await client.serviceApi.healthCheck()
37
+ * await client.serviceApi.getServiceExecutions()
32
38
  */
33
- healthCheck(requestOptions?: ServiceApi.RequestOptions): Promise<PlanqkServiceApi.HealthCheckResponse>;
39
+ getServiceExecutions(requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution[]>;
40
+ private __getServiceExecutions;
34
41
  /**
35
- * This method starts a service execution, which in turn is processed asynchronously by PLANQK.
42
+ * Starts a service execution, which in turn is processed asynchronously.
36
43
  * The location header of the response contains the URL which can be used to query the status and the result of the service execution.
37
44
  *
38
- * @param {Record<string, Record<string, any>>} request
45
+ * @param {Record<string, any>} request
39
46
  * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
40
47
  *
41
- * @throws {@link PlanqkServiceApi.BadRequestError}
42
- * @throws {@link PlanqkServiceApi.UnauthorizedError}
43
- * @throws {@link PlanqkServiceApi.ForbiddenError}
44
- * @throws {@link PlanqkServiceApi.NotFoundError}
45
- * @throws {@link PlanqkServiceApi.InternalServerError}
46
- *
47
48
  * @example
48
- * await client.serviceApi.execute({
49
- * "key": {
50
- * "key": "value"
51
- * }
49
+ * await client.serviceApi.startExecution({
50
+ * "key": "value"
52
51
  * })
53
52
  */
54
- execute(request: Record<string, Record<string, any>>, requestOptions?: ServiceApi.RequestOptions): Promise<PlanqkServiceApi.ServiceExecution>;
53
+ startExecution(request: Record<string, any>, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution>;
54
+ private __startExecution;
55
55
  /**
56
- * This method checks the status of a service execution.
56
+ * Retrieves the status of a service execution.
57
+ * The status can be one of the following: UNKNOWN, PENDING, RUNNING, SUCCEEDED, CANCELLED, FAILED.
57
58
  *
58
59
  * @param {string} id - The id of a service execution
59
60
  * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
60
61
  *
61
- * @throws {@link PlanqkServiceApi.UnauthorizedError}
62
- * @throws {@link PlanqkServiceApi.ForbiddenError}
63
- * @throws {@link PlanqkServiceApi.NotFoundError}
64
- * @throws {@link PlanqkServiceApi.InternalServerError}
65
- *
66
62
  * @example
67
63
  * await client.serviceApi.getStatus("id")
68
64
  */
69
- getStatus(id: string, requestOptions?: ServiceApi.RequestOptions): Promise<PlanqkServiceApi.ServiceExecution>;
65
+ getStatus(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution>;
66
+ private __getStatus;
70
67
  /**
71
- * This method retrieves the result of a service execution.
68
+ * Retrieves the result of a service execution.
69
+ * The result is returned as a JSON object containing the status and any additional data.
70
+ * The result may include links to download specific result files.
72
71
  *
73
72
  * @param {string} id - The id of a service execution
74
73
  * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
75
74
  *
76
- * @throws {@link PlanqkServiceApi.UnauthorizedError}
77
- * @throws {@link PlanqkServiceApi.ForbiddenError}
78
- * @throws {@link PlanqkServiceApi.NotFoundError}
79
- * @throws {@link PlanqkServiceApi.InternalServerError}
80
- *
81
75
  * @example
82
76
  * await client.serviceApi.getResult("id")
83
77
  */
84
- getResult(id: string, requestOptions?: ServiceApi.RequestOptions): Promise<PlanqkServiceApi.GetResultResponse>;
78
+ getResult(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.GetResultResponse>;
79
+ private __getResult;
85
80
  /**
86
- * This method downloads a result file of a service execution.
87
- * @throws {@link PlanqkServiceApi.UnauthorizedError}
88
- * @throws {@link PlanqkServiceApi.ForbiddenError}
89
- * @throws {@link PlanqkServiceApi.NotFoundError}
90
- * @throws {@link PlanqkServiceApi.InternalServerError}
81
+ * Retrieves a specific result file of a service execution.
82
+ * The file name is provided in the path parameter.
83
+ * The result file is returned as a binary stream.
91
84
  */
92
- getResultFile(id: string, file: string, requestOptions?: ServiceApi.RequestOptions): Promise<stream.Readable>;
85
+ getResultFile(id: string, file: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<core.BinaryResponse>;
86
+ private __getResultFile;
93
87
  /**
94
- * This method retrieves the log output of a service execution.
88
+ * Returns a list of log entries for a service execution in chronological order, where the first entry is the oldest.
95
89
  *
96
90
  * @param {string} id - The id of a service execution
97
91
  * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
98
92
  *
99
- * @throws {@link PlanqkServiceApi.UnauthorizedError}
100
- * @throws {@link PlanqkServiceApi.ForbiddenError}
101
- * @throws {@link PlanqkServiceApi.NotFoundError}
102
- * @throws {@link PlanqkServiceApi.InternalServerError}
103
- *
104
93
  * @example
105
94
  * await client.serviceApi.getLogs("id")
106
95
  */
107
- getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): Promise<string[]>;
96
+ getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<string[]>;
97
+ private __getLogs;
108
98
  /**
109
- * This method cancels a service execution.
99
+ * Cancel a pending or running service execution.
110
100
  *
111
101
  * @param {string} id - The id of a service execution
112
102
  * @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
113
103
  *
114
- * @throws {@link PlanqkServiceApi.UnauthorizedError}
115
- * @throws {@link PlanqkServiceApi.ForbiddenError}
116
- * @throws {@link PlanqkServiceApi.NotFoundError}
117
- * @throws {@link PlanqkServiceApi.InternalServerError}
118
- *
119
104
  * @example
120
- * await client.serviceApi.cancel("id")
105
+ * await client.serviceApi.cancelExecution("id")
121
106
  */
122
- cancel(id: string, requestOptions?: ServiceApi.RequestOptions): Promise<PlanqkServiceApi.ServiceExecution>;
107
+ cancelExecution(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution>;
108
+ private __cancelExecution;
123
109
  protected _getAuthorizationHeader(): Promise<string>;
124
110
  }