Methods
(static) authenticate(survey) → {Promise.<module:survey-model~SurveyObject>}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
survey |
module:survey-model~SurveyObject | survey object |
Returns:
a promise that resolves with a survey object
- Type
- Promise.<module:survey-model~SurveyObject>
(static) getAuthHeader(url, credentialsopt) → {Promise}
- Source:
Generates an Auhorization header that can be used to inject into piped requests (e.g. submissions).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url |
string | URL to request |
|
credentials |
Object |
<optional> |
user credentials |
Returns:
a promise that resolves with an auth header
- Type
- Promise
(static) getFormListUrl(server, idopt, customParamopt) → {string}
- Source:
getFormListUrl
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
server |
string | server URL |
|
id |
string |
<optional> |
Form id. |
customParam |
string |
<optional> |
custom query parameter |
Returns:
url
- Type
- string
(static) getManifest(survey) → {Promise.<module:survey-model~SurveyObject>}
- Source:
Obtains the XForm manifest
Parameters:
Name | Type | Description |
---|---|---|
survey |
module:survey-model~SurveyObject | survey object |
Returns:
a Promise that resolves with a survey object with added manifest
- Type
- Promise.<module:survey-model~SurveyObject>
(static) getMaxSize(survey) → {Promise.<string>}
- Source:
Checks the maximum acceptable submission size the server accepts
Parameters:
Name | Type | Description |
---|---|---|
survey |
module:survey-model~SurveyObject | survey object |
Returns:
promise resolving with max size stringified number
- Type
- Promise.<string>
(static) getSubmissionUrl(server) → {string}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
server |
string | server URL |
Returns:
url
- Type
- string
(static) getUpdatedRequestOptions(options)
- Source:
Updates request options.
Parameters:
Name | Type | Description |
---|---|---|
options |
object | request options |
(static) getXForm(survey) → {Promise.<module:survey-model~SurveyObject>}
- Source:
Gets XForm from url
Parameters:
Name | Type | Description |
---|---|---|
survey |
object | survey object |
Returns:
a Promise that resolves with a survey object with added XForm
- Type
- Promise.<module:survey-model~SurveyObject>
(static) getXFormInfo(survey) → {Promise.<module:survey-model~SurveyObject>}
- Source:
Gets form info
Parameters:
Name | Type | Description |
---|---|---|
survey |
module:survey-model~SurveyObject | survey object |
Returns:
a Promise that resolves with a survey object with added info
- Type
- Promise.<module:survey-model~SurveyObject>
(inner) _findFormAddInfo(formListXml, survey)
- Source:
Finds the relevant form in an OpenRosa XML formList
Parameters:
Name | Type | Description |
---|---|---|
formListXml |
string | OpenRosa XML formList |
survey |
module:survey-model~SurveyObject | survey object
|
(inner) _request(options) → {Promise}
- Source:
Sends a request to an OpenRosa server
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | request options object |
Returns:
Promise
- Type
- Promise
(inner) _simplifyFormObj(formObj) → {object}
- Source:
Convert arrays property values to strings, knowing that each xml node only occurs once in each xform node in /formList
Parameters:
Name | Type | Description |
---|---|---|
formObj |
object | a form object |
Returns:
a simplified form object
- Type
- object
(inner) _xmlToJson(xml) → {Promise.<(string|Error)>}
- Source:
transform XML to JSON for easier processing
Parameters:
Name | Type | Description |
---|---|---|
xml |
string | XML string |
Returns:
a promise that resolves with JSON
- Type
- Promise.<(string|Error)>
(inner) sanitizeHeader(value)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Type Definitions
OpenRosaXForm
- Source:
Properties:
Name | Type | Description |
---|---|---|
descriptionText |
string | |
downloadUrl |
string | |
formID |
string | |
hash |
string | |
manifestUrl |
string | |
name |
string | |
version |
string |