/** * Query Services API * Fetches single or multiple services with pagination and sorting */ import { type Service, type Paging, type Sorting } from '@wix/auto_sdk_bookings_services'; import type { FilterValue as Filter } from '@wix/headless-components/react'; /** * Synthetic location ID constants for non-business locations */ export declare const SYNTHETIC_CUSTOM_ID = "custom"; export declare const SYNTHETIC_CUSTOMER_ID = "customer"; /** * Paging metadata from query services response. * Extends the SDK's Paging type with hasNext flag to indicate if more services are available. */ export type PagingMetadata = Paging & { /** Number of items returned in the current page */ count?: number; /** Whether there are more services available to load */ hasNext?: boolean; }; /** * Query services request options * Used internally by ServiceListService to track query state */ export interface QueryServicesRequest { appId: string; filter?: Filter; pagingMetadata?: PagingMetadata; sort?: Sorting[]; } /** * Fetches a service by its ID * @param id - The service ID * @param appId - Optional app ID, defaults to booking app ID * @returns Object containing the service or null if not found */ export declare const getServiceById: (id: string, appId?: string) => Promise<{ service: Service | null; }>; /** * Fetches a service by its slug * @param slug - The service slug * @param appId - Optional app ID, defaults to booking app ID * @returns Object containing the service or null if not found */ export declare const getServiceBySlug: (slug: string, appId?: string) => Promise<{ service: Service | null; }>; /** * Converts a platform Filter object to the API filter format expected by the Bookings services API. * Handles special cases like location filtering where synthetic locations need to be converted * to location types. * * @param platformFilter - Platform Filter object with standard operators ($in, $hasSome, $eq, etc.) * @returns API filter object ready for the Bookings query API * * @example * ```ts * // Input (Platform Filter) * { * 'category.id': { $in: ['cat1', 'cat2'] }, * 'locations.business.id': { $hasSome: ['loc1', 'custom'] } * } * * // Output (API Filter) * { * 'category.id': { $in: ['cat1', 'cat2'] }, * 'locations.business.id': { $hasSome: ['loc1'] }, * 'locations.type': { $hasSome: ['CUSTOM'] } * } * ``` */ export declare function convertPlatformFilterToApiFilter(platformFilter: Filter): Record; /** * Query services with pagination and sorting. * Returns services array and paging metadata including hasNext flag. * * @param params - Query parameters including appId, filter (platform Filter type), paging metadata, and sort options * @returns Promise that resolves to services array and paging metadata with hasNext flag * * @example * ```ts * const { services, pagingMetadata } = await queryServices({ * appId: '13d21c63-b5ec-5912-8397-c3a5ddb27a97', * filter: { '_id': { $in: ['service1', 'service2'] } }, * pagingMetadata: { limit: 20, offset: 0 }, * sort: [{ fieldName: 'name', order: 'ASC' }] * }); * * if (pagingMetadata.hasNext) { * // Load more services * } * ``` */ export declare function queryServices({ appId, filter, pagingMetadata, sort, }: QueryServicesRequest): Promise<{ services: Service[]; pagingMetadata: PagingMetadata; }>;