getCardsFromWorkflow static method

Future<PcoCollection<PcoPeopleWorkflowCard>> getCardsFromWorkflow(
  1. String workflowId, {
  2. PcoPeopleWorkflowCardQuery? query,
  3. bool getAll = false,
  4. bool includeAllRelated = false,
  5. bool includeAssignee = false,
  6. bool includeCurrentStep = false,
  7. bool includePerson = false,
  8. bool includeWorkflow = false,
})

Will get a PcoCollection of PcoPeopleWorkflowCard objects (expecting one) using a path like this: /people/v2/workflows/$workflowId/cards

Getting a PcoCollection is useful even when retrieving a single object because it contains error data and helper functions.

Additional options may be specified by using the query argument, but some query options are also available as boolean flags in this function call too.

Implementation

static Future<PcoCollection<PcoPeopleWorkflowCard>> getCardsFromWorkflow(
  String workflowId, {
  PcoPeopleWorkflowCardQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeAssignee = false,
  bool includeCurrentStep = false,
  bool includePerson = false,
  bool includeWorkflow = false,
}) async {
  query ??= PcoPeopleWorkflowCardQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoPeopleWorkflowCard.canInclude);
  if (includeAssignee) query.include.add('assignee');
  if (includeCurrentStep) query.include.add('current_step');
  if (includePerson) query.include.add('person');
  if (includeWorkflow) query.include.add('workflow');
  var url = '/people/v2/workflows/$workflowId/cards';

  return PcoCollection.fromApiCall<PcoPeopleWorkflowCard>(url,
      query: query, apiVersion: kApiVersion);
}