Field Processor
Field processor is responsible for receiving, updating fields models. Also with field processor you can get and update field values.
All field methods are collected and described in this article:
getField
Due to this method you can get field from the relevant application. It takes application and field IDs as arguments.
import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.getField(app_id, field_id);
Argument Name | Type | Description |
---|---|---|
app_id | number |
application ID where we want to get the field model |
field_id | number |
field ID that we want to receive |
Method Returns field model from specific application:
{
"field_id": 505247,
"data_type": "image",
"name_space": "thumbnail",
"field_priority": 0,
"field_name": "Thumbnail",
"data_model": {
"show_field_name": true,
"display_mode": "single",
"image_editor": false,
"compress": false,
"quality": "1",
"table_display_mode": "image",
"interpretation": []
}
}
updateField
This method allows you to update field model of the current application. It take two arguments:
import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub. (app_id, fieldModel);
Argument Name | Type | Description |
---|---|---|
app_id | number |
application ID where we want to update the field model |
fieldModel | object |
contains existing field data |
The method returns updated field model:
{
"field_id": 505247,
"data_type": "image",
"name_space": "thumbnail",
"field_priority": 0,
"field_name": "Thumbnail",
"data_model": {
"show_field_name": false,
"display_mode": "multiple",
"image_editor": true,
"compress": false,
"quality": "1",
"table_display_mode": "image",
"interpretation": []
}
}
deleteField
The method is responsible for deleting field from the application. Its arguments are application and field IDs.
import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.deleteField(app_id, field_id);
Argument Name | Type | Description |
---|---|---|
app_id | number |
application ID where we want to delete the field model |
field_id | number |
unique field ID |
In response, a success message will be displayed.
delete field with id = 602126. Ok
getFieldModels
This method is used for getting a list of field models. It takes applications ID as an argument.
import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.getFieldModels(app_id);
Argument Name | Type | Description |
---|---|---|
app_id | number |
application ID where we want to get the field models |
It returnsan array of application field models.
{
"field_list": [{
"app_id": 7054,
"field_id": 82381,
"element_id": 82381,
"name_space": "app",
"field_priority": 0,
"name_space": "app",
"data_model": {...},
"interpretation": [],
"item_update_settings": {...},
"itself_filter": {...},
"search": "",
},…]
}
getFieldValue
This method is responsible for getting the value from the desired field. It takes application, item and field IDs as arguments.
import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.getFieldValue(app_id, item_id, field_id);
Argument Name | Type | Description |
---|---|---|
app_id | number |
application ID where we want to get the field model |
item_id | number |
item ID where we want to get the field model |
field_id | number |
unique field ID |
The method returns value from desired field:
{
"field_value": "value",
}
setFieldValue
This method is called to set value in the desired field. It takes application, item, and field IDs and, of course, the very value as arguments.
import GudHub from '@gudhub/core';
const gudhub = new GudHub(authkey);
gudhub.setFieldValue(app_id, item_id, field_id, field_value);
Argument Name | Type | Description |
---|---|---|
app_id | number |
application ID where we want to set field value |
item_id | number |
item ID where we want to set field value |
field_id | number |
field ID where we want to set field value |
field_value | string |
value to be set in the field |
{
"field_value": "value",
}