commit 31062b441c7ce38e6ce2772e92dc1ec83282e6fe from: Oliver Lowe date: Sat Jul 08 09:05:51 2023 UTC start documentation! commit - 00b2414c42245d4e97f287b3e6b1e889cb3c6dee commit + 31062b441c7ce38e6ce2772e92dc1ec83282e6fe blob - /dev/null blob + 4d52fe197fd39e372653989c5ec216724f3a3a63 (mode 644) --- /dev/null +++ README.md @@ -0,0 +1,16 @@ +[![godocs.io](http://godocs.io/olowe.co/icinga?status.svg)](http://godocs.io/olowe.co/icinga) + +Package lemmy provides a client interface to a subset of the Lemmy HTTP API version 3. + + go get olowe.co/lemmy + +## Development + +Please send patches, questions or a friendly "hello" to the [mailing list]: + + git send-email --to="~otl/public-inbox@lists.sr.ht" HEAD^ + +For those unfamiliar with this workflow, see [git-send-email.io] + +[mailing list]: https://lists.sr.ht/~otl/public-inbox +[git-send-email.io]: https://git-send-email.io blob - 69f23ac4f8278328ed70ee4d0074f744c9ba5a61 blob + 27a30aa6d4197d6488e180e6605d6f569200b5ae --- fs.go +++ fs.go @@ -11,10 +11,46 @@ import ( "strings" "time" ) + +/* +FS is a read-only filesystem interface to a Lemmy instance. +The root of the filesystem holds directories for each community known to the filesystem. +Local communities are named by their plain name verbatim. +Remote communities have the instance address as a suffix. For example: + + golang/ + plan9@lemmy.sdf.org/ + openbsd@lemmy.sdf.org/ + +Each community directory holds posts. +Each post has associated a directory numbered by its ID. +Within each post are the following entries: + + body Text describing, or accompanying, the post. + creator The numeric user ID of the post's author. + title The post's title. + url A URL pointing to a picture or website, usually as the + subject of the post if present. + comments Directory holding user-generated discussion. + Described in more detail below. + +The comments directory consists of one numbered directory per comment, +numbered by its unique comment ID. +Each of these directories contains the following entries: + + content The text body. + creator User ID of the comment's author. + references A list of comment IDs referenced by this comment, one + per line. The first line is the immediately referenced + comment (the parent); the second is the grandparent and + so on. This can be used by readers to render discussion + threads. +FS satisfies io/fs.FS. +*/ type FS struct { Client *Client - // Communities holds a cache of communities to + // Communities holds a cache of communities. Communities map[string]Community root *node baseURL string blob - 1cb2340215e23ee9502bd8a1c4fb1c869f507c06 blob + ff18fba3be4189956d8901b3a968fcdee9b4c39d --- lemmy.go +++ lemmy.go @@ -1,3 +1,4 @@ +// Package lemmy provides a client interface to the Lemmy HTTP API version 3. package lemmy import (