Change summary
README.md | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
Detailed changes
@@ -0,0 +1,107 @@
+<!--
+SPDX-FileCopyrightText: Amolith <amolith@secluded.site>
+
+SPDX-License-Identifier: CC0-1.0
+-->
+
+# go-lunatask
+
+[](https://godocs.io/git.secluded.site/go-lunatask)
+[](https://goreportcard.com/report/git.secluded.site/go-lunatask)
+[](https://api.reuse.software/info/git.secluded.site/go-lunatask)
+[](https://liberapay.com/Amolith/)
+
+Go client library for [Lunatask]'s [public API].
+
+[Lunatask]: https://lunatask.app
+[public API]: https://lunatask.app/api
+
+## Usage
+
+Generate an access token in the Lunatask desktop app under `Settings` →
+`Access tokens`.
+
+```sh
+go get git.secluded.site/go-lunatask@latest
+```
+
+```go
+package main
+
+import (
+ "context"
+ "log"
+ "os"
+
+ "git.secluded.site/go-lunatask"
+)
+
+func main() {
+ client := lunatask.NewClient(os.Getenv("LUNATASK_TOKEN"))
+
+ // Verify credentials
+ if _, err := client.Ping(context.Background()); err != nil {
+ log.Fatal(err)
+ }
+
+ // Create a task
+ task, err := client.CreateTask(context.Background(), &lunatask.CreateTaskRequest{
+ Name: "Review pull requests",
+ })
+ 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.
+
+```go
+task, err := client.CreateTask(ctx, req)
+if err != nil {
+ return err // actual error
+}
+if task == nil {
+ // duplicate exists, not created
+}
+```
+
+## Contributions
+
+Patch requests are in [amolith/go-lunatask] on [pr.pico.sh]. You don't
+need a new account to contribute, you don't need to fork this repo, you
+don't need to fiddle with `git send-email`, you don't need to faff with
+your email client to get `git request-pull` working...
+
+You just need:
+
+- Git
+- SSH
+- An SSH key
+
+```sh
+# Clone this repo, make your changes, and commit them
+# Create a new patch request with
+git format-patch origin/main --stdout | ssh pr.pico.sh pr create amolith/go-lunatask
+# After potential feedback, submit a revision to an existing patch request with
+git format-patch origin/main --stdout | ssh pr.pico.sh pr add {prID}
+# List patch requests
+ssh pr.pico.sh pr ls amolith/go-lunatask
+```
+
+See "How do Patch Requests work?" on [pr.pico.sh]'s home page for a more
+complete example workflow.
+
+[amolith/go-lunatask]: https://pr.pico.sh/r/amolith/go-lunatask
+[pr.pico.sh]: https://pr.pico.sh
+
+## License
+
+AGPL-3.0-or-later