UNPKG

noticebord-client

Version:

The official Typescript client library for the Noticebord API.

81 lines (80 loc) 2.93 kB
"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.TeamNoticeService = void 0; const service_1 = require("./service"); class TeamNoticeService extends service_1.Service { constructor(token, baseUrl) { super(token, baseUrl); } /** * Create a new notice * * @param {Number} team The team ID * @param {SaveTeamNoticeRequest} request The notice to create. */ createTeamNotice(team, request) { return __awaiter(this, void 0, void 0, function* () { const { data } = yield this.api.post(`/teams/${team}/notices`, request); return data; }); } /** * Fetch a list of all notices. * * @param {Number} team The team ID */ fetchTeamNotices(team, cursor) { return __awaiter(this, void 0, void 0, function* () { const { data } = yield this.api.get(`/teams/${team}/notices`, { params: { cursor }, }); return data; }); } /** * Fetch a single notice by ID * * @param {Number} team The team ID * @param {Number} id The id of the notice to find. */ fetchTeamNotice(team, id) { return __awaiter(this, void 0, void 0, function* () { const { data } = yield this.api.get(`/teams/${team}/notices/${id}`); return data; }); } /** * Update an existing notice * * @param {Number} team The team ID * @param {number} id The id of the notice to update. * @param {SaveTeamNoticeRequest} request The notice to create. */ updateTeamNotice(team, id, request) { return __awaiter(this, void 0, void 0, function* () { const { data } = yield this.api.put(`/teams/${team}/notices/${id}`, request); return data; }); } /** * Delete an existing notice * * @param {Number} team The team ID * @param {number} id The id of the notice to delete. */ deleteTeamNotice(team, id) { return __awaiter(this, void 0, void 0, function* () { yield this.api.delete(`/teams/${team}/notices/${id}`); }); } } exports.TeamNoticeService = TeamNoticeService;