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ể.

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 các thuộc tính

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

Ví dụ phản hồi

{
"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
}
]
}

Sơ đồ phản hồi

Sơ đồ: Record<Types, ITemplateEntity[]>