-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classResource.SuccessHolds the successfully requested API resource's data and HTTP response information.
public final classResource.ErrorHolds the unsuccessfully requested API resource's error details.
public final classResource.CancelledThe API resource request was cancelled.
public classResource.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Tdataprivate final IntegerresponseStatusCodeprivate final Map<String, List<String>>responseHeadersprivate final StringresponseBody
-
Method Summary
Modifier and Type Method Description TgetData()IntegergetResponseStatusCode()Map<String, List<String>>getResponseHeaders()StringgetResponseBody()final <U extends Any> Resource<U>mapSuccess(SuspendFunction1<Resource.Success<T>, Resource<U>> block)Utility method to chain API resource requests by mapping the successful resource request to the resource returned by the block. -
-
Method Detail
-
getResponseStatusCode
Integer getResponseStatusCode()
-
getResponseHeaders
Map<String, List<String>> getResponseHeaders()
-
getResponseBody
String getResponseBody()
-
mapSuccess
final <U extends Any> Resource<U> mapSuccess(SuspendFunction1<Resource.Success<T>, Resource<U>> block)
Utility method to chain API resource requests by mapping the successful resource request to the resource returned by the block.
Errors or cancellations are forwarded via copying and will prevent subsequent success mappings. For example if requests for
Resource<A>,Resource<B>, andResource<C>are chained, then ifResource<A>fails the success mapping blocks forResource<B>andResource<C>won't be called. Instead the error will be copied toResource<B>'s and then toResource<C>'s Error instance. The returned Resource will be aResource<C>.Errorinstance.
-
-
-
-