use of uk.nhs.digital.intranet.json.User in project hippo by NHS-digital-website.
the class GraphProviderImpl method getUser.
private User getUser(final String id) throws ProviderCommunicationException {
final HttpEntity<String> httpRequest = getHttpRequest(MediaType.APPLICATION_JSON);
final URI uri = UriComponentsBuilder.fromUriString(BASE_URL_V1).pathSegment("users").pathSegment(id).queryParam("$select", SELECTED_FIELDS_LONG).build().toUri();
try {
final ResponseEntity<User> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, httpRequest, User.class);
Assert.notNull(responseEntity.getBody(), "Received null response from Microsoft Graph API.");
return responseEntity.getBody();
} catch (final HttpStatusCodeException e) {
LOGGER.error("Received exception with status {} from Microsoft Graph API.", e.getStatusCode(), e);
throw new ProviderCommunicationException();
}
}
Aggregations