UNPKG

@raona/sp

Version:

Raona utilities to work with Sharepoint using pnp/sp

34 lines (33 loc) 1.41 kB
"use strict"; // import { Item, ItemAddResult } from '@pnp/sp'; Object.defineProperty(exports, "__esModule", { value: true }); var SPAbstractService_1 = require("./SPAbstractService"); var SPListService = /** @class */ (function () { // TODO: real type of this SPAbstractService | contextLike (this needs to be created) | string function SPListService(sourceOfTruth) { var service; if (sourceOfTruth instanceof SPAbstractService_1.SPAbstractService) { service = sourceOfTruth; } else { service = new SPAbstractService_1.SPAbstractService(sourceOfTruth); } this.service = service; } SPListService.prototype.getItems = function (options) { if (options === void 0) { options = {}; } options.listName = this.listName; return this.service.getListItems(options); }; SPListService.prototype.addItem = function (item) { return this.service.addListItem(this.listName, item); }; SPListService.prototype.updateItem = function (id, item) { return this.service.updateManyOfListByName(this.listName, [id], [item]); }; SPListService.prototype.updateItems = function (ids, items) { return this.service.updateManyOfListByName(this.listName, ids, items); }; return SPListService; }()); exports.SPListService = SPListService;