@4lch4/toggl-aid
Version:
A wrapper library for interacting with the Toggl API.
117 lines • 4.43 kB
JavaScript
"use strict";
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.Workspaces = void 0;
const BaseEndpoint_1 = require("../BaseEndpoint");
class Workspaces extends BaseEndpoint_1.BaseEndpoint {
getWorkspaces() {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', '/workspaces');
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspace(workspaceId) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
updateWorkspace(workspaceId, workspace) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('PUT', `/workspaces/${workspaceId}`, { data: { workspace: workspace } });
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspaceUsers(workspaceId) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}/users`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspaceClients(workspaceId) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}/clients`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspaceGroups(workspaceId) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}/groups`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspaceProjects(workspaceId, active = 'true', actualHours = false, onlyTemplates = false) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}/projects?active=${active}` +
`&actual_hours=${actualHours}&only_templates=${onlyTemplates}`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspaceTasks(workspaceId, active = 'true') {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}/tasks?active=${active}`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
getWorkspaceTags(workspaceId) {
return __awaiter(this, void 0, void 0, function* () {
try {
const res = yield this.axios.performRequest('GET', `/workspaces/${workspaceId}/tags`);
return this.respond(res);
}
catch (err) {
return err;
}
});
}
}
exports.Workspaces = Workspaces;
//# sourceMappingURL=Workspaces.js.map