Example #1
0
        /// <summary>
        /// Gets the projects.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token.</param>
        /// <returns>
        /// A task.
        /// </returns>
        public override async Task <IEnumerable <IProject> > GetProjectsAsync(CancellationToken cancellationToken)
        {
            var organizations = await _apiClient.GetOrganizationsAsync(cancellationToken).ConfigureAwait(false);

            var projects = new List <Api.Models.Project>();

            foreach (var organization in organizations)
            {
                var page = 1;

                Api.Models.Projects pageable;

                do
                {
                    pageable = await _apiClient.GetProjectsAsync(organization.Id, 50, page, cancellationToken).ConfigureAwait(false);

                    projects.AddRange(pageable.Items);

                    page++;
                }while (!IsLastPage(pageable));
            }

            return(projects.Select(project => new Project(project)).ToArray());
        }
Example #2
0
        /// <summary>
        /// Gets the projects.
        /// </summary>
        /// <param name="cancellationToken">A cancellation token.</param>
        /// <returns>
        /// A task.
        /// </returns>
        public override async Task <IEnumerable <IProject> > GetProjectsAsync(CancellationToken cancellationToken)
        {
            var projects = await _apiClient.GetProjectsAsync(cancellationToken).ConfigureAwait(false);

            return(projects.Select(project => new Project(project)).ToArray());
        }