انتقل إلى المحتوى الرئيسي

getAllForms

الحصول على جميع النماذج.

الوصف​

يجلب النماذج مع التقسيم إلى صفحات. يُعيد IFormsResponse: النماذج في items، والعدد في total.

.getAllForms(

, ,

);

مخطط المعلمات​

المخطط

langCode: string
رمز اللغة. الافتراضي: langCode المُمرَّر إلى defineOneEntry ("en_US" إذا لم يُمرَّر).
مثال: "en_US"

offset: number
عدد السجلات المراد تخطيها. الافتراضي: 0. يجب ألا يتجاوز offset + limit القيمة 200؛ وتُرفض النافذة الأكبر بالخطأ 400.
مثال: 0

limit: number
الحد الأقصى لعدد السجلات المراد إرجاعها. الافتراضي: 30.
مثال: 30

حد السجلات. إذا كانت صلاحية مجموعة المستخدمين لهذه الطريقة تسمح بالقراءة المقيدة فقط، تُرجع واجهة API عددًا من السجلات لا يتجاوز العدد المحدد في إعدادات المشروع (10 افتراضيًا)، أيًّا كانت قيمة limit التي تمررها. مع صلاحية القراءة الكاملة يعمل limit كالمعتاد. راجع Module permissions (يفتح في علامة تبويب جديدة).

أمثلة​

مثال بسيط​

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": 10,
"position": 1,
"identifier": "user_form",
"processingType": "script",
"templateId": null,
"attributes": [
{
"type": "string",
"marker": "name_attr",
"position": 1,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"multiselect": false,
"initialValue": null,
"localizeInfos": {
"title": "name"
},
"additionalFields": {}
},
{
"type": "string",
"marker": "username",
"position": 2,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"multiselect": false,
"initialValue": null,
"localizeInfos": {
"title": "username"
},
"additionalFields": {}
},
{
"type": "string",
"marker": "password",
"position": 3,
"settings": {},
"isVisible": true,
"listTitles": [],
"validators": {},
"multiselect": false,
"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": 15,
"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
}
},
"multiselect": false,
"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": {},
"multiselect": false,
"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": 16,
"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
}
},
"multiselect": false,
"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": {},
"multiselect": false,
"initialValue": null,
"localizeInfos": {
"title": "File"
},
"additionalFields": {}
}
]
}
],
"total": 9
}

مخطط الاستجابة​

المخطط: IFormsResponse

total: number
العدد الإجمالي للنماذج.

items: IFormsEntity[]
النماذج في هذه الاستجابة.

items.id: number
معرّف النموذج.
مثال: 12345

items.attributeSetId: number | null
معرّف مجموعة السمات التي يستخدمها النموذج، أو null إذا لم توجد.
مثال: 1234

items.type: string | null
نوع النموذج.
مثال: "contact"

items.localizeInfos: IFormLocalizeInfo
الاسم المترجم للنموذج ونصوص النموذج مثل رسائل النجاح والخطأ.
مثال:

{
"title": "Example title"
}

items.version: number
رقم إصدار الكائن؛ يتغير مع كل تحديث.
مثال: 1

items.position: number
موضع النموذج بدءًا من 1 في القائمة الكاملة المرتبة حسب ID؛ مع offset يستمر الترقيم من offset + 1. دائمًا 1 من getFormByMarker().
مثال: 1

items.identifier: string
علامة النموذج.
مثال: "form_contact_us"

items.processingType: string
طريقة معالجة إرسالات النموذج، مثل "email" أو "url".
مثال: "async"

items.templateId: number | null
معرّف القالب الذي يستخدمه النموذج، أو null إذا لم يكن للنموذج قالب.
مثال: 6789

items.attributes: IFormAttribute[]
حقول النموذج مع ترجمتها ومدققاتها وعلاماتها الخاصة بالنموذج، مرتبة حسب position. تعيد واجهة API كائنًا فارغًا للنماذج التي ليس لها سمات — ويحوّله SDK إلى مصفوفة فارغة.

items.total: number | string
عدد صفوف داخلي تُرجعه getFormByMarker() عن طريق الخطأ (دائمًا "1")؛ لا تعتمد عليه. لا تُرجعه عناصر getAllForms()؛ استخدم total في المستوى الأعلى بدلًا منه.
مثال: "1"

items.moduleFormConfigs: IFormConfig[]
روابط النموذج بالوحدات. تُرجعها getFormByMarker() فقط؛ وتُغفلها getAllForms().


أمثلة الاستخدام​

شرح تفصيلي خطوة بخطوة في الوثائق:

جربها مباشرة​

شغّل هذه الطريقة تفاعليًا في بيئة JS SDK التجريبية. اربط Project URL وApp Token عند زيارتك الأولى، ثم افتح: