getWatchablePlansFromSeriesAndPlanAndLive static method

Future<PcoCollection<PcoServicesPlan>> getWatchablePlansFromSeriesAndPlanAndLive(
  1. String seriesId,
  2. String planId,
  3. String liveId, {
  4. PcoServicesPlanQuery? query,
  5. bool getAll = false,
  6. bool includeAllRelated = false,
  7. bool includeContributors = false,
  8. bool includeMySchedules = false,
  9. bool includePlanTimes = false,
  10. bool includeSeries = false,
})

Will get a PcoCollection of PcoServicesPlan objects (expecting one) using a path like this: /services/v2/series/$seriesId/plans/$planId/live/$liveId/watchable_plans

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<PcoServicesPlan>>
    getWatchablePlansFromSeriesAndPlanAndLive(
  String seriesId,
  String planId,
  String liveId, {
  PcoServicesPlanQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeContributors = false,
  bool includeMySchedules = false,
  bool includePlanTimes = false,
  bool includeSeries = false,
}) async {
  query ??= PcoServicesPlanQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoServicesPlan.canInclude);
  if (includeContributors) query.include.add('contributors');
  if (includeMySchedules) query.include.add('my_schedules');
  if (includePlanTimes) query.include.add('plan_times');
  if (includeSeries) query.include.add('series');
  var url =
      '/services/v2/series/$seriesId/plans/$planId/live/$liveId/watchable_plans';

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