Skip to content

Commit 052dd97

Browse files
feat: init commit
0 parents  commit 052dd97

File tree

80 files changed

+34883
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+34883
-0
lines changed

.eslintrc.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"commonjs": true,
5+
"es2020": true,
6+
"node": true,
7+
"mocha": true
8+
},
9+
"extends": ["airbnb-base", "prettier"],
10+
"plugins": ["prettier"],
11+
"ignorePatterns": ["node_modules/**/*.js"],
12+
"parserOptions": {
13+
"ecmaVersion": 11
14+
},
15+
"rules": {
16+
"prettier/prettier": "error",
17+
"no-underscore-dangle": 0
18+
}
19+
}

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.gitignore

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port

.jsdoc.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"tags": {
3+
"allowUnknownTags": true,
4+
"dictionaries": ["jsdoc"]
5+
},
6+
"source": {
7+
"include": ["src"],
8+
"includePattern": ".js$",
9+
"excludePattern": "(node_modules/|docs)"
10+
},
11+
"plugins": ["plugins/markdown"],
12+
"templates": {
13+
"cleverLinks": false,
14+
"monospaceLinks": true,
15+
"useLongnameInNav": false,
16+
"showInheritedInNav": true
17+
},
18+
"opts": {
19+
"readme": "readme.md",
20+
"destination": "docs/",
21+
"encoding": "utf8",
22+
"private": true,
23+
"recurse": true,
24+
"sort": true,
25+
"template": "node_modules/docdash"
26+
},
27+
"docdash": {
28+
"sort": true,
29+
"openGraph": {
30+
"title": "clickup.js Documentation",
31+
"type": "website",
32+
"site_name": "clickupjs",
33+
"url": "https://github.com/ComfortablyCoding.github.io/clickup.js"
34+
},
35+
"meta": {
36+
"title": "clickup.js",
37+
"description": "A Node.js wrapper for the Clickup API",
38+
"keyword": "clickup clickup-js clickup.js api wrapper"
39+
},
40+
"search": true,
41+
"collapse": true,
42+
"wrap": true,
43+
"private": false,
44+
"menu": {
45+
"Github Repo": {
46+
"href": "https://github.com/ComfortablyCoding/clickup.js",
47+
"target": "_blank",
48+
"class": "menu-item",
49+
"id": "website_link"
50+
}
51+
}
52+
}
53+
}

.npmignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# NPM
2+
node_modules
3+
.git
4+
.vscode
5+
.eslintrc.json
6+
.jsdoc.json
7+
.prettierrc.json
8+
.gitattributes
9+
.gitignore
10+
npm-debug.log
11+
test/
12+
docs/

.prettierrc.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true,
6+
"useTabs": true,
7+
"printWidth": 120
8+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 jj
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# clickup.js
2+
3+
A Node.js wrapper for the [Clickup API](https://clickup.com/api).
4+
5+
## Install
6+
7+
```sh
8+
npm install clickup.js
9+
```
10+
11+
## Usage
12+
13+
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](https://clickup.com/api).
14+
15+
In your project, initialize an instance of clickup.js:
16+
17+
```js
18+
const Clickup = require('clickup.js');
19+
const token = '...'; // API access token
20+
const clickup = new Clickup(token);
21+
```
22+
23+
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:
24+
25+
```js
26+
(async () => {
27+
try {
28+
// get a specific task
29+
const { body } = await clickup.tasks.get('9hz');
30+
console.log(body);
31+
} catch (error) {
32+
if (error.response) {
33+
// The request was made and the server responded with a status code
34+
// that falls out of the range of 2xx
35+
console.log(error.response.body);
36+
console.log(error.response.statusCode);
37+
console.log(error.response.headers);
38+
} else if (error.request) {
39+
// The request was made but no response was received
40+
console.log(error.request);
41+
} else {
42+
// Something happened in setting up the request that triggered an Error
43+
console.log('Error', error.message);
44+
}
45+
console.log(error.options);
46+
}
47+
})();
48+
```
49+
50+
**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](https://github.com/sindresorhus/got).
51+
52+
## Important Note
53+
54+
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:
55+
56+
```js
57+
(async () => {
58+
try {
59+
// guest data
60+
const guestData = {
61+
permission_level: 'read',
62+
};
63+
// add guest to task
64+
const { body } = await clickup.tasks.addGuest('c04', 403, guestData);
65+
console.log(body);
66+
} catch (error) {
67+
if (error.response) {
68+
// The request was made and the server responded with a status code
69+
// that falls out of the range of 2xx
70+
console.log(error.response.body);
71+
console.log(error.response.statusCode);
72+
console.log(error.response.headers);
73+
} else if (error.request) {
74+
// The request was made but no response was received
75+
console.log(error.request);
76+
} else {
77+
// Something happened in setting up the request that triggered an Error
78+
console.log('Error', error.message);
79+
}
80+
console.log(error.options);
81+
}
82+
})();
83+
```
84+
85+
## Documentation
86+
87+
You can read the library documentation at the [clickup.js docs](https://comfortablycoding.github.io/clickup.js)
88+
89+
## Features
90+
91+
The available features are:
92+
93+
- `Authorization`
94+
- `Checklists`
95+
- `Comments`
96+
- `Folders`
97+
- `Goals`
98+
- `KeyResults`
99+
- `Lists`
100+
- `Spaces`
101+
- `Tasks`
102+
- `Teams`
103+
- `Views`
104+
- `Webhooks`
105+
106+
## License
107+
108+
MIT License
109+
110+
Copyright (c) 2020 jj
111+
112+
Permission is hereby granted, free of charge, to any person obtaining a copy
113+
of this software and associated documentation files (the "Software"), to deal
114+
in the Software without restriction, including without limitation the rights
115+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
116+
copies of the Software, and to permit persons to whom the Software is
117+
furnished to do so, subject to the following conditions:
118+
119+
The above copyright notice and this permission notice shall be included in all
120+
copies or substantial portions of the Software.
121+
122+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
123+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
124+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
125+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
126+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
127+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
128+
SOFTWARE.

0 commit comments

Comments
 (0)