コード例 #1
0
        public override async Task <PagingResponse <TResponse> > GetPageAsync <TResponse>(IRestResource <BitBucketClientContext> resource,
                                                                                          BitBucketClientContext context)
        {
            var url      = this.BuildUri(context, () => resource.GetPagingUrl(context));
            var response = await this.GetAsync(url.Uri).ConfigureAwait(false);

            return(await response.DeserializeAsync <BitBucketPagingResponse <TResponse> >().ConfigureAwait(false));
        }
コード例 #2
0
        public override async Task <IEnumerable <TResponse> > GetAllAsync <TResponse>(IRestResource <BitBucketClientContext> resource,
                                                                                      BitBucketClientContext context)
        {
            var results = new List <TResponse>(200);
            var url     = this.BuildUri(context, () => resource.GetPagingUrl(context));

            var response = await this.GetAsync(url.Uri).ConfigureAwait(false);

            var page = await response.DeserializeAsync <BitBucketPagingResponse <TResponse> >().ConfigureAwait(false);

            results.AddRange(page.Values);

            while (page.Next.HasValue())
            {
                response = await this.GetAsync(page.Next).ConfigureAwait(false);

                page = await response.DeserializeAsync <BitBucketPagingResponse <TResponse> >().ConfigureAwait(false);

                results.AddRange(page.Values);
            }

            return(results);
        }