Skip to main content

GithubSource class

Namespace: Velopack.Sources

Retrieves available releases from a GitHub repository.

public class GithubSource : GitBase<GithubRelease>, IUpdateSource

Inherits: GitBase<GithubRelease>
Implements: IUpdateSource

Constructors

ConstructorSummary
GithubSourceRetrieves available releases from a GitHub repository.

GithubSource(repoUrl, accessToken, prerelease, downloader)

public GithubSource(string repoUrl, string? accessToken, bool prerelease, IFileDownloader? downloader = null)

Retrieves available releases from a GitHub repository.

Parameters

NameTypeDescription
repoUrlstringThe URL of the GitHub repository to download releases from
(e.g. https://github.com/myuser/myrepo)
accessTokenstringThe GitHub access token to use with the request to download releases.
If left empty, the GitHub rate limit for unauthenticated requests allows
for up to 60 requests per hour, limited by IP address.
prereleaseboolIf true, pre-releases will be also be searched / downloaded. If false, only
stable releases will be considered.
downloaderIFileDownloaderThe file downloader used to perform HTTP requests.

Properties

PropertySummary
Authorization

Authorization

protected override (string Name, string Value)? Authorization { get; }

Methods

MethodSummary
GetReleasesRetrieves a list of GithubRelease from the current repository.
GetAssetUrlFromNameGiven a GithubRelease and an asset filename (eg. 'RELEASES') this
GetApiBaseUrlGiven a repository URL (e.g. https://github.com/myuser/myrepo) this function

GetReleases(includePrereleases)

protected override Task<GithubRelease[]> GetReleases(bool includePrereleases)

Retrieves a list of GithubRelease from the current repository.

Parameters

NameTypeDescription
includePrereleasesbool

Returns Task<GithubRelease[]>

GetAssetUrlFromName(release, assetName)

protected override string GetAssetUrlFromName(GithubRelease release, string assetName)

Given a GithubRelease and an asset filename (eg. 'RELEASES') this function will return either BrowserDownloadUrl or Url, depending whether an access token is available or not. Throws if the specified release has no matching assets.

Parameters

NameTypeDescription
releaseGithubRelease
assetNamestring

Returns string

GetApiBaseUrl(repoUrl)

protected virtual Uri GetApiBaseUrl(Uri repoUrl)

Given a repository URL (e.g. https://github.com/myuser/myrepo) this function returns the API base for performing requests. (eg. "https://api.github.com/" or http://internal.github.server.local/api/v3)

Parameters

NameTypeDescription
repoUrlUri

Returns Uri


Generated from Velopack 1.1.1