1313 */
1414package com .google .cloud .errorreporting .spi .v1beta1 ;
1515
16- import com .google .api .gax .core .PageAccessor ;
16+ import com .google .api .gax .core .PagedListResponse ;
1717import com .google .api .gax .grpc .ApiCallable ;
1818import com .google .api .gax .protobuf .PathTemplate ;
1919import com .google .devtools .clouderrorreporting .v1beta1 .DeleteEventsRequest ;
@@ -93,10 +93,14 @@ public class ErrorStatsServiceApi implements AutoCloseable {
9393 private final List <AutoCloseable > closeables = new ArrayList <>();
9494
9595 private final ApiCallable <ListGroupStatsRequest , ListGroupStatsResponse > listGroupStatsCallable ;
96- private final ApiCallable <ListGroupStatsRequest , PageAccessor <ErrorGroupStats >>
96+ private final ApiCallable <
97+ ListGroupStatsRequest ,
98+ PagedListResponse <ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >>
9799 listGroupStatsPagedCallable ;
98100 private final ApiCallable <ListEventsRequest , ListEventsResponse > listEventsCallable ;
99- private final ApiCallable <ListEventsRequest , PageAccessor <ErrorEvent >> listEventsPagedCallable ;
101+ private final ApiCallable <
102+ ListEventsRequest , PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent >>
103+ listEventsPagedCallable ;
100104 private final ApiCallable <DeleteEventsRequest , DeleteEventsResponse > deleteEventsCallable ;
101105
102106 public final ErrorStatsServiceSettings getSettings () {
@@ -190,7 +194,7 @@ public void close() throws IOException {
190194 * try (ErrorStatsServiceApi errorStatsServiceApi = ErrorStatsServiceApi.create()) {
191195 * String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
192196 * QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
193- * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(formattedProjectName, timeRange)) {
197+ * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(formattedProjectName, timeRange).iterateAllElements() ) {
194198 * // doThingsWith(element);
195199 * }
196200 * }
@@ -208,8 +212,8 @@ public void close() throws IOException {
208212 * higher response times or in returning incomplete results.
209213 * @throws com.google.api.gax.grpc.ApiException if the remote call fails
210214 */
211- public final PageAccessor < ErrorGroupStats > listGroupStats (
212- String projectName , QueryTimeRange timeRange ) {
215+ public final PagedListResponse < ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >
216+ listGroupStats ( String projectName , QueryTimeRange timeRange ) {
213217 PROJECT_PATH_TEMPLATE .validate (projectName , "listGroupStats" );
214218 ListGroupStatsRequest request =
215219 ListGroupStatsRequest .newBuilder ()
@@ -232,7 +236,7 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(
232236 * .setProjectName(formattedProjectName)
233237 * .setTimeRange(timeRange)
234238 * .build();
235- * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(request)) {
239+ * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(request).iterateAllElements() ) {
236240 * // doThingsWith(element);
237241 * }
238242 * }
@@ -241,7 +245,8 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(
241245 * @param request The request object containing all of the parameters for the API call.
242246 * @throws com.google.api.gax.grpc.ApiException if the remote call fails
243247 */
244- public final PageAccessor <ErrorGroupStats > listGroupStats (ListGroupStatsRequest request ) {
248+ public final PagedListResponse <ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >
249+ listGroupStats (ListGroupStatsRequest request ) {
245250 return listGroupStatsPagedCallable ().call (request );
246251 }
247252
@@ -258,15 +263,17 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(ListGroupStatsRequest
258263 * .setProjectName(formattedProjectName)
259264 * .setTimeRange(timeRange)
260265 * .build();
261- * ListenableFuture<PageAccessor <ErrorGroupStats>> future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
266+ * ListenableFuture<PagedListResponse <ListGroupStatsRequest,ListGroupStatsResponse, ErrorGroupStats>> future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
262267 * // Do something
263- * for (ErrorGroupStats element : future.get()) {
268+ * for (ErrorGroupStats element : future.get().iterateAllElements() ) {
264269 * // doThingsWith(element);
265270 * }
266271 * }
267272 * </code></pre>
268273 */
269- public final ApiCallable <ListGroupStatsRequest , PageAccessor <ErrorGroupStats >>
274+ public final ApiCallable <
275+ ListGroupStatsRequest ,
276+ PagedListResponse <ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >>
270277 listGroupStatsPagedCallable () {
271278 return listGroupStatsPagedCallable ;
272279 }
@@ -312,7 +319,7 @@ public final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGrou
312319 * try (ErrorStatsServiceApi errorStatsServiceApi = ErrorStatsServiceApi.create()) {
313320 * String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
314321 * String groupId = "";
315- * for (ErrorEvent element : errorStatsServiceApi.listEvents(formattedProjectName, groupId)) {
322+ * for (ErrorEvent element : errorStatsServiceApi.listEvents(formattedProjectName, groupId).iterateAllElements() ) {
316323 * // doThingsWith(element);
317324 * }
318325 * }
@@ -325,7 +332,8 @@ public final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGrou
325332 * @param groupId [Required] The group for which events shall be returned.
326333 * @throws com.google.api.gax.grpc.ApiException if the remote call fails
327334 */
328- public final PageAccessor <ErrorEvent > listEvents (String projectName , String groupId ) {
335+ public final PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent > listEvents (
336+ String projectName , String groupId ) {
329337 PROJECT_PATH_TEMPLATE .validate (projectName , "listEvents" );
330338 ListEventsRequest request =
331339 ListEventsRequest .newBuilder ().setProjectName (projectName ).setGroupId (groupId ).build ();
@@ -345,7 +353,7 @@ public final PageAccessor<ErrorEvent> listEvents(String projectName, String grou
345353 * .setProjectName(formattedProjectName)
346354 * .setGroupId(groupId)
347355 * .build();
348- * for (ErrorEvent element : errorStatsServiceApi.listEvents(request)) {
356+ * for (ErrorEvent element : errorStatsServiceApi.listEvents(request).iterateAllElements() ) {
349357 * // doThingsWith(element);
350358 * }
351359 * }
@@ -354,7 +362,8 @@ public final PageAccessor<ErrorEvent> listEvents(String projectName, String grou
354362 * @param request The request object containing all of the parameters for the API call.
355363 * @throws com.google.api.gax.grpc.ApiException if the remote call fails
356364 */
357- public final PageAccessor <ErrorEvent > listEvents (ListEventsRequest request ) {
365+ public final PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent > listEvents (
366+ ListEventsRequest request ) {
358367 return listEventsPagedCallable ().call (request );
359368 }
360369
@@ -371,15 +380,17 @@ public final PageAccessor<ErrorEvent> listEvents(ListEventsRequest request) {
371380 * .setProjectName(formattedProjectName)
372381 * .setGroupId(groupId)
373382 * .build();
374- * ListenableFuture<PageAccessor <ErrorEvent>> future = errorStatsServiceApi.listEventsPagedCallable().futureCall(request);
383+ * ListenableFuture<PagedListResponse <ListEventsRequest,ListEventsResponse, ErrorEvent>> future = errorStatsServiceApi.listEventsPagedCallable().futureCall(request);
375384 * // Do something
376- * for (ErrorEvent element : future.get()) {
385+ * for (ErrorEvent element : future.get().iterateAllElements() ) {
377386 * // doThingsWith(element);
378387 * }
379388 * }
380389 * </code></pre>
381390 */
382- public final ApiCallable <ListEventsRequest , PageAccessor <ErrorEvent >> listEventsPagedCallable () {
391+ public final ApiCallable <
392+ ListEventsRequest , PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent >>
393+ listEventsPagedCallable () {
383394 return listEventsPagedCallable ;
384395 }
385396
0 commit comments