new BackendFactory(znHttp)
Parameters:
Name | Type | Description |
---|---|---|
znHttp |
znHttp | A ZnHttp reference |
Methods
(static) createRecord(formId, data) → {Promise.<Object>}
Creates a new record.
Parameters:
Name | Type | Description |
---|---|---|
formId |
number | |
data |
Object | Record data. |
Returns:
- Type
- Promise.<Object>
(static) deleteRecord(formId, recordId) → {Promise.<Object>}
Deletes a record.
Parameters:
Name | Type | Description |
---|---|---|
formId |
number | |
recordId |
number |
Returns:
- Type
- Promise.<Object>
(static) errHandler(err)
Helper to handle API errors.
Parameters:
Name | Type | Description |
---|---|---|
err |
Response | A Node Response object. |
(static) fetchBatched(path, params) → {Array.<any>}
fetch all for given resource
Parameters:
Name | Type | Description |
---|---|---|
path |
string | valid Zengine API url params (ex: '/forms/123/records') |
params |
object | key/value pairs of query params (ex: { limit: 50, folder: 1234 }) |
Returns:
An array of Zengine objects
- Type
- Array.<any>
(static) fetchBatchedPaginated(path, params) → {Array.<Array.<object>>}
fetch all for a given resource, chunked by page
Parameters:
Name | Type | Description |
---|---|---|
path |
number | |
params |
object |
Returns:
An array of arrays storing the Zengine resources
- Type
- Array.<Array.<object>>
(static) formatResponse(response) → {Array.<Object>}
Helper to format API response data.
Parameters:
Name | Type | Description |
---|---|---|
response |
Response | A Node Response object. |
Returns:
An array of plain objects containing the results.
- Type
- Array.<Object>
(static) getActivity(id) → {Promise.<Array.<Object>>}
Load an Activity by id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | The activity id. |
Returns:
- Type
- Promise.<Array.<Object>>
(static) getForm(formId) → {Promise.<Object>}
Gets a form.
Parameters:
Name | Type | Description |
---|---|---|
formId |
number |
Returns:
- Type
- Promise.<Object>
(static) getRecord(formId, recordId) → {Promise.<Object>}
Load a record by id.
Parameters:
Name | Type | Description |
---|---|---|
formId |
number | |
recordId |
number |
Returns:
- Type
- Promise.<Object>
(static) moveRecord(formId, recordId, folderId) → {Promise.<Object>}
Convenience method to move a record to a given folder.
Parameters:
Name | Type | Description |
---|---|---|
formId |
number | |
recordId |
number | |
folderId |
number |
Returns:
- Type
- Promise.<Object>
(static) updateRecord(formId, recordId, data) → {Promise.<Object>}
Updates an existing record.
Parameters:
Name | Type | Description |
---|---|---|
formId |
number | |
recordId |
number | |
data |
Object | Record data. |
Returns:
- Type
- Promise.<Object>