ApiServiceResponseUtils extension

Utility functions for Either<List<JSON>, JSON>.

Mainly renames the Either methods to be more descriptive for the context of an API service.

on

Properties

asJson JSON

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Returns the response as a JSON object.
no setter
asJsonOrNull JSON?

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Returns the response as a JSON object or null if isJson is false.
no setter
asList List<JSON>

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Returns the response as a list of JSON objects.
no setter
asListOrNull List<JSON>?

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Returns the response as a list of JSON objects or null if the response is not a list.
no setter
isJson bool

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Returns true if the response is a JSON object.
no setter
isList bool

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Returns true if the response is a list of JSON objects.
no setter

Methods

assertJson() → void

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Asserts that isJson is true and throws an exception if not.
assertList() → void

Available on Either<List<JSON>, JSON>, provided by the ApiServiceResponseUtils extension

Asserts that isList is true and throws an exception if not.