notes/

directory
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2022 License: Apache-2.0

README

Notes

An m3o.com API. For example usage see m3o.com/notes/api.

Endpoints:

List

List all the notes

https://m3o.com/notes/api#List

package example

import(
	"fmt"
	"os"

	"go.m3o.com/notes"
)

// List all the notes
func ListAllNotes() {
	notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := notesService.List(&notes.ListRequest{
		
	})
	fmt.Println(rsp, err)
	
}

Update

Update a note

https://m3o.com/notes/api#Update

package example

import(
	"fmt"
	"os"

	"go.m3o.com/notes"
)

// Update a note
func UpdateAnote() {
	notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := notesService.Update(&notes.UpdateRequest{
		Note: &notes.Note{
		Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",
	Text: "Updated note text",
	Title: "Update Note",
	},

	})
	fmt.Println(rsp, err)
	
}

Delete

Delete a note

https://m3o.com/notes/api#Delete

package example

import(
	"fmt"
	"os"

	"go.m3o.com/notes"
)

// Delete a note
func DeleteAnote() {
	notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := notesService.Delete(&notes.DeleteRequest{
		Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",

	})
	fmt.Println(rsp, err)
	
}

Events

Subscribe to notes events

https://m3o.com/notes/api#Events

package example

import(
	"fmt"
	"os"

	"go.m3o.com/notes"
)

// Subscribe to notes events
func SubscribeToEvents() {
	notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
	
	stream, err := notesService.Events(&notes.EventsRequest{
		Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",

	})
	if err != nil {
		fmt.Println(err)
		return
	}

	for {
			rsp, err := stream.Recv()
			if err != nil {
					fmt.Println(err)
					return
			}

			fmt.Println(rsp)
	}
}

Create

Create a new note

https://m3o.com/notes/api#Create

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

https://m3o.com/notes/api#Read

package example

import(
	"fmt"
	"os"

	"go.m3o.com/notes"
)

// Read a note
func ReadAnote() {
	notesService := notes.NewNotesService(os.Getenv("M3O_API_TOKEN"))
	rsp, err := notesService.Read(&notes.ReadRequest{
		Id: "63c0cdf8-2121-11ec-a881-0242e36f037a",

	})
	fmt.Println(rsp, err)
	
}

Directories

Path Synopsis
createANote command
deleteANote command
listAllNotes command
readANote command
updateANote command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL