Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clickup.js

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clickup.js

A Node.js wrapper for the Clickup API

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
233
decreased by-14.65%
Maintainers
1
Weekly downloads
 
Created
Source

clickup.js

A Node.js wrapper for the Clickup API.

Install

npm install 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. Additionaly, the errors may have request (Got Stream) and response (Got Response) properties depending on which phase of the request failed. Read more about HTTP request library Got here.

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

License

MIT License

Copyright (c) 2020 jj

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Keywords

FAQs

Package last updated on 18 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc