Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-21 12:04:55 +00:00
parent 6c61a79774
commit cf4338a959
25 changed files with 1227 additions and 1227 deletions

View File

@@ -4,13 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http
Endpoints:
## Send
## New
Connect to a chat to receive a stream of messages
Send a message to a chat
Create a new chat room
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
[https://m3o.com/chat/api#New](https://m3o.com/chat/api#New)
```go
package example
@@ -22,18 +21,43 @@ import(
"go.m3o.com/chat"
)
// Connect to a chat to receive a stream of messages
// Send a message to a chat
func SendAmessage() {
// Create a new chat room
func CreateAnewChat() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Send(&chat.SendRequest{
Client: "web",
Subject: "Random",
Text: "Hey whats up?",
rsp, err := chatService.New(&chat.NewRequest{
Description: "The general chat room",
Name: "general",
})
fmt.Println(rsp, err)
}
```
## History
List the messages in a chat
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// List the messages in a chat
func GetChatHistory() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.History(&chat.HistoryRequest{
})
fmt.Println(rsp, err)
}
```
## Join
@@ -76,33 +100,6 @@ func JoinAroom() {
}
}
```
## Leave
Leave a chat room
[https://m3o.com/chat/api#Leave](https://m3o.com/chat/api#Leave)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Leave a chat room
func LeaveAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Leave(&chat.LeaveRequest{
})
fmt.Println(rsp, err)
}
```
## Kick
Kick a user from a chat room
@@ -130,12 +127,12 @@ func KickAuserFromAroom() {
}
```
## New
## Leave
Create a new chat room
Leave a chat room
[https://m3o.com/chat/api#New](https://m3o.com/chat/api#New)
[https://m3o.com/chat/api#Leave](https://m3o.com/chat/api#Leave)
```go
package example
@@ -147,13 +144,11 @@ import(
"go.m3o.com/chat"
)
// Create a new chat room
func CreateAnewChat() {
// Leave a chat room
func LeaveAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.New(&chat.NewRequest{
Description: "The general chat room",
Name: "general",
rsp, err := chatService.Leave(&chat.LeaveRequest{
})
fmt.Println(rsp, err)
@@ -240,12 +235,13 @@ func InviteAuser() {
}
```
## History
## Send
List the messages in a chat
Connect to a chat to receive a stream of messages
Send a message to a chat
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
```go
package example
@@ -257,11 +253,15 @@ import(
"go.m3o.com/chat"
)
// List the messages in a chat
func GetChatHistory() {
// Connect to a chat to receive a stream of messages
// Send a message to a chat
func SendAmessage() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.History(&chat.HistoryRequest{
rsp, err := chatService.Send(&chat.SendRequest{
Client: "web",
Subject: "Random",
Text: "Hey whats up?",
})
fmt.Println(rsp, err)