https://github.com/useshortcut/shortcut-client-js
The official JavaScript client library for the Shortcut (formerly Clubhouse) REST API.
https://github.com/useshortcut/shortcut-client-js
api api-client javascript javascript-client node nodejs shortcut shortcut-api shortcut-lib typescript
Last synced: 4 months ago
JSON representation
The official JavaScript client library for the Shortcut (formerly Clubhouse) REST API.
- Host: GitHub
- URL: https://github.com/useshortcut/shortcut-client-js
- Owner: useshortcut
- Created: 2016-04-11T21:34:52.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2024-03-29T15:56:34.000Z (about 2 years ago)
- Last Synced: 2024-05-15T14:32:15.641Z (about 2 years ago)
- Topics: api, api-client, javascript, javascript-client, node, nodejs, shortcut, shortcut-api, shortcut-lib, typescript
- Language: TypeScript
- Homepage: https://useshortcut.github.io/shortcut-client-js/
- Size: 2.16 MB
- Stars: 130
- Watchers: 30
- Forks: 31
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - clubhouse-lib - The official Node.js client library for the Clubhouse API. (TypeScript)
README
# @shortcut/client

[](https://badge.fury.io/js/@shortcut%2Fclient)
[](https://www.npmjs.org/package/@shortcut%2Fclient)
[](https://github.com/useshortcut/shortcut-client-js/blob/main/LICENSE)
[]()
[](https://twitter.com/intent/follow?screen_name=shortcut)
A library for interacting with the Shortcut REST API.
## Getting Started
### Installation
```shell
npm install @shortcut/client
```
> [!IMPORTANT]
> Our legacy npm organization namespace is `@useshortcut`.
>
> While it will still contain copies of all future released package versions, we **strongly** recommend switching to our primary `@shortcut` organization namespace.
### How to Get an API Token
The Shortcut API uses token-based authentication, you will need one to use this library.
To generate an API token, go to https://app.shortcut.com/settings/account/api-tokens.
To make it easier to explore our API, we recommend saving this token as an environment variable in your local dev environment:
```bash
export SHORTCUT_API_TOKEN="YOUR API TOKEN HERE"
```
This will allow you to copy and paste many examples in the documentation to try them out.
> [!NOTE]
> Requests made with a missing or invalid token will get a `401 Unauthorized` response.
> [!NOTE]
> All requests must be made over HTTPS.
> [!CAUTION]
> Tokens provide complete access to your Shortcut account, **so keep them secure**.
>
> Don’t paste them into your source code, use an environment variable instead.
>
> For security reasons, we will immediately invalidate any tokens we find have been made public.
## Usage
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.
```javascript
import { ShortcutClient } from '@shortcut/client';
// const { ShortcutClient } = require('@shortcut/client');
const shortcut = new ShortcutClient('YOUR_API_TOKEN'); // See https://github.com/useshortcut/shortcut-client-js#how-to-get-an-api-token
shortcut.getCurrentMemberInfo().then((response) => console.log(response?.data));
shortcut.listProjects().then((response) => console.log(response?.data));
```
## Play with It
You can play with it in your web browser with this live playground:
- [CodeSandbox](https://codesandbox.io/s/useshortcut-client-playground-48kq1)
## Documentation
[Documentation for this client](https://useshortcut.github.io/shortcut-client-js/).
[Documentation for the REST API](https://developer.shortcut.com/api/rest/v3).
## Publishing & Deployment
This library uses GitHub Actions for CI/CD. The deployment process is fully automated.
### Release Process
To publish a new version:
1. Update the version in `package.json`
2. Commit and push to `main`
3. Create a GitHub Release with a version tag (e.g., `v2.4.0`)
4. The publish workflow will automatically build and publish to npm
### Publishing to npm
Publishing is triggered automatically when a **GitHub Release is created**:
1. **Create a GitHub Release**: Go to the repository's Releases page and create a new release with a version tag (e.g., `v2.4.0`)
2. The `publish.yml` workflow will:
- Build the package (`yarn build` via `prepublishOnly`)
- Publish to npm under `@shortcut/client`
- Also publish under the legacy `@useshortcut/client` namespace for backwards compatibility
### Documentation Deployment
API documentation is automatically deployed to GitHub Pages on every push to `main`:
1. The `gh-pages.yml` workflow builds the documentation using TypeDoc
2. Documentation is published to https://useshortcut.github.io/shortcut-client-js/