RepositoryArchiveLink() публичный статический Метод

Returns the Uri for getting an archive of a given repository's contents, in a specific format
public static RepositoryArchiveLink ( long repositoryId, ArchiveFormat archiveFormat, string reference ) : Uri
repositoryId long The Id of the repository
archiveFormat ArchiveFormat The format of the archive. Can be either tarball or zipball
reference string A valid Git reference.
Результат Uri
Пример #1
0
        public Task <string> GetArchiveLink(string owner, string name, ArchiveFormat archiveFormat, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            return(ApiConnection.GetRedirect(ApiUrls.RepositoryArchiveLink(owner, name, archiveFormat, reference)));
        }
        /// <summary>
        /// Get an archive of a given repository's contents, in a specific format
        /// </summary>
        /// <remarks>https://developer.github.com/v3/repos/contents/#get-archive-link</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="archiveFormat">The format of the archive. Can be either tarball or zipball</param>
        /// <param name="reference">A valid Git reference.</param>
        /// <param name="timeout"> Time span until timeout </param>
        public async Task <byte[]> GetArchive(int repositoryId, ArchiveFormat archiveFormat, string reference, TimeSpan timeout)
        {
            Ensure.ArgumentNotNull(reference, "reference");
            Ensure.GreaterThanZero(timeout, "timeout");

            var endpoint = ApiUrls.RepositoryArchiveLink(repositoryId, archiveFormat, reference);

            var response = await Connection.Get <byte[]>(endpoint, timeout).ConfigureAwait(false);

            return(response.Body);
        }
Пример #3
0
        /// <summary>
        /// Get an archive of a given repository's contents, using a specific format and reference
        /// </summary>
        /// <remarks>https://developer.github.com/v3/repos/contents/#get-archive-link</remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="archiveFormat">The format of the archive. Can be either tarball or zipball</param>
        /// <param name="reference">A valid Git reference.</param>
        /// <returns>The binary contents of the archive</returns>
        public async Task <byte[]> GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            var endpoint = ApiUrls.RepositoryArchiveLink(owner, name, archiveFormat, reference);

            var response = await Connection.Get <byte[]>(endpoint, TimeSpan.FromMinutes(60));

            return(response.Body);
        }
Пример #4
0
        /// <summary>
        /// Get an archive of a given repository's contents, in a specific format
        /// </summary>
        /// <remarks>https://developer.github.com/v3/repos/contents/#get-archive-link</remarks>
        /// <param name="owner">The owner of the repository</param>
        /// <param name="name">The name of the repository</param>
        /// <param name="archiveFormat">The format of the archive. Can be either tarball or zipball</param>
        /// <param name="reference">A valid Git reference.</param>
        /// <param name="timeout"> Time span until timeout </param>
        /// <returns>The binary contents of the archive</returns>
        public async Task <byte[]> GetArchive(string owner, string name, ArchiveFormat archiveFormat, string reference, TimeSpan timeout)
        {
            Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
            Ensure.ArgumentNotNullOrEmptyString(name, "name");
            Ensure.GreaterThanZero(timeout, "timeout");

            var endpoint = ApiUrls.RepositoryArchiveLink(owner, name, archiveFormat, reference);

            var response = await Connection.Get <byte[]>(endpoint, timeout);

            return(response.Body);
        }