#Users
- User object
{
id: integer
username: string
email: string
created_at: datetime(iso 8601)
updated_at: datetime(iso 8601)
}
/** | |
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has | |
* already been handled. | |
* | |
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled. | |
*/ | |
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> { | |
override fun onChanged(event: Event<T>?) { | |
event?.getContentIfNotHandled()?.let { value -> | |
onEventUnhandledContent(value) |
package com.rogerthat.network.util; | |
import android.content.Context; | |
import java.io.ByteArrayOutputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.net.URLConnection; | |
import okhttp3.Interceptor; |
private val HEX_CHARS = "0123456789ABCDEF".toCharArray() | |
fun ByteArray.toHex() : String{ | |
val result = StringBuffer() | |
forEach { | |
val octet = it.toInt() | |
val firstIndex = (octet and 0xF0).ushr(4) | |
val secondIndex = octet and 0x0F | |
result.append(HEX_CHARS[firstIndex]) |
#Users
{
id: integer
username: string
email: string
created_at: datetime(iso 8601)
updated_at: datetime(iso 8601)
}