import { request , IRequestOptions } from "@esri/arcgis-rest-request" ; import { IUser } from "@esri/arcgis-rest-types" ; import { UserSession } from "@esri/arcgis-rest-auth" ; import { getPortalUrl } from "../util/get-portal-url" ; export interface IGetUserOptions extends IRequestOptions { /**
     * A session representing a logged in user.
     */ authentication ? : UserSession ; /**
     * Supply a username if you'd like to fetch information about a different user than is being used to authenticate the request.
     */ username ? : string ; } param requestOptions returns export function getUser ( requestOptions ? ) { let url ; let options = { httpMethod : "GET" } as IGetUserOptions ; if ( typeof requestOptions === "string" ) { url = `https://www.arcgis.com/sharing/rest/community/users/${ requestOptions }` ; } else { const username = requestOptions . username || requestOptions . authentication . username ; url = `${ getPortalUrl ( requestOptions ) }/community/users/${ encodeURIComponent ( username ) }` ; options = { ... requestOptions , ... options } ; } return request ( url , options ) ; }