basecamp-api-v3
Version:
This TypeScript library provides an API wrapper for interacting with Basecamp resources, including People, Projects, Todo Sets, Todo Lists, Comments, and Authorization.
46 lines (45 loc) • 2.51 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createATodolistGroup = exports.getATodolistGroup = exports.listTodolistGroups = void 0;
const fetchWithRetry_1 = require("../utils/fetchWithRetry");
const listTodolistGroups = (params) => __awaiter(void 0, void 0, void 0, function* () {
const url = `https://3.basecampapi.com/${params.accountId}/buckets/${params.projectId}/todolists/${params.todolistId}/groups.json`;
const options = {
method: 'get',
headers: { Authorization: `Bearer ${params.authorization}` }
};
return yield (0, fetchWithRetry_1.fetchDataWithRetry)({ url, options });
});
exports.listTodolistGroups = listTodolistGroups;
const getATodolistGroup = (params) => __awaiter(void 0, void 0, void 0, function* () {
const url = `https://3.basecampapi.com/${params.accountId}/buckets/${params.projectId}/todolists/${params.todolistId}.json`;
const options = {
method: 'get',
headers: { Authorization: `Bearer ${params.authorization}` }
};
return yield (0, fetchWithRetry_1.fetchDataWithRetry)({ url, options });
});
exports.getATodolistGroup = getATodolistGroup;
const createATodolistGroup = (params) => __awaiter(void 0, void 0, void 0, function* () {
const url = `https://3.basecampapi.com/${params.accountId}/buckets/${params.projectId}/todolists/${params.todolistId}/groups.json`;
const options = {
method: "post",
headers: {
Authorization: `Bearer ${params.authorization}`,
"Content-Type": "application/json"
},
body: JSON.stringify({ name: params.name, color: params.color }),
muteHttpExceptions: true
};
return yield (0, fetchWithRetry_1.fetchDataWithRetry)({ url, options });
});
exports.createATodolistGroup = createATodolistGroup;
;