/** * Parser for RIS API responses. * * This module provides functions to parse raw API responses into * structured Document and SearchResult models. */ import type { ContentUrl, Document, NormalizedSearchResults, RawContentReference, RawDocumentReference, SearchResult } from './types.js'; /** * Extract text from various API response formats. * Handles strings, objects with #text, and objects with item. */ export declare function extractText(elem: unknown): string | null; /** * Extract content URLs from raw content reference. */ export declare function extractContentUrls(contentRef: RawContentReference | undefined): ContentUrl; /** * Parse a document reference from the API response into a Document model. */ export declare function parseDocumentFromApiResponse(docRef: RawDocumentReference): Document; /** * Result type for finding a document by dokumentnummer. */ export type FindDocumentResult = { success: true; document: Document; } | { success: false; error: 'no_documents' | 'not_found'; totalResults?: number; }; /** * Find a document by dokumentnummer from a list of raw API document references. * * This function parses all documents and finds the one matching the requested * dokumentnummer rather than blindly taking the first result (which may not * be the correct document when the API returns multiple results). * * @param rawDocuments - Raw document references from the API response * @param dokumentnummer - The document number to find * @returns Result object indicating success with the document, or failure with error type */ export declare function findDocumentByDokumentnummer(rawDocuments: RawDocumentReference[], dokumentnummer: string): FindDocumentResult; /** * Parse API response into a SearchResult model. */ export declare function parseSearchResults(apiResponse: NormalizedSearchResults): SearchResult; //# sourceMappingURL=parser.d.ts.map