getAttributes
الحصول على جميع كائنات مجموعة السمات. تُرجع هذه الطريقة جميع كائنات مجموعات السمات والإجمالي. تُرجع وعدًا (Promise) يتم حله إلى كائن من نوع IAttributesSetsResponse.
الوصف
-
بالإضافة إلى إرجاع قائمة كائنات مجموعة السمات، توفر الطريقة أيضًا العدد الإجمالي لهذه الكائنات. هذا مفيد بشكل خاص لأغراض الترقيم، والتقارير، والتحليلات، مما يسمح للمطورين والمديرين بفهم نطاق وحجم مجموعات السمات التي يتم إدارتها.
-
هذه الوظيفة ضرورية للتطبيقات التي تتطلب نمذجة بيانات ديناميكية. على سبيل المثال، قد تستخدم منصات التجارة الإلكترونية مجموعات السمات لتعريف فئات المنتجات المختلفة، كل منها مع مجموعة فريدة من السمات مثل الحجم، اللون، المادة، إلخ. يمكن أيضًا استخدامها في أنظمة إدارة المستخدمين حيث تتطلب أدوار المستخدمين المختلفة متطلبات سمات مميزة.
-
من المحتمل أن تكون الطريقة مصممة للتكامل بسلاسة مع مكونات أخرى من النظام، مما يسمح بالتلاعب بالبيانات وعرضها بشكل مرن. قد يتضمن ذلك تصفية، فرز، أو تحويل مجموعات السمات بناءً على معايير أو منطق عمل محدد.
AttributesSets.getAttributes(
langCode,
offset,
limit,
typeId,
sortBy
);
مخطط المعاملات
المخطط
langCode: string
رمز اللغة. الافتراضي: "en_US"
مثال: "en_US"
offset: number
معامل إزاحة اختيار السجلات. الافتراضي: 0
مثال: 0
limit: number
معامل يحدد عدد السجلات المختارة. الافتراضي: 30
مثال: 30
typeId: number
معرف نوع مجموعة السمات. الافتراضي: null
مثال: NaN
sortBy: string
معرف نوع مجموعة السمات. الافتراضي: "id"
مثال: "id"
أمثلة
مثال بسيط
const response = await AttributesSets.getAttributes();
مثال مع السمات
const response = await AttributesSets.getAttributes('en_US', 0, 30, null, 'id');
مثال على الاستجابة
{
"total": 16,
"items": [
{
"id": 27,
"updatedDate": "2025-02-26T17:18:11.275Z",
"version": 0,
"identifier": "admins",
"typeId": 1,
"title": "Admins",
"schema": {
"admin-text": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "admin-text",
"localizeInfos": {
"title": "نص المسؤولين"
}
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 1,
"type": "forAdmins"
},
"position": 1
},
{
"id": 22,
"updatedDate": "2025-03-23T12:23:56.420Z",
"version": 0,
"identifier": "block",
"typeId": 2,
"title": "Block",
"schema": {
"block-text": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "block-text",
"localizeInfos": {
"title": "نص الكتلة"
}
},
"interval": {
"id": 2,
"type": "timeInterval",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "interval",
"localizeInfos": {
"title": "الفترة",
"intervals": [
{
"id": "c6466cd8-c55d-4583-97c5-42b684210f12",
"range": [],
"external": [],
"fullMonth": 2,
"intervals": [
{
"id": "ab0e3e90-8153-4679-aea4-198c5022f8d4",
"end": {
"hours": 19,
"minutes": 0
},
"start": {
"hours": 9,
"minutes": 0
},
"period": 60
}
],
"inEveryMonth": true,
"selectedYear": 2025
}
]
}
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 2,
"type": "forBlocks"
},
"position": 2
},
{
"id": 17,
"updatedDate": "2025-02-26T16:25:01.688Z",
"version": 0,
"identifier": "page",
"typeId": 4,
"title": "Page",
"schema": {
"text": {
"id": 1,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "text",
"localizeInfos": {
"title": "نص"
}
},
"number": {
"id": 2,
"type": "integer",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "number",
"localizeInfos": {
"title": "رقم"
}
},
"real": {
"id": 3,
"type": "real",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "real",
"localizeInfos": {
"title": "حقيقي"
}
},
"float": {
"id": 4,
"type": "float",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "float",
"localizeInfos": {
"title": "عائم"
}
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 4,
"type": "forPages"
},
"position": 3
},
"..."
]
}
مخطط الاستجابة
المخطط: IAttributesSetsResponse
total: number
إجمالي العناصر.
مثال: 100
items: IAttributeSetsEntity[]
مصفوفة IAttributeSetsEntity تحتوي على كائنات مجموعة السمات.
مثال:
[
{
"id": 1,
"identifier": "set1"
},
{
"id": 2,
"identifier": "set2"
}
]