/devholic-library

useful libraries made by devholic

Primary LanguageJava

devholic-library

useful libraries made by devholic

How to use?

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

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

2. Add the dependency

dependencies {
    implementation 'com.github.devholic22:devholic-library:Tag' // tag means the latest tag
}

library lists

Discord web-hook function

If you have discord webhook URL and content what you want to send, You can send via this library.

Example

import java.io.IOException;
import devholic.library.discordbot.DiscordSender;
public static void main(String[] args) throws IOException {
    DiscordSender sender = new DiscordSender("DISCORD_WEBHOOK");
    System.out.println(sender.send("hello world")); // result: send success
}
스크린샷 2023-08-22 오전 12 54 36

Get Google user information function (OAuth2)

If you have Access-Token about Google Server, you can get Google user information (HashMap) via this library.

Example

import java.io.IOException;
import devholic.library.oauth2.google.GoogleTokenAgent;
public static void main(String[] args) throws IOException { // if access-token has problem, IOException occur.
    Map<String, String> userResource = GoogleTokenAgent.getUserResource("ACCESS_TOKEN");
    for (String key : userResource.keySet()) {
        System.out.println(key + ": " + userResource.get(key));
    }
}

스크린샷 2023-09-01 오후 4 26 18

Get Github user information function (OAuth2)

If you have Access-Token about Github Server, you can get Github user information (HashMap) via this library.
when you want "bio" value, use result.get(key).split(" ") (because bio key has many values)

Example

import java.util.Map;
import java.io.IOException;
import devholic.library.oauth2.github.GithubTokenAgent;
public static void main(String[] args) throws IOException { // if access-token has problem, IOException occur.
    Map<String, String> result = GithubTokenAgent.getUserResource("ACCESS_TOKEN");
    for (String key : result.keySet()) {
        System.out.println(key + ": " + result.get(key));
    }
}
스크린샷 2023-09-02 오전 1 35 22

Get Apple user email information function (OAuth2, Not Exception catch yet!)

If you have id_token about Apple Server, you can get Apple user email information via this library.
In this library, client used fragment way.

Example

import devholic.library.oauth2.apple.AppleTokenAgent;
public static void main(String[] args) {
    String email = AppleTokenAgent.getUserResource("appleToken");
    System.out.println(email);
}
스크린샷 2023-09-03 오전 1 50 58