Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(resolve => {
const usOptions: common.IUserSessionOptions = {};
const authorization: common.UserSession = new common.UserSession(usOptions);
// Get the extents of a portal
// tslint:disable-next-line: no-floating-promises
portal
.getPortal(portalId, { authentication: authorization })
.then(portalResponse => {
const portalExtent: any = portalResponse.defaultExtent;
let html = "";
html += "<h4>Source extents</h4>";
if (!portalId) {
html += "<i>Using sample extents</i><br>";
}
html += "<pre>" + JSON.stringify(portalExtent, null, 4) + "</pre>";
// Convert the extents
const outSR: restTypes.ISpatialReference = { wkid: 4326 };
const geometryServiceUrl: string =
"http://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer";
// tslint:disable-next-line: no-floating-promises
export function getPortal(
id: string,
authentication: interfaces.UserSession
): Promise {
const requestOptions = {
authentication: authentication
};
return portal.getPortal(id, requestOptions);
}