public static async Task <GetFriendList> FriendListAsync(HttpClient client) { string url = baseAddress + "api/friendlist/" + user.username; HttpResponseMessage response = await client.GetAsync(url); if (response.IsSuccessStatusCode) { getFriendList = await response.Content.ReadAsAsync <GetFriendList>(); } return(getFriendList); }
public static async Task FriendList() { var client = new HttpClient(); SetupClientDefaults(client); client.BaseAddress = new Uri(baseAddress); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); try { getFriendList = await FriendListAsync(client); } catch (Exception e) { } finally { } }