Skip to main content

getTemplatePreviews

Get all preview templates.

Description​

Fetches all preview templates and resolves to an array of ITemplatesPreviewEntity objects.

The variants sit one level down, in proportions.default: proportions.default.horizontal, proportions.default.vertical and proportions.default.square. The response schema below lists them as proportions.horizontal and so on, following the SDK types. The live response also carries weight in the horizontal and vertical variants and a default: true flag next to them; the SDK types don't describe either.

.getTemplatePreviews(

);

Parameters schema​

Schema

langCode: string
Language code. Default: the langCode passed to defineOneEntry ("en_US" if none).
example: "en_US"

Examples​

Minimal example​

const response = await TemplatePreviews.getTemplatePreviews();

Example with langCode​

const response = await TemplatePreviews.getTemplatePreviews('en_US');

Example response​

[
{
"id": 3,
"title": "Preview Templates",
"proportions": {
"default": {
"horizontal": {
"width": 234,
"height": 324,
"alignmentType": "middleBottom",
"weight": 234
},
"vertical": {
"width": 2,
"height": 3,
"alignmentType": "leftTop",
"weight": 2
},
"square": {
"side": 360,
"alignmentType": "middleMiddle"
},
"default": true
}
},
"identifier": "preview-templates",
"version": 1,
"position": 1,
"isUsed": true
}
]

Response schema​

Schema: ITemplatesPreviewEntity[]

id: number
ID of the object.
example: 3

title: string
Name of the preview template.
example: "Product Template"

proportions: object
Preview proportions: the horizontal, vertical and square variants.
example:

{
"default": {
"horizontal": {
"width": 234,
"height": 324,
"alignmentType": "middleBottom"
},
"vertical": {
"width": 2,
"height": 3,
"alignmentType": "leftTop"
},
"square": {
"side": 3,
"alignmentType": "leftTop"
}
}
}

proportions.horizontal: IProportion | null
Horizontal proportion of the preview.
example:

{
"width": 234,
"height": 324,
"alignmentType": "middleBottom"
}

proportions.horizontal.width: string | number | null
Width of the preview.
example: 100

proportions.horizontal.height: string | number | null
Height of the preview.
example: 200

proportions.horizontal.alignmentType: string
Alignment of the image within the preview, such as middleMiddle or leftTop.
example: "center"

proportions.vertical: IProportion | null
Vertical variant of the preview, or null.
example:

{
"width": 2,
"height": 3,
"alignmentType": "leftTop"
}

proportions.square: ISquare
Square variant of the preview.
example:

{
"side": 3,
"alignmentType": "leftTop"
}

proportions.square.side: number | string
Side length of the square preview, as a number or a string.
example: 100

proportions.square.alignmentType: string
Alignment of the image within the square preview, such as middleMiddle.
example: "center"

identifier: string
Text identifier (marker) of the object.
example: "preview-templates"

version: number
Version number of the object; changes with each update.
example: 1

position: number
Position of the object, used for sorting.
example: 1

isUsed: boolean
Whether the template preview is in use.
example: true