Skip to content

Instantly share code, notes, and snippets.

@zaetrik
Created April 19, 2020 10:45
Show Gist options
  • Save zaetrik/394427d2c8633b7fa636274cc2036895 to your computer and use it in GitHub Desktop.
Save zaetrik/394427d2c8633b7fa636274cc2036895 to your computer and use it in GitHub Desktop.
Functional JS API Requests - Successful Request
getExchangeRatesForCountry(CountryCode.USD).then(console.log);
// => It returns our validated response
// wrapped inside of a TaskEither monad
{
_tag: 'Right',
right: {
rates: {
CAD: 1.4069981584,
HKD: 7.7505524862,
ISK: 144.1068139963,
PHP: 50.9162062615,
DKK: 6.8695211786,
HUF: 323.9502762431,
CZK: 25.0119705341,
GBP: 0.8009023941,
RON: 4.4526703499,
SEK: 9.9952117864,
IDR: 15585.6261510129,
INR: 76.479281768,
BRL: 5.2300184162,
RUB: 74.0009208103,
HRK: 6.9719152855,
JPY: 107.605893186,
THB: 32.5303867403,
CHF: 0.9682320442,
EUR: 0.9208103131,
MYR: 4.3699815838,
BGN: 1.8009208103,
TRY: 6.9043278085,
CNY: 7.0737569061,
NOK: 10.3908839779,
NZD: 1.6614180479,
ZAR: 18.750092081,
USD: 1,
MXN: 24.026335175,
SGD: 1.4223756906,
AUD: 1.573480663,
ILS: 3.5900552486,
KRW: 1216.8784530387,
PLN: 4.1606813996
},
base: 'USD',
date: '2020-04-17'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment