Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ioki-mobility/go-outline
The module provides Go client and cli for outline.
https://github.com/ioki-mobility/go-outline
Last synced: 13 days ago
JSON representation
The module provides Go client and cli for outline.
- Host: GitHub
- URL: https://github.com/ioki-mobility/go-outline
- Owner: ioki-mobility
- License: mit
- Created: 2023-06-23T12:11:25.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-28T03:39:02.000Z (6 months ago)
- Last Synced: 2024-06-28T04:42:57.855Z (6 months ago)
- Language: Go
- Homepage: https://ioki-mobility.github.io/go-outline/
- Size: 109 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Go Reference](https://pkg.go.dev/badge/github.com/ioki-mobility/go-outline.svg)](https://pkg.go.dev/github.com/ioki-mobility/go-outline)
[![Checks](https://github.com/ioki-mobility/go-outline/actions/workflows/checks.yml/badge.svg)](https://github.com/ioki-mobility/go-outline/actions/workflows/checks.yml)
[![MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/ioki-mobility/go-outline/blob/main/LICENSE)# go-outline
The module provides Go client and cli for [outline](https://www.getoutline.com/).# Go Client
The Go client provides easy to use API around [outline's official HTTP API](https://www.getoutline.com/developers).## Installation
```shell
go get github.com/ioki-mobility/go-outline
```
## Usage Examples
### Create a client
```go
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
```go
col, err := cl.Collections().Get("collection id").Do(context.Background())
if err != nil {
panic(err)
}
fmt.Println(col)
```### Get all collections
```go
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
```go
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:
```go
colCreateClient := cl.Collections().Create("collection name")
colCreateClient.
Description("desc").
PermissionRead(). // or PermissionReadWrite()
Color("#c0c0c0").
Private(true).
Do(context.Background())
```### Document Create
```go
doc := cl.Documents().Create("Document name", "collection id").Do(context.Background())
```There re also **optional** functions for the `DocumentsCreateClient` available:
```go
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
## Installation
- Download pre-built binaries from [releases](https://github.com/ioki-mobility/go-outline/releases) page
- Install via go toolchain:
```shell
go install github.com/ioki-mobility/go-outline/cmd/outcli@latest
```## Usage
Check the project website: https://ioki-mobility.github.io/go-outline/