//native
type Currencyapi = {
apiKey: string;
};
export async function main(
currencyApiResource: Currencyapi,
base_currency: string,
currencies: string,
) {
const paramString = new URLSearchParams({
base_currency: base_currency,
currencies: currencies,
}).toString();
const res = await fetch(
`https://api.currencyapi.com/v3/latest?${paramString}`,
{
headers: {
apikey: currencyApiResource.apiKey,
},
},
);
const data = await res.json();
const currency = data?.data;
return currency;
}
Submitted by hugo989 6 days ago