getAllFromServiceTypeAndPlanTemplate static method

Future<PcoCollection<PcoServicesItem>> getAllFromServiceTypeAndPlanTemplate(
  1. String serviceTypeId,
  2. String planTemplateId, {
  3. String? id,
  4. PcoServicesItemQuery? query,
  5. bool includeAllRelated = false,
  6. bool includeArrangement = false,
  7. bool includeItemNotes = false,
  8. bool includeItemTimes = false,
  9. bool includeKey = false,
  10. bool includeMedia = false,
  11. bool includeSelectedAttachment = false,
  12. bool includeSong = false,
})

Will get a PcoCollection containing ALL PcoServicesItem objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/plan_templates/$planTemplateId/items

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoServicesItem>>
    getAllFromServiceTypeAndPlanTemplate(
  String serviceTypeId,
  String planTemplateId, {
  String? id,
  PcoServicesItemQuery? query,
  bool includeAllRelated = false,
  bool includeArrangement = false,
  bool includeItemNotes = false,
  bool includeItemTimes = false,
  bool includeKey = false,
  bool includeMedia = false,
  bool includeSelectedAttachment = false,
  bool includeSong = false,
}) async {
  query ??= PcoServicesItemQuery();
  query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoServicesItem.canInclude);
  if (includeArrangement) query.include.add('arrangement');
  if (includeItemNotes) query.include.add('item_notes');
  if (includeItemTimes) query.include.add('item_times');
  if (includeKey) query.include.add('key');
  if (includeMedia) query.include.add('media');
  if (includeSelectedAttachment) query.include.add('selected_attachment');
  if (includeSong) query.include.add('song');
  var url =
      '/services/v2/service_types/$serviceTypeId/plan_templates/$planTemplateId/items';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesItem>(url,
      query: query, apiVersion: kApiVersion);
}