@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 838 B
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import e from"../../request.js";import r from"../../core/Error.js";import{join as t}from"../../core/urlUtils.js";async function s({serviceUrl:s,query:l,requestOptions:o={}}){if(null==l.layers&&null==l.templateIds)throw new r("query-shared-templates:invalid-parameters","Must supply a value for either the 'layers' or the 'templateIds' parameters");const p=t(s,"sharedTemplates","query"),n={f:"json",...o.query,...l};n.layers&&(n.layers=a(n.layers)),n.templateIds&&(n.templateIds=a(n.templateIds)),n.tags&&(n.tags=a(n.tags));const u={...o,responseType:"json",query:n};return(await e(p,u)).data.templates}function a(e){return Array.isArray(e)?e.join(","):""}export{s as querySharedTemplates};