Language
Pages are used to group assets within a kit. Each page contains a list of items which are fetched via the page.
For more information on the various types of items and their functions, see .
Return a single page and the items within it. Items may be paged using the page and limit parameters.
Typescript
const section = await lingo.fetchSection("<sectionID>", 0);
console.log(`${section.name} has ${section.items.length} items`);
Arguments
sectionId
string • required
The uuid for the page to fetch.
version
Number
The version of the page/kit to fetch. (default 0)
page
Number
The page number to retrieve when paging through results (default 1).
limit
Number
The max number of items to retrieve, up to 200 or 0 for no items (default 50).
Page Properties
id
string
The unique identifier for the page.
version
number
The numeric version the page belongs to.
name
string
The name of the page.
displayOrder
number
A relative order of the page in the version.
items
Item[]
A list of items on the page. Items may be paged depending on request options.
Retrieve all items on a page. This will fetch all pages of results automatically.
Typescript
const items = await lingo.fetchAllItemsInSection("<page.sectionID>", 0);
Arguments
sectionId
string • required
The uuid for the page to fetch.
version
number
The version of the page/kit to fetch. (default 0)
Retrieve the items on a page that fall under a particular heading.
Typescript
const items = await lingo.fetchItemsForHeading("<sectionID>", "<headerID>");
Arguments
sectionId
string • required
The uuid for the page to fetch.
headingId
string • required
The id or name of the heading. Note that with name, the first match is used.
version
number
The version of the page/kit to query. (default 0)
Creating content requires an API token with write access enabled.
Create a new page.
Typescript
const section = await lingo.createSection("<KitID>", "My Page");
Arguments
kitId
string • required
The id of the kit to create the page in.
name
string • required
The name for the new page.