Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 1 month ago
JSON representation

The official JavaScript client library for the Shortcut (formerly Clubhouse) REST API.

Awesome Lists containing this project

README

        


Shortcut


@shortcut/client


A library for interacting with the Shortcut REST API.



Current npm package version.


Current CircleCI build status.


PRs welcome!


Follow @shortcut


## Getting Started

### Installation

You can install `@shortcut/client` with [NPM](https://www.npmjs.com/) or [Yarn](https://yarnpkg.com).

```shell
npm install --save @shortcut/client
```

or

```shell
yarn add @shortcut/client
```

> 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.

### 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.

Requests made with a missing or invalid token will get a `401 Unauthorized` response. All requests must be made over HTTPS. 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).