UNPKG

@pnp/sp

Version:

pnp - provides a fluent api for working with SharePoint REST

53 lines 1.62 kB
import { __decorate } from "tslib"; import { body } from "@pnp/queryable"; import { _SPInstance, _SPCollection, spInvokableFactory, } from "../spqueryable.js"; import { defaultPath } from "../decorators.js"; import { spPost } from "../operations.js"; let _Features = class _Features extends _SPCollection { /** * Adds (activates) the specified feature * * @param id The Id of the feature (GUID) * @param force If true the feature activation will be forced */ async add(featureId, force = false) { const data = await spPost(Features(this, "add"), body({ featdefScope: 0, featureId, force, })); return { data: data, feature: this.getById(featureId), }; } /** * Gets a feature from the collection with the specified guid * * @param id The Id of the feature (GUID) */ getById(id) { return Feature(this).concat(`('${id}')`); } /** * Removes (deactivates) a feature from the collection * * @param id The Id of the feature (GUID) * @param force If true the feature deactivation will be forced */ remove(featureId, force = false) { return spPost(Features(this, "remove"), body({ featureId, force, })); } }; _Features = __decorate([ defaultPath("features") ], _Features); export { _Features }; export const Features = spInvokableFactory(_Features); export class _Feature extends _SPInstance { } export const Feature = spInvokableFactory(_Feature); //# sourceMappingURL=types.js.map