inform@1.0.0
- downloadAttachment(attachmentId, options)
- getAttachmentMetadata(attachmentId)
- getForm(formId, options)
- getForms(options)
- getSubmission(formId, submissionId)
- getSubmissions(formId, options)
This adaptor exports the following namespaced functions:
This adaptor exports the following from common:
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- group()
- lastReferenceValue()
- merge()
- scrubEmojis()
- sourceValue()
- util
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- group()
- lastReferenceValue()
- merge()
- scrubEmojis()
- sourceValue()
- util
Functions
downloadAttachment
downloadAttachment(attachmentId, options) ⇒ Operation
Download an attachment in binary or base64 format
Param | Type | Description |
---|---|---|
attachmentId | string | Id of the attachment to be retrieved. |
options | object | Optional request options. Supported options are: filename for the specific attachment to be downloaded, and parseAs for either 'stream or 'base64 . Defaults to parseAs: stream . |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example: Download an attachment
downloadAttachment('622038', {
filename:
'unicefbih/attachments/download_1.png',
});
Example: Download an attachment in base64 format
downloadAttachment('622038', {
filename:
'unicefbih/attachments/download_1.png',
parseAs: 'base64',
});
getAttachmentMetadata
getAttachmentMetadata(attachmentId) ⇒ Operation
Fetch a single attachment's metadata
Param | Type | Description |
---|---|---|
attachmentId | string | Id of the attachment to be retrieved. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example
getAttachmentMetadata('621985')
getForm
getForm(formId, options) ⇒ Operation
Get metadata or structural data for a single form
Param | Type | Description |
---|---|---|
formId | string | Id of the form to be retrieved. |
options | object | |
options.structureOnly | boolean | If true, only the form structure is returned in JSON format. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example: Get a single form
getForm('6225')
Example: Get a single form structure
getForm('6225', {
structureOnly: true,
});
getForms
getForms(options) ⇒ Operation
Fetch all forms
Param | Type | Description |
---|---|---|
options | object | Optional filter options. Some supported options are: public , tags , page , and page_size . |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example: Get all forms without filter options
getForms()
Example: Get all forms with filter options
getForms({
public: true,
page: 1,
page_size: 5,
});
getSubmission
getSubmission(formId, submissionId) ⇒ Operation
Get a single data submission for a single form
Param | Type | Description |
---|---|---|
formId | string | Id of the form's submissions to be retrieved. |
submissionId | string | Id of the submission to be retrieved. |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example
getSubmission('6225', '7783155')
getSubmissions
getSubmissions(formId, options) ⇒ Operation
Get submission data of a single form
Param | Type | Description |
---|---|---|
formId | string | Id of the form's submissions to be retrieved. |
options | object | Optional filter options. Some supported options are: query , limit , start , page , and page_size . |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example: Get submissions without filter options
getSubmissions('6225');
Example: Get submissions with filter options
getSubmissions('6225', {
query: `{"_submission_time":{"$gte":"2024-11-05"}}`,
limit: 1,
});
http
These functions belong to the http namespace.
http.get
get(path, options) ⇒ Operation
Make a GET request to Inform
Param | Type | Description |
---|---|---|
path | string | Path to resource |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example: Get all forms
http.get('forms')
http.request
request(method, path, options) ⇒ Operation
Make a general HTTP request to Inform
Param | Type | Description |
---|---|---|
method | string | HTTP method to use |
path | string | Path to resource |
options | RequestOptions | Optional request options |
This operation writes the following keys to state:
State Key | Description |
---|---|
data | the parsed response body |
references | an array of all previous data objects used in the Job |
Example: Get all forms with a query
http.request('GET', 'forms', {
query: {
public: true,
page: 1,
page_size: 5,
},
});
Interfaces
RequestOptions
Options provided to the Inform request
Properties
Name | Type | Description |
---|---|---|
body | object | string | body data to append to the request. JSON will be converted to a string. |
errors | object | Map of errorCodes -> error messages, ie, { 404: 'Resource not found;' } . Pass false to suppress errors for this code. |
query | object | An object of query parameters to be encoded into the URL. |
headers | object | An object of headers to append to the request. |