private static async Task <TResult> GetData <TResult>(IServiceClient client, IDeserializer deserializer, ICachingAgent caching, string key, string requestUri) { try { var response = await client.GetStringAsync(requestUri); var result = deserializer.DeserializeObject <TResult>(response); await caching.SetCache <TResult>(key, response, result); return(result); } catch (UnauthorizedAccessException) { throw; } catch (HttpRequestException) { var data = await caching.GetCache <TResult>(key); if (data is TResult) { return((TResult)data); } return(deserializer.DeserializeObject <TResult>(data as string)); } }
public CFIDDto GetCFID() { var response = _requestService.SendRequest(CfidEndpoint); return(_deserializer.DeserializeObject <CFIDDto>(response)); }
private T Send <T>(string request) { var response = _requestService.SendRequest(request, _auth, _cfid); return(_deserializer.DeserializeObject <T>(response)); }