@useshortcut/client 1.0.0 → 1.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/README.md +15 -13
- package/lib/ShortcutClient.js +5 -36
- package/lib/generated/Api.d.ts +201 -119
- package/lib/generated/Api.js +184 -466
- package/lib/generated/data-contracts.d.ts +1489 -609
- package/lib/generated/http-client.d.ts +14 -12
- package/lib/generated/http-client.js +50 -90
- package/lib/index.js +5 -1
- package/package.json +33 -31
- package/lib/ShortcutApi.d.ts +0 -5
- package/lib/ShortcutApi.js +0 -45
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img height="60" src="https://
|
|
2
|
+
<img height="60" src="https://github.com/useshortcut/shortcut-client-js/assets/739719/b1a2efa0-6de1-4bc4-8525-563c53a9b2ba" alt="Shortcut" />
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<h3 align="center">
|
|
6
|
-
@
|
|
6
|
+
@shortcut/client
|
|
7
7
|
</h3>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
A library for interacting with the Shortcut
|
|
10
|
+
A library for interacting with the Shortcut REST API.
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
|
-
<a href="https://www.npmjs.org/package/@
|
|
15
|
-
<img src="https://badge.fury.io/js/@
|
|
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
16
|
</a>
|
|
17
17
|
<a href="https://circleci.com/gh/useshortcut/shortcut-client-js">
|
|
18
18
|
<img src="https://circleci.com/gh/useshortcut/shortcut-client-js.svg?style=shield" alt="Current CircleCI build status." />
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
|
22
22
|
</a>
|
|
23
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@
|
|
24
|
+
<img src="https://img.shields.io/twitter/follow/useshortcut.svg?label=Follow%20@shortcut" alt="Follow @shortcut" />
|
|
25
25
|
</a>
|
|
26
26
|
</p>
|
|
27
27
|
|
|
@@ -31,18 +31,20 @@
|
|
|
31
31
|
|
|
32
32
|
### Installation
|
|
33
33
|
|
|
34
|
-
You can install `@
|
|
34
|
+
You can install `@shortcut/client` with [NPM](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com).
|
|
35
35
|
|
|
36
36
|
```shell
|
|
37
|
-
npm install --save @
|
|
37
|
+
npm install --save @shortcut/client
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
or
|
|
41
41
|
|
|
42
42
|
```shell
|
|
43
|
-
yarn add @
|
|
43
|
+
yarn add @shortcut/client
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
+
> Our legacy organization name is `@useshortcut`. While this will still contain copies of all future released package versions, we **strongly** recommended switching to our primary `@shortcut` organization namespace.
|
|
47
|
+
|
|
46
48
|
### How to Get an API Token
|
|
47
49
|
|
|
48
50
|
The Shortcut API uses token-based authentication, you will need one to use this library.
|
|
@@ -62,8 +64,8 @@ Requests made with a missing or invalid token will get a `401 Unauthorized` resp
|
|
|
62
64
|
To see all available exports, take a look at the [API documentation](https://useshortcut.github.io/shortcut-client-js/) or check out the `.d.ts` files in this repository.
|
|
63
65
|
|
|
64
66
|
```javascript
|
|
65
|
-
import { ShortcutClient } from '@
|
|
66
|
-
// const { ShortcutClient } = require('@
|
|
67
|
+
import { ShortcutClient } from '@shortcut/client';
|
|
68
|
+
// const { ShortcutClient } = require('@shortcut/client');
|
|
67
69
|
|
|
68
70
|
const shortcut = new ShortcutClient('YOUR_API_TOKEN'); // See https://github.com/useshortcut/shortcut-client-js#how-to-get-an-api-token
|
|
69
71
|
|
|
@@ -74,7 +76,7 @@ shortcut.listProjects().then((response) => console.log(response?.data));
|
|
|
74
76
|
|
|
75
77
|
## Play with It
|
|
76
78
|
|
|
77
|
-
You can play with it in your web browser with this live playground:
|
|
79
|
+
You can play with it in your web browser with this live playground:
|
|
78
80
|
|
|
79
81
|
- [CodeSandbox](https://codesandbox.io/s/useshortcut-client-playground-48kq1)
|
|
80
82
|
|
|
@@ -82,4 +84,4 @@ You can play with it in your web browser with this live playground:
|
|
|
82
84
|
|
|
83
85
|
[Documentation for this client](https://useshortcut.github.io/shortcut-client-js/).
|
|
84
86
|
|
|
85
|
-
[Documentation for the REST API](https://shortcut.com/api/rest).
|
|
87
|
+
[Documentation for the REST API](https://developer.shortcut.com/api/rest/v3).
|
package/lib/ShortcutClient.js
CHANGED
|
@@ -1,45 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
3
|
exports.ShortcutClient = void 0;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
function ShortcutClient(apiToken, config) {
|
|
34
|
-
if (config === void 0) { config = {}; }
|
|
35
|
-
var _this = this;
|
|
4
|
+
const Api_1 = require("./generated/Api");
|
|
5
|
+
class ShortcutClient extends Api_1.Api {
|
|
6
|
+
constructor(apiToken, config = {}) {
|
|
36
7
|
if (apiToken == null || typeof apiToken !== 'string') {
|
|
37
8
|
// eslint-disable-next-line no-console
|
|
38
9
|
console.error('You need to supply an API Token.');
|
|
39
10
|
}
|
|
40
|
-
|
|
41
|
-
return _this;
|
|
11
|
+
super(Object.assign({ headers: Object.assign({ 'Shortcut-Token': apiToken }, config.headers) }, config));
|
|
42
12
|
}
|
|
43
|
-
|
|
44
|
-
}(Api_1.Api));
|
|
13
|
+
}
|
|
45
14
|
exports.ShortcutClient = ShortcutClient;
|