# go-nc-exapp Shared Go library for Nextcloud ExApp Services: AppAPI authentication, OCS JSON calls, and per-user ExApp preferences. Import: `gitea.neitzel.de/konrad/go-nc-exapp` ## v1 scope **Included** - **Credentials** — Nextcloud base URL, AppAPI secret, and requesting user identity - **AuthHeaders** — outbound AppAPI authorization for OCS and other Nextcloud calls - **WithUser** — credentials scoped to a specific requesting user - **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) **Excluded from v1** - ExApp lifecycle HTTP routes (`/heartbeat`, `/enabled`, …) - HaRP listen / `serve()` and unix-socket bootstrap - Top-menu, script, and iframe UI registration - WebDAV and file storage (see **go-nc-files**) - **Visit** folder resolution (see **go-nc-files**) ## Usage ```go cred := gonexapp.Credentials{ BaseURL: "https://nextcloud.example", AppID: "myexapp", AppVersion: "0.1.0", AAVersion: "1.0.0", AppSecret: os.Getenv("APP_SECRET"), UserID: "alice", } prefs := gonexapp.NewAppAPIPreferences(cred, "myexapp", "savedDefault") value, err := prefs.Get() ``` Each ExApp chooses its own preference keys; this library does not hardcode product-specific names. ## Domain language See [CONTEXT.md](./CONTEXT.md) for AppAPI credentials, requesting user, ExApp preference, and OCS terminology. ## Related - **go-nc-files** — WebDAV, Working Folder, Saved Default, Visit resolution - Workspace ADR 0013 — extraction from CheckDNS