Commit from GitHub Actions (Generate Clients & Examples)

This commit is contained in:
asim
2021-11-03 15:28:08 +00:00
parent 3dba28fa2b
commit 71e26f92c3
5 changed files with 40 additions and 2 deletions

View File

@@ -78,5 +78,5 @@
"prepare": "npm run build"
},
"types": "index.d.ts",
"version": "1.0.618"
"version": "1.0.619"
}

View File

@@ -12,9 +12,9 @@ func PublishAmessage() {
mqService := mq.NewMqService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := mqService.Publish(&mq.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "events",
})

View File

@@ -0,0 +1,7 @@
curl "https://api.m3o.com/v1/stream/SendMessage" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $MICRO_API_TOKEN" \
-d '{
"channel": "general",
"text": "Hey checkout this tweet https://twitter.com/m3oservices/status/1455291054295498752"
}'

View File

@@ -0,0 +1,18 @@
package example
import (
"fmt"
"os"
"github.com/micro/services/clients/go/stream"
)
// SendMessage a message to the stream.
func SendMessage() {
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
rsp, err := streamService.SendMessage(&stream.SendMessageRequest{
Channel: "general",
Text: "Hey checkout this tweet https://twitter.com/m3oservices/status/1455291054295498752",
})
fmt.Println(rsp, err)
}

View File

@@ -0,0 +1,13 @@
const { StreamService } = require("m3o/stream");
// SendMessage a message to the stream.
async function sendMessage() {
let streamService = new StreamService(process.env.MICRO_API_TOKEN);
let rsp = await streamService.sendMessage({
channel: "general",
text: "Hey checkout this tweet https://twitter.com/m3oservices/status/1455291054295498752",
});
console.log(rsp);
}
sendMessage();