mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-16 13:04:34 +00:00
Amend examples (#211)
This commit is contained in:
6
examples/crypto/news/curl/getCryptocurrencyNews.sh
Executable file
6
examples/crypto/news/curl/getCryptocurrencyNews.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
curl "https://api.m3o.com/v1/crypto/News" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"symbol": "BTCUSD"
|
||||
}'
|
||||
16
examples/crypto/news/go/getCryptocurrencyNews.go
Executable file
16
examples/crypto/news/go/getCryptocurrencyNews.go
Executable file
@@ -0,0 +1,16 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/micro/services/clients/go/crypto"
|
||||
"os"
|
||||
)
|
||||
|
||||
// Get news related to a currency
|
||||
func GetCryptocurrencyNews() {
|
||||
cryptoService := crypto.NewCryptoService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := cryptoService.News(&crypto.NewsRequest{
|
||||
Symbol: "BTCUSD",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
12
examples/crypto/news/node/getCryptocurrencyNews.js
Executable file
12
examples/crypto/news/node/getCryptocurrencyNews.js
Executable file
@@ -0,0 +1,12 @@
|
||||
import * as crypto from "m3o/crypto";
|
||||
|
||||
// Get news related to a currency
|
||||
async function GetCryptocurrencyNews() {
|
||||
let cryptoService = new crypto.CryptoService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await cryptoService.news({
|
||||
symbol: "BTCUSD",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
await GetCryptocurrencyNews();
|
||||
Reference in New Issue
Block a user