getLastScheduledItemFromSong static method

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

Will get a PcoCollection of PcoServicesItem objects (expecting one) using a path like this: /services/v2/songs/$songId/last_scheduled_item

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<PcoServicesItem>> getLastScheduledItemFromSong(
  String songId, {
  PcoServicesItemQuery? query,
  bool getAll = false,
  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();
  if (getAll) 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/songs/$songId/last_scheduled_item';

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