getFromResource static method
Will get a PcoCollection
of PcoCalendarResourceApprovalGroup objects (expecting many)
using a path like this: /calendar/v2/resources/$resourceId/resource_approval_groups
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<PcoCalendarResourceApprovalGroup>>
getFromResource(
String resourceId, {
String? id,
PcoCalendarResourceApprovalGroupQuery? query,
bool getAll = false,
bool includeAllRelated = false,
bool includePeople = false,
bool includeResources = false,
}) async {
query ??= PcoCalendarResourceApprovalGroupQuery();
if (getAll) query.getAll = true;
if (includeAllRelated)
query.include.addAll(PcoCalendarResourceApprovalGroup.canInclude);
if (includePeople) query.include.add('people');
if (includeResources) query.include.add('resources');
var url = '/calendar/v2/resources/$resourceId/resource_approval_groups';
if (id != null) url += '/$id';
return PcoCollection.fromApiCall<PcoCalendarResourceApprovalGroup>(url,
query: query, apiVersion: kApiVersion);
}