Skip to content

Case: updateCase(httpClient)(caseId)(event)(payloadFn) #69

@vlaurin

Description

@vlaurin

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',
  },
  ...
}
*/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions