Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-11-02 14:08:34 +00:00
parent c5f35e9f42
commit abbc8bcd49
15 changed files with 626 additions and 626 deletions

View File

@@ -4,38 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Event/api](htt
Endpoints:
## Publish
Publish a message to the event. Specify a topic to group messages for a specific topic.
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Publish a message to the event. Specify a topic to group messages for a specific topic.
func PublishAmessage() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"type": "signup",
"user": "john",
"id": "1",
},
Topic: "user",
})
fmt.Println(rsp, err)
}
```
## Subscribe
Subscribe to messages for a given topic.
@@ -63,3 +31,35 @@ func SubscribeToAtopic() {
fmt.Println(rsp, err)
}
```
## Publish
Publish a message to the event. Specify a topic to group messages for a specific topic.
[https://m3o.com/event/api#Publish](https://m3o.com/event/api#Publish)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/event"
)
// Publish a message to the event. Specify a topic to group messages for a specific topic.
func PublishAmessage() {
eventService := event.NewEventService(os.Getenv("M3O_API_TOKEN"))
rsp, err := eventService.Publish(&event.PublishRequest{
Message: map[string]interface{}{
"id": "1",
"type": "signup",
"user": "john",
},
Topic: "user",
})
fmt.Println(rsp, err)
}
```