Files
m3o-go/examples/currency/convert/convert10UsdToGbp.go
2021-10-29 06:38:17 +00:00

20 lines
398 B
Go
Executable File

package example
import (
"fmt"
"os"
"github.com/go.m3o.com/currency"
)
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
func Convert10usdToGbp() {
currencyService := currency.NewCurrencyService(os.Getenv("M3O_API_TOKEN"))
rsp, err := currencyService.Convert(&currency.ConvertRequest{
Amount: 10,
From: "USD",
To: "GBP",
})
fmt.Println(rsp, err)
}