vanhecke/celmex/2.0.0

NOTE: the latest version is 3.0.0

Unavailable. Nobody can download this version any more, with elm or with the Lamdera compiler: github.com/vanhecke/celmex is gone (deleted or private); Software Heritage not asked yet (this run's --swh-calls were used up); no fork with the same repo name found; no cached copy. Use another version.

Details

Cortex.RequestData

Envelope builder for Cortex Advanced API endpoints that accept the standard filters / sort / search_from/search_to / timeframe shape.

Endpoint modules take a typed args record, map it into a Standard, and call encode with the appropriate Cortex.Query.Dialect — that single call produces the full {"request_data": {...}} body. The extra field is an escape hatch for endpoint-specific keys or new Cortex fields the SDK has not modeled yet; its pairs are merged in last, so they override any SDK-generated key on collision.

type alias Standard =
{ filters : List Filter
, sort : Maybe Sort
, range : Maybe Range
, timeframe : Maybe Timeframe
, extra : List ( String, Value )
}

The standard inner shape of request_data. Every field is optional at the wire level — omitted Maybes and the empty filters/extra lists drop out of the encoded body.

empty : Standard

A Standard with no fields set — encodes to {"request_data": {}} regardless of dialect.

encode : Dialect -> Standard -> Value

Encode a Standard as the {"request_data": {...}} envelope ready to hand to Cortex.Request.post.

The Dialect controls the wire shape of filters and sort and which fields are emitted: the Cortex.Query.standard dialect emits flat {field, operator, value} filters, a single {field, keyword} sort object, and the optional timeframe; the Cortex.Query.assetInventory dialect wraps filters in {AND: [...]} with uppercase SEARCH_FIELD/SEARCH_TYPE/ SEARCH_VALUE keys, wraps sort in a one-element array of {FIELD, ORDER}, and drops timeframe (the asset-inventory endpoint does not accept it).

range and extra behave identically across dialects.