GithubSource class
Namespace: Velopack.Sources
Retrieves available releases from a GitHub repository.
public class GithubSource : GitBase<GithubRelease>, IUpdateSource
Inherits: GitBase<GithubRelease>
Implements: IUpdateSource
Constructors
| Constructor | Summary |
|---|---|
GithubSource | Retrieves 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
| Name | Type | Description |
|---|---|---|
repoUrl | string | The URL of the GitHub repository to download releases from (e.g. https://github.com/myuser/myrepo) |
accessToken | string | The 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. |
prerelease | bool | If true, pre-releases will be also be searched / downloaded. If false, only stable releases will be considered. |
downloader | IFileDownloader | The file downloader used to perform HTTP requests. |
Properties
| Property | Summary |
|---|---|
Authorization |
Authorization
protected override (string Name, string Value)? Authorization { get; }
Methods
| Method | Summary |
|---|---|
GetReleases | Retrieves a list of GithubRelease from the current repository. |
GetAssetUrlFromName | Given a GithubRelease and an asset filename (eg. 'RELEASES') this |
GetApiBaseUrl | Given 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
| Name | Type | Description |
|---|---|---|
includePrereleases | bool |
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
| Name | Type | Description |
|---|---|---|
release | GithubRelease | |
assetName | string |
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
| Name | Type | Description |
|---|---|---|
repoUrl | Uri |
Returns Uri
Generated from Velopack 1.1.1