Suncel home pageSuncel logoSuncel v1.1
  1. GetGlobal

API > GetPage

GetGlobals

The GetGlobals function allows you to fetch the content/properties of multiple globals.

The function will return an array of type Global.

Import 

import { getGlobals } from "@suncel/nextjs/api";

Function signature

type GetGlobalsRes = {
  pages: Global[];
  count: number;
  total_count: number;
  success: boolean;
};

const getGlobals = async (
	options?:GetGlobalsOption
): Promise<RequestResult<GetGlobalsRes>>
  • options: Optional fetching options (see below)

Options

interface GetGlobalsOption {
  root?: boolean;
  folder?: string;
  q?: string;
  parents?: boolean;
  limit?: number;
  offset?: number;
  sort_by?: keyof Global;
  order?: 'asc' | 'desc';
}
  • root: To fetch only the root pages (do not work if folder has a value) (default value⇒ false)

  • folder: Folder Id - fetch all the pages under this folder (do not work if root is true)

  • q: Search query

  • parents: To includes the folders in the result (default value⇒ true)

  • limit: Limit of pages per request. 0 is no limit (use for pagination)

  • offset: Number of pages to skip (use for pagination)

  • sort_by: Apply a sort on an attribute (need to be used with order)

  • order: Order of the sort (need to be used with sort_by)