import { request , cleanUrl , appendCustomParams } from "@esri/arcgis-rest-request" ; import { IFeature } from "@esri/arcgis-rest-types" ; import { ISharedEditOptions , IApplyEditsResult } from "./helpers" ; /**
 * Apply edits request options. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/apply-edits-feature-service-layer-.htm) for more information.
 *
 */ export interface IApplyEditsOptions extends ISharedEditOptions { /**
     * Array of JSON features to add.
     */ adds ? : IFeature [ ] ; /**
     * Array of JSON features to update.
     */ updates ? : IFeature [ ] ; /**
     * Array of objectIds or globalIds to delete.
     */ deletes ? : number [ ] | string [ ] ; /**
     * When set to true, the features and attachments in the adds, updates, deletes, and attachments parameters are identified by their globalIds.
     */ useGlobalIds ? : boolean ; /**
     * Optional parameter which is false by default is set by client to indicate to the server that client in true curve capable.
     */ trueCurveClient ? : boolean ; /**
     * Use the attachments parameter to add, update or delete attachments. Applies only when the useGlobalIds parameter is set to true.
     * See [attachment](https://developers.arcgis.com/rest/services-reference/apply-edits-feature-service-layer-.htm) param details.
     */ attachments ? : { adds ? : any [ ] ; updates ? : any [ ] ; deletes ? : string [ ] ; } ; } param requestOptions returns export function applyEdits ( requestOptions ) { const url = `${ cleanUrl ( requestOptions . url ) }/applyEdits` ; const options = appendCustomParams < IApplyEditsOptions > ( requestOptions , [ "adds" , "updates" , "deletes" , "useGlobalIds" , "attachments" , "gdbVersion" , "returnEditMoment" , "rollbackOnFailure" , "trueCurveClient" , ] , { params : { ... requestOptions . params } } ) ; return request ( url , options ) ; }