The module provides Go client and cli for outline.
The Go client provides easy to use API around outline's official HTTP API.
go get github.com/ioki-mobility/go-outline
cl := outline.New("https://server.url", &http.Client{}, "api key")
Note: You can create a new API key in your outline account settings.
col, err := cl.Collections().Get("collection id").Do(context.Background())
if err != nil {
panic(err)
}
fmt.Println(col)
err := cl.Collections().List().Do(context.Background(), func(col *outline.Collection, err error) (bool, error) {
fmt.Println(col)
return true, nil
})
if err != nil {
panic(err)
}
col, err := cl.Collections().Create("collection name").Do(context.Background())
if err != nil {
panic(err)
}
fmt.Println(col)
There are also optional functions for the CollectionsCreateClient
available:
colCreateClient := cl.Collections().Create("collection name")
colCreateClient.
Description("desc").
PermissionRead(). // or PermissionReadWrite()
Color("#c0c0c0").
Private(true).
Do(context.Background())
doc := cl.Documents().Create("Document name", "collection id").Do(context.Background())
There re also optional functions for the DocumentsCreateClient
available:
docCreateClient := cl.Documents().Create("Document name")
docCreateClient.
Publish(true).
Text("text").
ParentDocumentID(DocumentId("parent document id")).
TemplateID(TemplateId("templateId")).
Template(false).
Do(context.Background())
- Download pre-built binaries from releases page
- Install via go toolchain:
go install github.com/ioki-mobility/go-outline/cmd/outcli@latest
Check the project website: https://ioki-mobility.github.io/go-outline/