glossary.ts (API Client)

glossary.ts (API Client)

Module: Glossary Frontend
Path: src/lib/api/glossary.ts

[!NOTE] HTTP client module providing typed methods for all 6 glossary API endpoints. Uses the shared apiClient from ./client and unwraps APIResponse wrappers.

Exports

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.

Key Methods

listEntries(projectSlug: string, params?: ListGlossaryEntriesParams): Promise<ListGlossaryEntriesResponse>

getEntry(projectSlug: string, entryId: string): Promise<GlossaryEntry>

createEntry(projectSlug: string, input: CreateGlossaryEntryInput): Promise<GlossaryEntry>

updateEntry(projectSlug: string, entryId: string, input: UpdateGlossaryEntryInput): Promise<GlossaryEntry>

deleteEntry(projectSlug: string, entryId: string): Promise<void>

getOccurrences(projectSlug: string, entryId: string): Promise<TermOccurrencesResponse>

Imports / Dependencies

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

Side Effects

Connected Pages
glossary.ts (API Client)
glossary.ts (API Client)
  • Exports
  • Key Methods listEntries(projectSlug: string, params?: ListGlossaryEntriesParams): Promise getEntry(projectSlug: string, entryId: string): Promise createEntry(projectSlug: string, input: CreateGlossaryEntryInput): Promise updateEntry(projectSlug: string, entryId: string, input: UpdateGlossaryEntryInput): Promise deleteEntry(projectSlug: string, entryId: string): Promise getOccurrences(projectSlug: string, entryId: string): Promise
  • Imports / Dependencies
  • Side Effects