示例#1
0
        public async Task <string> GetApiBooks(string query)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(URL);
                var formContent = new FormUrlEncodedContent(
                    new[]
                {
                    new KeyValuePair <string, string>("token", TOKEN),
                    new KeyValuePair <string, string>("query", query)
                });

                try
                {
                    var response = await client.PostAsync("api/find", formContent);

                    return(BookConverter.OrganizeBooksContent(response));
                }
                catch (Exception e)
                {
                    //TODO - fazer log
                    return(string.Empty);
                }
            }
        }