modulepackage
0.5.0
Repository: https://github.com/ioki-mobility/go-outline.git
Documentation: pkg.go.dev
# README
go-outline
Go client and cli for outline.
Installation
Installing the client:
go get github.com/ioki-mobility/go-outline
Installing the CLI:
- Download pre-built binaries from releases page for your platform
- Install via go toolchain:
go install github.com/ioki-mobility/go-outline/cli@latest
Usage
Client
Create a client
cl := outline.New("https://server.url", &http.Client{}, "api key")
Note: You can create a new API key in your outline account settings.
Get a collection
col, err := cl.Collections().Get("collection id").Do(context.Background())
if err != nil {
panic(err)
}
fmt.Println(col)
Get all collections
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)
}
Create a collection
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())
Document Create
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())
CLI
Build the CLI
go build -o outline ./cli
Required flags
Any command requires the flags server
and key
.
You can simply add them with --server https://server.url
and --key sup3rS3cre7Ap1K3Y
.
Collections
The basic command to work with collections is:
outline collections
Collections fetch
To fetch a collection and display it in a json string use:
outline collections fetch [COLLECTION_ID] [flags]
Collections create
To create a collection and display the created collection as a json string use:
outline collections create [COLLECTION_NAME] [flags]
# Packages
No description provided by the author
# Functions
IsTemporary returns true if err is temporary in nature i.e.
New creates and returns a new (per server) client.
# Structs
No description provided by the author
AttachmentCreateClient is a client for creating a single attachment.
No description provided by the author
AttachmentsClient exposes CRUD operations around the attachments resource.
Client is per server top level client which acts as entry point and stores common configuration (like base url) for resource level clients.
Collection represents an outline collection.
CollectionsClient exposes CRUD operations around the collections resource.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Document represents an outline document.
DocumentsClient exposes CRUD operations around the documents resource.
DocumentsClientGet gets a single document.
DocumentsClientGetAll can be used to retrieve more than one document.
DocumentsCreateClient is a client for creating a single document.
DocumentSummary represents summary of a document (and its children) that is part of a collection.
DocumentsUpdateClient is a client for updating a single document.
# Type aliases
No description provided by the author
CollectionsListFn is the type of function called by [CollectionsListClient.Do] for every new collection it finds.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author