import { PostEntity } from '../types/index.js'; import { AbstractFetchStrategy, EndpointParams, FetchOptions, FetchResponse, FilterDataOptions } from './AbstractFetchStrategy.js'; /** * The EndpointParams supported by the {@link SinglePostFetchStrategy} */ export interface PostParams extends EndpointParams { /** * The slug of the post to fetch */ slug?: string; /** * Post Types where we should look for * * If multiple post types are specified * multiple requests will be issued to each post type until a matching post is found */ postType?: string | string[]; /** * Fetch post by id */ id?: Number; /** * If set will fetch the latest post revision */ revision?: Boolean; /** * The authToken, required to fetch revisions or non-published posts */ authToken?: string; /** * Whether post.link should be checked against current path */ matchCurrentPath?: boolean; /** * If set, this is the path that will be checked if `slug` is set or `matchCurrentPath` is set to true. */ fullPath?: string; } /** * The SinglePostFetchStrategy is used to fetch a single post entity from any post type. * Note that custom post types should be defined in `headless.config.js` * * This strategy supports extracting endpoint params from url E.g: * - `/post-name` maps to `{ slug: 'post-name'}` * - `/2021/10/20/post-name` maps to `{ year: 2021, month: 10, day: 20, slug: 'post-name }` * - `/2021/` maps to `{ year: 2021, slug: 'post-name' }` * * @see {@link getParamsFromURL} to learn about url param mapping * * @category Data Fetching */ export declare class SinglePostFetchStrategy extends AbstractFetchStrategy { postType: string; revision?: PostEntity; path: string; locale: string; shouldCheckCurrentPathAgainstPostLink: boolean; optimizeYoastPayload: boolean; getDefaultEndpoint(): string; getDefaultParams(): Partial

; getParamsFromURL(path: string, nonUrlParams?: Partial

): Partial

; /** * Handlers post types, revisions and fetching by id * * @param params The params to build the endpoint url */ buildEndpointURL(params: P): string; /** * Returns only the post that matches the current path * * @param result * @param params * @returns */ getPostThatMatchesCurrentPath(result: T[], params: Partial

): T | undefined; /** * Prepares the post response * * @param response * @param params * @returns */ prepareResponse(response: FetchResponse, params: Partial

): FetchResponse; /** * Handles fetching by multiple post types, authToken and revisions * * @param url The url to fetch * @param params The params to build the endpoint url * @param options FetchOptions */ fetcher(url: string, params: P, options?: Partial): Promise>; filterData(data: FetchResponse, filterOptions?: FilterDataOptions): any; }