UNPKG

@esri/arcgis-rest-feature-service

Version:

Feature layer query and edit helpers for @esri/arcgis-rest-js

32 lines 1.43 kB
"use strict"; /* Copyright (c) 2018 Environmental Systems Research Institute, Inc. * Apache-2.0 */ Object.defineProperty(exports, "__esModule", { value: true }); exports.updateAttachment = void 0; const arcgis_rest_request_1 = require("@esri/arcgis-rest-request"); /** * Update a related attachment to a feature by id. See [Update Attachment](https://developers.arcgis.com/rest/services-reference/update-attachment.htm) for more information. * * ```js * import { updateAttachment } from '@esri/arcgis-rest-feature-service'; * // * updateAttachment({ * url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/ServiceRequest/FeatureServer/0", * featureId: 8484, * attachment: myFileInput.files[0], * attachmentId: 306 * }); * ``` * * @param requestOptions - Options for the request. * @returns A Promise that will resolve with the `updateAttachment()` response. */ function updateAttachment(requestOptions) { const options = Object.assign({ params: {} }, requestOptions); // `attachment` and `attachmentId` --> params: {} options.params.attachment = requestOptions.attachment; options.params.attachmentId = requestOptions.attachmentId; return (0, arcgis_rest_request_1.request)(`${(0, arcgis_rest_request_1.cleanUrl)(options.url)}/${options.featureId}/updateAttachment`, options); } exports.updateAttachment = updateAttachment; //# sourceMappingURL=updateAttachment.js.map