Document consumer README skeleton and add package Examples.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Konrad Neitzel
2026-08-27 22:00:02 +02:00
co-authored by Cursor
parent 69af4d19c8
commit cf3b396398
3 changed files with 102 additions and 3 deletions
+9 -3
View File
@@ -1,8 +1,8 @@
# go-nc-exapp
Shared Go library for Nextcloud ExApp Services: AppAPI authentication, OCS JSON calls, per-user ExApp preferences, and optional Required Groups Access Gate.
Shared Go library for Nextcloud ExApp Services: AppAPI authentication, OCS JSON calls, per-user ExApp preferences, and an optional Required Groups Access Gate.
Import: `gitea.neitzel.de/konrad/go-nc-exapp`
Import: `gitea.neitzel.de/konrad/go-nc-exapp` (package `gonexapp`).
## Scope
@@ -14,7 +14,7 @@ Import: `gitea.neitzel.de/konrad/go-nc-exapp`
- **UserFromRequest** — extract the requesting user from inbound AppAPI-proxied requests
- **OCSClient** — authenticated OCS calls that always append `format=json`
- **AppAPIPreferences** — parameterized get/set of a string ExApp preference (caller supplies app id and key)
- **Access Gate** — optional Required Groups enforcement (`Wrap` + `Check`), English denied HTML, positive membership cache; env helpers for `REQUIRED_GROUPS` / `REQUIRED_GROUPS_CACHE_SECONDS`
- **Access Gate** — optional Required Groups enforcement (`Wrap` + `Check`), English denied HTML for browsers, positive membership cache; env helpers for `REQUIRED_GROUPS` / `REQUIRED_GROUPS_CACHE_SECONDS`
**Excluded**
@@ -49,10 +49,16 @@ Each ExApp chooses its own preference keys; this library does not hardcode produ
Declare `REQUIRED_GROUPS` and `REQUIRED_GROUPS_CACHE_SECONDS` in the ExApp `info.xml` so Deploy options can set them.
Runnable package examples: `go test -run Example`.
## Domain language
See [CONTEXT.md](./CONTEXT.md) for AppAPI credentials, Requesting user, ExApp preference, OCS, Required Groups, and Access Gate terminology.
## Testing
Unit tests use `httptest` fake OCS servers. No live Nextcloud is required for Library CI.
## Related
- **go-nc-files** — WebDAV, Working Folder, Saved Default, Visit resolution