Select a result to preview
glossary.ts (API Client)Module: Glossary Frontend
Path: src/lib/api/glossary.ts
./client and unwraps APIResponse wrappers.
| Name | Kind | Description |
|---|---|---|
listEntries |
function | GET list with filter params |
getEntry |
function | GET single entry by ID |
createEntry |
function | POST new entry |
updateEntry |
function | PUT partial update |
deleteEntry |
function | DELETE entry |
getOccurrences |
function | GET term occurrences in content |
All six functions are grouped under a single named export glossaryApi object, matching the contentApi and searchApi patterns used elsewhere.
The module also re-exports the following types from $lib/types/glossary for consumer convenience: GlossaryEntry, GlossaryTermStatus, TermScope, SpoilerLevel, GlossaryCategory, PartOfSpeech, GlossarySortBy, SortOrder, CreateGlossaryEntryInput, UpdateGlossaryEntryInput, ListGlossaryEntriesResponse, ListGlossaryEntriesParams, TermOccurrence, TermOccurrencesResponse.
listEntries(projectSlug: string, params?: ListGlossaryEntriesParams): Promise<ListGlossaryEntriesResponse>/api/projects/{slug}/glossarylimit, offset, search, tags (joined with commas), category, status, sortBy, sortOrder{ entries: GlossaryEntry[], total: number, limit: number, offset: number }URLSearchParams from non-undefined param values and appends as query string.getEntry(projectSlug: string, entryId: string): Promise<GlossaryEntry>/api/projects/{slug}/glossary/{id}GlossaryEntry object.success: false.createEntry(projectSlug: string, input: CreateGlossaryEntryInput): Promise<GlossaryEntry>/api/projects/{slug}/glossaryterm, shortDefinition + optional fields (longDefinition, tags, category, status, partOfSpeech, aliases, scope, spoilerLevel, autoMark, enableTooltip, enableHyperlink)GlossaryEntry.updateEntry(projectSlug: string, entryId: string, input: UpdateGlossaryEntryInput): Promise<GlossaryEntry>/api/projects/{slug}/glossary/{id}GlossaryEntry.deleteEntry(projectSlug: string, entryId: string): Promise<void>/api/projects/{slug}/glossary/{id}204 No Content on success.getOccurrences(projectSlug: string, entryId: string): Promise<TermOccurrencesResponse>/api/projects/{slug}/glossary/{id}/occurrencesTermOccurrencesResponse with matching content documents found via FTS5 search.| Import | Source | Purpose |
|---|---|---|
apiClient |
./client |
Shared HTTP client with base URL and error handling |
APIResponse<T> |
$lib/types/project |
Response wrapper type used to unwrap success / data / error |
GlossaryEntry |
$lib/types/glossary |
TypeScript interface for a glossary entry |
CreateGlossaryEntryInput |
$lib/types/glossary |
Input type for creating entries |
UpdateGlossaryEntryInput |
$lib/types/glossary |
Input type for updating entries (all fields optional) |
ListGlossaryEntriesResponse |
$lib/types/glossary |
Paginated list response type |
ListGlossaryEntriesParams |
$lib/types/glossary |
Query parameter type for list filtering |
TermOccurrencesResponse |
$lib/types/glossary |
Response type for term occurrence search |
deleteEntry which calls apiClient.delete directly without unwrapping.