@pnp/sp
Version:
pnp - provides a fluent api for working with SharePoint REST
18 lines • 676 B
JavaScript
import { addProp, body } from "@pnp/queryable";
import { _Web, Web } from "../webs/types.js";
import { SiteUsers, SiteUser } from "./types.js";
import { odataUrlFrom } from "../utils/odata-url-from.js";
import { spPost } from "../operations.js";
addProp(_Web, "siteUsers", SiteUsers);
addProp(_Web, "currentUser", SiteUser);
_Web.prototype.ensureUser = async function (logonName) {
const data = await spPost(Web(this, "ensureuser"), body({ logonName }));
return {
data,
user: SiteUser([this, odataUrlFrom(data)]),
};
};
_Web.prototype.getUserById = function (id) {
return SiteUser(this, `getUserById(${id})`);
};
//# sourceMappingURL=web.js.map