getFromResourceBooking static method
Will get a PcoCollection
of PcoCalendarResource objects (expecting many)
using a path like this: /calendar/v2/resource_bookings/$resourceBookingId/resource
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<PcoCalendarResource>> getFromResourceBooking(
String resourceBookingId, {
String? id,
PcoCalendarResourceQuery? query,
bool getAll = false,
bool includeAllRelated = false,
bool includeResourceApprovalGroups = false,
bool includeResourceFolder = false,
bool includeResourceQuestions = false,
bool includeRoomSetups = false,
}) async {
query ??= PcoCalendarResourceQuery();
if (getAll) query.getAll = true;
if (includeAllRelated) query.include.addAll(PcoCalendarResource.canInclude);
if (includeResourceApprovalGroups)
query.include.add('resource_approval_groups');
if (includeResourceFolder) query.include.add('resource_folder');
if (includeResourceQuestions) query.include.add('resource_questions');
if (includeRoomSetups) query.include.add('room_setups');
var url = '/calendar/v2/resource_bookings/$resourceBookingId/resource';
if (id != null) url += '/$id';
return PcoCollection.fromApiCall<PcoCalendarResource>(url,
query: query, apiVersion: kApiVersion);
}