public async Task <UserModel> GetUserByAccessTokenAsync(string accessToken) { apiClient .CreateRequestMessage(HttpMethod.Get, ApiRoutes.UserAccount) .AddAuthorization(accessToken); var response = await apiClient.SendRequestAsync(); return(await response.TryFetchContentAsync <UserModel>()); }
protected async Task <TResponseContent> GetRequestAsync <TResponseContent>(string uri) where TResponseContent : new() { ApiClient .CreateRequestMessage(HttpMethod.Get, uri) .AddAuthorization(await GetTokenAsync()); var response = await ApiClient.SendRequestAsync(); return((response.StatusCode == HttpStatusCode.NotFound) ? new TResponseContent() : await response.TryFetchContentAsync <TResponseContent>()); }