getFromResource static method

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

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

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<PcoCalendarRequiredApproval>> getFromResource(
  String resourceId, {
  String? id,
  PcoCalendarRequiredApprovalQuery? query,
  bool getAll = false,
  bool includeResource = false,
}) async {
  query ??= PcoCalendarRequiredApprovalQuery();
  if (getAll) 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);
}