/// <summary> /// Returns a [cursor-paginated](#api-usage-cursor-pagination) list of /// your events. /// </summary> /// <param name="request">An optional `EventListRequest` representing the query parameters for this list request.</param> /// <param name="customiseRequestMessage">An optional `RequestSettings` allowing you to configure the request</param> /// <returns>A set of event resources</returns> public Task <EventListResponse> ListAsync(EventListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new EventListRequest(); var urlParams = new List <KeyValuePair <string, object> > { }; return(_goCardlessClient.ExecuteAsync <EventListResponse>("GET", "/events", urlParams, request, null, null, customiseRequestMessage)); }
/// <summary> /// Get a lazily enumerated list of events. /// This acts like the #list method, but paginates for you automatically. /// </summary> public IEnumerable <Task <IReadOnlyList <Event> > > AllAsync(EventListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new EventListRequest(); return(new TaskEnumerable <IReadOnlyList <Event>, string>(async after => { request.After = after; var list = await this.ListAsync(request, customiseRequestMessage); return Tuple.Create(list.Events, list.Meta?.Cursors?.After); })); }
/// <summary> /// Get a lazily enumerated list of events. /// This acts like the #list method, but paginates for you automatically. /// </summary> public IEnumerable <Event> All(EventListRequest request = null, RequestSettings customiseRequestMessage = null) { request = request ?? new EventListRequest(); string cursor = null; do { request.After = cursor; var result = Task.Run(() => ListAsync(request, customiseRequestMessage)).Result; foreach (var item in result.Events) { yield return(item); } cursor = result.Meta?.Cursors?.After; } while (cursor != null); }