Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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
            {
            }
        }