fix: Don't send newlines and whitespace in API calls (#2348)
This commit is contained in:
parent
011bb9f5b1
commit
ee4f069341
@ -24,10 +24,10 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||||||
|
|
||||||
fun addLibManga(track: Track): Observable<Track> {
|
fun addLibManga(track: Track): Observable<Track> {
|
||||||
val query = """
|
val query = """
|
||||||
mutation AddManga(${'$'}mangaId: Int, ${'$'}progress: Int, ${'$'}status: MediaListStatus) {
|
|mutation AddManga(${'$'}mangaId: Int, ${'$'}progress: Int, ${'$'}status: MediaListStatus) {
|
||||||
SaveMediaListEntry (mediaId: ${'$'}mangaId, progress: ${'$'}progress, status: ${'$'}status)
|
|SaveMediaListEntry (mediaId: ${'$'}mangaId, progress: ${'$'}progress, status: ${'$'}status)
|
||||||
{ id status } }
|
|{ id status } }
|
||||||
"""
|
|""".trimMargin()
|
||||||
val variables = jsonObject(
|
val variables = jsonObject(
|
||||||
"mangaId" to track.media_id,
|
"mangaId" to track.media_id,
|
||||||
"progress" to track.last_chapter_read,
|
"progress" to track.last_chapter_read,
|
||||||
@ -58,14 +58,14 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||||||
|
|
||||||
fun updateLibManga(track: Track): Observable<Track> {
|
fun updateLibManga(track: Track): Observable<Track> {
|
||||||
val query = """
|
val query = """
|
||||||
mutation UpdateManga(${'$'}listId: Int, ${'$'}progress: Int, ${'$'}status: MediaListStatus, ${'$'}score: Int) {
|
|mutation UpdateManga(${'$'}listId: Int, ${'$'}progress: Int, ${'$'}status: MediaListStatus, ${'$'}score: Int) {
|
||||||
SaveMediaListEntry (id: ${'$'}listId, progress: ${'$'}progress, status: ${'$'}status, scoreRaw: ${'$'}score) {
|
|SaveMediaListEntry (id: ${'$'}listId, progress: ${'$'}progress, status: ${'$'}status, scoreRaw: ${'$'}score) {
|
||||||
id
|
|id
|
||||||
status
|
|status
|
||||||
progress
|
|progress
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
"""
|
""".trimMargin()
|
||||||
val variables = jsonObject(
|
val variables = jsonObject(
|
||||||
"listId" to track.library_id,
|
"listId" to track.library_id,
|
||||||
"progress" to track.last_chapter_read,
|
"progress" to track.last_chapter_read,
|
||||||
@ -90,29 +90,29 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||||||
|
|
||||||
fun search(search: String): Observable<List<TrackSearch>> {
|
fun search(search: String): Observable<List<TrackSearch>> {
|
||||||
val query = """
|
val query = """
|
||||||
query Search(${'$'}query: String) {
|
|query Search(${'$'}query: String) {
|
||||||
Page (perPage: 50) {
|
|Page (perPage: 50) {
|
||||||
media(search: ${'$'}query, type: MANGA, format_not_in: [NOVEL]) {
|
|media(search: ${'$'}query, type: MANGA, format_not_in: [NOVEL]) {
|
||||||
id
|
|id
|
||||||
title {
|
|title {
|
||||||
romaji
|
|romaji
|
||||||
}
|
|}
|
||||||
coverImage {
|
|coverImage {
|
||||||
large
|
|large
|
||||||
}
|
|}
|
||||||
type
|
|type
|
||||||
status
|
|status
|
||||||
chapters
|
|chapters
|
||||||
description
|
|description
|
||||||
startDate {
|
|startDate {
|
||||||
year
|
|year
|
||||||
month
|
|month
|
||||||
day
|
|day
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
"""
|
""".trimMargin()
|
||||||
val variables = jsonObject(
|
val variables = jsonObject(
|
||||||
"query" to search
|
"query" to search
|
||||||
)
|
)
|
||||||
@ -144,35 +144,35 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||||||
|
|
||||||
fun findLibManga(track: Track, userid: Int) : Observable<Track?> {
|
fun findLibManga(track: Track, userid: Int) : Observable<Track?> {
|
||||||
val query = """
|
val query = """
|
||||||
query (${'$'}id: Int!, ${'$'}manga_id: Int!) {
|
|query (${'$'}id: Int!, ${'$'}manga_id: Int!) {
|
||||||
Page {
|
|Page {
|
||||||
mediaList(userId: ${'$'}id, type: MANGA, mediaId: ${'$'}manga_id) {
|
|mediaList(userId: ${'$'}id, type: MANGA, mediaId: ${'$'}manga_id) {
|
||||||
id
|
|id
|
||||||
status
|
|status
|
||||||
scoreRaw: score(format: POINT_100)
|
|scoreRaw: score(format: POINT_100)
|
||||||
progress
|
|progress
|
||||||
media{
|
|media{
|
||||||
id
|
|id
|
||||||
title {
|
|title {
|
||||||
romaji
|
|romaji
|
||||||
}
|
|}
|
||||||
coverImage {
|
|coverImage {
|
||||||
large
|
|large
|
||||||
}
|
|}
|
||||||
type
|
|type
|
||||||
status
|
|status
|
||||||
chapters
|
|chapters
|
||||||
description
|
|description
|
||||||
startDate {
|
|startDate {
|
||||||
year
|
|year
|
||||||
month
|
|month
|
||||||
day
|
|day
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
"""
|
""".trimMargin()
|
||||||
val variables = jsonObject(
|
val variables = jsonObject(
|
||||||
"id" to userid,
|
"id" to userid,
|
||||||
"manga_id" to track.media_id
|
"manga_id" to track.media_id
|
||||||
@ -214,16 +214,16 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
|
|||||||
|
|
||||||
fun getCurrentUser(): Observable<Pair<Int, String>> {
|
fun getCurrentUser(): Observable<Pair<Int, String>> {
|
||||||
val query = """
|
val query = """
|
||||||
query User
|
|query User
|
||||||
{
|
|{
|
||||||
Viewer {
|
|Viewer {
|
||||||
id
|
|id
|
||||||
mediaListOptions {
|
|mediaListOptions {
|
||||||
scoreFormat
|
|scoreFormat
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
}
|
|}
|
||||||
"""
|
""".trimMargin()
|
||||||
val payload = jsonObject(
|
val payload = jsonObject(
|
||||||
"query" to query
|
"query" to query
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user