Example #1
0
        public async Task<IPackage> DownloadAsync(Revision revision)
        {
            var request = new GetArchiveLinkRequest(AccountName, RepositoryName, revision, format: ArchiveFormat.Zipball);

            var link = await client.GetArchiveLink(request).ConfigureAwait(false);

            return await ZipPackage.FetchAsync(link, stripFirstLevel: true).ConfigureAwait(false);
        }
Example #2
0
        public async Task<ICommit> GetCommitAsync(Revision revision)
        {
            var commit = await client.GetCommitAsync(AccountName, RepositoryName, revision.Name).ConfigureAwait(false);

            if (commit == null)
            {
                throw new Exception($"The repository '{RepositoryName}' does not have a reference named '{revision.Path}'");
            }

            return commit;
        }
Example #3
0
        public async Task<ICommit> GetCommitAsync(Revision revision)
        {
            var reference = await GetRefAsync(revision.Path).ConfigureAwait(false);

            if (reference == null)
            {
                throw new Exception($"The repository '{RepositoryName}' does not have a reference named '{revision.Path}'");
            }

            return reference.Object.ToCommit();
        }
Example #4
0
 public RepositoryInfo(
     RepositoryProviderId provider,
     string accountName,
     string name,
     Revision? revision)
 {
     Provider = provider;
     AccountName = accountName;
     Name = name;
     Revision = revision;
 }
Example #5
0
        public GetArchiveLinkRequest(string accountName, string repositoryName, Revision revision, ArchiveFormat format = ArchiveFormat.Zipball)
        {
            #region Preconditions

            if (accountName == null)
                throw new ArgumentNullException(nameof(accountName));

            if (repositoryName == null)
                throw new ArgumentNullException(nameof(repositoryName));

            #endregion

            AccountName = accountName;
            RepositoryName = repositoryName;
            Revision = revision;
            Format = format;
        }
Example #6
0
        public async Task<IPackage> DownloadAsync(Revision revision)
        {
            var stream = await client.GetZipStreamAsync(AccountName, RepositoryName, revision.Name).ConfigureAwait(false);

            return ZipPackage.FromStream(stream, stripFirstLevel: true);
        }