Nhảy đến nội dung

getAllTemplates

Lấy tất cả các đối tượng mẫu của một loại cụ thể.

Description

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

);

Parameters schema

Schema

langCode: string
Mã ngôn ngữ. Mặc định: "en_US"
ví dụ: "en_US"

Examples

Minimal example

const response = await Templates.getAllTemplates();

Example with attributes

const response = await Templates.getAllTemplates('en_US');

Example response

{
"catalog_page": [
{
"id": 4,
"attributeSetIdentifier": null,
"title": "Mẫu",
"generalTypeId": 4,
"identifier": "template",
"version": 0,
"generalTypeName": "catalog_page",
"attributeValues": {},
"position": 3
}
],
"product_preview": [
{
"id": 5,
"attributeSetIdentifier": null,
"title": "Xem trước sản phẩm",
"generalTypeId": 5,
"identifier": "product_preview",
"version": 0,
"generalTypeName": "product_preview",
"attributeValues": {},
"position": 1
}
],
"product_block": [
{
"id": 6,
"attributeSetIdentifier": null,
"title": "mẫu khối",
"generalTypeId": 10,
"identifier": "block-template",
"version": 0,
"generalTypeName": "product_block",
"attributeValues": {},
"position": 2
}
]
}

Response schema

Schema: Record<Types, ITemplateEntity[]>