/// <summary>
        /// Get a list of all visible projects for authenticated user.
        /// When accessed without authentication, only public projects are returned.
        /// </summary>
        /// <param name="options">Query options.</param>
        public async Task <IList <Project> > GetAsync(Action <ProjectQueryOptions> options = null)
        {
            var queryOptions = new ProjectQueryOptions();

            options?.Invoke(queryOptions);

            string url = _queryBuilder.Build("projects", queryOptions);

            return(await _httpFacade.GetPagedList <Project>(url));
        }
Example #2
0
        public void NonDefaultQueryBuilt()
        {
            var sut = new ProjectsQueryBuilder();

            string query = sut.Build(
                "https://gitlab.com/api/v4/projects",
                new ProjectQueryOptions
            {
                UserId                   = "1",
                Archived                 = true,
                Visibility               = QueryProjectVisibilityLevel.Internal,
                Order                    = ProjectsOrder.UpdatedAt,
                SortOrder                = SortOrder.Ascending,
                Filter                   = "filter",
                Simple                   = true,
                Owned                    = true,
                IsMemberOf               = true,
                Starred                  = true,
                IncludeStatistics        = true,
                WithIssuesEnabled        = true,
                WithMergeRequestsEnabled = true
            });

            query.Should().Be("https://gitlab.com/api/v4/projects?" +
                              "user_id=1&" +
                              "archived=true&" +
                              "visibility=internal&" +
                              "order_by=updated_at&" +
                              "sort=asc&" +
                              "search=filter&" +
                              "simple=true&" +
                              "owned=true&" +
                              "membership=true&" +
                              "starred=true&" +
                              "statistics=true&" +
                              "with_issues_enabled=true&" +
                              "with_merge_requests_enabled=true");
        }