Пример #1
0
 /// <summary>
 /// List all events. All GET endpoints which return an object list
 /// support cursor based pagination with pagination information
 /// inside a pagination object. This means that to get all objects,
 /// you need to paginate through the results by always using the id
 /// of the last resource in the list as a starting_after parameter
 /// for the next call. To make it easier, the API will construct
 /// the next call into next_uri together with all the currently
 /// used pagination parameters. You know that you have paginated
 /// all the results when the response’s next_uri is empty.
 /// </summary>
 /// <param name="listOrder">Order of the resources in the response. desc (default), asc</param>
 /// <param name="limit">umber of results per call. Accepted values: 0 - 100. Default 25</param>
 /// <param name="startingAfter">A cursor for use in pagination. starting_after is a resource ID that defines your place in the list.</param>
 /// <param name="endingBefore">A cursor for use in pagination. ending_before is a resource ID that defines your place in the list.</param>
 public virtual Task <PagedResponse <Event> > ListEventsAsync(ListOrder?listOrder = null, int?limit = null, string startingAfter = null, string endingBefore = null, CancellationToken cancellationToken = default)
 {
     return(EventsEndpoint
            .SetQueryParam("order", listOrder?.ToString().ToLower())
            .SetQueryParam("limit", limit)
            .SetQueryParam("starting_after", startingAfter)
            .SetQueryParam("ending_before", endingBefore)
            .GetJsonAsync <PagedResponse <Event> >(cancellationToken));
 }
Пример #2
0
        public async Task <EventsResponse> Events(string clusterId, DateTimeOffset?startTime, DateTimeOffset?endTime, ListOrder?order,
                                                  IEnumerable <ClusterEventType> eventTypes, long?offset, long?limit, CancellationToken cancellationToken = default)
        {
            var request = new EventsRequest
            {
                ClusterId  = clusterId,
                EndTime    = endTime,
                StartTime  = startTime,
                Order      = order,
                EventTypes = eventTypes,
                Limit      = limit,
                Offset     = offset
            };

            var response = await HttpPost <EventsRequest, EventsResponse>(this.HttpClient, "clusters/events", request, cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }