Skip to content

Commit

Permalink
Datasource: Add type alias StateData (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugolefrancois authored Feb 2, 2024
1 parent c385c63 commit 9112044
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public final class com/mirego/trikot/datasources/DataState$Pending : com/mirego/
public fun toString ()Ljava/lang/String;
}

public final class com/mirego/trikot/datasources/StateDataKt {
public static final fun stateDataData (Ljava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static final fun stateDataError (Ljava/lang/Throwable;Ljava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static synthetic fun stateDataError$default (Ljava/lang/Throwable;Ljava/lang/Object;ILjava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static final fun stateDataPending (Ljava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static synthetic fun stateDataPending$default (Ljava/lang/Object;ILjava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
}

public final class com/mirego/trikot/datasources/extensions/DataStateExtensionsKt {
public static final fun data (Lcom/mirego/trikot/datasources/DataState;)Ljava/lang/Object;
public static final fun error (Lcom/mirego/trikot/datasources/DataState;)Ljava/lang/Throwable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ public final class com/mirego/trikot/datasources/DataState$Pending : com/mirego/
public fun toString ()Ljava/lang/String;
}

public final class com/mirego/trikot/datasources/StateDataKt {
public static final fun stateDataData (Ljava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static final fun stateDataError (Ljava/lang/Throwable;Ljava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static synthetic fun stateDataError$default (Ljava/lang/Throwable;Ljava/lang/Object;ILjava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static final fun stateDataPending (Ljava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
public static synthetic fun stateDataPending$default (Ljava/lang/Object;ILjava/lang/Object;)Lcom/mirego/trikot/datasources/DataState;
}

public final class com/mirego/trikot/datasources/extensions/DataStateExtensionsKt {
public static final fun data (Lcom/mirego/trikot/datasources/DataState;)Ljava/lang/Object;
public static final fun error (Lcom/mirego/trikot/datasources/DataState;)Ljava/lang/Throwable;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.mirego.trikot.datasources

typealias StateData<V> = DataState<V, Throwable>

fun <V> stateDataPending(value: V? = null): StateData<V> = DataState.pending(value)
fun <V> stateDataData(value: V): StateData<V> = DataState.data(value)
fun <V> stateDataError(error: Throwable, value: V? = null): StateData<V> = DataState.error(error, value)

0 comments on commit 9112044

Please sign in to comment.