TSDuck v3.40-4033
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::GitHubRelease Class Reference

This class holds information from GitHub about a release of a project. More...

#include <tsGitHubRelease.h>

Classes

struct  Asset
 Description of an "asset" of the release (typically a binary installer). More...
 

Public Types

using AssetList = std::list< Asset >
 List of assets.
 

Public Member Functions

 GitHubRelease ()=default
 Default constructor.
 
 GitHubRelease (const UString &owner, const UString &repository, const UString &tag=UString(), Report &report=(ts::CerrReport::Instance()))
 Constructor with download of the version information from GitHub.
 
int assetDownloadCount () const
 Get the number of downloads for the assets of the release.
 
bool downloadInfo (const UString &owner, const UString &repository, const UString &tag=UString(), Report &report=(ts::CerrReport::Instance()))
 Download the version information from GitHub.
 
void getAssets (AssetList &assets) const
 Get the list of all assets for the release.
 
void getPlatformAssets (AssetList &assets) const
 Get the list of assets for the current platform.
 
bool isValid () const
 Check if the content of this object is a valid release description.
 
Time publishDate () const
 Get the publish date of the release.
 
UString sourceFileName () const
 Get an appropriate file name to download sourceURL().
 
UString sourceTarURL () const
 Get the URL of the source tarball (tgz file) for the release.
 
UString sourceURL () const
 Get the most appropriate URL of the source archive for the release.
 
UString sourceZipURL () const
 Get the URL of the source zip archive for the release.
 
UString tag () const
 Get the Git tag name of the release.
 
UString version () const
 Get the version of the release.
 
UString versionName () const
 Get the version name of the release.
 

Static Public Member Functions

static bool GetAllVersions (GitHubReleaseVector &versions, const UString &owner, const UString &repository, Report &report=(ts::CerrReport::Instance()))
 Download information from GitHub for all versions of a product.
 
static bool IsPlatformAsset (const UString &fileName)
 Check if a binary file is appropriate for the current platform.
 

Detailed Description

This class holds information from GitHub about a release of a project.

Constructor & Destructor Documentation

◆ GitHubRelease()

ts::GitHubRelease::GitHubRelease ( const UString owner,
const UString repository,
const UString tag = UString(),
Report report = (ts::CerrReport::Instance()) 
)

Constructor with download of the version information from GitHub.

Use isValid() to check if the download was successful.

Parameters
[in]ownerProject owner, either a GitHub user name or organization name.
[in]repositoryProject repository name.
[in]tagGit tag of the version to fetch. If empty, fetch the latest version.
[in,out]reportWhere to report error.

Member Function Documentation

◆ isValid()

bool ts::GitHubRelease::isValid ( ) const
inline

Check if the content of this object is a valid release description.

Returns
True if this object is valid.

◆ downloadInfo()

bool ts::GitHubRelease::downloadInfo ( const UString owner,
const UString repository,
const UString tag = UString(),
Report report = (ts::CerrReport::Instance()) 
)

Download the version information from GitHub.

Parameters
[in]ownerProject owner, either a GitHub user name or organization name.
[in]repositoryProject repository name.
[in]tagGit tag of the version to fetch. If empty, fetch the latest version.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

◆ tag()

UString ts::GitHubRelease::tag ( ) const

Get the Git tag name of the release.

Returns
The Git tag name.

◆ version()

UString ts::GitHubRelease::version ( ) const

Get the version of the release.

Returns
The version. This is the tag without leading letters, following the convention that versions "3.1" is tagged as "v3.1" for instance.

◆ versionName()

UString ts::GitHubRelease::versionName ( ) const

Get the version name of the release.

Returns
The version name.

◆ publishDate()

Time ts::GitHubRelease::publishDate ( ) const

Get the publish date of the release.

Returns
The publish date.

◆ sourceTarURL()

UString ts::GitHubRelease::sourceTarURL ( ) const

Get the URL of the source tarball (tgz file) for the release.

Returns
The URL.

◆ sourceZipURL()

UString ts::GitHubRelease::sourceZipURL ( ) const

Get the URL of the source zip archive for the release.

Returns
The URL.

◆ sourceURL()

UString ts::GitHubRelease::sourceURL ( ) const

Get the most appropriate URL of the source archive for the release.

On Windows, prefer zip files. On UNIX, prefer tarballs.

Returns
The URL.

◆ sourceFileName()

UString ts::GitHubRelease::sourceFileName ( ) const

Get an appropriate file name to download sourceURL().

Returns
The local file name.
See also
sourceURL()

◆ assetDownloadCount()

int ts::GitHubRelease::assetDownloadCount ( ) const

Get the number of downloads for the assets of the release.

Returns
The number of downloads for the assets.

◆ getAssets()

void ts::GitHubRelease::getAssets ( AssetList assets) const

Get the list of all assets for the release.

Parameters
[out]assetsThe returned list of assets.

◆ getPlatformAssets()

void ts::GitHubRelease::getPlatformAssets ( AssetList assets) const

Get the list of assets for the current platform.

Parameters
[out]assetsThe returned list of assets.

◆ IsPlatformAsset()

static bool ts::GitHubRelease::IsPlatformAsset ( const UString fileName)
static

Check if a binary file is appropriate for the current platform.

The check is based on various naming conventions.

Parameters
[in]fileNameAsset base file name (no directory).
Returns
True is fileName seems appropriate for the local platform.

◆ GetAllVersions()

static bool ts::GitHubRelease::GetAllVersions ( GitHubReleaseVector versions,
const UString owner,
const UString repository,
Report report = (ts::CerrReport::Instance()) 
)
static

Download information from GitHub for all versions of a product.

Parameters
[out]versionsReturned vector of downloaded versions.
[in]ownerProject owner, either a GitHub user name or organization name.
[in]repositoryProject repository name.
[in,out]reportWhere to report error.
Returns
True on success, false on error.

The documentation for this class was generated from the following file: