useful libraries made by devholic
allprojects {
repositories {
....
maven {
url 'https://jitpack.io'
}
}
}
dependencies {
implementation 'com.github.devholic22:devholic-library:Tag' // tag means the latest tag
}
If you have discord webhook URL and content what you want to send, You can send via this library.
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
}
If you have Access-Token about Google Server, you can get Google user information (HashMap) via this library.
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));
}
}
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)
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));
}
}
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.
import devholic.library.oauth2.apple.AppleTokenAgent;
public static void main(String[] args) {
String email = AppleTokenAgent.getUserResource("appleToken");
System.out.println(email);
}