import { PostEntity, QueriedObject } from '../types/index.js'; import { FetchOptions, AbstractFetchStrategy, EndpointParams, FetchResponse, FilterDataOptions } from './AbstractFetchStrategy.js'; /** * The EndpointParams supported by the {@link PostsArchiveFetchStrategy} */ export interface PostsArchiveParams extends EndpointParams { /** * Current page of the collection. * * @default 1 */ page?: number; /** * If set will filter results by the specified category name * * It supports both a category id and category slug */ category?: string | number | number[]; /** * If set will filter results by the specified tag name * * It supports both a category id and category slug */ tag?: number | string; /** * If set will filter results by the specified year */ year?: string; /** * If set will filter results by the specified month */ month?: string; /** * If set will filter results by the specified day */ day?: string; /** * Maximum number of items to be returned in result set. * * @default 10 */ per_page?: number; /** * Limit results to those matching a string. */ search?: string; /** * Limit result set to posts assigned to specific authors. */ author?: number | number[] | string; /** * Ensure result set excludes posts assigned to specific authors. */ author_exclude?: number | number[]; /** * Ensure result set excludes specific IDs. */ exclude?: number[]; /** * Limit result set to specific IDs. */ include?: number[]; /** * Offset the result set by a specific number of items. */ offset?: number; /** * Order sort attribute ascending or descending. * * @default 'desc' */ order?: 'asc' | 'desc'; /** * The post type to query for. * * @default 'post' */ postType?: string; /** * Limit result set to posts with one or more specific slugs. */ slug?: string | string[]; /** * Sort collection by object attribute. * * @default 'date' */ orderby?: 'author' | 'date' | 'id' | 'include' | 'modified' | 'parent' | 'relevance' | 'slug' | 'include_slugs' | 'title'; /** * Limit result set to posts assigned one or more statuses. * * @default 'publish' */ status?: string | string[]; /** * Limit result set based on relationship between multiple taxonomies. */ tax_relation?: 'AND' | 'OR'; /** * Limit result set to all items that have the specified term assigned in the categories taxonomy. */ categories?: number | number[] | string | string[]; /** * Limit result set to all items except those that have the specified term assigned in the categories taxonomy. */ categories_exclude?: number | number[]; /** * Limit results to a specific taxonomy and expects the actual term slug to come from the url] * * If you only specify the taxonomy, the term slug will be assumed to be the first segment of the path */ taxonomy?: string; /** * Limit result set to all items that have the specified term assigned in the tags taxonomy. */ tags?: number | number[] | string | string[]; /** * Limit result set to all items except those that have the specified term assigned in the tags taxonomy. */ tags_exclude?: number | number[]; /** * Limit result set to items that are sticky. */ sticky?: boolean; /** * Overrides the value set in {@link CustomTaxonomy#matchArchivePath} * * @default false */ matchArchivePath?: boolean; } /** * The PostsArchiveFetchStrategy is used to fetch a collection of posts from any post type. * Note that custom post types and custom taxonomies should be defined in `headless.config.js` * * This strategy supports extracting endpoint params from url E.g: * - `/category/cat-name/page/2` maps to `{ category: 'cat-name', page: 2 }` * - `/page/2/` maps to `{ page: 2 }` * - `/genre/genre-name/page/2` maps to `{ genre: 'genre-name', page: 2 }` if a `genre` taxonomy is defined in `headless.config.js` * * @see {@link getParamsFromURL} to learn about url param mapping * * @category Data Fetching */ export declare class PostsArchiveFetchStrategy extends AbstractFetchStrategy { path: string; locale: string; optimizeYoastPayload: boolean; getDefaultEndpoint(): string; getDefaultParams(): Partial

; /** * This strategy automatically extracts taxonomy filters, date filters and pagination params from the URL * * It also takes into account the custom taxonomies specified in `headless.config.js` * * @param path The URL path to extract params from * @param params */ getParamsFromURL(path: string, params?: Partial

): Partial

; /** * Handles taxonomy filters and switch endpoint based on post type * * @param params The params to build the endpoint with */ buildEndpointURL(params: Partial

): string; prepareResponse(response: FetchResponse, params: Partial

): FetchResponse; /** * Before fetching posts, we need handle taxonomy and authors. * * If the headless plugin is not being used, then additional requests needs to be made to get * authors and terms ids * * @param url The URL to parse * @param params The params to build the endpoint with * @param options FetchOptions */ fetcher(url: string, params: Partial

, options?: Partial): Promise>; /** * Returns the queried object if applicable (e.g if querying by category, tag, author or custom taxonomy term) * * @param response The response from the API * @param params The request params * @returns */ getQueriedObject(response: FetchResponse, params: Partial

): QueriedObject; filterData(data: FetchResponse, options?: FilterDataOptions): FetchResponse; }