searchProducts

suspend fun searchProducts(name: String? = null, active: Boolean? = null, shippable: Boolean? = null): Pair<List<Product>?, NetworkingError?>

Searches products by optional filter criteria.

Return

A Pair containing the matching list of Product objects on success, or a NetworkingError on failure.

Parameters

name

Filters results to products whose name matches this value. Omitted when null.

active

Filters results to active or inactive products. Omitted when null.

shippable

Filters results to shippable or non-shippable products. Omitted when null.


fun searchProducts(name: String? = null, active: Boolean? = null, shippable: Boolean? = null, completionHandler: (List<Product>?, NetworkingError?) -> Unit)

Searches products by optional filter criteria and delivers the result via a callback.

Parameters

name

Filters results to products whose name matches this value. Omitted when null.

active

Filters results to active or inactive products. Omitted when null.

shippable

Filters results to shippable or non-shippable products. Omitted when null.

completionHandler

Invoked with the matching list of Product objects on success, or a NetworkingError on failure.