@esri/arcgis-rest-feature-service
Version:
Feature layer query and edit helpers for @esri/arcgis-rest-js
34 lines • 1.51 kB
JavaScript
;
/* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.queryRelated = void 0;
const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
/**
* Query the related records for a feature service. See the [REST Documentation](https://developers.arcgis.com/rest/services-reference/query-related-records-feature-service-.htm) for more information.
*
* ```js
* import { queryRelated } from '@esri/arcgis-rest-feature-service'
*
* queryRelated({
* url: "http://services.myserver/OrgID/ArcGIS/rest/services/Petroleum/KSPetro/FeatureServer/0",
* relationshipId: 1,
* params: { returnCountOnly: true }
* })
* .then(response) // response.relatedRecords
* ```
*
* @param requestOptions
* @returns A Promise that will resolve with the query response
*/
function queryRelated(requestOptions) {
const options = (0, arcgis_rest_request_1.appendCustomParams)(requestOptions, ["objectIds", "relationshipId", "definitionExpression", "outFields"], {
httpMethod: "GET",
params: Object.assign({
// set default query parameters
definitionExpression: "1=1", outFields: "*", relationshipId: 0 }, requestOptions.params)
});
return (0, arcgis_rest_request_1.request)(`${(0, arcgis_rest_request_1.cleanUrl)(requestOptions.url)}/queryRelatedRecords`, options);
}
exports.queryRelated = queryRelated;
//# sourceMappingURL=queryRelated.js.map