UNPKG

@goteborgco/open-api-js-client

Version:

Official JavaScript client for the Göteborg & Co GraphQL API

29 lines (28 loc) 1.28 kB
import { Client } from '../client/Client'; import type { SearchFilter, SortOptions } from '../interfaces/common'; import { WpEntity as WpEntityClass } from '../entities/WpEntity'; /** * Search API for searching content across all types * * This class provides type-safe methods for searching content from the GraphQL API. * Search results include content from places, events, guides, and other searchable content types. */ export declare class Search { private client; private readonly defaultSearchFields; constructor(client: Client); /** * Search content with optional filtering and sorting * * @param filter Search filter including query and optional filters: * - query: string (required) - The search query text * - lang: 'en' | 'sv' - Language filter * @param sort Optional sorting options: * - fields: string[] | string - Fields to sort by * - orders: ('asc' | 'desc')[] | 'asc' | 'desc' - Sort direction(s) * @param fields Optional GraphQL fields to return * @returns Array of matching content entities * @throws Error if search query is empty */ query(filter: SearchFilter, sort?: SortOptions, fields?: string): Promise<WpEntityClass[]>; }