import type { Transport, PageResult, ListParams } from '@23blocks/contracts'; import type { SearchResult, SearchQuery, LastQuery, FavoriteEntity, EntityType, SearchRequest, SearchResponse, AddFavoriteRequest } from '../types/index.js'; import type { SearchBlockConfig } from '../search.block.js'; /** * Search service interface */ export interface SearchService { /** * Execute a search query against the search index. * @param request - The search request containing query text, optional entity type filters, include/exclude lists, and pagination (limit/offset). * @returns A {@link SearchResponse} containing the matched results array, a synthesized {@link SearchQuery} with execution metadata (elapsed time, total records), and summary counts. * @note The returned `query` object is constructed from response metadata when available; otherwise it is synthesized client-side with default/null values. */ search(request: SearchRequest): Promise; /** * Get search suggestions/autocomplete results for a partial query. * @param query - The partial text to generate suggestions for. * @param limit - Maximum number of suggestions to return. Defaults to 10. * @returns An array of {@link SearchResult} items matching the suggestion query. */ suggest(query: string, limit?: number): Promise; /** * Get all available entity types that can be searched. * @returns An array of {@link EntityType} objects, each containing the type identifier and source. */ entityTypes(): Promise; } /** * Search history service interface */ export interface SearchHistoryService { /** * Get recent searches for the current user. * @param limit - Maximum number of recent queries to return. Defaults to 20. * @returns An array of {@link LastQuery} objects representing the user's recent search history, including query text, user context, and execution statistics. */ recent(limit?: number): Promise; /** * Get a specific saved query by its unique ID. * @param uniqueId - The unique identifier of the query to retrieve. * @returns The full {@link SearchQuery} record including query text, user context, execution timing, and result counts. */ get(uniqueId: string): Promise; /** * Clear all search history for the current user. * @returns Resolves with no value on successful deletion. * @note This deletes the entire search history; individual entries cannot be restored after clearing. */ clear(): Promise; /** * Delete a specific query from the search history. * @param uniqueId - The unique identifier of the history entry to delete. * @returns Resolves with no value on successful deletion. */ delete(uniqueId: string): Promise; } /** * Favorites service interface */ export interface FavoritesService { /** * List the current user's favorite entities with optional pagination, sorting, and filtering. * @param params - Optional {@link ListParams} for pagination, sorting, and filtering. * @returns A paginated result containing an array of {@link FavoriteEntity} items and pagination metadata. */ list(params?: ListParams): Promise>; /** * Get a single favorite by its unique ID. * @param uniqueId - The unique identifier of the favorite entry. * @returns The matching {@link FavoriteEntity}. */ get(uniqueId: string): Promise; /** * Add an entity to the user's favorites. * @param request - The favorite request containing the entity's unique ID, type, and optional alias/URL/avatar fields. * @returns The newly created {@link FavoriteEntity} as persisted by the backend. */ add(request: AddFavoriteRequest): Promise; /** * Remove a favorite by its unique ID. * @param uniqueId - The unique identifier of the favorite entry to remove. * @returns Resolves with no value on successful removal. */ remove(uniqueId: string): Promise; /** * Check whether a given entity is in the user's favorites. * @param entityUniqueId - The unique identifier of the entity to check. * @returns `true` if the entity is favorited, `false` otherwise. * @note Returns `false` on any error (e.g., network failure or 404), rather than throwing. */ isFavorite(entityUniqueId: string): Promise; } /** * Create the search service */ export declare function createSearchService(transport: Transport, _config: SearchBlockConfig): SearchService; /** * Create the search history service */ export declare function createSearchHistoryService(transport: Transport, _config: SearchBlockConfig): SearchHistoryService; /** * Create the favorites service */ export declare function createFavoritesService(transport: Transport, _config: SearchBlockConfig): FavoritesService; //# sourceMappingURL=search.service.d.ts.map