示例#1
0
        public AsyncPageable <Models.Build> ListBuildsAsync(
            string buildNumber                  = default,
            int?channelId                       = default,
            string commit                       = default,
            bool?loadCollections                = default,
            DateTimeOffset?notAfter             = default,
            DateTimeOffset?notBefore            = default,
            string repository                   = default,
            CancellationToken cancellationToken = default
            )
        {
            async IAsyncEnumerable <Page <Models.Build> > GetPages(string _continueToken, int?_pageSizeHint)
            {
                int?page    = 1;
                int?perPage = _pageSizeHint;

                if (!string.IsNullOrEmpty(_continueToken))
                {
                    page = int.Parse(_continueToken);
                }

                while (true)
                {
                    Page <Models.Build> _page = null;

                    try {
                        _page = await ListBuildsPageAsync(
                            buildNumber,
                            channelId,
                            commit,
                            loadCollections,
                            notAfter,
                            notBefore,
                            page,
                            perPage,
                            repository,
                            cancellationToken
                            ).ConfigureAwait(false);

                        if (_page.Values.Count < 1)
                        {
                            yield break;
                        }
                    }
                    catch (RestApiException e) when(e.Response.Status == 404)
                    {
                        yield break;
                    }

                    yield return(_page);

                    page++;
                }
            }

            return(AsyncPageable.Create(GetPages));
        }
示例#2
0
        public AsyncPageable <Models.Asset> ListAssetsAsync(
            int?buildId        = default,
            bool?loadLocations = default,
            string name        = default,
            bool?nonShipping   = default,
            string version     = default,
            CancellationToken cancellationToken = default
            )
        {
            async IAsyncEnumerable <Page <Models.Asset> > GetPages(string _continueToken, int?_pageSizeHint)
            {
                int?page    = 1;
                int?perPage = _pageSizeHint;

                if (!string.IsNullOrEmpty(_continueToken))
                {
                    page = int.Parse(_continueToken);
                }

                while (true)
                {
                    Page <Models.Asset> _page = null;

                    try {
                        _page = await ListAssetsPageAsync(
                            buildId,
                            loadLocations,
                            name,
                            nonShipping,
                            page,
                            perPage,
                            version,
                            cancellationToken
                            ).ConfigureAwait(false);

                        if (_page.Values.Count < 1)
                        {
                            yield break;
                        }
                    }
                    catch (RestApiException e) when(e.Response.Status == 404)
                    {
                        yield break;
                    }

                    yield return(_page);

                    page++;
                }
            }

            return(AsyncPageable.Create(GetPages));
        }
示例#3
0
        public AsyncPageable <Models.RepositoryHistoryItem> GetHistoryAsync(
            string branch     = default,
            string repository = default,
            CancellationToken cancellationToken = default
            )
        {
            async IAsyncEnumerable <Page <Models.RepositoryHistoryItem> > GetPages(string _continueToken, int?_pageSizeHint)
            {
                int?page    = 1;
                int?perPage = _pageSizeHint;

                if (!string.IsNullOrEmpty(_continueToken))
                {
                    page = int.Parse(_continueToken);
                }

                while (true)
                {
                    Page <Models.RepositoryHistoryItem> _page = null;

                    try {
                        _page = await GetHistoryPageAsync(
                            branch,
                            page,
                            perPage,
                            repository,
                            cancellationToken
                            ).ConfigureAwait(false);

                        if (_page.Values.Count < 1)
                        {
                            yield break;
                        }
                    }
                    catch (RestApiException e) when(e.Response.Status == 404)
                    {
                        yield break;
                    }

                    yield return(_page);

                    page++;
                }
            }

            return(AsyncPageable.Create(GetPages));
        }