@useshortcut/client 1.1.0 → 2.1.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/LICENSE +21 -0
- package/README.md +32 -39
- package/lib/ShortcutClient.d.mts +9 -0
- package/lib/ShortcutClient.d.ts +8 -4
- package/lib/ShortcutClient.js +18 -14
- package/lib/ShortcutClient.mjs +18 -0
- package/lib/_virtual/rolldown_runtime.js +30 -0
- package/lib/generated/Api.d.mts +1435 -0
- package/lib/generated/Api.d.ts +1430 -1037
- package/lib/generated/Api.js +2075 -1032
- package/lib/generated/Api.mjs +2075 -0
- package/lib/generated/data-contracts.d.mts +5901 -0
- package/lib/generated/data-contracts.d.ts +5706 -5103
- package/lib/generated/http-client.d.mts +62 -0
- package/lib/generated/http-client.d.ts +54 -37
- package/lib/generated/http-client.js +83 -97
- package/lib/generated/http-client.mjs +82 -0
- package/lib/index.d.mts +3 -0
- package/lib/index.d.ts +3 -3
- package/lib/index.js +5 -21
- package/lib/index.mjs +3 -0
- package/package.json +58 -44
- package/lib/generated/data-contracts.js +0 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Shortcut
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,55 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
<img height="60" src="https://github.com/useshortcut/shortcut-client-js/assets/739719/b1a2efa0-6de1-4bc4-8525-563c53a9b2ba" alt="Shortcut" />
|
|
3
|
-
</p>
|
|
4
|
-
|
|
5
|
-
<h3 align="center">
|
|
6
|
-
@shortcut/client
|
|
7
|
-
</h3>
|
|
8
|
-
|
|
9
|
-
<p align="center">
|
|
10
|
-
A library for interacting with the Shortcut REST API.
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
|
-
<p align="center">
|
|
14
|
-
<a href="https://www.npmjs.org/package/@shortcut/client">
|
|
15
|
-
<img src="https://badge.fury.io/js/@shortcut%2Fclient.svg" alt="Current npm package version." />
|
|
16
|
-
</a>
|
|
17
|
-
<a href="https://circleci.com/gh/useshortcut/shortcut-client-js">
|
|
18
|
-
<img src="https://circleci.com/gh/useshortcut/shortcut-client-js.svg?style=shield" alt="Current CircleCI build status." />
|
|
19
|
-
</a>
|
|
20
|
-
<a href="https://circleci.com/gh/useshortcut/shortcut-client-js">
|
|
21
|
-
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
|
22
|
-
</a>
|
|
23
|
-
<a href="https://twitter.com/intent/follow?screen_name=useshortcut">
|
|
24
|
-
<img src="https://img.shields.io/twitter/follow/useshortcut.svg?label=Follow%20@shortcut" alt="Follow @shortcut" />
|
|
25
|
-
</a>
|
|
26
|
-
</p>
|
|
27
|
-
|
|
28
|
-
<br>
|
|
1
|
+
# @shortcut/client
|
|
29
2
|
|
|
30
|
-
|
|
3
|
+
<img height="125" src="https://github.com/user-attachments/assets/7c3d3b8e-6252-4790-81cd-6640cd46a2d6" alt="Shortcut's logo" align="right">
|
|
31
4
|
|
|
32
|
-
|
|
5
|
+
[](https://badge.fury.io/js/@shortcut%2Fclient)
|
|
6
|
+
[](https://www.npmjs.org/package/@shortcut%2Fclient)
|
|
7
|
+
[](https://github.com/useshortcut/shortcut-client-js/blob/main/LICENSE)
|
|
8
|
+
[]()
|
|
9
|
+
[](https://twitter.com/intent/follow?screen_name=shortcut)
|
|
33
10
|
|
|
34
|
-
|
|
11
|
+
A library for interacting with the Shortcut REST API.
|
|
35
12
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
13
|
+
<br />
|
|
14
|
+
|
|
15
|
+
## Getting Started
|
|
39
16
|
|
|
40
|
-
|
|
17
|
+
### Installation
|
|
41
18
|
|
|
42
19
|
```shell
|
|
43
|
-
|
|
20
|
+
npm install @shortcut/client
|
|
44
21
|
```
|
|
45
22
|
|
|
46
|
-
>
|
|
23
|
+
> [!IMPORTANT]
|
|
24
|
+
> Our legacy npm organization namespace is `@useshortcut`.
|
|
25
|
+
>
|
|
26
|
+
> While it will still contain copies of all future released package versions, we **strongly** recommend switching to our primary `@shortcut` organization namespace.
|
|
47
27
|
|
|
48
28
|
### How to Get an API Token
|
|
49
29
|
|
|
50
30
|
The Shortcut API uses token-based authentication, you will need one to use this library.
|
|
51
31
|
|
|
52
|
-
To generate an API token, go to https://app.shortcut.com/settings/account/api-tokens.
|
|
32
|
+
To generate an API token, go to https://app.shortcut.com/settings/account/api-tokens.
|
|
33
|
+
|
|
34
|
+
To make it easier to explore our API, we recommend saving this token as an environment variable in your local dev environment:
|
|
53
35
|
|
|
54
36
|
```bash
|
|
55
37
|
export SHORTCUT_API_TOKEN="YOUR API TOKEN HERE"
|
|
@@ -57,7 +39,18 @@ export SHORTCUT_API_TOKEN="YOUR API TOKEN HERE"
|
|
|
57
39
|
|
|
58
40
|
This will allow you to copy and paste many examples in the documentation to try them out.
|
|
59
41
|
|
|
60
|
-
|
|
42
|
+
> [!NOTE]
|
|
43
|
+
> Requests made with a missing or invalid token will get a `401 Unauthorized` response.
|
|
44
|
+
|
|
45
|
+
> [!NOTE]
|
|
46
|
+
> All requests must be made over HTTPS.
|
|
47
|
+
|
|
48
|
+
> [!CAUTION]
|
|
49
|
+
> Tokens provide complete access to your Shortcut account, **so keep them secure**.
|
|
50
|
+
>
|
|
51
|
+
> Don’t paste them into your source code, use an environment variable instead.
|
|
52
|
+
>
|
|
53
|
+
> For security reasons, we will immediately invalidate any tokens we find have been made public.
|
|
61
54
|
|
|
62
55
|
## Usage
|
|
63
56
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApiConfig } from "./generated/http-client.mjs";
|
|
2
|
+
import { Api } from "./generated/Api.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/ShortcutClient.d.ts
|
|
5
|
+
declare class ShortcutClient<SecurityDataType = unknown> extends Api<SecurityDataType> {
|
|
6
|
+
constructor(apiToken: string, config?: ApiConfig<SecurityDataType>);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ShortcutClient };
|
package/lib/ShortcutClient.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { ApiConfig } from "./generated/http-client.js";
|
|
2
|
+
import { Api } from "./generated/Api.js";
|
|
3
|
+
|
|
4
|
+
//#region src/ShortcutClient.d.ts
|
|
5
|
+
declare class ShortcutClient<SecurityDataType = unknown> extends Api<SecurityDataType> {
|
|
6
|
+
constructor(apiToken: string, config?: ApiConfig<SecurityDataType>);
|
|
5
7
|
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ShortcutClient };
|
package/lib/ShortcutClient.js
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
1
|
+
const require_Api = require('./generated/Api.js');
|
|
2
|
+
|
|
3
|
+
//#region src/ShortcutClient.ts
|
|
4
|
+
var ShortcutClient = class extends require_Api.Api {
|
|
5
|
+
constructor(apiToken, config = {}) {
|
|
6
|
+
if (apiToken == null || typeof apiToken !== "string") console.error("You need to supply an API Token.");
|
|
7
|
+
super({
|
|
8
|
+
headers: {
|
|
9
|
+
"Shortcut-Token": apiToken,
|
|
10
|
+
...config.headers
|
|
11
|
+
},
|
|
12
|
+
...config
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.ShortcutClient = ShortcutClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Api } from "./generated/Api.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/ShortcutClient.ts
|
|
4
|
+
var ShortcutClient = class extends Api {
|
|
5
|
+
constructor(apiToken, config = {}) {
|
|
6
|
+
if (apiToken == null || typeof apiToken !== "string") console.error("You need to supply an API Token.");
|
|
7
|
+
super({
|
|
8
|
+
headers: {
|
|
9
|
+
"Shortcut-Token": apiToken,
|
|
10
|
+
...config.headers
|
|
11
|
+
},
|
|
12
|
+
...config
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { ShortcutClient };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
|
|
25
|
+
Object.defineProperty(exports, '__toESM', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return __toESM;
|
|
29
|
+
}
|
|
30
|
+
});
|