Beispiel #1
0
        /// <summary>
        /// Creates a new instance of the GitLab API v4 client pointing to the specified hostUrl.
        /// </summary>
        /// <param name="hostUrl">Host address of GitLab instance. For example https://gitlab.example.com or https://gitlab.example.com/api/v4/ </param>
        /// <param name="authenticationToken">Personal access token. Obtained from GitLab profile settings.</param>
        /// <param name="httpMessageHandler">Optional handler for HTTP messages. Used for SSL pinning or canceling validation for example.</param>
        public GitLabClient(string hostUrl, string authenticationToken = "", HttpMessageHandler httpMessageHandler = null)
        {
            Guard.NotEmpty(hostUrl, nameof(hostUrl));
            Guard.NotNull(authenticationToken, nameof(authenticationToken));
            HostUrl = FixBaseUrl(hostUrl);

            var jsonSerializer = new RequestsJsonSerializer();

            _httpFacade = new GitLabHttpFacade(
                HostUrl,
                jsonSerializer,
                authenticationToken,
                httpMessageHandler);

            var projectQueryBuilder                   = new ProjectsQueryBuilder();
            var projectIssueNotesQueryBuilder         = new ProjectIssueNotesQueryBuilder();
            var projectMergeRequestsNotesQueryBuilder = new ProjectMergeRequestsNotesQueryBuilder();
            var issuesQueryBuilder               = new IssuesQueryBuilder();
            var mergeRequestsQueryBuilder        = new MergeRequestsQueryBuilder();
            var projectMilestonesQueryBuilder    = new MilestonesQueryBuilder();
            var projectMergeRequestsQueryBuilder = new ProjectMergeRequestsQueryBuilder();
            var groupsQueryBuilder               = new GroupsQueryBuilder();
            var groupLabelsQueryBuilder          = new GroupLabelsQueryBuilder();
            var projectsGroupsQueryBuilder       = new ProjectsGroupQueryBuilder();
            var branchQueryBuilder               = new BranchQueryBuilder();
            var releaseQueryBuilder              = new ReleaseQueryBuilder();
            var tagQueryBuilder            = new TagQueryBuilder();
            var commitQueryBuilder         = new CommitQueryBuilder();
            var commitRefsQueryBuilder     = new CommitRefsQueryBuilder();
            var commitStatusesQueryBuilder = new CommitStatusesQueryBuilder();
            var pipelineQueryBuilder       = new PipelineQueryBuilder();
            var treeQueryBuilder           = new TreeQueryBuilder();
            var jobQueryBuilder            = new JobQueryBuilder();
            var toDoListBuilder            = new ToDoListQueryBuilder();
            var environmentQueryBuilder    = new EnvironmentQueryBuilder();

            Issues        = new IssuesClient(_httpFacade, issuesQueryBuilder, projectIssueNotesQueryBuilder);
            Uploads       = new UploadsClient(_httpFacade);
            MergeRequests = new MergeRequestsClient(_httpFacade, mergeRequestsQueryBuilder, projectMergeRequestsQueryBuilder, projectMergeRequestsNotesQueryBuilder);
            Projects      = new ProjectsClient(_httpFacade, projectQueryBuilder, projectMilestonesQueryBuilder, jobQueryBuilder);
            Users         = new UsersClient(_httpFacade);
            Groups        = new GroupsClient(_httpFacade, groupsQueryBuilder, projectsGroupsQueryBuilder, projectMilestonesQueryBuilder, groupLabelsQueryBuilder);
            Branches      = new BranchClient(_httpFacade, branchQueryBuilder);
            Releases      = new ReleaseClient(_httpFacade, releaseQueryBuilder);
            Tags          = new TagClient(_httpFacade, tagQueryBuilder);
            Webhooks      = new WebhookClient(_httpFacade);
            Commits       = new CommitsClient(_httpFacade, commitQueryBuilder, commitRefsQueryBuilder, commitStatusesQueryBuilder);
            Markdown      = new MarkdownClient(_httpFacade);
            Pipelines     = new PipelineClient(_httpFacade, pipelineQueryBuilder, jobQueryBuilder);
            Trees         = new TreesClient(_httpFacade, treeQueryBuilder);
            Files         = new FilesClient(_httpFacade);
            Runners       = new RunnersClient(_httpFacade);
            ToDoList      = new ToDoListClient(_httpFacade, toDoListBuilder);
            Connection    = new ConnectionClient(_httpFacade);
            Environments  = new EnvironmentClient(_httpFacade, environmentQueryBuilder, jobQueryBuilder);
        }
Beispiel #2
0
 internal EnvironmentClient(GitLabHttpFacade httpFacade, EnvironmentQueryBuilder queryBuilder, JobQueryBuilder jobQueryBuilder)
 {
     _httpFacade      = httpFacade;
     _queryBuilder    = queryBuilder;
     _jobQueryBuilder = jobQueryBuilder;
 }