getFromResource static method

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

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

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<PcoCalendarResourceQuestion>> getFromResource(
  String resourceId, {
  String? id,
  PcoCalendarResourceQuestionQuery? query,
  bool getAll = false,
}) async {
  query ??= PcoCalendarResourceQuestionQuery();
  if (getAll) query.getAll = true;

  var url = '/calendar/v2/resources/$resourceId/resource_questions';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCalendarResourceQuestion>(url,
      query: query, apiVersion: kApiVersion);
}