Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sample): moshi adapter fix for sample module #199

Merged
merged 1 commit into from
Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'com.squareup.okio:okio:2.10.0'

implementation "com.squareup.moshi:moshi:$moshiVersion"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion"

implementation "androidx.datastore:datastore-preferences:1.0.0"
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package com.sampleapp.functions.network.internal.core

import com.squareup.moshi.JsonClass

sealed class ResponseWrapper<out T> {
data class Success<out T>(val body: T) : ResponseWrapper<T>()
data class Failure(val error: ErrorResponse, val errorString: String? = null) :
ResponseWrapper<Nothing>()
}

@JsonClass(generateAdapter = true)
data class ErrorResponse(val reason: String?, val error: String)

@JsonClass(generateAdapter = true)
data class StatusResponse(val status: Boolean)