npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@damotech/clickup

v3.2.1

Published

A Node.js typescript wrapper for the Clickup API

Downloads

348

Readme

clickup.js

A Node.js wrapper for the Clickup API.

Downloads Install size Package version

Install

npm install clickup.js

or

yarn add clickup.js

Usage

Before you can use this library you will need to first authenticate with the Clickup API and obtain an Access Token. You can read how to do so at the Clickup API docs.

In your project, initialize an instance of clickup.js:

const { Clickup } = require('clickup.js');
const token = '...'; // API access token
const clickup = new Clickup(token);

Once you've created an instance, you can use it to access all the features provided by the wrapper, the following example fetches a task by id and displays the response to the console:

(async () => {
	try {
		// get a specific task
		const { body } = await clickup.tasks.get('9hz');
		console.log(body);
	} catch (error) {
		if (error.response) {
			// The request was made and the server responded with a status code
			// that falls out of the range of 2xx
			console.log(error.response.body);
			console.log(error.response.statusCode);
			console.log(error.response.headers);
		} else if (error.request) {
			// The request was made but no response was received
			console.log(error.request);
		} else {
			// Something happened in setting up the request that triggered an Error
			console.log('Error', error.message);
		}
		console.log(error.options);
	}
})();

Note: Due to the HTTP request library being used each error contains an options property which are the options Got used to create a request - just to make debugging easier. Additionally, the errors may have request and response properties depending on which phase of the request failed. Read more about HTTP request library Got.

Important Note

The library is structured to match classes with their respective routes, NOT how they are sectioned in the Clickup API docs. For example adding a guest to a task is under the Tasks class instead of the Guests class as its route is via task and not guest. Due to this a request to add a guest to a task will look like so:

(async () => {
	try {
		// guest data
		const guestData = {
			permission_level: 'read',
		};
		// add guest to task
		const { body } = await clickup.tasks.addGuest('c04', 403, guestData);
		console.log(body);
	} catch (error) {
		if (error.response) {
			// The request was made and the server responded with a status code
			// that falls out of the range of 2xx
			console.log(error.response.body);
			console.log(error.response.statusCode);
			console.log(error.response.headers);
		} else if (error.request) {
			// The request was made but no response was received
			console.log(error.request);
		} else {
			// Something happened in setting up the request that triggered an Error
			console.log('Error', error.message);
		}
		console.log(error.options);
	}
})();

Documentation

You can read the library documentation at the clickup.js docs

Features

The available features are:

  • Authorization
  • Checklists
  • Comments
  • Folders
  • Goals
  • KeyResults
  • Lists
  • Spaces
  • Tasks
  • Teams
  • Views
  • Webhooks

Disclaimer

The clickup.js package is unofficial and therefor not endorsed or affiliated with ClickUp or it's subsidiaries.