Skip to main content

ghana-bdr@0.1.2

get(path, query)
post(path, data)
sendBirthNotification(data)

This adaptor exports the following from common:

cursor()
dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
fnIf()
lastReferenceValue()
merge()
sourceValue()

Functions

get

get(path, query) ⇒ Operation

Make a GET request

ParamTypeDescription
pathstringPath to resource
queryobjectAn object of query parameters to be encoded into the URL.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

Example

get("patient");

post

post(path, data) ⇒ Operation

Make a POST request

ParamTypeDescription
pathstringPath to resource
dataobjectbody data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

Example

post("patient", { "name":"Bukayo" });

sendBirthNotification

sendBirthNotification(data) ⇒ Operation

Generate a birth certificate

ParamTypeDescription
dataobjectbody data to append to the request. JSON will be converted to a string (but a content-type header will not be attached to the request).

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job

Example

sendBirthNotification({
child: {},
mother: {},
father: {},
health_facility: {},
birth_informant: {}
})

Interfaces

HttpState

/** State object

Properties

NameDescription
datathe parsed response body
responsethe response from the HTTP server, including headers, statusCode, body, etc
referencesan array of all previous data objects used in the Job