Picnic.Page (Picnic v0.1.0)

Copy Markdown View Source

Flattens Picnic's display-page payloads into plain lists.

Some endpoints answer with a page of display tiles rather than a collection: a tree of banners, headers and product tiles, with the records worth having buried at arbitrary depth. This module walks that tree and pulls them out so resource modules keep returning flat lists.

It is as lenient as Picnic.Decode on purpose. An unfamiliar page never raises and never becomes an error: unrecognised nodes are skipped, and a payload with no usable body yields [] plus a drift warning rather than a failure. Callers who need the tiles themselves can fetch the untouched page through Picnic.request/4.

Summary

Functions

Collects the products out of a search page, in the order the page lists them.

Functions

selling_units(error)

@spec selling_units(Picnic.HTTP.result()) :: Picnic.HTTP.result()

Collects the products out of a search page, in the order the page lists them.

Takes and returns a Picnic.HTTP.request/4 result so it drops straight into a resource pipeline; errors pass through untouched.