getTemplateByType
Mengambil semua objek template, dikelompokkan berdasarkan tipe.
Deskripsi
Metode ini mengambil semua objek template dari tipe yang ditentukan. Ini mengembalikan sebuah Promise yang menyelesaikan menjadi array dari objek ITemplateEntity.
Templates.getTemplateByType(
type*,
langCode
);
Skema parameter
Skema
type(required): BlockType
Jenis template yang akan diambil. Parameter ini menentukan kategori atau klasifikasi template yang diminta
contoh: "product"
langCode: string
Kode bahasa. Default: "en_US"
contoh: "en_US"
Contoh
Contoh minimal
const response = await Templates.getTemplateByType('catalog_page');
Contoh dengan atribut
const response = await Templates.getTemplateByType('catalog_page', 'en_US');
Contoh respons
[
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
]
Skema respons
Skema: ITemplateEntity[]
id: number
Pengidentifikasi unik dari posisi.
contoh: 12345
attributeSetIdentifier: string | null
Set id atribut.
contoh: "attribute_set_1"
title: string
Nama template.
contoh: "Product Template"
generalTypeId: number
Id Entitas tipe umum.
contoh: 67890
identifier: string
Pengidentifikasi tekstual untuk field record.
contoh: "template_12345"
version: number
Nomor versi dari objek.
contoh: 1
generalTypeName: BlockType
Nama tipe umum.
contoh: "product"
attributeValues: IAttributeValues
Peta nilai atribut yang dikunci oleh penanda; objek kosong jika tidak ada.
contoh:
{
"id": 1,
"value": "some"
}
position: number
Posisi objek.
contoh: 1