Skip to content

N7ghtm4r3/GitHubManager

Repository files navigation

GitHubManager

v1.0.1

           MMM.           .MMM
           MMMMMMMMMMMMMMMMMMM
           MMMMMMMMMMMMMMMMMMM      ___________________________________________
          MMMMMMMMMMMMMMMMMMMMM    |                                           |
         MMMMMMMMMMMMMMMMMMMMMMM   | This is a Java Based library              |
         MMMMMMMMMMMMMMMMMMMMMMM   | useful to work with GitHub's API service! |
        MMMMMMMMMMMMMMMMMMMMMMMM   |_   _______________________________________|
        MMMM::- -:::::::- -::MMMM    |/
         MM~:~ 00~:::::~ 00~:~MM
    .. MMMMM::.00:::+:::.00::MMMMM ..
          .MM::::: ._. :::::MM.
             MMMM;:::::;MMMM
      -MM        MMMMMMM
      ^  M+     MMMMMMMMM
          MMMMMMM MM MM MM
               MM MM MM MM
               MM MM MM MM
            .~~MM~MM~MM~MM~~.
         ~~~~MM:~MM~~~MM~:MM~~~~
        ~~~~~~==~==~~~==~==~~~~~~
         ~~~~~~==~==~==~==~~~~~~
             :~==~==~==~==~~

Implementation

Add the JitPack repository to your build file

Gradle

  • Add it in your root build.gradle at the end of repositories

    Gradle (Short)

    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }

    Gradle (Kotlin)

    repositories {
        ...
        maven("https://jitpack.io")
    }
  • Add the dependency

    Gradle (Short)

    dependencies {
        implementation 'com.github.N7ghtm4r3:GitHubManager:1.0.1'
    }

    Gradle (Kotlin)

    dependencies {
        implementation("com.github.N7ghtm4r3:GitHubManager:1.0.1")
    }

Maven

  • Add it in your root build.gradle at the end of repositories
<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
  • Add the dependency
<dependency>
    <groupId>com.github.N7ghtm4r3</groupId>
    <artifactId>GitHubManager</artifactId>
    <version>1.0.1</version>
</dependency>

🛠 Skills

  • Java

Usage/Examples

Creating access token

To use correctly the library you must before create the access token to pass to the managers to correctly perform their workflow, you can follow how do to it here

Execution

try{
    GitHubUsersManager gitHubUsersManager = new GitHubUsersManager();
    gitHubUsersManager.getUsers();
}catch(Exception e){
    e.printStackTrace();
 }

To avoid re-entering credentials for each manager, you can instantiate managers like this with the ARCS:

// choose the manager (for signed and no-signed managers same procedure), for example: GitHubUsersManager, GitHubRepositoriesManager, etc 
GitHubManager firstManager = new GitHubManager(/* params of the constructor chosen */, "accessToken");
// and then use it 
firstManager.makeSomething();
// you don't need to insert all credentials to make manager work
GitHubManager secondManager = new GitHubManager(); // same credentials used
// and then use it
secondManager.makeSomething();

Responses

Library give to you the opportunity to customize the return object after a request, the possibilities are:

  • JSON: return response formatted as JSON (org.json.JSONObject or org.json.JSONArray)
  • STRING: return response formatted as String
  • LIBRARY_OBJECT: return response formatted as custom object offered by the library
// choose the manager for example: GitHubUsersManager, GitHubRepositoriesManager, etc
GitHubManager manager = new GitHubManager(/* params of the constructor chosen */);
// method to return directly a library given by library
manager.someRequest(); // in this case will be returned directly a LIBRARY_OBJECT
// method to customize the format of the return 
manager.someRequest(ReturnFormat.JSON); // in this case will be returned response in JSON format

Errors handling

try{
    System.out.println(manager.getUsers());
}catch(Exception e){
    System.out.println(manager.getErrorResponse());
    //or
    manager.printErrorResponse();
}

/* NOTE: if is not a request error will appear: "Error is not in api request, check out your code"
  and you will have to work on your code to manage error*/

Authors

Support

If you need help using the library or encounter any problems or bugs, please contact us via the following links:

Thank you for your help!

Badges

Twitter

Donations

If you want support project and developer

Crypto Address Network
3H3jyCzcRmnxroHthuXh22GXXSmizin2yp Bitcoin
0x1b45bc41efeb3ed655b078f95086f25fc83345c4 Ethereum

If you want support project and developer with PayPal

Copyright © 2024 Tecknobit