UNPKG

@esri/arcgis-rest-portal

Version:

ArcGIS Online and Enterprise content and user helpers for @esri/arcgis-rest-request

30 lines 1.33 kB
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ import { request } from "@esri/arcgis-rest-request"; import { getPortalUrl } from "../util/get-portal-url.js"; import { determineOwner } from "./helpers.js"; /** * Protect an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/protect.htm) for more information. * * @param requestOptions - Options for the request * @returns A Promise to protect an item. */ export function protectItem(requestOptions) { return determineOwner(requestOptions).then((owner) => { const url = `${getPortalUrl(requestOptions)}/content/users/${owner}/items/${requestOptions.id}/protect`; return request(url, requestOptions); }); } /** * Unprotect an item. See the [REST Documentation](https://developers.arcgis.com/rest/users-groups-and-items/unprotect.htm) for more information. * * @param requestOptions - Options for the request * @returns A Promise to unprotect an item. */ export function unprotectItem(requestOptions) { return determineOwner(requestOptions).then((owner) => { const url = `${getPortalUrl(requestOptions)}/content/users/${owner}/items/${requestOptions.id}/unprotect`; return request(url, requestOptions); }); } //# sourceMappingURL=protect.js.map