-
-
Save shahriarhossain/eed8e16a4b1dfad3556c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseOperation | |
{ | |
public async Task<T> GetAsync<T>(string endpoint) where T : class | |
{ | |
string content; | |
using (var client = new HttpClient()) | |
{ | |
try | |
{ | |
Authenticate.ClientAuthentication(client); | |
content = await client.GetStringAsync(endpoint).ConfigureAwait(false); | |
} | |
catch (Exception ex) | |
{ | |
throw ex; | |
} | |
} | |
return JsonConvert.DeserializeObject<T>(content); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment