@agility/content-fetch
Version:
JS/TS library for the Agility Fetch API
42 lines (41 loc) • 1.76 kB
TypeScript
import { Page } from '../types/Page';
import { ApiClientInstance } from '../types/Client';
/**
* Gets the details of a page by its Page ID.
* @memberof AgilityFetch.Client.Pages
* @param {Object} requestParams - The parameters for the API request.
* @param {number} requestParams.pageID - The unique page ID of the page you wish to retrieve in the current language.
* @param {string} requestParams.locale - The locale code of the content you want to retrieve.
* @param {string} requestParams.languageCode - DEPRECATED: Use locale instead - The language code of the content you want to retrieve.
* @param {boolean} [requestParams.expandAllContentLinks] - Whether or not to expand entire linked content references, includings lists and items that are rendered in the CMS as Grid or Link. Default is **false**
* @param {number} [requestParams.contentLinkDepth] - The depth, representing the levels in which you want linked content auto-resolved. Default is **2**.
* @returns {Promise<AgilityFetch.Types.Page>} - Returns a page item object.
* @example
*
* import agility from '@agility/content-fetch'
*
* const api = agility.getApi({
* guid: 'ade6cf3c',
* apiKey: 'defaultlive.201ffdd0841cacad5bb647e76547e918b0c9ecdb8b5ddb3cf92e9a79b03623cb',
* });
*
* api.getPage({
* pageID: 1,
* locale: 'en-us'
* })
* .then(function(page) {
* console.log(page);
* })
* .catch(function(error) {
* console.log(error);
* });
*/
export interface PageRequestParams {
pageID: number;
locale?: string;
expandAllContentLinks?: boolean;
contentLinkDepth?: number;
languageCode?: string;
}
declare function getPage(this: ApiClientInstance, requestParams: PageRequestParams): Promise<Page>;
export default getPage;