-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Milestone
Description
Extend existing updateCase(httpClient)(caseId)(event)(payload) to accept a function as the payload. This function will be called with the data returned by an optional about-to-start callback and will return the payload object, allowing payload to be generated dynamically based on callback data.
Example
import {updateCase, httpClient} from '@quickcase/node-toolkit';
// A configured `httpClient` is required to create case
const client = httpClient('http://data-store:4452')(() => Promise.resolve('access-token'));
const payloadFn = (start) => ({
data: {
field2: start.field2,
},
summary: 'Short text',
description: 'Longer description',
});
const aCase = await updateCase(client)('1234123412341238')('Open')(payloadFn);
/*
{
id: '1234123412341238',
state: 'Opened',
data: {
field1: 'value1',
field2: 'value2',
},
...
}
*/