getFromResourceBooking static method

Future<PcoCollection<PcoCalendarEventResourceRequest>> getFromResourceBooking(
  1. String resourceBookingId, {
  2. PcoCalendarEventResourceRequestQuery? query,
  3. bool getAll = false,
  4. bool includeAllRelated = false,
  5. bool includeCreatedBy = false,
  6. bool includeEvent = false,
  7. bool includeResource = false,
  8. bool includeRoomSetup = false,
  9. bool includeUpdatedBy = false,
})

Will get a PcoCollection of PcoCalendarEventResourceRequest objects (expecting one) using a path like this: /calendar/v2/resource_bookings/$resourceBookingId/event_resource_request

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<PcoCalendarEventResourceRequest>>
    getFromResourceBooking(
  String resourceBookingId, {
  PcoCalendarEventResourceRequestQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeCreatedBy = false,
  bool includeEvent = false,
  bool includeResource = false,
  bool includeRoomSetup = false,
  bool includeUpdatedBy = false,
}) async {
  query ??= PcoCalendarEventResourceRequestQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCalendarEventResourceRequest.canInclude);
  if (includeCreatedBy) query.include.add('created_by');
  if (includeEvent) query.include.add('event');
  if (includeResource) query.include.add('resource');
  if (includeRoomSetup) query.include.add('room_setup');
  if (includeUpdatedBy) query.include.add('updated_by');
  var url =
      '/calendar/v2/resource_bookings/$resourceBookingId/event_resource_request';

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