13
13
*/
14
14
package com .google .cloud .errorreporting .spi .v1beta1 ;
15
15
16
- import com .google .api .gax .core .PageAccessor ;
16
+ import com .google .api .gax .core .PagedListResponse ;
17
17
import com .google .api .gax .grpc .ApiCallable ;
18
18
import com .google .api .gax .protobuf .PathTemplate ;
19
19
import com .google .devtools .clouderrorreporting .v1beta1 .DeleteEventsRequest ;
@@ -93,10 +93,14 @@ public class ErrorStatsServiceApi implements AutoCloseable {
93
93
private final List <AutoCloseable > closeables = new ArrayList <>();
94
94
95
95
private final ApiCallable <ListGroupStatsRequest , ListGroupStatsResponse > listGroupStatsCallable ;
96
- private final ApiCallable <ListGroupStatsRequest , PageAccessor <ErrorGroupStats >>
96
+ private final ApiCallable <
97
+ ListGroupStatsRequest ,
98
+ PagedListResponse <ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >>
97
99
listGroupStatsPagedCallable ;
98
100
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 ;
100
104
private final ApiCallable <DeleteEventsRequest , DeleteEventsResponse > deleteEventsCallable ;
101
105
102
106
public final ErrorStatsServiceSettings getSettings () {
@@ -190,7 +194,7 @@ public void close() throws IOException {
190
194
* try (ErrorStatsServiceApi errorStatsServiceApi = ErrorStatsServiceApi.create()) {
191
195
* String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
192
196
* QueryTimeRange timeRange = QueryTimeRange.newBuilder().build();
193
- * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(formattedProjectName, timeRange)) {
197
+ * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(formattedProjectName, timeRange).iterateAllElements() ) {
194
198
* // doThingsWith(element);
195
199
* }
196
200
* }
@@ -208,8 +212,8 @@ public void close() throws IOException {
208
212
* higher response times or in returning incomplete results.
209
213
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
210
214
*/
211
- public final PageAccessor < ErrorGroupStats > listGroupStats (
212
- String projectName , QueryTimeRange timeRange ) {
215
+ public final PagedListResponse < ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >
216
+ listGroupStats ( String projectName , QueryTimeRange timeRange ) {
213
217
PROJECT_PATH_TEMPLATE .validate (projectName , "listGroupStats" );
214
218
ListGroupStatsRequest request =
215
219
ListGroupStatsRequest .newBuilder ()
@@ -232,7 +236,7 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(
232
236
* .setProjectName(formattedProjectName)
233
237
* .setTimeRange(timeRange)
234
238
* .build();
235
- * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(request)) {
239
+ * for (ErrorGroupStats element : errorStatsServiceApi.listGroupStats(request).iterateAllElements() ) {
236
240
* // doThingsWith(element);
237
241
* }
238
242
* }
@@ -241,7 +245,8 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(
241
245
* @param request The request object containing all of the parameters for the API call.
242
246
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
243
247
*/
244
- public final PageAccessor <ErrorGroupStats > listGroupStats (ListGroupStatsRequest request ) {
248
+ public final PagedListResponse <ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >
249
+ listGroupStats (ListGroupStatsRequest request ) {
245
250
return listGroupStatsPagedCallable ().call (request );
246
251
}
247
252
@@ -258,15 +263,17 @@ public final PageAccessor<ErrorGroupStats> listGroupStats(ListGroupStatsRequest
258
263
* .setProjectName(formattedProjectName)
259
264
* .setTimeRange(timeRange)
260
265
* .build();
261
- * ListenableFuture<PageAccessor <ErrorGroupStats>> future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
266
+ * ListenableFuture<PagedListResponse <ListGroupStatsRequest,ListGroupStatsResponse, ErrorGroupStats>> future = errorStatsServiceApi.listGroupStatsPagedCallable().futureCall(request);
262
267
* // Do something
263
- * for (ErrorGroupStats element : future.get()) {
268
+ * for (ErrorGroupStats element : future.get().iterateAllElements() ) {
264
269
* // doThingsWith(element);
265
270
* }
266
271
* }
267
272
* </code></pre>
268
273
*/
269
- public final ApiCallable <ListGroupStatsRequest , PageAccessor <ErrorGroupStats >>
274
+ public final ApiCallable <
275
+ ListGroupStatsRequest ,
276
+ PagedListResponse <ListGroupStatsRequest , ListGroupStatsResponse , ErrorGroupStats >>
270
277
listGroupStatsPagedCallable () {
271
278
return listGroupStatsPagedCallable ;
272
279
}
@@ -312,7 +319,7 @@ public final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGrou
312
319
* try (ErrorStatsServiceApi errorStatsServiceApi = ErrorStatsServiceApi.create()) {
313
320
* String formattedProjectName = ErrorStatsServiceApi.formatProjectName("[PROJECT]");
314
321
* String groupId = "";
315
- * for (ErrorEvent element : errorStatsServiceApi.listEvents(formattedProjectName, groupId)) {
322
+ * for (ErrorEvent element : errorStatsServiceApi.listEvents(formattedProjectName, groupId).iterateAllElements() ) {
316
323
* // doThingsWith(element);
317
324
* }
318
325
* }
@@ -325,7 +332,8 @@ public final ApiCallable<ListGroupStatsRequest, ListGroupStatsResponse> listGrou
325
332
* @param groupId [Required] The group for which events shall be returned.
326
333
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
327
334
*/
328
- public final PageAccessor <ErrorEvent > listEvents (String projectName , String groupId ) {
335
+ public final PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent > listEvents (
336
+ String projectName , String groupId ) {
329
337
PROJECT_PATH_TEMPLATE .validate (projectName , "listEvents" );
330
338
ListEventsRequest request =
331
339
ListEventsRequest .newBuilder ().setProjectName (projectName ).setGroupId (groupId ).build ();
@@ -345,7 +353,7 @@ public final PageAccessor<ErrorEvent> listEvents(String projectName, String grou
345
353
* .setProjectName(formattedProjectName)
346
354
* .setGroupId(groupId)
347
355
* .build();
348
- * for (ErrorEvent element : errorStatsServiceApi.listEvents(request)) {
356
+ * for (ErrorEvent element : errorStatsServiceApi.listEvents(request).iterateAllElements() ) {
349
357
* // doThingsWith(element);
350
358
* }
351
359
* }
@@ -354,7 +362,8 @@ public final PageAccessor<ErrorEvent> listEvents(String projectName, String grou
354
362
* @param request The request object containing all of the parameters for the API call.
355
363
* @throws com.google.api.gax.grpc.ApiException if the remote call fails
356
364
*/
357
- public final PageAccessor <ErrorEvent > listEvents (ListEventsRequest request ) {
365
+ public final PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent > listEvents (
366
+ ListEventsRequest request ) {
358
367
return listEventsPagedCallable ().call (request );
359
368
}
360
369
@@ -371,15 +380,17 @@ public final PageAccessor<ErrorEvent> listEvents(ListEventsRequest request) {
371
380
* .setProjectName(formattedProjectName)
372
381
* .setGroupId(groupId)
373
382
* .build();
374
- * ListenableFuture<PageAccessor <ErrorEvent>> future = errorStatsServiceApi.listEventsPagedCallable().futureCall(request);
383
+ * ListenableFuture<PagedListResponse <ListEventsRequest,ListEventsResponse, ErrorEvent>> future = errorStatsServiceApi.listEventsPagedCallable().futureCall(request);
375
384
* // Do something
376
- * for (ErrorEvent element : future.get()) {
385
+ * for (ErrorEvent element : future.get().iterateAllElements() ) {
377
386
* // doThingsWith(element);
378
387
* }
379
388
* }
380
389
* </code></pre>
381
390
*/
382
- public final ApiCallable <ListEventsRequest , PageAccessor <ErrorEvent >> listEventsPagedCallable () {
391
+ public final ApiCallable <
392
+ ListEventsRequest , PagedListResponse <ListEventsRequest , ListEventsResponse , ErrorEvent >>
393
+ listEventsPagedCallable () {
383
394
return listEventsPagedCallable ;
384
395
}
385
396
0 commit comments