Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of <see cref="SrcResource"/>.
        /// </summary>
        /// <remarks>
        /// If revision is null a non async request will occurs.
        /// if you want a fullly async experience, you should do yourseulf an explicit call to <see cref="RepositoryResource.GetMainBranchRevisionAsync(CancellationToken)"/>
        /// and then provide the result in the <paramref name="revision"/> parameter.
        /// </remarks>
        /// <param name="RepositoryResource">The parent resource extended by this resource.</param>
        /// <param name="revision">The name of the revision to browse. This may be a commit hash, a branch name, a tag name, or null to target the last commit of the main branch.</param>
        /// <param name="path">An optional path to a sub directory if you want to start to browse somewhere else that at the root path.</param>
        internal SrcResource(RepositoryResource repositoryResource, string revision = null, string path = null)
            : base(repositoryResource, "src/")
        {
            // full build of the SrcPath value is delayed so that when revision is null errors are send
            // only when caller really try to do a request and not when building the resource object
            string BuildSrcPath()
            {
                if (string.IsNullOrEmpty(revision))
                {
                    revision = repositoryResource.GetMainBranchRevision();
                }

                return(UrlHelper.ConcatPathSegments(revision, path).EnsureEndsWith('/'));
            }

            SrcPath = new Lazy <string>(BuildSrcPath);
        }
 public IssuesResource(RepositoryResource repositoryResource)
     : base(repositoryResource, "issues")
 {
 }
 public PullRequestsResource(RepositoryResource repositoryResource)
     : base(repositoryResource, "pullrequests")
 {
 }
 internal CommitResource(
     RepositoryResource repositoryResource, string revision)
     : base(repositoryResource, $"commit/{revision}")
 {
     _commentsResource = new Lazy <CommitCommentsResource>(() => new CommitCommentsResource(this));
 }
Beispiel #5
0
 internal TagsResource(RepositoryResource repositoryResource)
     : base(repositoryResource, "refs/tags/")
 {
 }
 public void Init()
 {
     sharpBucket = TestHelpers.GetV2ClientAuthenticatedWithBasicAuthentication();
      var repositoriesEndPoint = sharpBucket.RepositoriesEndPoint();
      repositoryResource = repositoriesEndPoint.RepositoryResource(ACCOUNT_NAME, REPOSITORY_NAME);
 }
Beispiel #7
0
 internal BranchResource(RepositoryResource repositoryResource)
     : base(repositoryResource, "refs/branches/")
 {
 }