Formatting

This commit is contained in:
arkon
2022-04-08 16:44:23 -04:00
parent 2dfafa387b
commit 5afff31f72
197 changed files with 481 additions and 483 deletions
@@ -56,8 +56,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@@ -140,8 +140,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@@ -208,8 +208,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@@ -250,8 +250,8 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
authClient.newCall(
POST(
apiUrl,
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@@ -260,7 +260,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
val viewer = data["Viewer"]!!.jsonObject
Pair(
viewer["id"]!!.jsonPrimitive.int,
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content
viewer["mediaListOptions"]!!.jsonObject["scoreFormat"]!!.jsonPrimitive.content,
)
}
}
@@ -275,7 +275,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
struct["format"]!!.jsonPrimitive.content.replace("_", "-"),
struct["status"]!!.jsonPrimitive.contentOrNull ?: "",
parseDate(struct, "startDate"),
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0
struct["chapters"]!!.jsonPrimitive.intOrNull ?: 0,
)
}
@@ -287,7 +287,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
struct["progress"]!!.jsonPrimitive.int,
parseDate(struct, "startedAt"),
parseDate(struct, "completedAt"),
jsonToALManga(struct["media"]!!.jsonObject)
jsonToALManga(struct["media"]!!.jsonObject),
)
}
@@ -297,7 +297,7 @@ class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
date.set(
struct[dateKey]!!.jsonObject["year"]!!.jsonPrimitive.int,
struct[dateKey]!!.jsonObject["month"]!!.jsonPrimitive.int - 1,
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int
struct[dateKey]!!.jsonObject["day"]!!.jsonPrimitive.int,
)
date.timeInMillis
} catch (_: Exception) {
@@ -61,8 +61,8 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
authClient.newCall(
POST(
"$apiUrl/subject/${track.media_id}/update/watched_eps",
body = body
)
body = body,
),
).await()
track
@@ -168,7 +168,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
.add("client_secret", clientSecret)
.add("code", code)
.add("redirect_uri", redirectUrl)
.build()
.build(),
)
companion object {
@@ -201,7 +201,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
.add("client_secret", clientSecret)
.add("refresh_token", token)
.add("redirect_uri", redirectUrl)
.build()
.build(),
)
}
}
@@ -34,7 +34,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
.header("User-Agent", "Tachiyomi")
.url(
originalRequest.url.newBuilder()
.addQueryParameter("access_token", currAuth.access_token).build()
.addQueryParameter("access_token", currAuth.access_token).build(),
)
.build() else originalRequest.newBuilder()
.post(addToken(currAuth.access_token, originalRequest.body as FormBody))
@@ -51,7 +51,7 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
System.currentTimeMillis() / 1000,
oauth.expires_in,
oauth.refresh_token,
this.oauth?.user_id
this.oauth?.user_id,
)
bangumi.saveToken(oauth)
@@ -39,7 +39,7 @@ class DelayedTrackingStore(context: Context) {
DelayedTrackingItem(
trackId = it.key.toLong(),
mangaId = mangaId.toLong(),
lastChapterRead = lastChapterRead.toFloat()
lastChapterRead = lastChapterRead.toFloat(),
)
}
}
@@ -62,10 +62,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
"${baseUrl}library-entries",
headers = headersOf(
"Content-Type",
"application/vnd.api+json"
"application/vnd.api+json",
),
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType())
)
body = data.toString().toRequestBody("application/vnd.api+json".toMediaType()),
),
)
.await()
.parseAs<JsonObject>()
@@ -98,11 +98,11 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
.headers(
headersOf(
"Content-Type",
"application/vnd.api+json"
)
"application/vnd.api+json",
),
)
.patch(data.toString().toRequestBody("application/vnd.api+json".toMediaType()))
.build()
.build(),
)
.await()
.parseAs<JsonObject>()
@@ -137,10 +137,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
"X-Algolia-Application-Id",
algoliaAppId,
"X-Algolia-API-Key",
key
key,
),
body = jsonObject.toString().toRequestBody(jsonMime)
)
body = jsonObject.toString().toRequestBody(jsonMime),
),
)
.await()
.parseAs<JsonObject>()
@@ -252,7 +252,7 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
.add("refresh_token", token)
.add("client_id", clientId)
.add("client_secret", clientSecret)
.build()
.build(),
)
}
}
@@ -72,7 +72,7 @@ class KomgaApi(private val client: OkHttpClient) {
Request.Builder()
.url("${track.tracking_url.replace("/api/v1/series/", "/api/v2/series/")}/read-progress/tachiyomi")
.put(payload.toRequestBody("application/json".toMediaType()))
.build()
.build(),
)
.await()
return getTrackSearch(track.tracking_url)
@@ -92,7 +92,7 @@ data class ReadProgressDto(
booksUnreadCount,
booksInProgressCount,
lastReadContinuousIndex.toFloat(),
booksCount.toFloat()
booksCount.toFloat(),
)
}
@@ -165,7 +165,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
.filter {
it.jsonObject["node"]!!.jsonObject["title"]!!.jsonPrimitive.content.contains(
query,
ignoreCase = true
ignoreCase = true,
)
}
.map {
@@ -44,8 +44,8 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
authClient.newCall(
POST(
"$apiUrl/v2/user_rates",
body = payload.toString().toRequestBody(jsonMime)
)
body = payload.toString().toRequestBody(jsonMime),
),
).await()
track
}
@@ -153,7 +153,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
.add("client_secret", clientSecret)
.add("code", code)
.add("redirect_uri", redirectUrl)
.build()
.build(),
)
companion object {
@@ -186,7 +186,7 @@ class ShikimoriApi(private val client: OkHttpClient, interceptor: ShikimoriInter
.add("client_id", clientId)
.add("client_secret", clientSecret)
.add("refresh_token", token)
.build()
.build(),
)
}
}