Package cc.carm.lib.githubreleases4j
Class GithubReleases4J
- java.lang.Object
-
- cc.carm.lib.githubreleases4j.GithubReleases4J
-
public class GithubReleases4J extends java.lang.Object
GitHub Releases for Java
To provide an easy way to fetch updates and download assets.
Based on GitHub REST API (Releases) .- Author:
- CarmJos
-
-
Field Summary
Fields Modifier and Type Field Description static java.text.SimpleDateFormat
GH_TIME_FORMAT
static java.lang.String
GITHUB_API_URL
static java.lang.String
GITHUB_URL
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @Nullable GithubRelease
getLatestRelease(@NotNull java.lang.String owner, @NotNull java.lang.String repository)
Get a public repository's latest release.static @Nullable GithubRelease
getLatestRelease(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @Nullable java.lang.String token)
Get a repository's latest release.static @NotNull java.lang.String
getLatestReleaseURL(@NotNull java.lang.String owner, @NotNull java.lang.String repository)
static @Nullable GithubRelease
getRelease(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @NotNull java.lang.String releaseID)
Get a public repository's release by the id .static @Nullable GithubRelease
getRelease(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @NotNull java.lang.String releaseID, @Nullable java.lang.String token)
Get a repository's release by the id .static @Nullable GithubRelease
getReleaseByTag(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @NotNull java.lang.String tagName)
Get a public repository's release by the tag name .static @Nullable GithubRelease
getReleaseByTag(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @NotNull java.lang.String tagName, @Nullable java.lang.String token)
Get a repository's release by the tag name .static @NotNull java.lang.String
getReleasesURL(@NotNull java.lang.String owner, @NotNull java.lang.String repository)
static @NotNull java.lang.String
getReleaseURLByTag(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @NotNull java.lang.String releaseTagName)
static @Nullable java.lang.Integer
getVersionBehind(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @NotNull java.lang.String currentTagName)
Get how many versions behind the current version's tag name.static @Nullable java.lang.Integer
getVersionBehind(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @Nullable java.lang.String token, @NotNull java.lang.String currentTagName)
Get how many versions behind the current version's tag name.static @NotNull java.util.List<GithubRelease>
listReleases(@NotNull java.lang.String owner, @NotNull java.lang.String repository)
List a public repository's current existing releases.static @NotNull java.util.List<GithubRelease>
listReleases(@NotNull java.lang.String owner, @NotNull java.lang.String repository, @Nullable java.lang.String token)
List repository's current existing releases.protected static @Nullable java.util.Date
parseDate(@Nullable java.lang.String dateString)
-
-
-
Method Detail
-
listReleases
@NotNull public static @NotNull java.util.List<GithubRelease> listReleases(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @Nullable @Nullable java.lang.String token)
List repository's current existing releases.- Parameters:
owner
- Repository's Ownerrepository
- Repository's Nametoken
- OAuth Access Token
Necessary when this repository is private.- Returns:
GithubRelease
-
listReleases
@NotNull public static @NotNull java.util.List<GithubRelease> listReleases(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository)
List a public repository's current existing releases.- Parameters:
owner
- Repository's Ownerrepository
- Repository's Name- Returns:
GithubRelease
-
getRelease
@Nullable public static @Nullable GithubRelease getRelease(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @NotNull @NotNull java.lang.String releaseID, @Nullable @Nullable java.lang.String token)
Get a repository's release by the id .- Parameters:
owner
- Repository's Ownerrepository
- Repository's NamereleaseID
- Release IDtoken
- OAuth Access Token
Necessary when this repository is private.- Returns:
GithubRelease
-
getRelease
@Nullable public static @Nullable GithubRelease getRelease(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @NotNull @NotNull java.lang.String releaseID)
Get a public repository's release by the id .- Parameters:
owner
- Repository's Ownerrepository
- Repository's NamereleaseID
- Release ID- Returns:
GithubRelease
-
getReleaseByTag
@Nullable public static @Nullable GithubRelease getReleaseByTag(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @NotNull @NotNull java.lang.String tagName, @Nullable @Nullable java.lang.String token)
Get a repository's release by the tag name .- Parameters:
owner
- Repository's Ownerrepository
- Repository's NametagName
- Release Tag Nametoken
- OAuth Access Token
Necessary when this repository is private.- Returns:
GithubRelease
-
getReleaseByTag
@Nullable public static @Nullable GithubRelease getReleaseByTag(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @NotNull @NotNull java.lang.String tagName)
Get a public repository's release by the tag name .- Parameters:
owner
- Repository's Ownerrepository
- Repository's NametagName
- Release Tag Name- Returns:
GithubRelease
-
getLatestRelease
@Nullable public static @Nullable GithubRelease getLatestRelease(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @Nullable @Nullable java.lang.String token)
Get a repository's latest release.- Parameters:
owner
- Repository's Ownerrepository
- Repository's Nametoken
- OAuth Access Token
Necessary when this repository is private.- Returns:
GithubRelease
-
getLatestRelease
@Nullable public static @Nullable GithubRelease getLatestRelease(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository)
Get a public repository's latest release.- Parameters:
owner
- Repository's Ownerrepository
- Repository's Name- Returns:
GithubRelease
-
getVersionBehind
@Nullable public static @Nullable java.lang.Integer getVersionBehind(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @Nullable @Nullable java.lang.String token, @NotNull @NotNull java.lang.String currentTagName)
Get how many versions behind the current version's tag name.- Parameters:
owner
- Repository's Ownerrepository
- Repository's Nametoken
- OAuth Access Token
Necessary when this repository is private.currentTagName
- Current Version's tag name.- Returns:
- NULL if not fetch releases, -1 if no match tag name.
- Since:
- 1.3.0
-
getVersionBehind
@Nullable public static @Nullable java.lang.Integer getVersionBehind(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @NotNull @NotNull java.lang.String currentTagName)
Get how many versions behind the current version's tag name.- Parameters:
owner
- Repository's Ownerrepository
- Repository's NamecurrentTagName
- Current Version's tag name.- Returns:
- NULL if not fetch releases, -1 if no match tag name.
- Since:
- 1.3.0
-
getReleasesURL
@NotNull public static @NotNull java.lang.String getReleasesURL(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository)
-
getLatestReleaseURL
@NotNull public static @NotNull java.lang.String getLatestReleaseURL(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository)
-
getReleaseURLByTag
@NotNull public static @NotNull java.lang.String getReleaseURLByTag(@NotNull @NotNull java.lang.String owner, @NotNull @NotNull java.lang.String repository, @NotNull @NotNull java.lang.String releaseTagName)
-
parseDate
@Contract("null->null") @Nullable protected static @Nullable java.util.Date parseDate(@Nullable @Nullable java.lang.String dateString)
-
-