getAllForms
احصل على جميع كائنات النماذج.
الوصف
تسترجع هذه الطريقة جميع كائنات النماذج مع الترقيم. تعيد Promise التي تحل إلى كائن IFormsResponse يحتوي على العناصر والعدد الإجمالي.
Forms.getAllForms(
langCode,
offset,
limit
);
مخطط المعاملات
المخطط
langCode: string
رمز اللغة. الافتراضي: "en_US"
مثال: "en_US"
offset: number
معامل للترقيم. الافتراضي: 0
مثال: 0
limit: number
معامل للترقيم. الافتراضي: 30
مثال: 30
بشكل افتراضي، يمكنك استرجاع 10 كائنات. وذلك بسبب حد السجلات في إعدادات أذونات الوحدة.
لعمل الترقيم بشكل صحيح، تحتاج إلى تكوين أذونات الوحدة وفقًا لاحتياجاتك في القسم المقابل.
أمثلة
مثال بسيط
const response = await Forms.getAllForms();
مثال مع السمات
const response = await Forms.getAllForms('en_US', 0, 30);
مثال على الاستجابة
{
"items": [
{
"id": 4,
"attributeSetId": 11,
"type": "data",
"localizeInfos": {
"title": "user_form",
"titleForSite": "",
"successMessage": "",
"unsuccessMessage": "",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 9,
"position": 1,
"identifier": "user_form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name_attr",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "name"
},
"additionalFields": {}
},
{
"type": "string",
"marker": "username",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "username"
},
"additionalFields": {}
},
{
"type": "string",
"marker": "password",
"position": 3,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "password"
},
"additionalFields": {}
},
"..."
]
},
{
"id": 6,
"attributeSetId": 15,
"type": "data",
"localizeInfos": {
"title": "Test form",
"titleForSite": "",
"successMessage": "",
"unsuccessMessage": "",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 14,
"position": 2,
"identifier": "test-form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {
"requiredValidator": {
"strict": true
},
"stringInspectionValidator": {
"stringMax": 0,
"stringMin": 0,
"stringLength": 0
}
},
"initialValue": null,
"localizeInfos": {
"title": "Name"
},
"additionalFields": {
"additional_field": {
"type": "string",
"value": "Additional field data"
}
}
},
{
"type": "file",
"marker": "file",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "File"
},
"additionalFields": {}
}
]
},
{
"id": 7,
"attributeSetId": 15,
"type": "data",
"localizeInfos": {
"title": "File form",
"titleForSite": "Form title (for application)",
"successMessage": "Message about successful data processing",
"unsuccessMessage": "Message about unsuccessful data processing",
"urlAddress": "",
"database": "0",
"script": "0"
},
"version": 15,
"position": 3,
"identifier": "file_form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {
"requiredValidator": {
"strict": true
},
"stringInspectionValidator": {
"stringMax": 0,
"stringMin": 0,
"stringLength": 0
}
},
"initialValue": null,
"localizeInfos": {
"title": "Name"
},
"additionalFields": {
"additional_field": {
"type": "string",
"value": "Additional field data"
}
}
},
{
"type": "file",
"marker": "file",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"initialValue": null,
"localizeInfos": {
"title": "File"
},
"additionalFields": {}
}
]
},
"..."
],
"total": 9
}
مخطط الاستجابة
المخطط: IFormsEntity[]
total: number
إجمالي عدد العناصر.
items: IFormsEntity[]
مصفوفة من كائنات النماذج.
items.id: number
معرف الكائن.
مثال: 12345
items.attributeSetId: number | null
معرف مجموعة السمات المستخدمة، أو null إذا لم يكن ذلك قابلاً للتطبيق.
مثال: 1234
items.type: string | null
نوع النموذج.
مثال: "contact"
items.localizeInfos: IFormLocalizeInfo
اسم النموذج وحقول التوطين الخاصة بالنموذج (رسائل النجاح/الخطأ، إعدادات المعالجة، إلخ).
مثال:
{
"key": "value"
}
items.version: number
رقم إصدار الكائن.
مثال: 1
items.position: number
موضع الكائن.
مثال: 1
items.identifier: string
المعرف النصي لحقل السجل.
مثال: "form_contact_us"
items.processingType: string
نوع معالجة النموذج.
مثال: "async"
items.templateId: number | null
معرف القالب المستخدم من قبل النموذج، أو null إذا لم يتم استخدام أي قالب.
مثال: 6789
items.attributes: IFormAttribute[]
حقول النموذج مع توطينها، والمحققين، وعلامات محددة للنموذج.
items.total: number | string
إجمالي عدد الإدخالات ذات الصلة.
مثال: "1"
items.moduleFormConfigs: IFormConfig[]
مصفوفة من إعدادات نماذج الوحدة المرتبطة بالنموذج.
أمثلة الاستخدام
خطوة بخطوة في الوثائق:
- احصل على جميع النماذج — استرجع كل نموذج تم تكوينه في المشروع.
جربه مباشرة
قم بتشغيل هذه الطريقة بشكل تفاعلي في JS SDK sandbox — قم بتوصيل عنوان URL لمشروعك ورمز التطبيق عند الزيارة الأولى، ثم افتح:
- احصل على جميع النماذج — استرجع كل نموذج تم تكوينه في المشروع.