jw
07/18/2019, 4:09 PMtoString()
called on itPaul Woitaschek
07/18/2019, 4:09 PMjw
07/18/2019, 4:09 PMPaul Woitaschek
07/18/2019, 4:10 PMjw
07/18/2019, 4:10 PMPaul Woitaschek
07/18/2019, 4:10 PMLocalDate
parameters only work by accident ^^jw
07/18/2019, 4:11 PMjw
07/18/2019, 4:11 PMjw
07/18/2019, 4:11 PMPaul Woitaschek
07/18/2019, 4:12 PMSergioedcigreja
07/19/2019, 12:03 PMkevin.cianfarini
07/19/2019, 7:00 PMalec
07/19/2019, 7:03 PMalec
07/19/2019, 7:04 PMalec
07/19/2019, 7:04 PMkevin.cianfarini
07/19/2019, 7:10 PMalec
07/19/2019, 7:12 PMMike R
07/20/2019, 3:00 PMExpose(serialized = false)
annotations. I know this is a Gson thing and not a retrofit thing, but I'm noticing that Gson is still serializing the values that I have annotated NOT to serialize. What's the deal? Posting some code samples in a secMike R
07/20/2019, 3:01 PMdata class Listing(
@Expose @SerializedName("brand") var brand: String?,
@Expose(serialize = false) @SerializedName("id") var id: String?,
@Expose(serialize = false) @SerializedName("creator_id") var creatorId: String?,
@Expose(serialize = false) @SerializedName("lowest_price_at") var lowestPriceAt: String?)
Mike R
07/20/2019, 3:02 PMclass Client {
private var rfBuilder = Retrofit.Builder()
private var service: ClientService
init {
this.rfBuilder.apply {
baseUrl(BASE_URL)
addConverterFactory(
GsonConverterFactory.create(
GsonBuilder().apply {
excludeFieldsWithoutExposeAnnotation()
setPrettyPrinting()
}.create()
)
)
client(
OkHttpClient.Builder().apply {
addInterceptor { chain ->
val original = chain.request()
val requestBuilder = original.newBuilder().addHeader("User-Agent", USER_AGENT)
val request = requestBuilder.build()
chain.proceed(request)
}
}.build()
)
}
<http://logger.info|logger.info> { "Client running with user agent $USER_AGENT" }
this.service = rfBuilder.build().create()
}
Mike R
07/20/2019, 3:03 PMGson().toJson(listing)
with it and prints it outMike R
07/20/2019, 3:03 PMbrand
should be serializedMike R
07/20/2019, 3:04 PMinit
... I'm all ears 😆 I sorta really love apply
Ive Vasiljevic
07/23/2019, 8:30 AM.addInterceptor(HeaderInterceptor())
to OkHttpClient Builderegorand
07/23/2019, 12:02 PMHeaderInterceptor
would need to know about all headers for all endpointsegorand
07/23/2019, 12:04 PMAuthenticationInterceptor
that adds necessary auth headers, or a LogoutInterceptor
that handles 401 status code and clears local datamyanmarking
07/24/2019, 5:06 PMjw
07/24/2019, 5:10 PMjw
07/24/2019, 5:10 PM