An unofficial Java Wrapper for the Artilities REST API
This wrapper currently supports getting an Idea
, Getting a challenge Idea
, Looking up artist slang
, getting Atilities Banners
. The other API functions like getting patreons
will hopefully follow soon.
You can grab the latest release from this github page!
- Navigate to Releases and download the latest version of JARtilities
- Open Your Project in any Java IDE (my example: IntelliJ)
- Head to File > Project Structure
- Go to Library and click the + sign, then proceed to click on Java
- Select JARtilities.jar and click OK
- After it's added to the list you can click Apply
- That's it.
You can get a random Idea from the Artilities Database using the getIdea()
function, this function will return a HashMap with the following keys: english
, executionTime
, statusCode
, russian
, raw
, WebResponseCode
.
english
- Will return a random Idea in englishrussian
- Will return a random Idea in russianexecutionTime
- Will return the amount of time it took the server to respond (in ms).statusCode
- Will return the Servers response code (in best case200
).WebResponseCode
- Will return the response code of the request itself (in best case it matchesstatusCode
)raw
- Will return the raw JSON output of the server
- If there was an error during the request, the HashMap will return
null
- You might need to change your encoding to display
russian
HashMap<String,String> testMap = Artilities.getIdea();
if(testMap != null) {
System.out.println("Your Idea: " + testMap.get("english"));
System.out.println("Russian: " + testMap.get("russian"));
System.out.println("Server Response " + testMap.get("statusCode"));
System.out.println("Server Response Time: " + testMap.get("executionTime") + "ms");
System.out.println("Raw JSON: " + testMap.get("raw"));
} else {
System.out.println("There was an error during the request.");
}
Your Idea: God of gambling
Russian: Бог азартных игр
Server Response 200
Server Response Time: 136ms
Raw JSON: {"status_code":200,"generated_idea":{"ru":"Бог азартных игр","eng":"God of gambling"},"execution_time":136}
You can get a random Challenge from Artilities Database using the getChallenge()
function, this function will return a HashMap with the following keys: english
, executionTime
, statusCode
, russian
, raw
, WebResponseCode
.
english
- Will return a random Idea in englishrussian
- Will return a random Idea in russianexecutionTime
- Will return the amount of time it took the server to respond (in ms).statusCode
- Will return the Servers response code (in best case200
).WebResponseCode
- Will return the response code of the request itself (in best case it matchesstatusCode
)raw
- Will return the raw JSON output of the server
- If there was an error during the request, the HashMap will return
null
- You might need to change your encoding to display
russian
HashMap<String,String> testMap = Artilities.getChallenge();
if(testMap != null) {
System.out.println("Your Challenge: " + testMap.get("english"));
System.out.println("Russian: " + testMap.get("russian"));
System.out.println("Server Response " + testMap.get("statusCode"));
System.out.println("Server Response Time: " + testMap.get("executionTime") + "ms");
System.out.println("Raw JSON: " + testMap.get("raw"));
} else {
System.out.println("There was an error during the request.");
}
Your Challenge: Generate a palette and make a drawing with these colors but in negative
Russian: Сгенерируй палитру и выполни работу в сгенерированных цветах, но в негативе
Server Response 200
Server Response Time: 24ms
Raw JSON: {"status_code":200,"generated_challenge":{"eng":"Generate a palette and make a drawing with these colors but in negative","ru":"Сгенерируй палитру и выполни работу в сгенерированных цветах, но в негативе"},"execution_time":24}
You can look up artist slang from the Artilities Database using the getDictionaryEntry()
function, this function will return a HashMap with the following keys: term
, desription
, statusCode
, executionTime
, WebResponseCode
, raw
.
term
- Will return the result termdescription
- Will return the meaning / description of the searched termexecutionTime
- Will return the amount of time it took the server to respond (in ms).statusCode
- Will return the Servers response code (in best case200
).WebResponseCode
- Will return the response code of the request itself (in best case it matchesstatusCode
)raw
- Will return the raw JSON output of the server
- If there was an error during the request, the HashMap will return
null
- If no result was found,
term
anddescription
will returnnull
getDictionaryEntry()
requires a String as argument input.
HashMap<String,String> testMap = Artilities.getDictionaryEntry("UFO"); //In this case im looking up the term "UFO" which means "up for offers"
if(testMap != null) {
if(testMap.get("term") != null) {
System.out.println("Your term: " + testMap.get("term"));
System.out.println("Description: " + testMap.get("description"));
System.out.println("Server Response " + testMap.get("statusCode"));
System.out.println("Server Response Time: " + testMap.get("executionTime") + "ms");
System.out.println("Raw JSON: " + testMap.get("raw"));
} else {
System.out.println("No term found for given query.");
}
} else {
System.out.println("There was an error during the request.");
}
Your term: UFO
Description: Short for Up For Offers.
Server Response 200
Server Response Time: 52ms
Raw JSON: {"status_code":200,"query_results":[["UFO","Short for Up For Offers."]],"execution_time":52}
You can get Artilities Banners using the getBanners()
function, this function will return a HashMap with the following keys: bannerLink
, bannerImage
, language
, raw
, executionTime
, statusCode
, WebResponseCode
.
language
- Will return the language of the banner (usually "")bannerImage
- Will return the link of the banner ImagebannerLink
- Will return the link the banner is linked toexecutionTime
- Will return the amount of time it took the server to respond (in ms).statusCode
- Will return the Servers response code (in best case200
).WebResponseCode
- Will return the response code of the request itself (in best case it matchesstatusCode
)raw
- Will return the raw JSON output of the server
- If there was an error during the request, the HashMap will return
null
getBanners()
is not part if themain
functions of the API, which is why the wrapper marks it asother
, meaning to usegetBanners()
you need to useArtilities.other.getBanners()
HashMap<String,String> testMap = Artilities.other.getBanners();
if(testMap != null) {
System.out.println("Banner Image: " + testMap.get("bannerImage"));
System.out.println("Banner Link: " + testMap.get("bannerLink"));
System.out.println("Server Response " + testMap.get("statusCode"));
System.out.println("Server Response Time: " + testMap.get("executionTime") + "ms");
System.out.println("Raw JSON: " + testMap.get("raw"));
} else {
System.out.println("There was an error during the request.");
}
Banner Image: https://i.imgur.com/pKmfznm.gif
Banner Link: https://discord.com/invite/u7dBmKyMWa
Server Response 200
Server Response Time: 54ms
Raw JSON: {"status_code":200,"details":{"banner_url":"https://discord.com/invite/u7dBmKyMWa","banner_image":"https://i.imgur.com/pKmfznm.gif","language":""},"execution_time":54}