getAllTemplates
Lấy tất cả các đối tượng mẫu của một loại cụ thể.
Mô tả
Phương thức này truy xuất tất cả các đối tượng mẫu được nhóm theo loại từ API. Nó trả về một Promise mà khi hoàn thành sẽ trả về một đối tượng GroupedTemplatesObject, chứa một mảng các đối tượng mẫu.
Templates.getAllTemplates(
langCode);
Sơ đồ tham số
Sơ đồ
langCode: string
Mã ngôn ngữ. Mặc định: "en_US"
ví dụ: "en_US"
Ví dụ
Ví dụ tối thiểu
const response = await Templates.getAllTemplates();
Ví dụ với thuộc tính
const response = await Templates.getAllTemplates('en_US');
Phản hồi ví dụ
{
"catalog_page": [
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Template",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 1
}
],
"product_preview": [
{
"id": 5,
"attributeSetIdentifier": null,
"title": "Product preview",
"generalTypeId": 5,
"identifier": "product_preview",
"version": 0,
"generalTypeName": "product_preview",
"attributeValues": {},
"position": 3
}
],
"product_block": [
{
"id": 6,
"attributeSetIdentifier": null,
"title": "block template",
"generalTypeId": 10,
"identifier": "block-template",
"version": 0,
"generalTypeName": "product_block",
"attributeValues": {},
"position": 2
}
]
}