Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-21 12:11:52 +00:00
parent cf4338a959
commit c737c0dd9f
27 changed files with 1274 additions and 1274 deletions

View File

@@ -33,12 +33,13 @@ Name: "general",
}
```
## 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
@@ -50,56 +51,20 @@ 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)
}
```
## Join
Join a chat room
[https://m3o.com/chat/api#Join](https://m3o.com/chat/api#Join)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Join a chat room
func JoinAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
stream, err := chatService.Join(&chat.JoinRequest{
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}
```
## Kick
Kick a user from a chat room
@@ -125,33 +90,6 @@ func KickAuserFromAroom() {
})
fmt.Println(rsp, err)
}
```
## 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)
}
```
## List
@@ -235,13 +173,12 @@ func InviteAuser() {
}
```
## Send
## History
Connect to a chat to receive a stream of messages
Send a message to a chat
List the messages in a chat
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
```go
package example
@@ -253,15 +190,78 @@ import(
"go.m3o.com/chat"
)
// Connect to a chat to receive a stream of messages
// Send a message to a chat
func SendAmessage() {
// List the messages in a chat
func GetChatHistory() {
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.History(&chat.HistoryRequest{
})
fmt.Println(rsp, err)
}
```
## Join
Join a chat room
[https://m3o.com/chat/api#Join](https://m3o.com/chat/api#Join)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Join a chat room
func JoinAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
stream, err := chatService.Join(&chat.JoinRequest{
})
if err != nil {
fmt.Println(err)
return
}
for {
rsp, err := stream.Recv()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(rsp)
}
}
```
## 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)