Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-21 12:15:24 +00:00
parent c737c0dd9f
commit 92317e7690
23 changed files with 1165 additions and 1165 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,25 +21,22 @@ 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
## Invite
Connect to a chat to receive a stream of messages
Send a message to a chat
Invite a user to a chat room
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite)
```go
package example
@@ -51,15 +48,11 @@ import(
"go.m3o.com/chat"
)
// Connect to a chat to receive a stream of messages
// Send a message to a chat
func SendAmessage() {
// Invite a user to a chat room
func InviteAuser() {
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.Invite(&chat.InviteRequest{
})
fmt.Println(rsp, err)
@@ -92,12 +85,12 @@ func KickAuserFromAroom() {
}
```
## List
## Leave
List available chats
Leave a chat room
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
[https://m3o.com/chat/api#Leave](https://m3o.com/chat/api#Leave)
```go
package example
@@ -109,14 +102,43 @@ import(
"go.m3o.com/chat"
)
// List available chats
func ListChatRooms() {
// Leave a chat room
func LeaveAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.List(&chat.ListRequest{
rsp, err := chatService.Leave(&chat.LeaveRequest{
})
fmt.Println(rsp, err)
}
```
## New
Create a new chat room
[https://m3o.com/chat/api#New](https://m3o.com/chat/api#New)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Create a new chat room
func CreateAnewChat() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.New(&chat.NewRequest{
Description: "The general chat room",
Name: "general",
})
fmt.Println(rsp, err)
}
```
## Delete
@@ -146,12 +168,13 @@ func DeleteAchat() {
}
```
## Invite
## Send
Invite a user to a chat room
Connect to a chat to receive a stream of messages
Send a message to a chat
[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite)
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
```go
package example
@@ -163,11 +186,15 @@ import(
"go.m3o.com/chat"
)
// Invite a user to a chat room
func InviteAuser() {
// 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.Invite(&chat.InviteRequest{
rsp, err := chatService.Send(&chat.SendRequest{
Client: "web",
Subject: "Random",
Text: "Hey whats up?",
})
fmt.Println(rsp, err)
@@ -240,30 +267,3 @@ 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)
}
```