Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-22 08:29:01 +00:00
parent ad465bab1b
commit 4f9eefd72c
28 changed files with 1639 additions and 1639 deletions

View File

@@ -4,12 +4,12 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http
Endpoints:
## 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
@@ -21,11 +21,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)
@@ -56,38 +58,6 @@ func GetChatHistory() {
})
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)
}
```
## Join
@@ -130,33 +100,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)
}
```
## Leave
Leave a chat room
@@ -184,12 +127,12 @@ func LeaveAroom() {
}
```
## New
## Kick
Create a new chat room
Kick a user from a chat room
[https://m3o.com/chat/api#New](https://m3o.com/chat/api#New)
[https://m3o.com/chat/api#Kick](https://m3o.com/chat/api#Kick)
```go
package example
@@ -201,13 +144,38 @@ import(
"go.m3o.com/chat"
)
// Create a new chat room
func CreateAnewChat() {
// Kick a user from a chat room
func KickAuserFromAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.New(&chat.NewRequest{
Description: "The general chat room",
Name: "general",
rsp, err := chatService.Kick(&chat.KickRequest{
})
fmt.Println(rsp, err)
}
```
## List
List available chats
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// List available chats
func ListChatRooms() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.List(&chat.ListRequest{
})
fmt.Println(rsp, err)
@@ -267,3 +235,35 @@ 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)
}
```