QGitHubReleaseAPI  0.7
Qt library to receive release information from the GitHub API
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Properties | List of all members
QGitHubReleaseAPI Class Reference

The QGitHubReleaseAPI class. More...

Public Types

enum  TYPE { RAW, TEXT, HTML }
 Type of body. More...

Public Slots

void cancel ()
 Cancels the current operation.

Signals

void available (const QGitHubReleaseAPI &api)
 Emitted if the release data is available.
void canceled ()
 Emitted if a operation has canceled.
void error (const QString &error)
 Emitted on any error.
void progress (qint64 bytesReceived, qint64 bytesTotal)
 Emitted while downloading.

Public Member Functions

 QGitHubReleaseAPI (const QUrl &apiUrl, TYPE type, bool multi=true, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QUrl &apiUrl, bool multi=true, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, TYPE type, bool latest=true, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, bool latest=true, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, const QString &tag, TYPE type, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, const QString &tag, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, const char *tag, TYPE type, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, const char *tag, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, int perPage, TYPE type, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
 QGitHubReleaseAPI (const QString &user, const QString &repo, int perPage, QObject *parent=0)
 Creates an QGitHubReleaseAPI instance.
QUrl apiUrl () const
 The api URL.
QByteArray asJsonData () const
 Gets the release information as raw Json data.
qint64 downloadToFile (const QUrl &url, QFile &outputFile) const
 Downloads the file at QUrl into a file.
QByteArray downloadToMemory (const QUrl &url) const
 Downloads the file at QUrl into a QByteArray.
int entries () const
 The number of entries received.
QString eTag () const
 the eTag
uint rateLimit () const
uint rateLimitRemaining () const
QDateTime rateLimitReset () const
void setETag (const QString &eTag)
 Sets the eTag.
QVariantList toVariantList () const
 Gets the release information as QVariantList.
Accessing the release information
ulong releaseId (int idx=0) const
QUrl releaseUrl (int idx=0) const
QUrl assetsUrl (int idx=0) const
QUrl uploadUrl (int idx=0) const
QUrl releaseHtmlUrl (int idx=0) const
QString name (int idx=0) const
QString body (int idx=0) const
QString tagName (int idx=0) const
QDateTime publishedAt (int idx=0) const
QDateTime createdAt (int idx=0) const
QUrl tarBallUrl (int idx=0) const
QUrl zipBallUrl (int idx=0) const
QByteArray tarBall (int idx=0) const
qint64 tarBall (QFile &outputFile, int idx=0) const
QByteArray zipBall (int idx=0) const
qint64 zipBall (QFile &outputFile, int idx=0) const
QString targetCommitish (int idx=0) const
bool isDraft (int idx=0) const
bool isPreRelease (int idx=0) const
Accessing the user information
QUrl avatarUrl (int idx=0) const
 The URL to the avatar.
QImage avatar (int idx=0) const
 Downloads the avatar and creates a QImage.
QUrl authorHtmlUrl (int idx=0) const
 The URL to the author HTML site.
ulong authorId (int idx=0) const
 the authorId
QString login (int idx=0) const
 The login name of the author.

Static Public Member Functions

static void setUserAgent (const char *userAgent)
 Sets an UserAgent.

Properties

QUrl apiUrl
 the apiUrl
QUrl assetsUrl
 the assetsUrl
QUrl authorHtmlUrl
 the authorHtmlUrl
ulong authorId
 the authorId
QImage avatar
 the avatatr as QImage
QUrl avatarUrl
 the avatarUrl
QString body
 the release body
QDateTime createdAt
 the date of creation
bool draft
 true if the release is a draft, false otherwise
int entries
 the number of entries
QString eTag
 the eTag
QString login
 the author login
QString name
 the release name
bool prerelease
 true if pre-release, false otherwise
QDateTime publishedAt
 the date of publishing
uint rateLimit
 the current rateLimit
uint rateLimitRemaining
 the remaining rateLimit
QDateTime rateLimitReset
 the date the rate limit resets
QUrl releaseHtmlUrl
 the releaseHtmlUrl
ulong releaseId
 the releaseId
QUrl releaseUrl
 the releaseUrl
QString tagName
 the release tag name
QByteArray tarBall
 the tarBall as QByteArray
QUrl tarBallUrl
 the tarBallUrl
QString targetCommitish
 the targetCommitish (branch)
QUrl uploadUrl
 the uploadUrl
QByteArray zipBall
 the zipBall as QByteArray
QUrl zipBallUrl
 the zipBallUrl

Detailed Description

The QGitHubReleaseAPI class.

Author
Heiko Schaefer

Member Enumeration Documentation

Type of body.

Enumerator:
RAW 

receive a raw body and render it with libmarkdown

TEXT 

receive a text body

HTML 

receive a html body (rendered by GitHub)

Constructor & Destructor Documentation

QGitHubReleaseAPI::QGitHubReleaseAPI ( const QUrl &  apiUrl,
TYPE  type,
bool  multi = true,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
apiUrldirect URL to retrieve
typethe type of the body
multitrue if multiple results are expected, false otherwise
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QUrl &  apiUrl,
bool  multi = true,
QObject *  parent = 0 
)
explicit

Creates an QGitHubReleaseAPI instance.

Parameters
apiUrldirect URL to retrieve
multitrue if multiple results are expected, false otherwise
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
TYPE  type,
bool  latest = true,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
typethe type of the body
latesttrue to only retrieve the latest release, false for all releases
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
bool  latest = true,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
latesttrue to only retrieve the latest release, false for all releases
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
const QString &  tag,
TYPE  type,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
tagthe release tag to retrieve
typethe type of the body
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
const QString &  tag,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
tagthe release tag to retrieve
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
const char *  tag,
TYPE  type,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
tagthe release tag to retrieve
typethe type of the body
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
const char *  tag,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
tagthe release tag to retrieve
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
int  perPage,
TYPE  type,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
perPagethe amount of releases to retrieve
typethe type of the body
QGitHubReleaseAPI::QGitHubReleaseAPI ( const QString &  user,
const QString &  repo,
int  perPage,
QObject *  parent = 0 
)

Creates an QGitHubReleaseAPI instance.

Parameters
userthe GitHub user (aka login)
repothe repository to retrieve release information for
perPagethe amount of releases to retrieve

Member Function Documentation

QUrl QGitHubReleaseAPI::apiUrl ( ) const

The api URL.

Returns
the api URL
QByteArray QGitHubReleaseAPI::asJsonData ( ) const

Gets the release information as raw Json data.

Returns
QUrl QGitHubReleaseAPI::authorHtmlUrl ( int  idx = 0) const

The URL to the author HTML site.

Parameters
idxthe entry index
Returns
url to the author HTML site
ulong QGitHubReleaseAPI::authorId ( int  idx = 0) const

the authorId

Parameters
idxthe entry index
Returns
the authorId
void QGitHubReleaseAPI::available ( const QGitHubReleaseAPI api)
signal

Emitted if the release data is available.

Parameters
apireference to the QGitHubReleaseAPI
QImage QGitHubReleaseAPI::avatar ( int  idx = 0) const

Downloads the avatar and creates a QImage.

Parameters
idxthe entry index
Returns
the avatar image of a NULL QImage on failure
QUrl QGitHubReleaseAPI::avatarUrl ( int  idx = 0) const

The URL to the avatar.

Parameters
idxthe entry index
Returns
url to the avatar
qint64 QGitHubReleaseAPI::downloadToFile ( const QUrl &  url,
QFile &  outputFile 
) const

Downloads the file at QUrl into a file.

Parameters
urlthe URL to download from
outputFilethe file to download to
Returns
the number of received bytes
QByteArray QGitHubReleaseAPI::downloadToMemory ( const QUrl &  url) const

Downloads the file at QUrl into a QByteArray.

Parameters
urlthe URL to download from
Returns
the QByteArray containing the downloaded file
int QGitHubReleaseAPI::entries ( ) const

The number of entries received.

Returns
the number of entries received
void QGitHubReleaseAPI::error ( const QString &  error)
signal

Emitted on any error.

Parameters
errorthe error string
QString QGitHubReleaseAPI::eTag ( ) const

the eTag

An eTag, if known, can get used to avoid using the rate limit

Returns
the ETag
QString QGitHubReleaseAPI::login ( int  idx = 0) const

The login name of the author.

Parameters
idxthe entry index
Returns
the login name of the author
void QGitHubReleaseAPI::progress ( qint64  bytesReceived,
qint64  bytesTotal 
)
signal

Emitted while downloading.

bytesTotal is -1 if the number of total bytes is not available
bytesReceived is equal to bytesTotal if the download has finished

Parameters
bytesReceivedthe number of bytes received
bytesTotalthe number of total bytes
void QGitHubReleaseAPI::setETag ( const QString &  eTag)

Sets the eTag.

An eTag, if known, can get used to avoid using the rate limit

Parameters
eTagthe eTag
void QGitHubReleaseAPI::setUserAgent ( const char *  userAgent)
static

Sets an UserAgent.

Note
defaults to QGitHubReleaseAPI
Parameters
userAgentan UserAgent
QVariantList QGitHubReleaseAPI::toVariantList ( ) const

Gets the release information as QVariantList.

Returns