Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-03-03 14:24:45 +00:00
parent e8facfabd7
commit 544f3d2941
33 changed files with 1428 additions and 1422 deletions

View File

@@ -4,12 +4,13 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http
Endpoints:
## Delete
## Send
Delete a chat room
Connect to a chat to receive a stream of messages
Send a message to a chat
[https://m3o.com/chat/api#Delete](https://m3o.com/chat/api#Delete)
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
```go
package example
@@ -21,11 +22,15 @@ import(
"go.m3o.com/chat"
)
// Delete a chat room
func DeleteAchat() {
// 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.Delete(&chat.DeleteRequest{
rsp, err := chatService.Send(&chat.SendRequest{
Client: "web",
Subject: "Random",
Text: "Hey whats up?",
})
fmt.Println(rsp, err)
@@ -85,12 +90,12 @@ func LeaveAroom() {
}
```
## List
## Create
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#Create](https://m3o.com/chat/api#Create)
```go
package example
@@ -102,11 +107,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.Create(&chat.CreateRequest{
Description: "The general chat room",
Name: "general",
})
fmt.Println(rsp, err)
@@ -137,38 +144,6 @@ func InviteAuser() {
})
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)
}
```
## History
@@ -238,12 +213,12 @@ func JoinAroom() {
}
}
```
## Create
## List
Create a new chat room
List available chats
[https://m3o.com/chat/api#Create](https://m3o.com/chat/api#Create)
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
```go
package example
@@ -255,13 +230,38 @@ 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.Create(&chat.CreateRequest{
Description: "The general chat room",
Name: "general",
rsp, err := chatService.List(&chat.ListRequest{
})
fmt.Println(rsp, err)
}
```
## Delete
Delete a chat room
[https://m3o.com/chat/api#Delete](https://m3o.com/chat/api#Delete)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Delete a chat room
func DeleteAchat() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Delete(&chat.DeleteRequest{
})
fmt.Println(rsp, err)