Commit from m3o/m3o action

This commit is contained in:
m3o-actions
2021-11-02 11:49:54 +00:00
parent 68b5269093
commit 47e7a6709f
16 changed files with 476 additions and 459 deletions

View File

@@ -4,34 +4,6 @@ An [m3o.com](https://m3o.com) API. For example usage see [m3o.com/Notes/api](htt
Endpoints:
## Create
Create a new note
[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Create a new note
func CreateAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Create(&notes.CreateRequest{
Text: "This is my note",
Title: "New Note",
})
fmt.Println(rsp, err)
}
```
## Read
Read a note
@@ -143,12 +115,12 @@ func DeleteAnote() {
fmt.Println(rsp, err)
}
```
## Subscribe
## Events
Specify the note to events
[https://m3o.com/notes/api#Subscribe](https://m3o.com/notes/api#Subscribe)
[https://m3o.com/notes/api#Events](https://m3o.com/notes/api#Events)
```go
package example
@@ -163,10 +135,38 @@ import(
// Specify the note to events
func SubscribeToEvents() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Subscribe(&notes.SubscribeRequest{
rsp, err := notesService.Events(&notes.EventsRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}
```
## Create
Create a new note
[https://m3o.com/notes/api#Create](https://m3o.com/notes/api#Create)
```go
package example
import(
"fmt"
"os"
"go.m3o.com/notes"
)
// Create a new note
func CreateAnote() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Create(&notes.CreateRequest{
Text: "This is my note",
Title: "New Note",
})
fmt.Println(rsp, err)
}
```

View File

@@ -0,0 +1,17 @@
package example
import (
"fmt"
"os"
"go.m3o.com/notes"
)
// Specify the note to events
func SubscribeToEvents() {
notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
rsp, err := notesService.Events(&notes.EventsRequest{
Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
})
fmt.Println(rsp, err)
}