https://github.com/devholic22/devholic-library
useful libraries made by devholic
https://github.com/devholic22/devholic-library
Last synced: about 1 year ago
JSON representation
useful libraries made by devholic
- Host: GitHub
- URL: https://github.com/devholic22/devholic-library
- Owner: devholic22
- Created: 2023-08-21T15:28:34.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-03T05:21:30.000Z (almost 3 years ago)
- Last Synced: 2025-05-04T23:15:43.629Z (about 1 year ago)
- Language: Java
- Size: 86.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# devholic-library
useful libraries made by devholic
## How to use?
### 1. Add it in your root build.gradle at the end of repositories:
```groovy
allprojects {
repositories {
....
maven {
url 'https://jitpack.io'
}
}
}
```
### 2. Add the dependency
```groovy
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
```java
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
}
```

### 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
```java
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 userResource = GoogleTokenAgent.getUserResource("ACCESS_TOKEN");
for (String key : userResource.keySet()) {
System.out.println(key + ": " + userResource.get(key));
}
}
```

### 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
```java
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 result = GithubTokenAgent.getUserResource("ACCESS_TOKEN");
for (String key : result.keySet()) {
System.out.println(key + ": " + result.get(key));
}
}
```

### 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
```java
import devholic.library.oauth2.apple.AppleTokenAgent;
public static void main(String[] args) {
String email = AppleTokenAgent.getUserResource("appleToken");
System.out.println(email);
}
```