public static async Task <IList <Event> > FetchAllAsync(this EventsResource.ListRequest listRequest, DateTime?after = null, DateTime?before = null) { listRequest.TimeMin = after; listRequest.TimeMax = before; var pageStreamer = new PageStreamer <Event, EventsResource.ListRequest, Events, string>((request, token) => request.PageToken = token, response => response.NextPageToken, response => response.Items); return(await pageStreamer.FetchAllAsync(listRequest, CancellationToken.None)); }
/// <inheritdoc /> public override Task <IList <Object> > ListAllObjectsAsync( string bucket, string prefix, ListObjectsOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { var initialRequest = CreateListObjectsRequest(bucket, prefix, options); return(s_objectPageStreamer.FetchAllAsync(initialRequest, cancellationToken)); }
/// <summary> /// Asynchronously lists the buckets in a given project, returning the results as a list. /// </summary> /// <remarks> /// This lists all the buckets within a project before the returned task completes. /// This does not support reporting progress, or streaming the results. /// </remarks> /// <param name="projectId">The ID of the project to list the buckets from. Must not be null.</param> /// <param name="options">The options for the operation. May be null, in which case /// defaults will be supplied.</param> /// <param name="cancellationToken">The token to monitor for cancellation requests.</param> /// <returns>A list of buckets within the project.</returns> public Task <IList <Bucket> > ListAllBucketsAsync( string projectId, ListBucketsOptions options = null, CancellationToken cancellationToken = default(CancellationToken)) { Preconditions.CheckNotNull(projectId, nameof(projectId)); var initialRequest = CreateListBucketsRequest(projectId, options); return(s_bucketPageStreamer.FetchAllAsync(initialRequest, cancellationToken)); }
public static async Task <List <Message> > ListAll(this UsersResource.MessagesResource.ListRequest request) { var pageStreamer = new PageStreamer <Message, UsersResource.MessagesResource.ListRequest, ListMessagesResponse, string>( (zRequest, zToken) => zRequest.PageToken = zToken, zResponse => zResponse.NextPageToken, zResponse => zResponse.Messages); var messages = await pageStreamer.FetchAllAsync(request, CancellationToken.None); return(messages.ToList()); }