mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-22 23:35:26 +00:00
Generate clients (#206)
This commit is contained in:
8
examples/currency/convert/curl/convert10UsdToGbp.sh
Executable file
8
examples/currency/convert/curl/convert10UsdToGbp.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
curl "https://api.m3o.com/v1/currency/Convert" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"amount": 10,
|
||||
"from": "USD",
|
||||
"to": "GBP"
|
||||
}'
|
||||
7
examples/currency/convert/curl/convertUsdToGbp.sh
Executable file
7
examples/currency/convert/curl/convertUsdToGbp.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
curl "https://api.m3o.com/v1/currency/Convert" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"from": "USD",
|
||||
"to": "GBP"
|
||||
}'
|
||||
18
examples/currency/convert/go/convert10UsdToGbp.go
Executable file
18
examples/currency/convert/go/convert10UsdToGbp.go
Executable file
@@ -0,0 +1,18 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/currency"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||
func Convert10usdToGbp() {
|
||||
currencyService := currency.NewCurrencyService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := currencyService.Convert(¤cy.ConvertRequest{
|
||||
Amount: 10,
|
||||
From: "USD",
|
||||
To: "GBP",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
17
examples/currency/convert/go/convertUsdToGbp.go
Executable file
17
examples/currency/convert/go/convertUsdToGbp.go
Executable file
@@ -0,0 +1,17 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/currency"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||
func ConvertUsdToGbp() {
|
||||
currencyService := currency.NewCurrencyService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := currencyService.Convert(¤cy.ConvertRequest{
|
||||
From: "USD",
|
||||
To: "GBP",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
16
examples/currency/convert/node/convert10UsdToGbp.js
Executable file
16
examples/currency/convert/node/convert10UsdToGbp.js
Executable file
@@ -0,0 +1,16 @@
|
||||
import * as currency from "m3o/currency";
|
||||
|
||||
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||
async function Convert10usdToGbp() {
|
||||
let currencyService = new currency.CurrencyService(
|
||||
process.env.MICRO_API_TOKEN
|
||||
);
|
||||
let rsp = await currencyService.convert({
|
||||
amount: 10,
|
||||
from: "USD",
|
||||
to: "GBP",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await Convert10usdToGbp();
|
||||
15
examples/currency/convert/node/convertUsdToGbp.js
Executable file
15
examples/currency/convert/node/convertUsdToGbp.js
Executable file
@@ -0,0 +1,15 @@
|
||||
import * as currency from "m3o/currency";
|
||||
|
||||
// Convert returns the currency conversion rate between two pairs e.g USD/GBP
|
||||
async function ConvertUsdToGbp() {
|
||||
let currencyService = new currency.CurrencyService(
|
||||
process.env.MICRO_API_TOKEN
|
||||
);
|
||||
let rsp = await currencyService.convert({
|
||||
from: "USD",
|
||||
to: "GBP",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await ConvertUsdToGbp();
|
||||
Reference in New Issue
Block a user