PcoServicesPlanQuery constructor

PcoServicesPlanQuery({
  1. bool includeContributors = false,
  2. bool includeMySchedules = false,
  3. bool includePlanTimes = false,
  4. bool includeSeries = false,
  5. bool includeAllRelated = false,
  6. String? whereCreatedAt,
  7. String? whereId,
  8. String? whereSeriesTitle,
  9. String? whereTitle,
  10. String? whereUpdatedAt,
  11. PcoServicesPlanFilter? filterBy,
  12. PcoServicesPlanOrder? orderBy,
  13. bool reverse = false,
  14. int perPage = 25,
  15. int pageOffset = 0,
  16. Map<String, String> extraParams = const {},
  17. List<PlanningCenterApiWhere>? where,
  18. Iterable<String> filter = const <String>[],
  19. String? order,
  20. Iterable<String> include = const <String>[],
})

Implementation

PcoServicesPlanQuery({
  /// include associated contributors
  /// when true, adds `?include=contributors` to url
  bool includeContributors = false,

  /// include associated my_schedules
  /// when true, adds `?include=my_schedules` to url
  bool includeMySchedules = false,

  /// include associated plan_times
  /// when true, adds `?include=plan_times` to url
  bool includePlanTimes = false,

  /// include associated series
  /// when true, adds `?include=series` to url
  bool includeSeries = false,

  /// when true, adds `?include=contributors,my_schedules,plan_times,series` to url parameters
  bool includeAllRelated = false,

  /// Query by `created_at`
  /// query on a specific created_at, url example: ?where[created_at]=2000-01-01T12:00:00Z
  /// include a prefix of `<`, `<=`, `>`, `>=` to query by comparisons
  String? whereCreatedAt,

  /// Query by `id`
  /// query on a specific id, url example: ?where[id]=primary_key
  /// include a prefix of `<`, `<=`, `>`, `>=` to query by comparisons
  String? whereId,

  /// Query by `series_title`
  /// query on a specific series_title, url example: ?where[series_title]=string
  /// include a prefix of `<`, `<=`, `>`, `>=` to query by comparisons
  String? whereSeriesTitle,

  /// Query by `title`
  /// query on a specific title, url example: ?where[title]=string
  /// include a prefix of `<`, `<=`, `>`, `>=` to query by comparisons
  String? whereTitle,

  /// Query by `updated_at`
  /// query on a specific updated_at, url example: ?where[updated_at]=2000-01-01T12:00:00Z
  /// include a prefix of `<`, `<=`, `>`, `>=` to query by comparisons
  String? whereUpdatedAt,
  PcoServicesPlanFilter? filterBy,
  PcoServicesPlanOrder? orderBy,

  /// reverse the ordering
  bool reverse = false,

  // direct access to super class params
  super.perPage,
  super.pageOffset,
  super.extraParams,
  super.where,
  super.filter,
  super.order,
  super.include,
}) : super() {
  if (filterBy != null) filter.add(filterString(filterBy));
  if (includeAllRelated || includeContributors) include.add('contributors');
  if (includeAllRelated || includeMySchedules) include.add('my_schedules');
  if (includeAllRelated || includePlanTimes) include.add('plan_times');
  if (includeAllRelated || includeSeries) include.add('series');

  if (whereCreatedAt != null)
    where.add(PlanningCenterApiWhere.parse('created_at', whereCreatedAt));
  if (whereId != null) where.add(PlanningCenterApiWhere.parse('id', whereId));
  if (whereSeriesTitle != null)
    where.add(PlanningCenterApiWhere.parse('series_title', whereSeriesTitle));
  if (whereTitle != null)
    where.add(PlanningCenterApiWhere.parse('title', whereTitle));
  if (whereUpdatedAt != null)
    where.add(PlanningCenterApiWhere.parse('updated_at', whereUpdatedAt));

  if (orderBy != null) order = orderString(orderBy, reverse: reverse);
}