Last active
May 25, 2022 13:12
-
-
Save ToxicMushroom/975601e26be80994a57487e043a3e6dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val commonClientConfig: HttpClientConfig<OkHttpConfig>.() -> Unit = { | |
expectSuccess = false | |
install(ContentNegotiation) { | |
jackson { | |
disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES) | |
disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) | |
} | |
} | |
install(UserAgent) { | |
agent = "Melijn / 3.0.0 Discord bot" | |
} | |
} | |
val httpClient = HttpClient(OkHttp, commonClientConfig) | |
webManager.httpClient.post("https://graphql.anilist.co") { | |
val body1 = | |
"{ \"operationName\":\"SearchMedia\", \"variables\":{ \"name\":\"erased\", \"type\":\"MANGA\" }, \"query\":\"query SearchMedia(\$name: String!, \$type: MediaType!) { Page(page: 1, perPage: 10) { __typename media(search: \$name, type: \$type) { __typename id title { __typename romaji english native userPreferred } siteUrl favourites } } }\" }" | |
println(body1) | |
setBody(TextContent(body1, ContentType.Application.Json)) | |
contentType(ContentType.Application.Json) | |
}.body<String>() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment