@esri/arcgis-rest-portal
Version:
ArcGIS Online and Enterprise content and user helpers for @esri/arcgis-rest-request
23 lines • 1.1 kB
JavaScript
;
/* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
* Apache-2.0 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getUserProperties = void 0;
const arcgis_rest_request_1 = require("@esri/arcgis-rest-request");
const get_portal_url_js_1 = require("../util/get-portal-url.js");
/**
* Fetches the properties for a user
* @param username The user whose properties to fetch
* @param requestOptions An IAuthenticatedRequestOptions object
* @returns a promise that resolves an IUserProperties object
*/
async function getUserProperties(username, requestOptions) {
const url = `${(0, get_portal_url_js_1.getPortalUrl)(requestOptions)}/community/users/${encodeURIComponent(username)}/properties`;
const response = await (0, arcgis_rest_request_1.request)(url, Object.assign({ httpMethod: "GET" }, requestOptions));
if (!response.properties.mapViewer) {
response.properties.mapViewer = "modern";
}
return response.properties;
}
exports.getUserProperties = getUserProperties;
//# sourceMappingURL=get-user-properties.js.map