@esri/arcgis-rest-portal 4.0.6 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /* @preserve
2
- * @esri/arcgis-rest-portal - v4.0.5 - Apache-2.0
3
- * Copyright (c) 2017-2022 Esri, Inc.
4
- * Thu Sep 22 2022 19:48:13 GMT+0000 (Coordinated Universal Time)
2
+ * @esri/arcgis-rest-portal - v4.1.0 - Apache-2.0
3
+ * Copyright (c) 2017-2023 Esri, Inc.
4
+ * Thu Mar 02 2023 01:32:35 GMT+0000 (Coordinated Universal Time)
5
5
  */
6
6
  import { cleanUrl, request, appendCustomParams, warn } from '@esri/arcgis-rest-request';
7
7
 
@@ -2330,6 +2330,48 @@ function updateUser(requestOptions) {
2330
2330
  return request(updateUrl, requestOptions);
2331
2331
  }
2332
2332
 
2333
+ /* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
2334
+ * Apache-2.0 */
2335
+ /**
2336
+ * Fetches the properties for a user
2337
+ * @param username The user whose properties to fetch
2338
+ * @param requestOptions An IUserRequestOptions object
2339
+ * @returns a promise that resolves an IUserProperties object
2340
+ */
2341
+ async function getUserProperties(username, requestOptions) {
2342
+ const url = `${getPortalUrl(requestOptions)}/community/users/${encodeURIComponent(username)}/properties`;
2343
+ const response = await request(url, Object.assign({ httpMethod: "GET" }, requestOptions));
2344
+ if (!response.properties.mapViewer) {
2345
+ response.properties.mapViewer = "modern";
2346
+ }
2347
+ return response.properties;
2348
+ }
2349
+
2350
+ /* Copyright (c) 2023 Environmental Systems Research Institute, Inc.
2351
+ * Apache-2.0 */
2352
+ /**
2353
+ * Updates the properties for a user
2354
+ * @param username The user whose properties to update
2355
+ * @param properties IUserProperties object with properties to update
2356
+ * @param requestOptions An IUserRequestOptions object
2357
+ * @returns a promise that resolves to { success: boolean }
2358
+ */
2359
+ async function setUserProperties(username, properties, requestOptions) {
2360
+ const url = `${getPortalUrl(requestOptions)}/community/users/${encodeURIComponent(username)}/setProperties`;
2361
+ const options = Object.assign({ httpMethod: "POST", params: { properties } }, requestOptions);
2362
+ try {
2363
+ const response = await request(url, options);
2364
+ if (!response.success) {
2365
+ throw new Error("Success was false");
2366
+ }
2367
+ return response;
2368
+ }
2369
+ catch (e) {
2370
+ const error = e;
2371
+ throw new Error(`Failed to set user properties: ${error.message}`);
2372
+ }
2373
+ }
2374
+
2333
2375
  /* Copyright (c) 2018 Environmental Systems Research Institute, Inc.
2334
2376
  * Apache-2.0 */
2335
2377
  /**
@@ -2853,5 +2895,5 @@ function getPortalSettings(id, requestOptions) {
2853
2895
  return request(url, options);
2854
2896
  }
2855
2897
 
2856
- export { SearchQueryBuilder, acceptInvitation, addGroupUsers, addItemData, addItemPart, addItemRelationship, addItemResource, bboxToString, cancelItemUpload, commitItemUpload, createFolder, createGroup, createGroupNotification, createItem, createItemInFolder, createOrgNotification, declineInvitation, determineOwner, ensureMembership, exportItem, getGroup, getGroupCategorySchema, getGroupContent, getGroupUsers, getItem, getItemBaseUrl, getItemData, getItemGroups, getItemInfo, getItemMetadata, getItemParts, getItemResource, getItemResources, getItemStatus, getPortal, getPortalSettings, getPortalUrl, getRelatedItems, getSelf, getSharingUrl, getUniqueServiceName, getUser, getUserContent, getUserInvitation, getUserInvitations, getUserMembership, getUserNotifications, getUserTags, getUserUrl, inviteGroupUsers, isBBox, isItemOwner, isItemSharedWithGroup, isOrgAdmin, isServiceNameAvailable, joinGroup, leaveGroup, moveItem, protectGroup, protectItem, reassignItem, removeFolder, removeGroup, removeGroupUsers, removeItem, removeItemRelationship, removeItemResource, removeNotification, scrubControlChars, searchGroupContent, searchGroupUsers, searchGroups, searchItems, searchUsers, setItemAccess, shareItemWithGroup, unprotectGroup, unprotectItem, unshareItemWithGroup, updateGroup, updateItem, updateItemInfo, updateItemResource, updateUser, updateUserMemberships };
2898
+ export { SearchQueryBuilder, acceptInvitation, addGroupUsers, addItemData, addItemPart, addItemRelationship, addItemResource, bboxToString, cancelItemUpload, commitItemUpload, createFolder, createGroup, createGroupNotification, createItem, createItemInFolder, createOrgNotification, declineInvitation, determineOwner, ensureMembership, exportItem, getGroup, getGroupCategorySchema, getGroupContent, getGroupUsers, getItem, getItemBaseUrl, getItemData, getItemGroups, getItemInfo, getItemMetadata, getItemParts, getItemResource, getItemResources, getItemStatus, getPortal, getPortalSettings, getPortalUrl, getRelatedItems, getSelf, getSharingUrl, getUniqueServiceName, getUser, getUserContent, getUserInvitation, getUserInvitations, getUserMembership, getUserNotifications, getUserProperties, getUserTags, getUserUrl, inviteGroupUsers, isBBox, isItemOwner, isItemSharedWithGroup, isOrgAdmin, isServiceNameAvailable, joinGroup, leaveGroup, moveItem, protectGroup, protectItem, reassignItem, removeFolder, removeGroup, removeGroupUsers, removeItem, removeItemRelationship, removeItemResource, removeNotification, scrubControlChars, searchGroupContent, searchGroupUsers, searchGroups, searchItems, searchUsers, setItemAccess, setUserProperties, shareItemWithGroup, unprotectGroup, unprotectItem, unshareItemWithGroup, updateGroup, updateItem, updateItemInfo, updateItemResource, updateUser, updateUserMemberships };
2857
2899
  //# sourceMappingURL=portal.esm.js.map