dinero icon indicating copy to clipboard operation
dinero copied to clipboard

PoC: Create struct functions to perform API calls

Open rbUUbr opened this issue 5 years ago • 0 comments

Currently I have an use-case when I need convert a lot of currencies to another currencies in a row. In my code I need to do something like this:

client := // client creating
for _, currency := range currencies {
  request := client.newRequest(...params)
  rsp, _ := client.do(request)
}

Here is the problem: I need to do a lot of actions to just convert the currency :(

  1. create client
  2. set up request
  3. perform request What if this library will have some kind of advanced API to do something like:
client := // client creating
for _, currency := range currencies {
  rsp, _ := client.ConvertCurrency(currency, "USD")
}

WDYT about it?

rbUUbr avatar Dec 23 '19 18:12 rbUUbr