PcoCollection<T extends PcoResource> class
Null safety
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
insteadread-only - endpoint → String
-
final
- error → PlanningCenterApiError?
-
read-only
- errorMessage → String
-
read-only
- firstOrNull → T?
-
read-only
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- hasMore → bool
-
read-only
- isError → bool
-
read-only
- isSingle → bool
-
read-only
-
items
↔ List<
T> -
read / write
- meta ↔ PlanningCenterApiMeta
-
read / write
- query ↔ PlanningCenterApiQuery
-
read / write
-
response
↔ PlanningCenterApiResponse<
PlanningCenterApiData> -
read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
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 non-existent 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