Document Folder APIs and add local Visit 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 9068d8ba8e
commit fa2f2e5f2c
5 changed files with 75 additions and 4 deletions
+10 -4
View File
@@ -2,11 +2,11 @@
Shared Go library for Nextcloud ExApp Services: a User Files seam (local disk and WebDAV), Saved Default path storage, and Visit-scoped Working Folder resolution.
Import: `gitea.neitzel.de/konrad/go-nc-files`
Import: `gitea.neitzel.de/konrad/go-nc-files` (package `goncfiles`).
Depends on [go-nc-exapp](https://gitea.neitzel.de/konrad/go-nc-exapp) for AppAPI credentials on WebDAV.
## v1 scope
## Scope
**Included**
@@ -16,10 +16,10 @@ Depends on [go-nc-exapp](https://gitea.neitzel.de/konrad/go-nc-exapp) for AppAPI
- **CleanRel** — rejects `..`, URLs, and numeric file IDs
- **RequireBasename** — shared basename rules for child file names
- **DefaultPathStore** — `GetDefault` / `SetDefault` for Saved Default paths; `FileStore` (JSON) and `Memory` implementations
- **Visit** — `Open` resolves Working Folder from Saved Default (app-icon) or visit-only path (Files view); fail-closed on missing/forbidden visit paths
- **Visit** — `Open` / `OpenLocal` resolve Working Folder from Saved Default (app-icon) or visit-only path (Files view); fail-closed on missing/forbidden visit paths
- Sentinel errors: `ErrNotExist`, `ErrForbidden`, `ErrNotDir`
**Excluded from v1**
**Excluded**
- ExApp lifecycle HTTP routes and HaRP bootstrap (see **go-nc-exapp**)
- AppAPI preference OCS wiring (ExApp adapts `gonexapp.AppAPIPreferences` to `DefaultPathStore`)
@@ -47,10 +47,16 @@ visit, err := goncfiles.Open(root, store, "myapp", visitRelative)
Each ExApp chooses its Saved Default preference key and initial folder name; this library stays key-agnostic.
Runnable package examples: `go test -run Example`.
## Domain language
See [CONTEXT.md](./CONTEXT.md) for User Files Root, Working Folder, Saved Default, Visit, and Files seam terminology.
## Testing
Unit tests use a temporary local root (and httptest for WebDAV). No live Nextcloud is required for Library CI.
## Related
- **go-nc-exapp** — AppAPI credentials and OCS preferences