Commit from GitHub Actions (Publish APIs & Clients)

This commit is contained in:
asim
2021-10-22 19:32:31 +00:00
parent df88da842a
commit 036979282a
6 changed files with 38 additions and 4 deletions

View File

@@ -0,0 +1,6 @@
curl "https://api.m3o.com/v1/stream/Subscribe" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"topic": "events"
}'

View File

@@ -0,0 +1,16 @@
package example
import (
"fmt"
"github.com/micro/services/clients/go/stream"
"os"
)
// Subscribe to messages for a given topic.
func SubscribeToAtopic() {
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := streamService.Subscribe(&stream.SubscribeRequest{
Topic: "events",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,12 @@
const { StreamService } = require("m3o/stream");
// Subscribe to messages for a given topic.
async function subscribeToAtopic() {
let streamService = new StreamService(process.env.MICRO_API_TOKEN);
let rsp = await streamService.subscribe({
topic: "events",
});
console.log(rsp);
}
subscribeToAtopic();