Example #1
0
        public async Task <string> GetYahooTaxAsync(string c_from, string c_to)
        {
            var url = ApiEndpoint.YahooEndpoint(c_from, c_to);

            var response = await client.GetAsync(url);

            var stringResult = response.Content.ReadAsStringAsync().Result;

            return(stringResult.Split(',')[1]);
        }
Example #2
0
        public async Task <ResponseRates> GetAllRates(string c_from, List <string> c_to)
        {
            var url = ApiEndpoint.AllRates(c_from, c_to.ToArray());

            var response = await client.GetAsync(url).ConfigureAwait(false);

            var           jsonResult = response.Content.ReadAsStringAsync().Result;
            ResponseRates rates      = JsonConvert.DeserializeObject <ResponseRates>(jsonResult);

            return(rates);
        }
Example #3
0
        public async Task <YahooResponse> GetRateAsync(string c_from, string c_to)
        {
            var url = ApiEndpoint.RateEndpoint(c_from, c_to);

            var response = await client.GetAsync(url).ConfigureAwait(false);

            var           jsonResult = response.Content.ReadAsStringAsync().Result;
            YahooResponse rate       = JsonConvert.DeserializeObject <YahooResponse>(jsonResult);

            return(rate);
        }
Example #4
0
        public async Task <WalletItemDTO> GetTotalValue(List <WalletItemDTO> from, string c_to)
        {
            string data = JsonConvert.SerializeObject(from);

            var content = new StringContent(data, Encoding.UTF8, "application/json");

            var url = ApiEndpoint.TotalEndpoint(c_to);

            var response = await client.PostAsync(url, content).ConfigureAwait(false);

            var           jsonResult = response.Content.ReadAsStringAsync().Result;
            WalletItemDTO item       = JsonConvert.DeserializeObject <WalletItemDTO>(jsonResult);

            return(item);
        }