Skip to main content

json_page

Function json_page 

Source
pub fn json_page(items: Vec<Value>, total: i64, window: Window) -> Value
Expand description

The envelope a paged --json listing answers with.

Deliberately the same four members, spelled the same way, as acme_proxy_admin::webadmin::handlers::paging::page_envelope: total is what the same filters match unpaged, which is the whole difference between having read the table and having read a page of it, and a script should not have to learn one shape for the API and another for the shell.

The only listing shape the binary answers with. Three listings — eab list, admin user list, admin session list — used to print a bare array instead, on the argument that an operator mints those rows by hand a few at a time and so has no page to report. That was true of the tables and false of the scripts reading them, which had to learn one shape for the shell and another for /api; the bare-array renderer beside this one went with them.