dev.piste.api.val4j.apis.riotgames.official.RiotEntitlementsAuthAPI Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of val4j Show documentation
Show all versions of val4j Show documentation
A Java wrapper for every API associated with VALORANT
package dev.piste.api.val4j.apis.riotgames.official;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import dev.piste.api.val4j.http.RestClient;
import dev.piste.api.val4j.http.enums.ContentType;
import dev.piste.api.val4j.http.requests.PostRequestBuilder;
import dev.piste.api.val4j.http.requests.RestRequest;
import java.io.IOException;
/**
* @author Piste (GitHub)
*/
public class RiotEntitlementsAuthAPI {
private final RestClient restClient;
public RiotEntitlementsAuthAPI() {
this.restClient = new RestClient("https://entitlements.auth.riotgames.com/api").enableSSL();
}
public String getEntitlementsToken(String accessToken) throws IOException {
RestRequest restRequest = new PostRequestBuilder("", ContentType.JSON)
.addPath("token").addPath("v1")
.addHeader("Authorization", "Bearer " + accessToken)
.build();
JsonObject responseObject = restClient.sendRequest(restRequest).getAsJsonObject();
return responseObject.get("entitlements_token").getAsString();
}
}