getFromPersonAndAvailableSignup static method

Future<PcoCollection<PcoServicesSignupSheet>> getFromPersonAndAvailableSignup(
  1. String personId,
  2. String availableSignupId, {
  3. String? id,
  4. PcoServicesSignupSheetQuery? query,
  5. bool getAll = false,
  6. bool includeAllRelated = false,
  7. bool includeScheduledPeople = false,
  8. bool includeSignupSheetMetadata = false,
})

Will get a PcoCollection of PcoServicesSignupSheet objects (expecting many) using a path like this: /services/v2/people/$personId/available_signups/$availableSignupId/signup_sheets

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<PcoServicesSignupSheet>>
    getFromPersonAndAvailableSignup(
  String personId,
  String availableSignupId, {
  String? id,
  PcoServicesSignupSheetQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeScheduledPeople = false,
  bool includeSignupSheetMetadata = false,
}) async {
  query ??= PcoServicesSignupSheetQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoServicesSignupSheet.canInclude);
  if (includeScheduledPeople) query.include.add('scheduled_people');
  if (includeSignupSheetMetadata) query.include.add('signup_sheet_metadata');
  var url =
      '/services/v2/people/$personId/available_signups/$availableSignupId/signup_sheets';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesSignupSheet>(url,
      query: query, apiVersion: kApiVersion);
}