getAllTemplates
Mengambil semua objek template dari tipe tertentu.
Deskripsi
Metode ini mengambil semua objek template yang dikelompokkan berdasarkan tipe dari API. Ini mengembalikan sebuah Promise yang menyelesaikan menjadi objek GroupedTemplatesObject, yang berisi array objek template.
Templates.getAllTemplates(
langCode);
Skema parameter
Skema
langCode: string
Kode bahasa. Default: "en_US"
contoh: "en_US"
Contoh
Contoh minimal
const response = await Templates.getAllTemplates();
Contoh dengan atribut
const response = await Templates.getAllTemplates('en_US');
Contoh respons
{
"frequently_ordered_block": [
{
"id": 7,
"attributeSetIdentifier": null,
"title": "Default frequently ordered block template",
"generalTypeId": 24,
"identifier": "frequently_ordered_block_default",
"version": 0,
"generalTypeName": "frequently_ordered_block",
"attributeValues": {},
"position": 12
}
],
"recently_viewed_block": [
{
"id": 10,
"attributeSetIdentifier": null,
"title": "Default recently viewed block template",
"generalTypeId": 27,
"identifier": "recently_viewed_block_default",
"version": 0,
"generalTypeName": "recently_viewed_block",
"attributeValues": {},
"position": 9
}
],
"trending_block": [
{
"id": 9,
"attributeSetIdentifier": null,
"title": "Default trending block template",
"generalTypeId": 26,
"identifier": "trending_block_default",
"version": 0,
"generalTypeName": "trending_block",
"attributeValues": {},
"position": 10
}
],
"slider_block": [
{
"id": 8,
"attributeSetIdentifier": null,
"title": "Default slider block template",
"generalTypeId": 25,
"identifier": "slider_block_default",
"version": 0,
"generalTypeName": "slider_block",
"attributeValues": {},
"position": 11
}
],
"wishlist_similar_block": [
{
"id": 15,
"attributeSetIdentifier": null,
"title": "Default wishlist similar block template",
"generalTypeId": 32,
"identifier": "wishlist_similar_block_default",
"version": 0,
"generalTypeName": "wishlist_similar_block",
"attributeValues": {},
"position": 4
}
],
"cart_similar_block": [
{
"id": 14,
"attributeSetIdentifier": null,
"title": "Default cart similar block template",
"generalTypeId": 31,
"identifier": "cart_similar_block_default",
"version": 0,
"generalTypeName": "cart_similar_block",
"attributeValues": {},
"position": 5
}
],
"cart_complement_block": [
{
"id": 13,
"attributeSetIdentifier": null,
"title": "Default cart complement block template",
"generalTypeId": 30,
"identifier": "cart_complement_block_default",
"version": 0,
"generalTypeName": "cart_complement_block",
"attributeValues": {},
"position": 6
}
],
"personal_recommendations_block": [
{
"id": 12,
"attributeSetIdentifier": null,
"title": "Default personal recommendations block template",
"generalTypeId": 29,
"identifier": "personal_recommendations_block_default",
"version": 0,
"generalTypeName": "personal_recommendations_block",
"attributeValues": {},
"position": 7
}
],
"repeat_purchase_block": [
{
"id": 11,
"attributeSetIdentifier": null,
"title": "Default repeat purchase block template",
"generalTypeId": 28,
"identifier": "repeat_purchase_block_default",
"version": 0,
"generalTypeName": "repeat_purchase_block",
"attributeValues": {},
"position": 8
}
],
"catalog_page": [
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
]
}
Skema respons
Skema: Record<Types, ITemplateEntity[]>
id: number
Pengidentifikasi unik untuk posisi tersebut.
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 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