@pnp/sp
Version:
pnp - provides a fluent api for working with SharePoint REST
73 lines • 2.99 kB
JavaScript
import { __decorate } from "tslib";
import { _SPCollection, spInvokableFactory, deleteable, _SPInstance, } from "../spqueryable.js";
import { body } from "@pnp/queryable";
import { defaultPath } from "../decorators.js";
import { spPost, spPostMerge } from "../operations.js";
let _UserCustomActions = class _UserCustomActions extends _SPCollection {
/**
* Returns the user custom action with the specified id
*
* @param id The GUID id of the user custom action to retrieve
*/
getById(id) {
return UserCustomAction(this).concat(`('${id}')`);
}
/**
* Creates a user custom action
*
* @param properties The information object of property names and values which define the new user custom action
*/
async add(properties) {
const data = await spPost(this, body(properties));
return {
action: this.getById(data.Id),
data,
};
}
/**
* Deletes all user custom actions in the collection
*/
clear() {
return spPost(UserCustomActions(this, "clear"));
}
};
_UserCustomActions = __decorate([
defaultPath("usercustomactions")
], _UserCustomActions);
export { _UserCustomActions };
export const UserCustomActions = spInvokableFactory(_UserCustomActions);
export class _UserCustomAction extends _SPInstance {
constructor() {
super(...arguments);
this.delete = deleteable();
}
/**
* Updates this user custom action with the supplied properties
*
* @param properties An information object of property names and values to update for this user custom action
*/
async update(props) {
const data = await spPostMerge(this, body(props));
return {
data,
action: this,
};
}
}
export const UserCustomAction = spInvokableFactory(_UserCustomAction);
export var UserCustomActionRegistrationType;
(function (UserCustomActionRegistrationType) {
UserCustomActionRegistrationType[UserCustomActionRegistrationType["None"] = 0] = "None";
UserCustomActionRegistrationType[UserCustomActionRegistrationType["List"] = 1] = "List";
UserCustomActionRegistrationType[UserCustomActionRegistrationType["ContentType"] = 2] = "ContentType";
UserCustomActionRegistrationType[UserCustomActionRegistrationType["ProgId"] = 3] = "ProgId";
UserCustomActionRegistrationType[UserCustomActionRegistrationType["FileType"] = 4] = "FileType";
})(UserCustomActionRegistrationType || (UserCustomActionRegistrationType = {}));
export var UserCustomActionScope;
(function (UserCustomActionScope) {
UserCustomActionScope[UserCustomActionScope["Unknown"] = 0] = "Unknown";
UserCustomActionScope[UserCustomActionScope["Site"] = 2] = "Site";
UserCustomActionScope[UserCustomActionScope["Web"] = 3] = "Web";
UserCustomActionScope[UserCustomActionScope["List"] = 4] = "List";
})(UserCustomActionScope || (UserCustomActionScope = {}));
//# sourceMappingURL=types.js.map