Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2022-02-19 17:50:34 +00:00
parent 47b379f500
commit 21d9e25274
25 changed files with 1112 additions and 1112 deletions

View File

@@ -4,87 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/chat/api](http
Endpoints:
## Invite
Invite a user to a chat room
[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// Invite a user to a chat room
func InviteAuser() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Invite(&chat.InviteRequest{
})
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)
}
```
## 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)
}
```
## Delete
Delete a chat room
@@ -112,12 +31,12 @@ func DeleteAchat() {
}
```
## History
## Invite
List the messages in a chat
Invite a user to a chat room
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
[https://m3o.com/chat/api#Invite](https://m3o.com/chat/api#Invite)
```go
package example
@@ -129,14 +48,46 @@ import(
"go.m3o.com/chat"
)
// List the messages in a chat
func GetChatHistory() {
// Invite a user to a chat room
func InviteAuser() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.History(&chat.HistoryRequest{
rsp, err := chatService.Invite(&chat.InviteRequest{
})
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
@@ -179,12 +130,12 @@ func JoinAroom() {
}
}
```
## Leave
## Kick
Leave a chat room
Kick a user from a chat room
[https://m3o.com/chat/api#Leave](https://m3o.com/chat/api#Leave)
[https://m3o.com/chat/api#Kick](https://m3o.com/chat/api#Kick)
```go
package example
@@ -196,10 +147,10 @@ import(
"go.m3o.com/chat"
)
// Leave a chat room
func LeaveAroom() {
// Kick a user from a chat room
func KickAuserFromAroom() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.Leave(&chat.LeaveRequest{
rsp, err := chatService.Kick(&chat.KickRequest{
})
fmt.Println(rsp, err)
@@ -235,13 +186,12 @@ Name: "general",
}
```
## Send
## List
Connect to a chat to receive a stream of messages
Send a message to a chat
List available chats
[https://m3o.com/chat/api#Send](https://m3o.com/chat/api#Send)
[https://m3o.com/chat/api#List](https://m3o.com/chat/api#List)
```go
package example
@@ -253,15 +203,65 @@ import(
"go.m3o.com/chat"
)
// Connect to a chat to receive a stream of messages
// Send a message to a chat
func SendAmessage() {
// List available chats
func ListChatRooms() {
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.List(&chat.ListRequest{
})
fmt.Println(rsp, err)
}
```
## History
List the messages in a chat
[https://m3o.com/chat/api#History](https://m3o.com/chat/api#History)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/chat"
)
// List the messages in a chat
func GetChatHistory() {
chatService := chat.NewChatService(os.Getenv("M3O_API_TOKEN"))
rsp, err := chatService.History(&chat.HistoryRequest{
})
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)