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": 17,
"items": [
{
"id": 27,
"createdDate": "2025-10-28T13:50:27.426Z",
"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": 20,
"createdDate": "2025-10-28T13:50:27.426Z",
"updatedDate": "2025-02-26T16:52:53.463Z",
"version": 0,
"identifier": "reg",
"typeId": 6,
"title": "Registration",
"schema": {
"email_reg": {
"id": 1,
"type": "string",
"isLogin": true,
"isPrice": false,
"isSignUp": false,
"original": true,
"isVisible": true,
"identifier": "email_reg",
"isPassword": false,
"validators": {
"emailInspectionValidator": true
},
"localizeInfos": {
"title": "البريد الإلكتروني"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": false
},
"password_reg": {
"id": 2,
"type": "string",
"isPrice": false,
"isSignUp": false,
"original": true,
"isVisible": true,
"identifier": "password_reg",
"isPassword": true,
"validators": {
"requiredValidator": {
"strict": true
},
"stringInspectionValidator": {
"stringMax": 0,
"stringMin": 0,
"stringLength": 0
}
},
"localizeInfos": {
"title": "كلمة المرور"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": false
},
"name_reg": {
"id": 3,
"type": "string",
"isPrice": false,
"isSignUp": true,
"original": true,
"isVisible": true,
"identifier": "name_reg",
"localizeInfos": {
"title": "الاسم"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": false
},
"phone_reg": {
"id": 4,
"type": "string",
"isPrice": false,
"isSignUp": true,
"original": true,
"isVisible": true,
"identifier": "phone_reg",
"validators": {
"requiredValidator": {
"strict": true
}
},
"localizeInfos": {
"title": "الهاتف"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": true
},
"email_notification_reg": {
"id": 5,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "email_notification_reg",
"localizeInfos": {
"title": "البريد الإلكتروني للإشعارات"
},
"isNotificationEmail": true
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 6,
"type": "forUsers"
},
"position": 2
},
{
"id": 11,
"createdDate": "2025-10-28T13:50:27.426Z",
"updatedDate": "2025-05-05T10:41:05.287Z",
"version": 0,
"identifier": "user_form_set",
"typeId": 6,
"title": "user_form_set",
"schema": {
"name_attr": {
"id": 1,
"type": "string",
"isLogin": false,
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "name_attr",
"isPassword": false,
"localizeInfos": {
"title": "الاسم"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": false,
"isNotificationPhonePush": false
},
"username": {
"id": 2,
"type": "string",
"isLogin": true,
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "username",
"isPassword": false,
"localizeInfos": {
"title": "اسم المستخدم"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": false,
"isNotificationPhonePush": false
},
"password": {
"id": 3,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "password",
"isPassword": true,
"localizeInfos": {
"title": "كلمة المرور"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": false,
"isNotificationPhonePush": false
},
"phone": {
"id": 4,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "phone",
"localizeInfos": {
"title": "الهاتف"
},
"isNotificationEmail": false,
"isNotificationPhoneSMS": true,
"isNotificationPhonePush": true
},
"email": {
"id": 5,
"type": "string",
"isPrice": false,
"original": true,
"isVisible": true,
"identifier": "email",
"localizeInfos": {
"title": "البريد الإلكتروني"
},
"additionalFields": [],
"isNotificationEmail": true
}
},
"isVisible": true,
"properties": {},
"type": {
"id": 6,
"type": "forUsers"
},
"position": 3
},
"..."
]
}
مخطط الاستجابة
المخطط: IAttributesSetsResponse
total: number
إجمالي العناصر.
مثال: 100
items: IAttributeSetsEntity[]
مصفوفة IAttributeSetsEntity تحتوي على كائنات مجموعات السمات.
مثال:
[
{
"id": 1,
"identifier": "set1"
},
{
"id": 2,
"identifier": "set2"
}
]