You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Initialize an `AsyncGraphQLQueryPager` that outputs a `PaginationOutput<InitialQuery, PaginatedQuery>`.
60
+
/// - Parameters:
61
+
/// - client: Apollo client type
62
+
/// - initialQuery: The query to call for the first page of pagination. May be a separate type of query than the pagination query.
63
+
/// - watcherDispatchQueue: The queue that the underlying `GraphQLQueryWatcher`s respond on. Defaults to `main`.
64
+
/// - extractPageInfo: A user-input closure that instructs the pager on how to extract `P`, a `PaginationInfo` type, from the `Data` of either the `InitialQuery` or `PaginatedQuery`.
65
+
/// - pageResolver: A user-input closure that instructs the pager on how to create a new `PaginatedQuery` given a `PaginationInfo` and a `PaginationDirection`.
136
66
publicconvenienceinit<
137
67
P:PaginationInfo,
138
68
InitialQuery:GraphQLQuery,
@@ -151,11 +81,17 @@ public class AsyncGraphQLQueryPager<Model>: Publisher {
151
81
extractPageInfo: extractPageInfo,
152
82
pageResolver: pageResolver
153
83
)
154
-
self.init(
155
-
pager: pager
156
-
)
84
+
self.init(pager: pager)
157
85
}
158
86
87
+
/// Initialize an `AsyncGraphQLQueryPager` that outputs a user-defined `Model`, the result of the `transform` argument.
88
+
/// - Parameters:
89
+
/// - client: Apollo client type
90
+
/// - initialQuery: The query to call for the first page of pagination. May be a separate type of query than the pagination query.
91
+
/// - watcherDispatchQueue: The queue that the underlying `GraphQLQueryWatcher`s respond on. Defaults to `main`.
92
+
/// - extractPageInfo: A user-input closure that instructs the pager on how to extract `P`, a `PaginationInfo` type, from the `Data` of either the `InitialQuery` or `PaginatedQuery`.
93
+
/// - pageResolver: A user-input closure that instructs the pager on how to create a new `PaginatedQuery` given a `PaginationInfo` and a `PaginationDirection`.
94
+
/// - transform: Transforms the `PaginationOutput` into a `Model` type.
159
95
publicconvenienceinit<
160
96
P:PaginationInfo,
161
97
InitialQuery:GraphQLQuery,
@@ -164,38 +100,23 @@ public class AsyncGraphQLQueryPager<Model>: Publisher {
/// Subscribe to the results of the pager, with the management of the subscriber being stored internally to the `AnyGraphQLQueryPager`.
198
118
/// - Parameter completion: The closure to trigger when new values come in.
119
+
@available(*, deprecated, message:"Will be removed in a future version of ApolloPagination. Use the `Combine` publishers instead. If you need to dispatch to the main thread, make sure to use a `.receive(on: RunLoop.main)` as part of your `Combine` operation.")
/// Loads all pages. Does not output a value until all pages have loaded.
225
146
/// - Parameters:
226
147
/// - fetchFromInitialPage: Pass true to begin loading from the initial page; otherwise pass false. Defaults to `true`. **NOTE**: Loading all pages with this value set to `false` requires that the initial page has already been loaded previously.
227
148
publicfunc loadAll(
@@ -243,30 +164,12 @@ public class AsyncGraphQLQueryPager<Model>: Publisher {
243
164
244
165
/// Resets pagination state and cancels in-flight updates from the pager.
245
166
publicfunc reset()async{
246
-
await pager.reset()
167
+
await pager.reset()
247
168
}
248
169
249
170
publicfunc receive<S>(
250
171
subscriber:S
251
-
)where S:Subscriber, Never ==S.Failure,Result<(Model,UpdateSource),anyError>==S.Input{
172
+
)where S:Subscriber, Never ==S.Failure,Result<Model,anyError>==S.Input{
0 commit comments