-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch to kotlinx serialization (closes #184)
- Loading branch information
Showing
43 changed files
with
187 additions
and
153 deletions.
There are no files selected for viewing
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
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
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
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
34 changes: 17 additions & 17 deletions
34
app/src/main/java/com/bnyro/wallpaper/api/bi/obj/BingImage.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
package com.bnyro.wallpaper.api.bi.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class BingImage( | ||
@JsonProperty("bot") val bot: Int? = null, | ||
@JsonProperty("copyright") val copyright: String? = null, | ||
@JsonProperty("copyrightlink") val copyrightLink: String? = null, | ||
@JsonProperty("drk") val drk: Int? = null, | ||
@JsonProperty("enddate") val endDate: String? = null, | ||
@JsonProperty("fullstartdate") val fullStartDate: String? = null, | ||
@JsonProperty("hsh") val hsh: String? = null, | ||
@JsonProperty("quiz") val quiz: String? = null, | ||
@JsonProperty("startdate") val startDate: String? = null, | ||
@JsonProperty("title") val title: String = "", | ||
@JsonProperty("top") val top: Int? = null, | ||
@JsonProperty("url") val url: String = "", | ||
@JsonProperty("urlbase") val urlBase: String = "", | ||
@JsonProperty("wp") val wp: Boolean = false | ||
@SerialName("bot") val bot: Int? = null, | ||
@SerialName("copyright") val copyright: String? = null, | ||
@SerialName("copyrightlink") val copyrightLink: String? = null, | ||
@SerialName("drk") val drk: Int? = null, | ||
@SerialName("enddate") val endDate: String? = null, | ||
@SerialName("fullstartdate") val fullStartDate: String? = null, | ||
@SerialName("hsh") val hsh: String? = null, | ||
@SerialName("quiz") val quiz: String? = null, | ||
@SerialName("startdate") val startDate: String? = null, | ||
@SerialName("title") val title: String = "", | ||
@SerialName("top") val top: Int? = null, | ||
@SerialName("url") val url: String = "", | ||
@SerialName("urlbase") val urlBase: String = "", | ||
@SerialName("wp") val wp: Boolean = false | ||
) |
4 changes: 2 additions & 2 deletions
4
app/src/main/java/com/bnyro/wallpaper/api/bi/obj/BingImageResponse.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package com.bnyro.wallpaper.api.bi.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class BingImageResponse( | ||
val images: List<BingImage> = emptyList() | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ package com.bnyro.wallpaper.api.le | |
|
||
import com.bnyro.wallpaper.api.CommunityApi | ||
import com.bnyro.wallpaper.db.obj.Wallpaper | ||
import com.bnyro.wallpaper.util.RetrofitBuilder | ||
import com.bnyro.wallpaper.util.RetrofitHelper | ||
|
||
class LeApi : CommunityApi() { | ||
override val name: String = "Lemmy" | ||
|
@@ -32,7 +32,7 @@ class LeApi : CommunityApi() { | |
|
||
override val defaultCommunityName: String = "[email protected]" | ||
|
||
private val api = RetrofitBuilder.create(baseUrl, Lemmy::class.java) | ||
private val api = RetrofitHelper.create(baseUrl, Lemmy::class.java) | ||
|
||
override suspend fun getWallpapers(page: Int): List<Wallpaper> { | ||
return api.getWallpapers( | ||
|
8 changes: 4 additions & 4 deletions
8
app/src/main/java/com/bnyro/wallpaper/api/le/obj/LemmyCreator.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package com.bnyro.wallpaper.api.le.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class LemmyCreator( | ||
@JsonProperty("name") val name: String = "", | ||
@SerialName("name") val name: String = "", | ||
) |
14 changes: 7 additions & 7 deletions
14
app/src/main/java/com/bnyro/wallpaper/api/le/obj/LemmyPost.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
package com.bnyro.wallpaper.api.le.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class LemmyPost( | ||
@JsonProperty("ap_id") val postUrl: String = "", | ||
@JsonProperty("name") val name: String = "", | ||
@JsonProperty("published") val published: String = "", | ||
@JsonProperty("thumbnail_url") val thumbnailUrl: String? = null, | ||
@SerialName("ap_id") val postUrl: String = "", | ||
@SerialName("name") val name: String = "", | ||
@SerialName("published") val published: String = "", | ||
@SerialName("thumbnail_url") val thumbnailUrl: String? = null, | ||
) |
10 changes: 5 additions & 5 deletions
10
app/src/main/java/com/bnyro/wallpaper/api/le/obj/LemmyPostView.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.bnyro.wallpaper.api.le.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class LemmyPostView( | ||
@JsonProperty("creator") val creator: LemmyCreator = LemmyCreator(), | ||
@JsonProperty("post") val post: LemmyPost = LemmyPost(), | ||
@SerialName("creator") val creator: LemmyCreator = LemmyCreator(), | ||
@SerialName("post") val post: LemmyPost = LemmyPost(), | ||
) |
4 changes: 2 additions & 2 deletions
4
app/src/main/java/com/bnyro/wallpaper/api/le/obj/LemmyResponse.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package com.bnyro.wallpaper.api.le.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class LemmyResponse( | ||
val posts: List<LemmyPostView> = emptyList() | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.bnyro.wallpaper.api.ow | ||
|
||
import kotlinx.serialization.json.JsonObject | ||
import retrofit2.http.GET | ||
|
||
interface OWalls { | ||
@GET("tanujnotes/bf400a269746c5c124a599af040dd82e/raw") | ||
suspend fun getAll(): Any | ||
suspend fun getAll(): JsonObject | ||
} |
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
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
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
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
3 changes: 3 additions & 0 deletions
3
app/src/main/java/com/bnyro/wallpaper/api/px/obj/PixelWall.kt
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
3 changes: 3 additions & 0 deletions
3
app/src/main/java/com/bnyro/wallpaper/api/px/obj/PixelWallsResponse.kt
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
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
12 changes: 6 additions & 6 deletions
12
app/src/main/java/com/bnyro/wallpaper/api/re/obj/ChildData.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package com.bnyro.wallpaper.api.re.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class ChildData( | ||
@JsonProperty("title") val title: String? = null, | ||
@JsonProperty("url") val url: String? = null, | ||
@JsonProperty("preview") val preview: Preview? = null | ||
@SerialName("title") val title: String? = null, | ||
@SerialName("url") val url: String? = null, | ||
@SerialName("preview") val preview: Preview? = null | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package com.bnyro.wallpaper.api.re.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class Children( | ||
@JsonProperty("data") val childdata: ChildData | ||
@SerialName("data") val childData: ChildData | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package com.bnyro.wallpaper.api.re.obj | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@Serializable | ||
data class Data( | ||
@JsonProperty("after") val after: String? = null, | ||
@JsonProperty("children") val children: ArrayList<Children>? = arrayListOf() | ||
@SerialName("after") val after: String? = null, | ||
@SerialName("children") val children: ArrayList<Children>? = arrayListOf() | ||
) |
Oops, something went wrong.