diff --git a/README.md b/README.md new file mode 100644 index 0000000..cb81e5e --- /dev/null +++ b/README.md @@ -0,0 +1,107 @@ +# Release Checker - API +Easy to use and lightweight api for notify about new release version from GitHub + +## Tabele of Contentes + +1. [About](#About) +2. [Short Wiki](#Short-Wiki) + * [Method Summary](#Method-Summary) + * [Errors](#Errors) + * [Working Example](#Working-Example) +3. [Libraries and API's](#Libraries-and-API's) +4. [Installation](#Installation) +5. [Contributing](#contributing) +6. [ToDo](#ToDo) +7. [License](#License) + +## About + +This api works by getting releases versions via GitHub API, using link +`https://api.github.com/repos/[REPOSITORY AUTHOR]/[REPOSITORY NAME]/releases"`. + +The methods described in [Method Summary](#Method-Summary), modify the values of the variables, +```java +private static String version; +private static String repositoryURL; +``` +coded in API. This API uses jsonSimple library to work, maven dependency is in [Installation](#Installation). +In case of errors with API please describe it in Issues. + + +## Short Wiki +### Method Summary + +| Type | Method | Description | +|---------|-------------------------------------------------------------|------------------------------------| +| String | getVersion(**String** version) | Get the latest release version | +| String | getRepository(**String** author, **String** repositoryName) | Get the author and repository name | +| boolean | releaseChecker() | Gets state of latest release | + + +### Errors + +| Message | Reason | +|------------------------------------------------------------------------------------------|----------------------------------------------| +| `[ERROR] Assign a version using getVersion(). Setting default value as FALSE.` | You need to specify a version of release | +| `[ERROR] Assign a repository URL using getRepository(). Setting default value as FALSE.` | You need to specify a repository and release | +| `java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0` | There is no releases in that repository | + +### Working Example + +```java +public static void main(String[] args) { + getVersion("v2.0"); + getRepository("boybacks", "xorencrypt"); + if (releaseChecker()) { + System.out.println("There is no new versions"); + } + else { + System.out.println("There is new version"); + } +} +``` + +## Libraries and API's + +* [JSONSimple](https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple) +* [DiscordAPI](https://docs.github.com/) +* [JitPack](https://jitpack.io/) + +## Installation +Add this to your maven project in `pom.xml` file: + +```xml + + + jitpack.io + https://jitpack.io + + +``` +```xml + + com.github.BoyBACKS + releasesChecker-API + v1.1 + +``` + +```xml + + com.googlecode.json-simple + json-simple + 1.1.1 + +``` + +## Contributing +Pull requests are always welcome. For bigger changes, please open an issue first to discuss what you would like to change. + +## ToDo +* For now, we do not expect another versions. + +## Donate +Would you like to support my work? [Click here](https://www.buymeacoffee.com/BoyBACKS) how you would like to do it! + +## License +[GNU GPLv3](https://choosealicense.com/licenses/gpl-3.0/) \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4f942f2..7340d96 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ net.boybacks releaseschecker - 1.0 + 1.1 17 diff --git a/src/main/java/net/boybacks/releaseschecker/ReleaseChecker.java b/src/main/java/net/boybacks/releaseschecker/ReleaseChecker.java index 9b39920..054991b 100644 --- a/src/main/java/net/boybacks/releaseschecker/ReleaseChecker.java +++ b/src/main/java/net/boybacks/releaseschecker/ReleaseChecker.java @@ -7,10 +7,10 @@ public class ReleaseChecker { - public static String version; - public static String repositoryURL; + private static String version; + private static String repositoryURL; - public static boolean releaseChecker() { + public static boolean releaseCheck() { if (version == null) { System.out.println("[ERROR] Assign a version using getVersion(). Setting default value as FALSE."); return false; @@ -39,18 +39,4 @@ public static String getVersion(String releaseVersion) { public static String getRepository(String author, String repositoryName) { return repositoryURL = author + "/" + repositoryName; } - -//Here you can see example release checker! - -// public static void main(String[] args) { -// getVersion("v2.0"); -// getRepository("boybacks", "xorencrypt"); -// if (releaseChecker()) { -// System.out.println("There is no new versions"); -// } -// else { -// System.out.println("There is new version"); -// } -// } - -} +} \ No newline at end of file