PcoCalendarResourceQuery constructor

PcoCalendarResourceQuery({
  1. bool includeResourceApprovalGroups = false,
  2. bool includeResourceFolder = false,
  3. bool includeResourceQuestions = false,
  4. bool includeRoomSetups = false,
  5. bool includeAllRelated = false,
  6. String? whereCreatedAt,
  7. String? whereKind,
  8. String? whereName,
  9. String? wherePathName,
  10. String? whereSerialNumber,
  11. String? whereUpdatedAt,
  12. PcoCalendarResourceFilter? filterBy,
  13. PcoCalendarResourceOrder? orderBy,
  14. bool reverse = false,
  15. int perPage = 25,
  16. int pageOffset = 0,
  17. Map<String, String> extraParams = const {},
  18. List<PlanningCenterApiWhere>? where,
  19. Iterable<String> filter = const <String>[],
  20. String? order,
  21. Iterable<String> include = const <String>[],
})

Implementation

PcoCalendarResourceQuery({
  /// include associated resource_approval_groups
  /// when true, adds `?include=resource_approval_groups` to url
  bool includeResourceApprovalGroups = false,

  /// include associated resource_folder
  /// when true, adds `?include=resource_folder` to url
  bool includeResourceFolder = false,

  /// include associated resource_questions
  /// when true, adds `?include=resource_questions` to url
  bool includeResourceQuestions = false,

  /// include associated room_setups
  /// when true, adds `?include=room_setups` to url
  bool includeRoomSetups = false,

  /// when true, adds `?include=resource_approval_groups,resource_folder,resource_questions,room_setups` 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 `kind`
  /// query on a specific kind, url example: ?where[kind]=string
  /// include a prefix of `<`, `<=`, `>`, `>=` to query by comparisons
  String? whereKind,

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

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

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

  /// 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,
  PcoCalendarResourceFilter? filterBy,
  PcoCalendarResourceOrder? 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 || includeResourceApprovalGroups)
    include.add('resource_approval_groups');
  if (includeAllRelated || includeResourceFolder)
    include.add('resource_folder');
  if (includeAllRelated || includeResourceQuestions)
    include.add('resource_questions');
  if (includeAllRelated || includeRoomSetups) include.add('room_setups');

  if (whereCreatedAt != null)
    where.add(PlanningCenterApiWhere.parse('created_at', whereCreatedAt));
  if (whereKind != null)
    where.add(PlanningCenterApiWhere.parse('kind', whereKind));
  if (whereName != null)
    where.add(PlanningCenterApiWhere.parse('name', whereName));
  if (wherePathName != null)
    where.add(PlanningCenterApiWhere.parse('path_name', wherePathName));
  if (whereSerialNumber != null)
    where.add(
        PlanningCenterApiWhere.parse('serial_number', whereSerialNumber));
  if (whereUpdatedAt != null)
    where.add(PlanningCenterApiWhere.parse('updated_at', whereUpdatedAt));

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