getProducts

suspend fun getProducts(page: Int? = null, perPage: Int? = null): Pair<ProductsResponses.ListProductsResponse?, NetworkingError?>

Retrieves a paginated list of products.

Return

A Pair containing a ProductsResponses.ListProductsResponse on success, or a NetworkingError on failure.

Parameters

page

The page number to retrieve. Defaults to the first page when null.

perPage

The number of products to return per page. Uses the API default when null.


fun getProducts(page: Int? = null, perPage: Int? = null, completionHandler: (ProductsResponses.ListProductsResponse?, NetworkingError?) -> Unit)

Retrieves a paginated list of products and delivers the result via a callback.

Parameters

page

The page number to retrieve. Defaults to the first page when null.

perPage

The number of products to return per page. Uses the API default when null.

completionHandler

Invoked with a ProductsResponses.ListProductsResponse on success, or a NetworkingError on failure.