Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-21 13:32:02 +00:00
parent 86d710f81e
commit d976129e73
26 changed files with 1218 additions and 1218 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http
Endpoints:
## New
## List
Create a new chat room
List available chats
[https://m3o.com/chat/api#New](https://m3o.com/chat/api#New)
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
```go
package example
@@ -21,12 +21,42 @@ import(
"go.m3o.com/chat"
)
// Create a new chat room
func CreateAnewChat() {
// List available chats
func ListChatRooms() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.New(&chat.NewRequest{
Description: "The general chat room",
Name: "general",
rsp, err := chatService.List(&chat.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Send
Connect to a chat to receive a stream of messages
Send a message to a chat
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// 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.Send(&chat.SendRequest{
Client: "web",
Subject: "Random",
Text: "Hey whats up?",
})
fmt.Println(rsp, err)
@@ -73,33 +103,6 @@ func JoinAroom() {
}
}
```
## Kick
Kick a user from a chat room
[https://m3o.com/chat/api#Kick](https://m3o.com/chat/api#Kick)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Kick a user from a chat room
func KickAuserFromAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Kick(&chat.KickRequest{
})
fmt.Println(rsp, err)
}
```
## History
List the messages in a chat
@@ -125,6 +128,33 @@ func GetChatHistory() {
})
fmt.Println(rsp, err)
}
```
## Kick
Kick a user from a chat room
[https://m3o.com/chat/api#Kick](https://m3o.com/chat/api#Kick)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Kick a user from a chat room
func KickAuserFromAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Kick(&chat.KickRequest{
})
fmt.Println(rsp, err)
}
```
## Leave
@@ -154,12 +184,12 @@ func LeaveAroom() {
}
```
## List
## New
List available chats
Create a new chat room
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
[https://m3o.com/chat/api#New](https://m3o.com/chat/api#New)
```go
package example
@@ -171,11 +201,13 @@ import(
"go.m3o.com/chat"
)
// List available chats
func ListChatRooms() {
// Create a new chat room
func CreateAnewChat() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.List(&chat.ListRequest{
rsp, err := chatService.New(&chat.NewRequest{
Description: "The general chat room",
Name: "general",
})
fmt.Println(rsp, err)
@@ -235,35 +267,3 @@ func InviteAuser() {
}
```
## Send
Connect to a chat to receive a stream of messages
Send a message to a chat
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// 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.Send(&chat.SendRequest{
Client: "web",
Subject: "Random",
Text: "Hey whats up?",
})
fmt.Println(rsp, err)
}
```