fromApiCall<T extends PcoResource> static method

Future<PcoCollection<T>> fromApiCall<T extends PcoResource>(
  1. String endpoint,
  2. {PlanningCenterApiQuery? query,
  3. required String apiVersion}
)

url, query: query, apiVersion:kApiVersion

Implementation

static Future<PcoCollection<T>> fromApiCall<T extends PcoResource>(
    String endpoint,
    {PlanningCenterApiQuery? query,
    required String apiVersion}) async {
  var res = await PlanningCenter.instance
      .call(endpoint, query: query, apiVersion: apiVersion);
  var retval = PcoCollection<T>.fromApiResponse(res, endpoint, apiVersion);
  if (query?.getAll == true) {
    while (query!.getAll && retval.hasMore) {
      await retval.getMore();
    }
  }
  return retval;
}