getAllFromResource static method

Future<PcoCollection<PcoCalendarRequiredApproval>> getAllFromResource(
  1. String resourceId, {
  2. String? id,
  3. PcoCalendarRequiredApprovalQuery? query,
  4. bool includeResource = false,
})

Will get a PcoCollection containing ALL PcoCalendarRequiredApproval objects (expecting many) using a path like this: /calendar/v2/resources/$resourceId/required_approvals

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoCalendarRequiredApproval>> getAllFromResource(
  String resourceId, {
  String? id,
  PcoCalendarRequiredApprovalQuery? query,
  bool includeResource = false,
}) async {
  query ??= PcoCalendarRequiredApprovalQuery();
  query.getAll = true;

  if (includeResource) query.include.add('resource');
  var url = '/calendar/v2/resources/$resourceId/required_approvals';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCalendarRequiredApproval>(url,
      query: query, apiVersion: kApiVersion);
}