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.
34 lines (33 loc) • 1.82 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.getAProject = exports.getAllProjects = void 0;
const fetchWithRetry_1 = require("../utils/fetchWithRetry");
const getAllProjects = (params) => __awaiter(void 0, void 0, void 0, function* () {
const queryStringArr = [`status=${params.status || ''}`];
const queryString = queryStringArr.join('&');
const url = `https://3.basecampapi.com/${params.accountId}/projects.json?${queryString}`;
const options = {
method: 'get',
headers: { Authorization: `Bearer ${params.authorization}` }
};
return yield (0, fetchWithRetry_1.fetchDataWithRetry)({ url, options });
});
exports.getAllProjects = getAllProjects;
const getAProject = (params) => __awaiter(void 0, void 0, void 0, function* () {
const url = `https://3.basecampapi.com/${params.accountId}/projects/${params.projectId}.json`;
const options = {
method: 'get',
headers: { Authorization: `Bearer ${params.authorization}` }
};
return yield (0, fetchWithRetry_1.fetchDataWithRetry)({ url, options });
});
exports.getAProject = getAProject;
;