@planqk/planqk-service-sdk 2.6.2 → 2.8.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.
- package/dist/sdk/BaseClient.d.ts +26 -0
- package/dist/sdk/{api/resources/serviceApi/types/GetResultResponse.js → BaseClient.js} +1 -3
- package/dist/sdk/Client.d.ts +4 -22
- package/dist/sdk/Client.js +2 -4
- package/dist/sdk/api/index.d.ts +1 -1
- package/dist/sdk/api/index.js +1 -1
- package/dist/sdk/api/resources/index.d.ts +0 -1
- package/dist/sdk/api/resources/index.js +0 -4
- package/dist/sdk/api/resources/serviceApi/client/Client.d.ts +9 -26
- package/dist/sdk/api/resources/serviceApi/client/Client.js +43 -27
- package/dist/sdk/api/resources/serviceApi/index.d.ts +0 -1
- package/dist/sdk/api/resources/serviceApi/index.js +0 -1
- package/dist/sdk/api/types/HalLink.d.ts +0 -3
- package/dist/sdk/api/types/HalLink.js +1 -3
- package/dist/sdk/api/types/LogEntry.d.ts +19 -0
- package/dist/sdk/api/types/LogEntry.js +15 -0
- package/dist/sdk/api/types/RequestBody.d.ts +1 -0
- package/dist/sdk/api/types/RequestBody.js +3 -0
- package/dist/sdk/api/types/ResultResponse.d.ts +15 -0
- package/dist/sdk/api/types/ResultResponse.js +3 -0
- package/dist/sdk/api/types/ServiceExecution.d.ts +1 -4
- package/dist/sdk/api/types/ServiceExecution.js +1 -3
- package/dist/sdk/api/types/index.d.ts +3 -0
- package/dist/sdk/api/types/index.js +3 -0
- package/dist/sdk/core/auth/AuthProvider.d.ts +4 -0
- package/dist/sdk/core/auth/AuthProvider.js +2 -0
- package/dist/sdk/core/auth/AuthRequest.d.ts +9 -0
- package/dist/sdk/core/auth/AuthRequest.js +2 -0
- package/dist/sdk/core/auth/BasicAuth.js +2 -1
- package/dist/sdk/core/auth/index.d.ts +2 -0
- package/dist/sdk/core/fetcher/APIResponse.d.ts +1 -1
- package/dist/sdk/core/fetcher/BinaryResponse.d.ts +1 -1
- package/dist/sdk/core/fetcher/EndpointMetadata.d.ts +13 -0
- package/dist/sdk/core/fetcher/EndpointMetadata.js +2 -0
- package/dist/sdk/core/fetcher/EndpointSupplier.d.ts +12 -0
- package/dist/sdk/core/fetcher/EndpointSupplier.js +13 -0
- package/dist/sdk/core/fetcher/Fetcher.d.ts +6 -4
- package/dist/sdk/core/fetcher/Fetcher.js +3 -3
- package/dist/sdk/core/fetcher/HttpResponsePromise.d.ts +1 -1
- package/dist/sdk/core/fetcher/index.d.ts +7 -5
- package/dist/sdk/core/fetcher/index.js +7 -5
- package/dist/sdk/core/fetcher/requestWithRetries.js +44 -8
- package/dist/sdk/core/headers.d.ts +2 -3
- package/dist/sdk/core/url/join.js +23 -3
- package/dist/sdk/environments.d.ts +0 -3
- package/dist/sdk/environments.js +1 -3
- package/dist/sdk/errors/PlanqkServiceApiError.d.ts +0 -3
- package/dist/sdk/errors/PlanqkServiceApiError.js +1 -3
- package/dist/sdk/errors/PlanqkServiceApiTimeoutError.d.ts +0 -3
- package/dist/sdk/errors/PlanqkServiceApiTimeoutError.js +1 -3
- package/dist/sdk/index.d.ts +1 -0
- package/fern/fern.config.json +1 -1
- package/fern/generators.yml +6 -4
- package/fern/openapi/openapi.yml +115 -80
- package/package.json +1 -1
- package/planqk/service/_version.py +1 -1
- package/planqk/service/client.py +3 -3
- package/planqk/service/sdk/__init__.py +61 -8
- package/planqk/service/sdk/client.py +27 -7
- package/planqk/service/sdk/core/__init__.py +80 -20
- package/planqk/service/sdk/core/client_wrapper.py +8 -6
- package/planqk/service/sdk/core/force_multipart.py +4 -2
- package/planqk/service/sdk/core/http_response.py +1 -1
- package/planqk/service/sdk/core/http_sse/__init__.py +42 -0
- package/planqk/service/sdk/core/http_sse/_api.py +112 -0
- package/planqk/service/sdk/core/http_sse/_decoders.py +61 -0
- package/planqk/service/sdk/core/http_sse/_exceptions.py +7 -0
- package/planqk/service/sdk/core/http_sse/_models.py +17 -0
- package/planqk/service/sdk/core/pydantic_utilities.py +5 -2
- package/planqk/service/sdk/core/unchecked_base_model.py +341 -0
- package/planqk/service/sdk/service_api/__init__.py +0 -3
- package/planqk/service/sdk/service_api/client.py +17 -21
- package/planqk/service/sdk/service_api/raw_client.py +36 -40
- package/planqk/service/sdk/types/__init__.py +57 -4
- package/planqk/service/sdk/types/hal_link.py +3 -2
- package/planqk/service/sdk/types/log_entry.py +35 -0
- package/planqk/service/sdk/types/log_entry_severity.py +5 -0
- package/planqk/service/sdk/types/request_body.py +5 -0
- package/planqk/service/sdk/types/result_response.py +27 -0
- package/planqk/service/sdk/{service_api/types/get_result_response_embedded.py → types/result_response_embedded.py} +4 -3
- package/planqk/service/sdk/{service_api/types/get_result_response_links.py → types/result_response_links.py} +4 -3
- package/planqk/service/sdk/types/service_execution.py +3 -2
- package/pyproject.toml +1 -1
- package/requirements-dev.txt +59 -43
- package/requirements.txt +6 -6
- package/src/index.test.ts +10 -0
- package/src/sdk/BaseClient.ts +30 -0
- package/src/sdk/Client.ts +6 -23
- package/src/sdk/api/index.ts +1 -1
- package/src/sdk/api/resources/index.ts +0 -1
- package/src/sdk/api/resources/serviceApi/client/Client.ts +87 -82
- package/src/sdk/api/resources/serviceApi/index.ts +0 -1
- package/src/sdk/api/types/HalLink.ts +1 -3
- package/src/sdk/api/types/LogEntry.ts +22 -0
- package/src/sdk/api/types/RequestBody.ts +3 -0
- package/src/sdk/api/types/ResultResponse.ts +20 -0
- package/src/sdk/api/types/ServiceExecution.ts +2 -4
- package/src/sdk/api/types/index.ts +3 -0
- package/src/sdk/core/auth/AuthProvider.ts +5 -0
- package/src/sdk/core/auth/AuthRequest.ts +9 -0
- package/src/sdk/core/auth/BasicAuth.ts +2 -1
- package/src/sdk/core/auth/index.ts +2 -0
- package/src/sdk/core/fetcher/APIResponse.ts +1 -1
- package/src/sdk/core/fetcher/BinaryResponse.ts +1 -1
- package/src/sdk/core/fetcher/EndpointMetadata.ts +13 -0
- package/src/sdk/core/fetcher/EndpointSupplier.ts +14 -0
- package/src/sdk/core/fetcher/Fetcher.ts +8 -6
- package/src/sdk/core/fetcher/HttpResponsePromise.ts +1 -1
- package/src/sdk/core/fetcher/index.ts +7 -5
- package/src/sdk/core/fetcher/requestWithRetries.ts +49 -9
- package/src/sdk/core/headers.ts +8 -10
- package/src/sdk/core/url/join.ts +28 -3
- package/src/sdk/environments.ts +1 -3
- package/src/sdk/errors/PlanqkServiceApiError.ts +1 -3
- package/src/sdk/errors/PlanqkServiceApiTimeoutError.ts +1 -3
- package/src/sdk/index.ts +1 -0
- package/uv.lock +77 -47
- package/dist/sdk/api/resources/serviceApi/types/GetResultResponse.d.ts +0 -18
- package/dist/sdk/api/resources/serviceApi/types/index.d.ts +0 -1
- package/dist/sdk/api/resources/serviceApi/types/index.js +0 -17
- package/planqk/service/sdk/service_api/types/__init__.py +0 -9
- package/planqk/service/sdk/service_api/types/get_result_response.py +0 -26
- package/src/sdk/api/resources/serviceApi/types/GetResultResponse.ts +0 -22
- package/src/sdk/api/resources/serviceApi/types/index.ts +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as environments from "./environments.js";
|
|
2
|
+
import * as core from "./core/index.js";
|
|
3
|
+
export interface BaseClientOptions {
|
|
4
|
+
environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
|
|
5
|
+
/** Specify a custom URL to connect the client to. */
|
|
6
|
+
baseUrl?: core.Supplier<string>;
|
|
7
|
+
token?: core.Supplier<core.BearerToken | undefined>;
|
|
8
|
+
/** Additional headers to include in requests. */
|
|
9
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
10
|
+
/** The default maximum time to wait for a response in seconds. */
|
|
11
|
+
timeoutInSeconds?: number;
|
|
12
|
+
/** The default number of times to retry the request. Defaults to 2. */
|
|
13
|
+
maxRetries?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface BaseRequestOptions {
|
|
16
|
+
/** The maximum time to wait for a response in seconds. */
|
|
17
|
+
timeoutInSeconds?: number;
|
|
18
|
+
/** The number of times to retry the request. Defaults to 2. */
|
|
19
|
+
maxRetries?: number;
|
|
20
|
+
/** A hook to abort the request. */
|
|
21
|
+
abortSignal?: AbortSignal;
|
|
22
|
+
/** Additional query string parameters to include in the request. */
|
|
23
|
+
queryParams?: Record<string, unknown>;
|
|
24
|
+
/** Additional headers to include in the request. */
|
|
25
|
+
headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
|
|
26
|
+
}
|
package/dist/sdk/Client.d.ts
CHANGED
|
@@ -1,32 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as environments from "./environments.js";
|
|
5
|
-
import * as core from "./core/index.js";
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js";
|
|
6
2
|
import { ServiceApi } from "./api/resources/serviceApi/client/Client.js";
|
|
7
3
|
export declare namespace PlanqkServiceApiClient {
|
|
8
|
-
interface Options {
|
|
9
|
-
environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
|
|
10
|
-
/** Specify a custom URL to connect the client to. */
|
|
11
|
-
baseUrl?: core.Supplier<string>;
|
|
12
|
-
token: core.Supplier<core.BearerToken>;
|
|
13
|
-
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
4
|
+
interface Options extends BaseClientOptions {
|
|
15
5
|
}
|
|
16
|
-
interface RequestOptions {
|
|
17
|
-
/** The maximum time to wait for a response in seconds. */
|
|
18
|
-
timeoutInSeconds?: number;
|
|
19
|
-
/** The number of times to retry the request. Defaults to 2. */
|
|
20
|
-
maxRetries?: number;
|
|
21
|
-
/** A hook to abort the request. */
|
|
22
|
-
abortSignal?: AbortSignal;
|
|
23
|
-
/** Additional headers to include in the request. */
|
|
24
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
6
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
25
7
|
}
|
|
26
8
|
}
|
|
27
9
|
export declare class PlanqkServiceApiClient {
|
|
28
10
|
protected readonly _options: PlanqkServiceApiClient.Options;
|
|
29
11
|
protected _serviceApi: ServiceApi | undefined;
|
|
30
|
-
constructor(_options
|
|
12
|
+
constructor(_options?: PlanqkServiceApiClient.Options);
|
|
31
13
|
get serviceApi(): ServiceApi;
|
|
32
14
|
}
|
package/dist/sdk/Client.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -43,7 +41,7 @@ const Client_js_1 = require("./api/resources/serviceApi/client/Client.js");
|
|
|
43
41
|
class PlanqkServiceApiClient {
|
|
44
42
|
_options;
|
|
45
43
|
_serviceApi;
|
|
46
|
-
constructor(_options) {
|
|
44
|
+
constructor(_options = {}) {
|
|
47
45
|
this._options = {
|
|
48
46
|
..._options,
|
|
49
47
|
headers: (0, headers_js_1.mergeHeaders)({
|
package/dist/sdk/api/index.d.ts
CHANGED
package/dist/sdk/api/index.js
CHANGED
|
@@ -14,5 +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/index.js"), exports);
|
|
18
17
|
__exportStar(require("./types/index.js"), exports);
|
|
18
|
+
__exportStar(require("./resources/index.js"), exports);
|
|
@@ -32,10 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
exports.serviceApi = void 0;
|
|
40
37
|
exports.serviceApi = __importStar(require("./serviceApi/index.js"));
|
|
41
|
-
__exportStar(require("./serviceApi/types/index.js"), exports);
|
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
|
-
import * as environments from "../../../../environments.js";
|
|
1
|
+
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
|
|
5
2
|
import * as core from "../../../../core/index.js";
|
|
6
3
|
import * as PlanqkServiceApi from "../../../index.js";
|
|
7
4
|
export declare namespace ServiceApi {
|
|
8
|
-
interface Options {
|
|
9
|
-
environment?: core.Supplier<environments.PlanqkServiceApiEnvironment | string>;
|
|
10
|
-
/** Specify a custom URL to connect the client to. */
|
|
11
|
-
baseUrl?: core.Supplier<string>;
|
|
12
|
-
token: core.Supplier<core.BearerToken>;
|
|
13
|
-
/** Additional headers to include in requests. */
|
|
14
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
5
|
+
interface Options extends BaseClientOptions {
|
|
15
6
|
}
|
|
16
|
-
interface RequestOptions {
|
|
17
|
-
/** The maximum time to wait for a response in seconds. */
|
|
18
|
-
timeoutInSeconds?: number;
|
|
19
|
-
/** The number of times to retry the request. Defaults to 2. */
|
|
20
|
-
maxRetries?: number;
|
|
21
|
-
/** A hook to abort the request. */
|
|
22
|
-
abortSignal?: AbortSignal;
|
|
23
|
-
/** Additional headers to include in the request. */
|
|
24
|
-
headers?: Record<string, string | core.Supplier<string | undefined> | undefined>;
|
|
7
|
+
interface RequestOptions extends BaseRequestOptions {
|
|
25
8
|
}
|
|
26
9
|
}
|
|
27
10
|
export declare class ServiceApi {
|
|
28
11
|
protected readonly _options: ServiceApi.Options;
|
|
29
|
-
constructor(_options
|
|
12
|
+
constructor(_options?: ServiceApi.Options);
|
|
30
13
|
/**
|
|
31
14
|
* Retrieves a list of all service executions.
|
|
32
15
|
* The response includes links to each service execution, allowing for further queries on their status and results.
|
|
@@ -42,7 +25,7 @@ export declare class ServiceApi {
|
|
|
42
25
|
* Starts a service execution, which in turn is processed asynchronously.
|
|
43
26
|
* The location header of the response contains the URL which can be used to query the status and the result of the service execution.
|
|
44
27
|
*
|
|
45
|
-
* @param {
|
|
28
|
+
* @param {PlanqkServiceApi.RequestBody} request
|
|
46
29
|
* @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
|
|
47
30
|
*
|
|
48
31
|
* @example
|
|
@@ -50,7 +33,7 @@ export declare class ServiceApi {
|
|
|
50
33
|
* "key": "value"
|
|
51
34
|
* })
|
|
52
35
|
*/
|
|
53
|
-
startExecution(request:
|
|
36
|
+
startExecution(request: PlanqkServiceApi.RequestBody, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution>;
|
|
54
37
|
private __startExecution;
|
|
55
38
|
/**
|
|
56
39
|
* Retrieves the status of a service execution.
|
|
@@ -75,7 +58,7 @@ export declare class ServiceApi {
|
|
|
75
58
|
* @example
|
|
76
59
|
* await client.serviceApi.getResult("id")
|
|
77
60
|
*/
|
|
78
|
-
getResult(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.
|
|
61
|
+
getResult(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ResultResponse>;
|
|
79
62
|
private __getResult;
|
|
80
63
|
/**
|
|
81
64
|
* Retrieves a specific result file of a service execution.
|
|
@@ -93,7 +76,7 @@ export declare class ServiceApi {
|
|
|
93
76
|
* @example
|
|
94
77
|
* await client.serviceApi.getLogs("id")
|
|
95
78
|
*/
|
|
96
|
-
getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<
|
|
79
|
+
getLogs(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.LogEntry[]>;
|
|
97
80
|
private __getLogs;
|
|
98
81
|
/**
|
|
99
82
|
* Cancel a pending or running service execution.
|
|
@@ -106,5 +89,5 @@ export declare class ServiceApi {
|
|
|
106
89
|
*/
|
|
107
90
|
cancelExecution(id: string, requestOptions?: ServiceApi.RequestOptions): core.HttpResponsePromise<PlanqkServiceApi.ServiceExecution>;
|
|
108
91
|
private __cancelExecution;
|
|
109
|
-
protected _getAuthorizationHeader(): Promise<string>;
|
|
92
|
+
protected _getAuthorizationHeader(): Promise<string | undefined>;
|
|
110
93
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
4
|
if (k2 === undefined) k2 = k;
|
|
7
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -43,7 +41,7 @@ const headers_js_1 = require("../../../../core/headers.js");
|
|
|
43
41
|
const errors = __importStar(require("../../../../errors/index.js"));
|
|
44
42
|
class ServiceApi {
|
|
45
43
|
_options;
|
|
46
|
-
constructor(_options) {
|
|
44
|
+
constructor(_options = {}) {
|
|
47
45
|
this._options = _options;
|
|
48
46
|
}
|
|
49
47
|
/**
|
|
@@ -59,14 +57,16 @@ class ServiceApi {
|
|
|
59
57
|
return core.HttpResponsePromise.fromPromise(this.__getServiceExecutions(requestOptions));
|
|
60
58
|
}
|
|
61
59
|
async __getServiceExecutions(requestOptions) {
|
|
60
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
62
61
|
const _response = await core.fetcher({
|
|
63
62
|
url: (await core.Supplier.get(this._options.baseUrl)) ??
|
|
64
63
|
(await core.Supplier.get(this._options.environment)) ??
|
|
65
64
|
environments.PlanqkServiceApiEnvironment.Default,
|
|
66
65
|
method: "GET",
|
|
67
|
-
headers:
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
headers: _headers,
|
|
67
|
+
queryParameters: requestOptions?.queryParams,
|
|
68
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
69
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
70
70
|
withCredentials: true,
|
|
71
71
|
abortSignal: requestOptions?.abortSignal,
|
|
72
72
|
});
|
|
@@ -100,7 +100,7 @@ class ServiceApi {
|
|
|
100
100
|
* Starts a service execution, which in turn is processed asynchronously.
|
|
101
101
|
* The location header of the response contains the URL which can be used to query the status and the result of the service execution.
|
|
102
102
|
*
|
|
103
|
-
* @param {
|
|
103
|
+
* @param {PlanqkServiceApi.RequestBody} request
|
|
104
104
|
* @param {ServiceApi.RequestOptions} requestOptions - Request-specific configuration.
|
|
105
105
|
*
|
|
106
106
|
* @example
|
|
@@ -112,17 +112,19 @@ class ServiceApi {
|
|
|
112
112
|
return core.HttpResponsePromise.fromPromise(this.__startExecution(request, requestOptions));
|
|
113
113
|
}
|
|
114
114
|
async __startExecution(request, requestOptions) {
|
|
115
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
115
116
|
const _response = await core.fetcher({
|
|
116
117
|
url: (await core.Supplier.get(this._options.baseUrl)) ??
|
|
117
118
|
(await core.Supplier.get(this._options.environment)) ??
|
|
118
119
|
environments.PlanqkServiceApiEnvironment.Default,
|
|
119
120
|
method: "POST",
|
|
120
|
-
headers:
|
|
121
|
+
headers: _headers,
|
|
121
122
|
contentType: "application/json",
|
|
123
|
+
queryParameters: requestOptions?.queryParams,
|
|
122
124
|
requestType: "json",
|
|
123
125
|
body: request,
|
|
124
|
-
timeoutMs: requestOptions?.timeoutInSeconds
|
|
125
|
-
maxRetries: requestOptions?.maxRetries,
|
|
126
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
127
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
126
128
|
withCredentials: true,
|
|
127
129
|
abortSignal: requestOptions?.abortSignal,
|
|
128
130
|
});
|
|
@@ -166,14 +168,16 @@ class ServiceApi {
|
|
|
166
168
|
return core.HttpResponsePromise.fromPromise(this.__getStatus(id, requestOptions));
|
|
167
169
|
}
|
|
168
170
|
async __getStatus(id, requestOptions) {
|
|
171
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
169
172
|
const _response = await core.fetcher({
|
|
170
173
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
171
174
|
(await core.Supplier.get(this._options.environment)) ??
|
|
172
175
|
environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}`),
|
|
173
176
|
method: "GET",
|
|
174
|
-
headers:
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
headers: _headers,
|
|
178
|
+
queryParameters: requestOptions?.queryParams,
|
|
179
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
180
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
177
181
|
withCredentials: true,
|
|
178
182
|
abortSignal: requestOptions?.abortSignal,
|
|
179
183
|
});
|
|
@@ -218,14 +222,16 @@ class ServiceApi {
|
|
|
218
222
|
return core.HttpResponsePromise.fromPromise(this.__getResult(id, requestOptions));
|
|
219
223
|
}
|
|
220
224
|
async __getResult(id, requestOptions) {
|
|
225
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
221
226
|
const _response = await core.fetcher({
|
|
222
227
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
223
228
|
(await core.Supplier.get(this._options.environment)) ??
|
|
224
229
|
environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/result`),
|
|
225
230
|
method: "GET",
|
|
226
|
-
headers:
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
headers: _headers,
|
|
232
|
+
queryParameters: requestOptions?.queryParams,
|
|
233
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
234
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
229
235
|
withCredentials: true,
|
|
230
236
|
abortSignal: requestOptions?.abortSignal,
|
|
231
237
|
});
|
|
@@ -264,15 +270,17 @@ class ServiceApi {
|
|
|
264
270
|
return core.HttpResponsePromise.fromPromise(this.__getResultFile(id, file, requestOptions));
|
|
265
271
|
}
|
|
266
272
|
async __getResultFile(id, file, requestOptions) {
|
|
273
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
267
274
|
const _response = await core.fetcher({
|
|
268
275
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
269
276
|
(await core.Supplier.get(this._options.environment)) ??
|
|
270
277
|
environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/result/${encodeURIComponent(file)}`),
|
|
271
278
|
method: "GET",
|
|
272
|
-
headers:
|
|
279
|
+
headers: _headers,
|
|
280
|
+
queryParameters: requestOptions?.queryParams,
|
|
273
281
|
responseType: "binary-response",
|
|
274
|
-
timeoutMs: requestOptions?.timeoutInSeconds
|
|
275
|
-
maxRetries: requestOptions?.maxRetries,
|
|
282
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
283
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
276
284
|
withCredentials: true,
|
|
277
285
|
abortSignal: requestOptions?.abortSignal,
|
|
278
286
|
});
|
|
@@ -315,14 +323,16 @@ class ServiceApi {
|
|
|
315
323
|
return core.HttpResponsePromise.fromPromise(this.__getLogs(id, requestOptions));
|
|
316
324
|
}
|
|
317
325
|
async __getLogs(id, requestOptions) {
|
|
326
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
318
327
|
const _response = await core.fetcher({
|
|
319
328
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
320
329
|
(await core.Supplier.get(this._options.environment)) ??
|
|
321
330
|
environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/log`),
|
|
322
331
|
method: "GET",
|
|
323
|
-
headers:
|
|
324
|
-
|
|
325
|
-
|
|
332
|
+
headers: _headers,
|
|
333
|
+
queryParameters: requestOptions?.queryParams,
|
|
334
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
335
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
326
336
|
withCredentials: true,
|
|
327
337
|
abortSignal: requestOptions?.abortSignal,
|
|
328
338
|
});
|
|
@@ -365,14 +375,16 @@ class ServiceApi {
|
|
|
365
375
|
return core.HttpResponsePromise.fromPromise(this.__cancelExecution(id, requestOptions));
|
|
366
376
|
}
|
|
367
377
|
async __cancelExecution(id, requestOptions) {
|
|
378
|
+
let _headers = (0, headers_js_1.mergeHeaders)(this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: await this._getAuthorizationHeader() }), requestOptions?.headers);
|
|
368
379
|
const _response = await core.fetcher({
|
|
369
380
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
370
381
|
(await core.Supplier.get(this._options.environment)) ??
|
|
371
382
|
environments.PlanqkServiceApiEnvironment.Default, `${encodeURIComponent(id)}/cancel`),
|
|
372
383
|
method: "PUT",
|
|
373
|
-
headers:
|
|
374
|
-
|
|
375
|
-
|
|
384
|
+
headers: _headers,
|
|
385
|
+
queryParameters: requestOptions?.queryParams,
|
|
386
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
387
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
376
388
|
withCredentials: true,
|
|
377
389
|
abortSignal: requestOptions?.abortSignal,
|
|
378
390
|
});
|
|
@@ -403,7 +415,11 @@ class ServiceApi {
|
|
|
403
415
|
}
|
|
404
416
|
}
|
|
405
417
|
async _getAuthorizationHeader() {
|
|
406
|
-
|
|
418
|
+
const bearer = await core.Supplier.get(this._options.token);
|
|
419
|
+
if (bearer != null) {
|
|
420
|
+
return `Bearer ${bearer}`;
|
|
421
|
+
}
|
|
422
|
+
return undefined;
|
|
407
423
|
}
|
|
408
424
|
}
|
|
409
425
|
exports.ServiceApi = ServiceApi;
|
|
@@ -14,5 +14,4 @@ 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("./types/index.js"), exports);
|
|
18
17
|
__exportStar(require("./client/index.js"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface LogEntry {
|
|
2
|
+
/** Log message content. */
|
|
3
|
+
message?: string;
|
|
4
|
+
/** Severity of the log entry. */
|
|
5
|
+
severity?: LogEntry.Severity;
|
|
6
|
+
/** Timestamp when the entry was logged. */
|
|
7
|
+
timestamp?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace LogEntry {
|
|
10
|
+
/** Severity of the log entry. */
|
|
11
|
+
const Severity: {
|
|
12
|
+
readonly Debug: "DEBUG";
|
|
13
|
+
readonly Notice: "NOTICE";
|
|
14
|
+
readonly Info: "INFO";
|
|
15
|
+
readonly Warning: "WARNING";
|
|
16
|
+
readonly Error: "ERROR";
|
|
17
|
+
};
|
|
18
|
+
type Severity = (typeof Severity)[keyof typeof Severity];
|
|
19
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.LogEntry = void 0;
|
|
5
|
+
var LogEntry;
|
|
6
|
+
(function (LogEntry) {
|
|
7
|
+
/** Severity of the log entry. */
|
|
8
|
+
LogEntry.Severity = {
|
|
9
|
+
Debug: "DEBUG",
|
|
10
|
+
Notice: "NOTICE",
|
|
11
|
+
Info: "INFO",
|
|
12
|
+
Warning: "WARNING",
|
|
13
|
+
Error: "ERROR",
|
|
14
|
+
};
|
|
15
|
+
})(LogEntry || (exports.LogEntry = LogEntry = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RequestBody = Record<string, any>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as PlanqkServiceApi from "../index.js";
|
|
2
|
+
export interface ResultResponse {
|
|
3
|
+
_links?: ResultResponse.Links;
|
|
4
|
+
_embedded?: ResultResponse.Embedded;
|
|
5
|
+
/** Accepts any additional properties */
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export declare namespace ResultResponse {
|
|
9
|
+
interface Links {
|
|
10
|
+
status?: PlanqkServiceApi.HalLink;
|
|
11
|
+
}
|
|
12
|
+
interface Embedded {
|
|
13
|
+
status?: PlanqkServiceApi.ServiceExecution;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
-
*/
|
|
4
1
|
export interface ServiceExecution {
|
|
5
2
|
id?: string;
|
|
6
3
|
status?: ServiceExecution.Status;
|
|
@@ -9,7 +6,6 @@ export interface ServiceExecution {
|
|
|
9
6
|
endedAt?: string;
|
|
10
7
|
}
|
|
11
8
|
export declare namespace ServiceExecution {
|
|
12
|
-
type Status = "UNKNOWN" | "PENDING" | "RUNNING" | "SUCCEEDED" | "CANCELLED" | "FAILED";
|
|
13
9
|
const Status: {
|
|
14
10
|
readonly Unknown: "UNKNOWN";
|
|
15
11
|
readonly Pending: "PENDING";
|
|
@@ -18,4 +14,5 @@ export declare namespace ServiceExecution {
|
|
|
18
14
|
readonly Cancelled: "CANCELLED";
|
|
19
15
|
readonly Failed: "FAILED";
|
|
20
16
|
};
|
|
17
|
+
type Status = (typeof Status)[keyof typeof Status];
|
|
21
18
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
-
*/
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.ServiceExecution = void 0;
|
|
7
5
|
var ServiceExecution;
|
|
@@ -14,5 +14,8 @@ 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("./RequestBody.js"), exports);
|
|
18
|
+
__exportStar(require("./ResultResponse.js"), exports);
|
|
17
19
|
__exportStar(require("./ServiceExecution.js"), exports);
|
|
20
|
+
__exportStar(require("./LogEntry.js"), exports);
|
|
18
21
|
__exportStar(require("./HalLink.js"), exports);
|
|
@@ -14,7 +14,8 @@ exports.BasicAuth = {
|
|
|
14
14
|
fromAuthorizationHeader: (header) => {
|
|
15
15
|
const credentials = header.replace(BASIC_AUTH_HEADER_PREFIX, "");
|
|
16
16
|
const decoded = (0, base64_js_1.base64Decode)(credentials);
|
|
17
|
-
const [username,
|
|
17
|
+
const [username, ...passwordParts] = decoded.split(":");
|
|
18
|
+
const password = passwordParts.length > 0 ? passwordParts.join(":") : undefined;
|
|
18
19
|
if (username == null || password == null) {
|
|
19
20
|
throw new Error("Invalid basic auth");
|
|
20
21
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type SecuritySchemeKey = string;
|
|
2
|
+
/**
|
|
3
|
+
* A collection of security schemes, where the key is the name of the security scheme and the value is the list of scopes required for that scheme.
|
|
4
|
+
* All schemes in the collection must be satisfied for authentication to be successful.
|
|
5
|
+
*/
|
|
6
|
+
export type SecuritySchemeCollection = Record<SecuritySchemeKey, AuthScope[]>;
|
|
7
|
+
export type AuthScope = string;
|
|
8
|
+
export type EndpointMetadata = {
|
|
9
|
+
/**
|
|
10
|
+
* An array of security scheme collections. Each collection represents an alternative way to authenticate.
|
|
11
|
+
*/
|
|
12
|
+
security?: SecuritySchemeCollection[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EndpointMetadata } from "./EndpointMetadata.js";
|
|
2
|
+
import { Supplier } from "./Supplier.js";
|
|
3
|
+
type EndpointSupplierFn<T> = (arg: {
|
|
4
|
+
endpointMetadata: EndpointMetadata;
|
|
5
|
+
}) => T | Promise<T>;
|
|
6
|
+
export type EndpointSupplier<T> = Supplier<T> | EndpointSupplierFn<T>;
|
|
7
|
+
export declare const EndpointSupplier: {
|
|
8
|
+
get: <T>(supplier: EndpointSupplier<T>, arg: {
|
|
9
|
+
endpointMetadata: EndpointMetadata;
|
|
10
|
+
}) => Promise<T>;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EndpointSupplier = void 0;
|
|
4
|
+
exports.EndpointSupplier = {
|
|
5
|
+
get: async (supplier, arg) => {
|
|
6
|
+
if (typeof supplier === "function") {
|
|
7
|
+
return supplier(arg);
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
return supplier;
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
};
|