Skip to content

Commit

Permalink
revert, move to another pr
Browse files Browse the repository at this point in the history
  • Loading branch information
husnjaktv committed Jul 16, 2024
1 parent b852a41 commit e67fdc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
8 changes: 0 additions & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ tasks {
compileTestKotlin {
kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
}
test {
useJUnitPlatform()
maxParallelForks = 1
testLogging {
events("passed", "skipped", "failed")
}
exclude("**/*Token*") // No need to generate tokens for tests
}

dokkaJavadoc {
outputDirectory.set(buildDir.resolve("javadoc"))
Expand Down
10 changes: 4 additions & 6 deletions src/main/kotlin/com/api/igdb/request/IGDBWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ import com.github.kittinunf.fuel.httpPost
/**
* The ApiRequester object holds the API Key and uses it to request the IGDB API.
*/
private const val IGDB_API_URL = "https://api.igdb.com/v4"
private var IGDB_API_URL = "https://api.igdb.com/v4"
object IGDBWrapper {
private var requestHeaders: Map<String, Any> = mapOf("x-user-agent" to "igdb-api-jvm")
private var requestUrl: String = IGDB_API_URL

/**
* The Set method for API Credentials
Expand All @@ -19,7 +18,6 @@ object IGDBWrapper {
* @property accessToken The IGDB AccessToken
*/
fun setCredentials(clientID: String, accessToken: String) {
requestUrl = IGDB_API_URL
requestHeaders = mapOf(
"client-id" to clientID,
"authorization" to "Bearer $accessToken",
Expand All @@ -33,7 +31,7 @@ object IGDBWrapper {
* @property proxyHeaders The headers to send to the Proxy Server
*/
fun setupProxy(proxyURL: String, proxyHeaders: Map<String, String>) {
requestUrl = proxyURL
IGDB_API_URL = proxyURL
proxyHeaders.toMutableMap()["x-user-agent"] = "igdb-api-jvm"
requestHeaders = proxyHeaders.toMap()
}
Expand All @@ -47,7 +45,7 @@ object IGDBWrapper {
*/
@Throws(RequestException::class)
fun apiProtoRequest(endpoint: Endpoint, query: String): ByteArray {
val requestURL = "$requestUrl${endpoint.url()}.pb"
val requestURL = "$IGDB_API_URL${endpoint.url()}.pb"
val (request, response, result) = requestURL.httpPost()
.header(requestHeaders).body(query).responseString()

Expand All @@ -66,7 +64,7 @@ object IGDBWrapper {
*/
@Throws(RequestException::class)
fun apiJsonRequest(endpoint: Endpoint, query: String): String {
val requestURL = "$requestUrl${endpoint.url()}"
val requestURL = "$IGDB_API_URL${endpoint.url()}"
val (request, response, result) = requestURL.httpPost()
.header(requestHeaders).body(query).responseString()

Expand Down

0 comments on commit e67fdc4

Please sign in to comment.