Skip to main content

ghana-nia@0.1.2

get(path, query)
post(path, data)
registerChild(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" });

registerChild

registerChild(data) ⇒ Operation

Generate a national ID

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

registerChild({
babyData: {
dateOfBirth: "string",
fatherName: "string",
forenames: "string",
gender: "string",
lightwaveETrackerID: "string",
motherName: "string",
noSiblingsInDelivery: "string",
placeOfBirth: "string",
surname: "string",
timeOfbirth: "string",
weightAtBirth: "string",
babyPicture: "string"
},
personVouching: {
etrackerLightwaveID: "string",
ghanaCardPIN: "string",
relationToBaby: "string",
relativePhone: "string",
relativePicture: "string"
},
merchantKey: "XXXXXXXXXXXXXXXXXXXXXX"
})

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