Methods
cleanupState(state) → {State}
Removes unserializable keys from the state.
Parameters:
Name | Type | Description |
---|---|---|
state |
State |
- Source:
Returns:
- Type
- State
Example
cleanupState(state)
createCase(params, callback) → {Operation}
Create case in Primero
Parameters:
Name | Type | Description |
---|---|---|
params |
object | an object with some case data. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
createCase({
data: state => data {
"enabled": true,
"age": 15,
"sex": "male",
"name": "Alex",
"status": "open",
"case_id": "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz",
"owned_by": "primero_cp"
}}, callback)
createReferrals(params, callback) → {Operation}
Create case in Primero
Parameters:
Name | Type | Description |
---|---|---|
params |
object | an object with some case data. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
createReferrals({
data: {
"ids": ['case_id'],
"transitioned_to": "primero_cp",
"notes": "Creating a referral"
}}, callback)
execute(operations) → {Operation}
Execute a sequence of operations.
Wraps `language-common/execute`, and prepends initial state for http.
Parameters:
Name | Type | Description |
---|---|---|
operations |
Operations | Operations to be performed. |
- Source:
Returns:
- Type
- Operation
Example
execute(
create('foo'),
delete('bar')
)(state)
generateAuthString(state) → {string}
Generate an auth string to support multiple types of auth credentials.
Parameters:
Name | Type | Description |
---|---|---|
state |
State |
- Source:
Returns:
- Type
- string
Example
generateAuthString(state)
getCases(query, callback) → {Operation}
Get cases from Primero
Parameters:
Name | Type | Description |
---|---|---|
query |
object | an object with a query param at minimum. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
getCases({
remote: true,
case_id: '6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz'
query: 'sex=male' // optional
}, callback)
getReferrals(params, callback) → {Operation}
Get referrals for a specific case in Primero
Parameters:
Name | Type | Description |
---|---|---|
params |
object | an object with an externalId value to use and the id. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
getReferrals(
{
externalId: "record_id",
id: "7ed1d49f-14c7-4181-8d83-dc8ed1699f08"
}, callback)
login(state) → {State}
Logs in to Primero.
Parameters:
Name | Type | Description |
---|---|---|
state |
State | Runtime state. |
- Source:
Returns:
- Type
- State
Example
login(state)
queryHandler(state, params, callback) → {State}
Execute custom query
Parameters:
Name | Type | Description |
---|---|---|
state |
State | |
params |
object | |
callback |
function |
- Source:
Returns:
- Type
- State
updateCase(id, params, callback) → {Operation}
Update case in Primero
Parameters:
Name | Type | Description |
---|---|---|
id |
string | an ID to use for the update. |
params |
object | an object with some case data. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
updateCase("7ed1d49f-14c7-4181-8d83-dc8ed1699f08", {
data: state => data {
"age": 20,
"sex": "male",
"name": "Alex",
"status": "open",
"case_id": "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz",
}}, callback)
updateReferrals(params, callback) → {Operation}
Update referrals for a specific case in Primero
Parameters:
Name | Type | Description |
---|---|---|
params |
object | an object with an externalId value to use, the id and the referral id to update. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
updateReferrals(
{
externalId: "record_id",
id: "7ed1d49f-14c7-4181-8d83-dc8ed1699f08"
referral_id: "37612f65-3bda-48eb-b526-d31383f94166",
data: state => state.data
},
callback)
upsertCase(params, callback) → {Operation}
Upsert case to Primero
Parameters:
Name | Type | Description |
---|---|---|
params |
object | an object with an externalId and some case data. |
callback |
function | (Optional) Callback function |
- Source:
Returns:
- Type
- Operation
Example
upsertCase({
externalIds: ['case_id'],
data: state => data {
"age": 20,
"sex": "male",
"name": "Alex",
"status": "open",
"case_id": "6aeaa66a-5a92-4ff5-bf7a-e59cde07eaaz",
}}, callback);