PcoCollection<T extends PcoResource> class

PcoCollection represents any response that has one or more items of data from the server. Most requests will return a PcoCollection.

Information like endpoint and apiVersion will be preserved so future queries can be generated from existing collections. Also, meta preserves the meta section of the ApiResponse, query preserves the original query for the collection, and response preserves the full response from the API Request. Finally items is a typed list of the response data encapsulated by the appropriate class.

Once you have a PcoCollection, you can load more items (if there are more) by calling nextPage to get a new collection with the next page of data or by calling getMore to extend the current collection with the next page of data.

Constructors

PcoCollection(List<T> items, PlanningCenterApiMeta meta, PlanningCenterApiResponse<PlanningCenterApiData> response, PlanningCenterApiQuery query, String endpoint, String apiVersion)
PcoCollection.fromApiResponse(PlanningCenterApiResponse<PlanningCenterApiData> response, dynamic endpoint, dynamic apiVersion)
we also require the original endpoint and the apiversion so that subsequent requests like getMore and nextPage can be built easily off of this one.
factory

Properties

apiVersion String
final
data List<T>
@Deprecated: use items instead
no setter
endpoint String
final
error PlanningCenterApiError?
no setter
errorMessage String
no setter
firstOrNull → T?
no setter
hashCode int
The hash code for this object.
no setterinherited
hasMore bool
no setter
isError bool
no setter
isSingle bool
no setter
items List<T>
getter/setter pair
meta PlanningCenterApiMeta
getter/setter pair
query PlanningCenterApiQuery
getter/setter pair
response PlanningCenterApiResponse<PlanningCenterApiData>
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getMore() Future<bool>
If a collection has more items available on the server getMore will call nextPage internally, will extend the current data with the the new data and then will update this collection with new query, meta, and response values.
nextPage() Future<PcoCollection<T>>
nextPage will return a new collection representing the next page of data from the server. The page offset is stored in the metadata of the previous response. If the server has no more items, the API will be called with an offset equal to the total count of items as reported by the server on the previous request.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromApiCall<T extends PcoResource>(String endpoint, {PlanningCenterApiQuery? query, required String apiVersion}) Future<PcoCollection<T>>
url, query: query, apiVersion:kApiVersion