getWhoIs method
Gets information about a particular user.
This API may be restricted to only be called by the user being looked up, or by a server admin. Server-local administrator privileges are not specified in this document.
userId
The user to look up.
Implementation
Future<WhoIsInfo> getWhoIs(String userId) async {
final requestUri =
Uri(path: '_api/client/v3/admin/whois/${Uri.encodeComponent(userId)}');
final request = Request('GET', baseUri!.resolveUri(requestUri));
request.headers['authorization'] = 'Bearer ${bearerToken!}';
final response = await httpClient.send(request);
final responseBody = await response.stream.toBytes();
if (response.statusCode != 200) unexpectedResponse(response, responseBody);
final responseString = utf8.decode(responseBody);
final json = jsonDecode(responseString);
return WhoIsInfo.fromJson(json as Map<String, Object?>);
}