Go client library for Lunatask.app
1

Configure Feed

Select the types of activity you want to include in your feed.

Go 99.9%
Other 0.1%
49 1 15

Clone this repository

https://tangled.org/secluded.site/go-lunatask https://tangled.org/did:plc:oamkmi7wiyyyipa5wxkejysp
git@knot.secluded.site:secluded.site/go-lunatask git@knot.secluded.site:did:plc:oamkmi7wiyyyipa5wxkejysp

For self-hosted knots, clone URLs may differ based on your setup.


README.md

go-lunatask#

Go module documentation AGPL-3.0-or-later license Test coverage REUSE status Liberapay donation status

Open an issue on Tangled Open a pull request on Tangled

Go client library for Lunatask's public API.

lune, a CLI and MCP server for Lunatask, is this library's primary consumer.

Usage#

Generate an access token in the Lunatask desktop app under SettingsAccess tokens.

go get secluded.site/go-lunatask@latest

See the module documentation on godocs.io or pkg.go.dev for more detail.

package main

import (
	"context"
	"log"
	"os"

	"secluded.site/go-lunatask"
)

func main() {
	client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"), lunatask.UserAgent("MyApp/1.0"))

	// Verify credentials
	if _, err := client.Ping(context.Background()); err != nil {
		log.Fatal(err)
	}

	// Create a task
	task, err := client.NewTask("Review pull requests").Create(context.Background())
	if err != nil {
		log.Fatal(err)
	}
	if task == nil {
		log.Println("Task already exists")
	}
}

A note on duplicate handling#

Create methods return (nil, nil) when a matching entity already exists. This is intentional API behavior on Lunatask's part because of its end-to-end encryption.

task, err := client.NewTask("Review PR").Create(ctx)
if err != nil {
    return err // actual error
}
if task == nil {
    // duplicate exists, not created
}

Contributions#

You can open an issue or pull request on Tangled.

License#

AGPL-3.0-or-later