Two endpoints designed for the hover-then-Ctrl+J SumatraPDF flow (the LLM parser is expensive; we don't want to pay twice for "is it already in the library?" and "add it"):
POST /libraries/{id}/citations/lookup — parse plain citation text,
run DuplicateCheck against the active library, stash the parsed
BibEntry in CitationCacheService, return matches plus the cache
token.
POST /libraries/{id}/citations/{parserCacheKey} — look up the cached
parsed entry by token, append it to the current library, evict the
token. Returns 410 Gone when the token expired so the client can fall
back to POST /libraries/current/entries and pay for the parse again.
| Modifier and Type | Class and Description |
|---|---|
| public static record | |
| public static record | CitationsResource.
Wrapper for the batched lookup payload. |
| public static record | CitationsResource.
Aligned-by-index with the request: |
| public static record | |
| public static record | CitationsResource.
Result of a single plain-citation lookup. |
| public static enum | CitationsResource.
Categorisation of a |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv CitationCacheService | |
| pack-priv BibEntryTypesManager | |
| pack-priv CliPreferences | |
| pack-priv SrvStateManager | |
| pack-priv UiMessageHandler |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Response | |
| private Response | alreadyExistsResponse(String parserCacheKey, BibEntry existingEntry)
Returns a 200 OK |
| private Response | |
| private CitationsResource. | doLookup(String citationText, BibDatabaseContext targetContext, List<BibDatabaseContext> openDatabases, DuplicateCheck duplicateCheck)
Shared body of single + batched lookup. |
| private static String | |
| public CitationsResource. | |
| public CitationsResource. | lookupBatch(String id, CitationsResource.
Batched variant of |
| private BibEntry | parseAndCache(String citationText)
Cache miss → invoke the configured plain-citation parser and stash the result by text-hash. |
| private BibDatabaseContext | resolveTargetContext(String id)
Resolves the path-segment library id to the library this request operates on. |
| private Optional | targetLibrary(String id)
The append target for the resolved library: empty for "current" (append to the active tab without switching), otherwise the open library's on-disk path so the GUI switches to it first. |