Exemple #1
0
        /// <summary>
        /// Retrieve a list of references (from branch or / and tag) that this commit belongs to
        /// </summary>
        /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
        /// <param name="options">Query Options <see cref="CommitRefsQueryOptions"/>.</param>
        /// <param name="sha">The commit hash or name of a repository branch or tag</param>
        /// <returns></returns>
        public async Task <IList <CommitRef> > GetRefsAsync(ProjectId projectId, string sha, Action <CommitRefsQueryOptions> options)
        {
            var queryOptions = new CommitRefsQueryOptions();

            options?.Invoke(queryOptions);

            string url = _commitRefsQueryBuilder.Build($"projects/{projectId}/repository/commits/{sha}/refs", queryOptions);

            return(await _httpFacade.GetPagedList <CommitRef>(url));
        }
        public void NonDefaultQueryBuilt()
        {
            var sut = new CommitRefsQueryBuilder();

            string query = sut.Build(
                "https://https://gitlab.com/api/v4/projects/1/repository/commits/abc/refs",
                new CommitRefsQueryOptions {
                Type = CommitRefType.Branch
            });

            query.Should().Be("https://https://gitlab.com/api/v4/projects/1/repository/commits/abc/refs?" +
                              "type=branch");
        }