in SampleCPMProject/CpmClient/JarvisCPMClient.cs [81:97]
private async Task<T> MakeRequestAndParseResponse<T>(HttpRequestMessage reqMessage)
{
reqMessage.Headers.Authorization = new Headers.AuthenticationHeaderValue("Bearer", AadAuthentication.GetAccessTokenForCpmApi());
HttpResponseMessage response = await httpClient.SendAsync(reqMessage);
await ValidateResponse(response);
if (typeof(T) != typeof(object))
{
string responseAsJson = await response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<T>(responseAsJson);
}
else
{
return default(T);
}
}