UNPKG

@pnp/sp

Version:

pnp - provides a fluent api for working with SharePoint REST

50 lines 1.85 kB
import { _ClientsidePage } from "../clientside-pages/types.js"; import { Item } from "../items/index.js"; import { spPost } from "../operations.js"; import { SPQueryable } from "../spqueryable.js"; _ClientsidePage.prototype.addComment = async function (info) { const item = await this.getItem(); return item.comments.add(info); }; _ClientsidePage.prototype.getCommentById = async function (id) { const item = await this.getItem(); const data = await item.comments.getById(id)(); return Object.assign(item.comments.getById(id), data); }; _ClientsidePage.prototype.clearComments = async function () { const item = await this.getItem(); return item.comments.clear(); }; _ClientsidePage.prototype.getComments = async function () { const item = await this.getItem(); return item.comments(); }; _ClientsidePage.prototype.like = async function () { const item = await this.getItem("ID"); return spPost(SPQueryable(item, "like")); }; _ClientsidePage.prototype.unlike = async function () { const item = await this.getItem("ID"); return spPost(SPQueryable(item, "unlike")); }; _ClientsidePage.prototype.getLikedByInformation = async function () { const item = await this.getItem("ID"); return item.getLikedByInformation(); }; _ClientsidePage.prototype.enableComments = async function () { return this.setCommentsOn(true).then(r => { this.commentsDisabled = false; return r; }); }; _ClientsidePage.prototype.disableComments = async function () { return this.setCommentsOn(false).then(r => { this.commentsDisabled = true; return r; }); }; _ClientsidePage.prototype.setCommentsOn = async function (on) { const item = await this.getItem(); return Item(item, `SetCommentsDisabled(${!on})`).update({}); }; //# sourceMappingURL=clientside-page.js.map