queryUserByID method

Future<List<ThirdPartyUser>> queryUserByID(
  1. String userid
)
inherited

Retrieve an array of third party users from a SDN User ID.

userid The SDN User ID to look up.

Implementation

Future<List<ThirdPartyUser>> queryUserByID(String userid) async {
  final requestUri =
      Uri(path: '_api/client/v3/thirdparty/user', queryParameters: {
    'userid': 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 (json as List)
      .map((v) => ThirdPartyUser.fromJson(v as Map<String, Object?>))
      .toList();
}