UNPKG

@stackend/api

Version:

JS bindings to api.stackend.com

108 lines 3.5 kB
import { Thunk } from '../api'; import { PagesState, PageAndLoadedState, PageActions } from './pageReducer'; import { GetPagesResult, GetSubSiteResult, Page, SubSiteNode, SubSite } from './index'; import { getTreeNodeByPermalink } from '../api/tree'; /** * Request multiple pages */ export declare function requestPages({ pageIds, permalinks, communityPermalink }: { pageIds?: Array<number>; permalinks?: Array<string>; communityPermalink?: string | null; }): Thunk<Promise<GetPagesResult>>; /** * Request the missing pages. Works as requestPages, but does only fetch if the page is not present. * @param pageIds * @param permalinks * @param communityPermalink * @param getMenuForIds */ export declare function requestMissingPages({ pageIds, permalinks, communityPermalink }: { pageIds?: Array<number>; permalinks?: Array<string>; communityPermalink?: string | null; }): Thunk<Promise<GetPagesResult>>; export declare function shouldFetchPage(p: Page | PageAndLoadedState | null | undefined, now: number): boolean; /** * Request a single page * @param pageId * @returns {Thunk<GetPagesResult>} */ export declare function requestPage(pageId: number): Thunk<Promise<GetPagesResult>>; /** * Request a single page * @param permalink * @returns {Thunk<GetPagesResult>} */ export declare function requestPageByPermalink(permalink: string): Thunk<Promise<GetPagesResult>>; /** * Clear all pages * @returns {Function} */ export declare function clearPages(): Thunk<PageActions>; /** * Clear a single page * @param pageId * @returns {Function} */ export declare function clearPage(pageId: number): Thunk<PageActions>; export declare function receivePages(json: GetPagesResult): Thunk<any>; /** * Request a sub site by id or permalink * @param arg May be a */ export declare function requestSubSite(arg: number | { id?: number; permalink?: string; }): Thunk<Promise<GetSubSiteResult>>; /** * Request a missing sub site * @param id * @param permalink */ export declare function requestMissingSubSite({ id, permalink }: { id?: number; permalink?: string; }): Thunk<Promise<GetSubSiteResult>>; export declare function receiveSubSites({ subSites }: { subSites: { [id: number]: SubSite; }; }): Thunk<PageActions>; /** * Get a page from the store given a permalink * @param pages * @param permalink * @returns {null|Page} */ export declare function getPageByPermalink(pages: PagesState, permalink: string | null): Page | undefined | null; export declare const SITE_HASH_PREFIX = "#/site"; /** * Get a hash permalink to a subsite page. Specify treePath or permalink * @param treePath * @param permalink * @returns {string|null} */ export declare function getSubSitePageHashPermalink({ treePath, permalink }: { treePath?: Array<SubSiteNode> | null; permalink?: string | null; }): string | null; /** * Given a sub site node hash permalink, extract the real permalink * @param hashPermalink * @returns {null} */ export declare function getSubSiteNodePermalink(hashPermalink: string | null): string | null; /** * Get a subsite from storage given a permalink * @param pages * @param permalink */ export declare function getSubSiteByPermalink(pages: PagesState, permalink: string): SubSite | null; /** * Get a node within a subsite given its permalink * @param subSite * @param permalink */ export declare const getSubSiteNodeByPermalink: typeof getTreeNodeByPermalink; //# sourceMappingURL=pageActions.d.ts.map