@shortcut/client 2.0.0 → 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.
- package/lib/ShortcutClient.d.mts +6 -7
- package/lib/ShortcutClient.d.ts +6 -7
- package/lib/ShortcutClient.js +15 -2175
- package/lib/ShortcutClient.mjs +15 -2138
- package/lib/_virtual/rolldown_runtime.js +30 -0
- package/lib/generated/Api.d.mts +1428 -1408
- package/lib/generated/Api.d.ts +1428 -1408
- package/lib/generated/Api.js +2072 -2162
- package/lib/generated/Api.mjs +2072 -2125
- package/lib/generated/data-contracts.d.mts +5460 -5419
- package/lib/generated/data-contracts.d.ts +5460 -5419
- package/lib/generated/http-client.d.mts +47 -33
- package/lib/generated/http-client.d.ts +47 -33
- package/lib/generated/http-client.js +81 -134
- package/lib/generated/http-client.mjs +79 -98
- package/lib/index.d.mts +3 -5
- package/lib/index.d.ts +3 -5
- package/lib/index.js +4 -2178
- package/lib/index.mjs +2 -2141
- package/package.json +6 -12
- package/lib/generated/data-contracts.js +0 -18
- package/lib/generated/data-contracts.mjs +0 -0
|
@@ -1,48 +1,62 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig,
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios";
|
|
2
2
|
|
|
3
|
+
//#region src/generated/http-client.d.ts
|
|
3
4
|
type QueryParamsType = Record<string | number, any>;
|
|
4
5
|
interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
7
|
+
secure?: boolean;
|
|
8
|
+
/** request path */
|
|
9
|
+
path: string;
|
|
10
|
+
/** content type of request body */
|
|
11
|
+
type?: ContentType;
|
|
12
|
+
/** query params */
|
|
13
|
+
query?: QueryParamsType;
|
|
14
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
15
|
+
format?: ResponseType;
|
|
16
|
+
/** request body */
|
|
17
|
+
body?: unknown;
|
|
17
18
|
}
|
|
18
19
|
type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
19
20
|
interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
|
|
22
|
+
secure?: boolean;
|
|
23
|
+
format?: ResponseType;
|
|
23
24
|
}
|
|
24
25
|
declare enum ContentType {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
Json = "application/json",
|
|
27
|
+
FormData = "multipart/form-data",
|
|
28
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
29
|
+
Text = "text/plain",
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* @internal
|
|
32
33
|
* @private
|
|
33
34
|
*/
|
|
34
35
|
declare class HttpClient<SecurityDataType = unknown> {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
instance: AxiosInstance;
|
|
37
|
+
private securityData;
|
|
38
|
+
private securityWorker?;
|
|
39
|
+
private secure?;
|
|
40
|
+
private format?;
|
|
41
|
+
constructor({
|
|
42
|
+
securityWorker,
|
|
43
|
+
secure,
|
|
44
|
+
format,
|
|
45
|
+
...axiosConfig
|
|
46
|
+
}?: ApiConfig<SecurityDataType>);
|
|
47
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
48
|
+
protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
|
|
49
|
+
protected stringifyFormItem(formItem: unknown): string;
|
|
50
|
+
protected createFormData(input: Record<string, unknown>): FormData;
|
|
51
|
+
request: <T = any, _E = any>({
|
|
52
|
+
secure,
|
|
53
|
+
path,
|
|
54
|
+
type,
|
|
55
|
+
query,
|
|
56
|
+
format,
|
|
57
|
+
body,
|
|
58
|
+
...params
|
|
59
|
+
}: FullRequestParams) => Promise<AxiosResponse<T>>;
|
|
46
60
|
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
61
|
+
//#endregion
|
|
62
|
+
export { ApiConfig, HttpClient, RequestParams };
|
|
@@ -1,48 +1,62 @@
|
|
|
1
|
-
import { AxiosInstance, AxiosRequestConfig,
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse, ResponseType } from "axios";
|
|
2
2
|
|
|
3
|
+
//#region src/generated/http-client.d.ts
|
|
3
4
|
type QueryParamsType = Record<string | number, any>;
|
|
4
5
|
interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
/** set parameter to `true` for call `securityWorker` for this request */
|
|
7
|
+
secure?: boolean;
|
|
8
|
+
/** request path */
|
|
9
|
+
path: string;
|
|
10
|
+
/** content type of request body */
|
|
11
|
+
type?: ContentType;
|
|
12
|
+
/** query params */
|
|
13
|
+
query?: QueryParamsType;
|
|
14
|
+
/** format of response (i.e. response.json() -> format: "json") */
|
|
15
|
+
format?: ResponseType;
|
|
16
|
+
/** request body */
|
|
17
|
+
body?: unknown;
|
|
17
18
|
}
|
|
18
19
|
type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
|
|
19
20
|
interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
securityWorker?: (securityData: SecurityDataType | null) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
|
|
22
|
+
secure?: boolean;
|
|
23
|
+
format?: ResponseType;
|
|
23
24
|
}
|
|
24
25
|
declare enum ContentType {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
Json = "application/json",
|
|
27
|
+
FormData = "multipart/form-data",
|
|
28
|
+
UrlEncoded = "application/x-www-form-urlencoded",
|
|
29
|
+
Text = "text/plain",
|
|
29
30
|
}
|
|
30
31
|
/**
|
|
31
32
|
* @internal
|
|
32
33
|
* @private
|
|
33
34
|
*/
|
|
34
35
|
declare class HttpClient<SecurityDataType = unknown> {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
instance: AxiosInstance;
|
|
37
|
+
private securityData;
|
|
38
|
+
private securityWorker?;
|
|
39
|
+
private secure?;
|
|
40
|
+
private format?;
|
|
41
|
+
constructor({
|
|
42
|
+
securityWorker,
|
|
43
|
+
secure,
|
|
44
|
+
format,
|
|
45
|
+
...axiosConfig
|
|
46
|
+
}?: ApiConfig<SecurityDataType>);
|
|
47
|
+
setSecurityData: (data: SecurityDataType | null) => void;
|
|
48
|
+
protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig;
|
|
49
|
+
protected stringifyFormItem(formItem: unknown): string;
|
|
50
|
+
protected createFormData(input: Record<string, unknown>): FormData;
|
|
51
|
+
request: <T = any, _E = any>({
|
|
52
|
+
secure,
|
|
53
|
+
path,
|
|
54
|
+
type,
|
|
55
|
+
query,
|
|
56
|
+
format,
|
|
57
|
+
body,
|
|
58
|
+
...params
|
|
59
|
+
}: FullRequestParams) => Promise<AxiosResponse<T>>;
|
|
46
60
|
}
|
|
47
|
-
|
|
48
|
-
export {
|
|
61
|
+
//#endregion
|
|
62
|
+
export { ApiConfig, HttpClient, RequestParams };
|
|
@@ -1,137 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
|
+
const axios = require_rolldown_runtime.__toESM(require("axios"));
|
|
29
3
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
ContentType2["Text"] = "text/plain";
|
|
43
|
-
return ContentType2;
|
|
44
|
-
})(ContentType || {});
|
|
4
|
+
//#region src/generated/http-client.ts
|
|
5
|
+
let ContentType = /* @__PURE__ */ function(ContentType$1) {
|
|
6
|
+
ContentType$1["Json"] = "application/json";
|
|
7
|
+
ContentType$1["FormData"] = "multipart/form-data";
|
|
8
|
+
ContentType$1["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
9
|
+
ContentType$1["Text"] = "text/plain";
|
|
10
|
+
return ContentType$1;
|
|
11
|
+
}({});
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
45
16
|
var HttpClient = class {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
...params
|
|
110
|
-
}) => {
|
|
111
|
-
const secureParams = (typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
|
|
112
|
-
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
113
|
-
const responseFormat = format || this.format || void 0;
|
|
114
|
-
if (type === "multipart/form-data" /* FormData */ && body && body !== null && typeof body === "object") {
|
|
115
|
-
body = this.createFormData(body);
|
|
116
|
-
}
|
|
117
|
-
if (type === "text/plain" /* Text */ && body && body !== null && typeof body !== "string") {
|
|
118
|
-
body = JSON.stringify(body);
|
|
119
|
-
}
|
|
120
|
-
return this.instance.request({
|
|
121
|
-
...requestParams,
|
|
122
|
-
headers: {
|
|
123
|
-
...requestParams.headers || {},
|
|
124
|
-
...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {}
|
|
125
|
-
},
|
|
126
|
-
params: query,
|
|
127
|
-
responseType: responseFormat,
|
|
128
|
-
data: body,
|
|
129
|
-
url: path
|
|
130
|
-
});
|
|
131
|
-
};
|
|
17
|
+
instance;
|
|
18
|
+
securityData = null;
|
|
19
|
+
securityWorker;
|
|
20
|
+
secure;
|
|
21
|
+
format;
|
|
22
|
+
constructor({ securityWorker, secure, format,...axiosConfig } = {}) {
|
|
23
|
+
this.instance = axios.default.create({
|
|
24
|
+
...axiosConfig,
|
|
25
|
+
baseURL: axiosConfig.baseURL || "https://api.app.shortcut.com"
|
|
26
|
+
});
|
|
27
|
+
this.secure = secure;
|
|
28
|
+
this.format = format;
|
|
29
|
+
this.securityWorker = securityWorker;
|
|
30
|
+
}
|
|
31
|
+
setSecurityData = (data) => {
|
|
32
|
+
this.securityData = data;
|
|
33
|
+
};
|
|
34
|
+
mergeRequestParams(params1, params2) {
|
|
35
|
+
const method = params1.method || params2 && params2.method;
|
|
36
|
+
return {
|
|
37
|
+
...this.instance.defaults,
|
|
38
|
+
...params1,
|
|
39
|
+
...params2 || {},
|
|
40
|
+
headers: {
|
|
41
|
+
...method && this.instance.defaults.headers[method.toLowerCase()] || {},
|
|
42
|
+
...params1.headers || {},
|
|
43
|
+
...params2 && params2.headers || {}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
stringifyFormItem(formItem) {
|
|
48
|
+
if (typeof formItem === "object" && formItem !== null) return JSON.stringify(formItem);
|
|
49
|
+
else return `${formItem}`;
|
|
50
|
+
}
|
|
51
|
+
createFormData(input) {
|
|
52
|
+
return Object.keys(input || {}).reduce((formData, key) => {
|
|
53
|
+
const property = input[key];
|
|
54
|
+
const propertyContent = property instanceof Array ? property : [property];
|
|
55
|
+
for (const formItem of propertyContent) {
|
|
56
|
+
const isFileType = formItem instanceof Blob;
|
|
57
|
+
formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
|
|
58
|
+
}
|
|
59
|
+
return formData;
|
|
60
|
+
}, new FormData());
|
|
61
|
+
}
|
|
62
|
+
request = async ({ secure, path, type, query, format, body,...params }) => {
|
|
63
|
+
const secureParams = (typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
|
|
64
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
65
|
+
const responseFormat = format || this.format || void 0;
|
|
66
|
+
if (type === ContentType.FormData && body && body !== null && typeof body === "object") body = this.createFormData(body);
|
|
67
|
+
if (type === ContentType.Text && body && body !== null && typeof body !== "string") body = JSON.stringify(body);
|
|
68
|
+
return this.instance.request({
|
|
69
|
+
...requestParams,
|
|
70
|
+
headers: {
|
|
71
|
+
...requestParams.headers || {},
|
|
72
|
+
...type && type !== ContentType.FormData ? { "Content-Type": type } : {}
|
|
73
|
+
},
|
|
74
|
+
params: query,
|
|
75
|
+
responseType: responseFormat,
|
|
76
|
+
data: body,
|
|
77
|
+
url: path
|
|
78
|
+
});
|
|
79
|
+
};
|
|
132
80
|
};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
81
|
+
|
|
82
|
+
//#endregion
|
|
83
|
+
exports.ContentType = ContentType;
|
|
84
|
+
exports.HttpClient = HttpClient;
|
|
@@ -1,101 +1,82 @@
|
|
|
1
|
-
// src/generated/http-client.ts
|
|
2
1
|
import axios from "axios";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
|
|
3
|
+
//#region src/generated/http-client.ts
|
|
4
|
+
let ContentType = /* @__PURE__ */ function(ContentType$1) {
|
|
5
|
+
ContentType$1["Json"] = "application/json";
|
|
6
|
+
ContentType$1["FormData"] = "multipart/form-data";
|
|
7
|
+
ContentType$1["UrlEncoded"] = "application/x-www-form-urlencoded";
|
|
8
|
+
ContentType$1["Text"] = "text/plain";
|
|
9
|
+
return ContentType$1;
|
|
10
|
+
}({});
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
10
15
|
var HttpClient = class {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
...params
|
|
75
|
-
}) => {
|
|
76
|
-
const secureParams = (typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
|
|
77
|
-
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
78
|
-
const responseFormat = format || this.format || void 0;
|
|
79
|
-
if (type === "multipart/form-data" /* FormData */ && body && body !== null && typeof body === "object") {
|
|
80
|
-
body = this.createFormData(body);
|
|
81
|
-
}
|
|
82
|
-
if (type === "text/plain" /* Text */ && body && body !== null && typeof body !== "string") {
|
|
83
|
-
body = JSON.stringify(body);
|
|
84
|
-
}
|
|
85
|
-
return this.instance.request({
|
|
86
|
-
...requestParams,
|
|
87
|
-
headers: {
|
|
88
|
-
...requestParams.headers || {},
|
|
89
|
-
...type && type !== "multipart/form-data" /* FormData */ ? { "Content-Type": type } : {}
|
|
90
|
-
},
|
|
91
|
-
params: query,
|
|
92
|
-
responseType: responseFormat,
|
|
93
|
-
data: body,
|
|
94
|
-
url: path
|
|
95
|
-
});
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
export {
|
|
99
|
-
ContentType,
|
|
100
|
-
HttpClient
|
|
16
|
+
instance;
|
|
17
|
+
securityData = null;
|
|
18
|
+
securityWorker;
|
|
19
|
+
secure;
|
|
20
|
+
format;
|
|
21
|
+
constructor({ securityWorker, secure, format,...axiosConfig } = {}) {
|
|
22
|
+
this.instance = axios.create({
|
|
23
|
+
...axiosConfig,
|
|
24
|
+
baseURL: axiosConfig.baseURL || "https://api.app.shortcut.com"
|
|
25
|
+
});
|
|
26
|
+
this.secure = secure;
|
|
27
|
+
this.format = format;
|
|
28
|
+
this.securityWorker = securityWorker;
|
|
29
|
+
}
|
|
30
|
+
setSecurityData = (data) => {
|
|
31
|
+
this.securityData = data;
|
|
32
|
+
};
|
|
33
|
+
mergeRequestParams(params1, params2) {
|
|
34
|
+
const method = params1.method || params2 && params2.method;
|
|
35
|
+
return {
|
|
36
|
+
...this.instance.defaults,
|
|
37
|
+
...params1,
|
|
38
|
+
...params2 || {},
|
|
39
|
+
headers: {
|
|
40
|
+
...method && this.instance.defaults.headers[method.toLowerCase()] || {},
|
|
41
|
+
...params1.headers || {},
|
|
42
|
+
...params2 && params2.headers || {}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
stringifyFormItem(formItem) {
|
|
47
|
+
if (typeof formItem === "object" && formItem !== null) return JSON.stringify(formItem);
|
|
48
|
+
else return `${formItem}`;
|
|
49
|
+
}
|
|
50
|
+
createFormData(input) {
|
|
51
|
+
return Object.keys(input || {}).reduce((formData, key) => {
|
|
52
|
+
const property = input[key];
|
|
53
|
+
const propertyContent = property instanceof Array ? property : [property];
|
|
54
|
+
for (const formItem of propertyContent) {
|
|
55
|
+
const isFileType = formItem instanceof Blob;
|
|
56
|
+
formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
|
|
57
|
+
}
|
|
58
|
+
return formData;
|
|
59
|
+
}, new FormData());
|
|
60
|
+
}
|
|
61
|
+
request = async ({ secure, path, type, query, format, body,...params }) => {
|
|
62
|
+
const secureParams = (typeof secure === "boolean" ? secure : this.secure) && this.securityWorker && await this.securityWorker(this.securityData) || {};
|
|
63
|
+
const requestParams = this.mergeRequestParams(params, secureParams);
|
|
64
|
+
const responseFormat = format || this.format || void 0;
|
|
65
|
+
if (type === ContentType.FormData && body && body !== null && typeof body === "object") body = this.createFormData(body);
|
|
66
|
+
if (type === ContentType.Text && body && body !== null && typeof body !== "string") body = JSON.stringify(body);
|
|
67
|
+
return this.instance.request({
|
|
68
|
+
...requestParams,
|
|
69
|
+
headers: {
|
|
70
|
+
...requestParams.headers || {},
|
|
71
|
+
...type && type !== ContentType.FormData ? { "Content-Type": type } : {}
|
|
72
|
+
},
|
|
73
|
+
params: query,
|
|
74
|
+
responseType: responseFormat,
|
|
75
|
+
data: body,
|
|
76
|
+
url: path
|
|
77
|
+
});
|
|
78
|
+
};
|
|
101
79
|
};
|
|
80
|
+
|
|
81
|
+
//#endregion
|
|
82
|
+
export { ContentType, HttpClient };
|
package/lib/index.d.mts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import 'axios';
|
|
5
|
-
import './generated/http-client.mjs';
|
|
1
|
+
import { BaseTaskParams, BasicWorkspaceInfo, Branch, Category, Commit, CreateCategory, CreateCategoryParams, CreateCommentComment, CreateDoc, CreateEntityTemplate, CreateEpic, CreateEpicComment, CreateEpicHealth, CreateGenericIntegration, CreateGroup, CreateIteration, CreateLabelParams, CreateLinkedFile, CreateMilestone, CreateObjective, CreateOrDeleteStoryReaction, CreateProject, CreateStories, CreateStoryComment, CreateStoryCommentParams, CreateStoryContents, CreateStoryFromTemplateParams, CreateStoryLink, CreateStoryLinkParams, CreateStoryParams, CreateSubTaskParams, CreateTask, CreateTaskParams, CustomField, CustomFieldEnumValue, CustomFieldValueParams, DataConflictError, DeleteStories, DisabledFeatureError, DocSlim, EntityTemplate, Epic, EpicAssociatedGroup, EpicPaginatedResults, EpicSearchResult, EpicSearchResults, EpicSlim, EpicState, EpicStats, EpicWorkflow, Group, Health, History, HistoryActionBranchCreate, HistoryActionBranchMerge, HistoryActionBranchPush, HistoryActionLabelCreate, HistoryActionLabelDelete, HistoryActionLabelUpdate, HistoryActionProjectUpdate, HistoryActionPullRequest, HistoryActionStoryCommentCreate, HistoryActionStoryCreate, HistoryActionStoryDelete, HistoryActionStoryLinkCreate, HistoryActionStoryLinkDelete, HistoryActionStoryLinkUpdate, HistoryActionStoryUpdate, HistoryActionTaskCreate, HistoryActionTaskDelete, HistoryActionTaskUpdate, HistoryActionWorkspace2BulkUpdate, HistoryChangesStory, HistoryChangesStoryLink, HistoryChangesTask, HistoryReferenceBranch, HistoryReferenceCommit, HistoryReferenceCustomFieldEnumValue, HistoryReferenceEpic, HistoryReferenceGeneral, HistoryReferenceGroup, HistoryReferenceIteration, HistoryReferenceLabel, HistoryReferenceProject, HistoryReferenceStory, HistoryReferenceStoryTask, HistoryReferenceWorkflowState, Icon, Identity, Iteration, IterationAssociatedGroup, IterationSearchResults, IterationSlim, IterationStats, KeyResult, KeyResultValue, Label, LabelSlim, LabelStats, LinkSubTaskParams, LinkedFile, MaxSearchResultsExceededError, Member, MemberInfo, MemberInfoOrganization2, Milestone, MilestoneStats, Objective, ObjectiveSearchResult, ObjectiveSearchResults, ObjectiveStats, Profile, Project, ProjectStats, PullRequest, PullRequestLabel, RemoveCustomFieldParams, RemoveLabelParams, Repository, SearchResults, SearchStories, Story, StoryComment, StoryContents, StoryContentsTask, StoryCustomField, StoryHistoryChangeAddsRemovesInt, StoryHistoryChangeAddsRemovesUuid, StoryHistoryChangeOldNewBool, StoryHistoryChangeOldNewInt, StoryHistoryChangeOldNewStr, StoryHistoryChangeOldNewUuid, StoryLink, StoryReaction, StorySearchResult, StorySearchResults, StorySlim, StoryStats, SyncedItem, Task, ThreadedComment, TypedStoryLink, UnusableEntitlementError, UpdateCategory, UpdateComment, UpdateCustomField, UpdateCustomFieldEnumValue, UpdateEntityTemplate, UpdateEpic, UpdateFile, UpdateGroup, UpdateHealth, UpdateIteration, UpdateKeyResult, UpdateLabel, UpdateLinkedFile, UpdateMilestone, UpdateObjective, UpdateProject, UpdateStories, UpdateStory, UpdateStoryComment, UpdateStoryContents, UpdateStoryLink, UpdateTask, UploadedFile, Workflow, WorkflowState } from "./generated/data-contracts.mjs";
|
|
2
|
+
import { ShortcutClient } from "./ShortcutClient.mjs";
|
|
3
|
+
export { BaseTaskParams, BasicWorkspaceInfo, Branch, Category, Commit, CreateCategory, CreateCategoryParams, CreateCommentComment, CreateDoc, CreateEntityTemplate, CreateEpic, CreateEpicComment, CreateEpicHealth, CreateGenericIntegration, CreateGroup, CreateIteration, CreateLabelParams, CreateLinkedFile, CreateMilestone, CreateObjective, CreateOrDeleteStoryReaction, CreateProject, CreateStories, CreateStoryComment, CreateStoryCommentParams, CreateStoryContents, CreateStoryFromTemplateParams, CreateStoryLink, CreateStoryLinkParams, CreateStoryParams, CreateSubTaskParams, CreateTask, CreateTaskParams, CustomField, CustomFieldEnumValue, CustomFieldValueParams, DataConflictError, DeleteStories, DisabledFeatureError, DocSlim, EntityTemplate, Epic, EpicAssociatedGroup, EpicPaginatedResults, EpicSearchResult, EpicSearchResults, EpicSlim, EpicState, EpicStats, EpicWorkflow, Group, Health, History, HistoryActionBranchCreate, HistoryActionBranchMerge, HistoryActionBranchPush, HistoryActionLabelCreate, HistoryActionLabelDelete, HistoryActionLabelUpdate, HistoryActionProjectUpdate, HistoryActionPullRequest, HistoryActionStoryCommentCreate, HistoryActionStoryCreate, HistoryActionStoryDelete, HistoryActionStoryLinkCreate, HistoryActionStoryLinkDelete, HistoryActionStoryLinkUpdate, HistoryActionStoryUpdate, HistoryActionTaskCreate, HistoryActionTaskDelete, HistoryActionTaskUpdate, HistoryActionWorkspace2BulkUpdate, HistoryChangesStory, HistoryChangesStoryLink, HistoryChangesTask, HistoryReferenceBranch, HistoryReferenceCommit, HistoryReferenceCustomFieldEnumValue, HistoryReferenceEpic, HistoryReferenceGeneral, HistoryReferenceGroup, HistoryReferenceIteration, HistoryReferenceLabel, HistoryReferenceProject, HistoryReferenceStory, HistoryReferenceStoryTask, HistoryReferenceWorkflowState, Icon, Identity, Iteration, IterationAssociatedGroup, IterationSearchResults, IterationSlim, IterationStats, KeyResult, KeyResultValue, Label, LabelSlim, LabelStats, LinkSubTaskParams, LinkedFile, MaxSearchResultsExceededError, Member, MemberInfo, MemberInfoOrganization2, Milestone, MilestoneStats, Objective, ObjectiveSearchResult, ObjectiveSearchResults, ObjectiveStats, Profile, Project, ProjectStats, PullRequest, PullRequestLabel, RemoveCustomFieldParams, RemoveLabelParams, Repository, SearchResults, SearchStories, ShortcutClient, Story, StoryComment, StoryContents, StoryContentsTask, StoryCustomField, StoryHistoryChangeAddsRemovesInt, StoryHistoryChangeAddsRemovesUuid, StoryHistoryChangeOldNewBool, StoryHistoryChangeOldNewInt, StoryHistoryChangeOldNewStr, StoryHistoryChangeOldNewUuid, StoryLink, StoryReaction, StorySearchResult, StorySearchResults, StorySlim, StoryStats, SyncedItem, Task, ThreadedComment, TypedStoryLink, UnusableEntitlementError, UpdateCategory, UpdateComment, UpdateCustomField, UpdateCustomFieldEnumValue, UpdateEntityTemplate, UpdateEpic, UpdateFile, UpdateGroup, UpdateHealth, UpdateIteration, UpdateKeyResult, UpdateLabel, UpdateLinkedFile, UpdateMilestone, UpdateObjective, UpdateProject, UpdateStories, UpdateStory, UpdateStoryComment, UpdateStoryContents, UpdateStoryLink, UpdateTask, UploadedFile, Workflow, WorkflowState, ShortcutClient as default };
|