basecamp-api-v3
v1.0.3
Published
This TypeScript library provides an API wrapper for interacting with Basecamp resources, including People, Projects, Todo Sets, Todo Lists, Comments, and Authorization.
Downloads
6
Maintainers
Readme
Basecamp API V3
This TypeScript library provides an API wrapper for interacting with Basecamp resources, including People, Projects, Todo Sets, Todo Lists, Comments, and Authorization.
Installation
You can install the library using npm or yarn:
npm install basecamp-api-v3or with yarn:
yarn add basecamp-api-v3Import Modules
import {
Authorization,
People,
Projects,
Todosets,
Todolists,
TodolistsGroups,
Todos,
Comments
} from 'basecamp-api-v3'Usage/Examples
Authorization
Generate Code by Basecamp Login
const params = {
url: 'basecamp_url',
email: '[email protected]',
password: 'password123',
sphereKey: 'sphere_key'
}
const response = await Authorization.generateCodeByBasecampLogin(params)Generate Access Token by Code
const params = {
clientId: 'client_id',
clientSecret: 'client_secret',
code: 'auth_code',
redirectUri: 'redirect_url'
}
const response = await Authorization.generateAccessTokenByCode(params)Generate Access Token by Refresh Token
const params = {
clientId: 'client_id',
clientSecret: 'client_secret',
refreshToken: 'refresh_token'
}
const response = await Authorization.generateAccessTokenByRefreshToken(params)People
Get All People
const params = {
accountId: 'account_id',
authorization: 'Bearer token'
}
const response = await People.getAllPeople(params)Get People on a Project
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id'
}
const response = await People.getPeopleOnAProject(params)Get Pingable People
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
}
const response = await People.getPingablePeople(params)Get My Personal Info
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
}
const response = await People.getMyPersonalInfo(params)Get Person
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
peopleId: 'people_id'
}
const response = await People.getPerson(params)Projects
Get All Projects
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
status: ''
}
const response = await Projects.getAllProjects(params)Get A Project
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id'
}
const response = await Projects.getAProject(params)Todosets
Get A Todoset
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todosetId: 'todoset_id
}
const response = await Todosets.getTodoset(params)Todolists
Get All Todolists
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todosetId: 'todoset_id'
}
const response = await Todolists.getTodolists(params)Get A Todolist
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id'
}
const response = await Todolists.getATodolist(params)Create A Todolist
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todosetId: 'todoset_id',
name: 'Todolist Name',
description: 'Todolist Description'
}
const response = await Todolists.createATodolist(params)Update A Todolist
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id',
name: 'Todolist Name',
description: 'Todolist Description'
}
const response = await Todolists.updateATodolist(params)TodolistsGroups
Get All Todolist Groups
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id',
}
const response = await TodolistsGroups.listTodolistGroups(params)Get A Todolist Group
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id',
}
const response = await TodolistsGroups.getATodolistGroup(params)Create A Todolist Group
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id',
name: 'Todolist Group Name',
color: 'Todolist Color'
}
const response = await TodolistsGroups.createATodolistGroup(params)Todos
Get All Todos
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id',
status: 'status',
completed: completed
}
const response = await Todos.getTodos(params)Get A Todo
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todoId: 'todo_id',
}
const response = await Todos.getATodo(params)Create A Todo
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todolistId: 'todolist_id',
content: 'Todo Title',
description: 'Todo Description',
assignee_ids: ['assignee_id'],
completion_subscriber_ids: ['completion_subscriber_ids'],
notify: true,
due_on: 'MM/DD/YYYY',
starts_on: 'MM/DD/YYYY',
}
const response = await Todos.createATodo(params)Update A Todo
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todoId: 'todo_id',
content: 'Todo Title',
description: 'Todo Description',
assignee_ids: ['assignee_id'],
completion_subscriber_ids: ['completion_subscriber_ids'],
notify: true,
due_on: 'MM/DD/YYYY',
starts_on: 'MM/DD/YYYY',
}
const response = await Todos.updateATodo(params)Complete A Todo
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todoId: 'todo_id',
}
const response = await Todos.completeATodo(params)Uncomplete A Todo
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todoId: 'todo_id',
}
const response = await Todos.uncompleteATodo(params)Reposition A Todo
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
todoId: 'todo_id',
position: 1
}
const response = await Todos.repositionATodo(params)Comments
Get All Comments
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
recordingId: 'recording_id'
}
const response = await Comments.getComments(params)Get a Specific Comment
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
commentId: 'comment_id'
}
const response = await Comments.getAComment(params)Create a Comment
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
recordingId: 'recording_id',
content: 'Comment'
}
const response = await Comments.createAComment(params)Update a Comment
const params = {
accountId: 'account_id',
authorization: 'Bearer token',
projectId: 'project_id',
commentId: 'comment_id',
content: 'Updated comment'
}
const response = await Comments.updateAComment(params)Error Handling
All functions return a response object with success, status, data, and message fields for easier error handling.
License
Authors
Support
If you find this project helpful, consider supporting it!
Or donate directly via PayPal: https://www.paypal.me/SirTim21
