mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-13 19:45:26 +00:00
Commit from GitHub Actions (Generate Clients & Examples)
This commit is contained in:
7
examples/stream/createChannel/curl/createChannel.sh
Executable file
7
examples/stream/createChannel/curl/createChannel.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
curl "https://api.m3o.com/v1/stream/CreateChannel" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||
-d '{
|
||||
"description": "The channel for all things",
|
||||
"name": "general"
|
||||
}'
|
||||
19
examples/stream/createChannel/go/createChannel.go
Executable file
19
examples/stream/createChannel/go/createChannel.go
Executable file
@@ -0,0 +1,19 @@
|
||||
package example
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/micro/services/clients/go/stream"
|
||||
)
|
||||
|
||||
// Create a channel with a given name and description. Channels are created automatically but
|
||||
// this allows you to specify a description that's persisted for the lifetime of the channel.
|
||||
func CreateChannel() {
|
||||
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
||||
rsp, err := streamService.CreateChannel(&stream.CreateChannelRequest{
|
||||
Description: "The channel for all things",
|
||||
Name: "general",
|
||||
})
|
||||
fmt.Println(rsp, err)
|
||||
}
|
||||
14
examples/stream/createChannel/node/createChannel.js
Executable file
14
examples/stream/createChannel/node/createChannel.js
Executable file
@@ -0,0 +1,14 @@
|
||||
const { StreamService } = require("m3o/stream");
|
||||
|
||||
// Create a channel with a given name and description. Channels are created automatically but
|
||||
// this allows you to specify a description that's persisted for the lifetime of the channel.
|
||||
async function createChannel() {
|
||||
let streamService = new StreamService(process.env.MICRO_API_TOKEN);
|
||||
let rsp = await streamService.createChannel({
|
||||
description: "The channel for all things",
|
||||
name: "general",
|
||||
});
|
||||
console.log(rsp);
|
||||
}
|
||||
|
||||
createChannel();
|
||||
Reference in New Issue
Block a user