Reference · SDK

techne.query(query, options?)

Next release: this page describes techne-sdk/types, which is not in techne-sdk 0.3.4 yet. With techne-sdk 0.3 today shows the released API.

methodtechne-sdk/connectIn React, useRecordQuery

One page of a query, as items. The query sets the type, so techne.query(Place.query(…)) answers places.

A list across authors answers curated records, each with its byline. It answers valid items by default. include: 'all' adds the pending and invalid ones the platform answered. It never adds what the platform left out, which is records blocked, hidden or not admitted.

Parameters

NameTypeWhat it is
queryrequiredQuery<T>A pub.techne.draft.query document, usually from a type's helper such as Place.query.
options.params{ [name]: string }The query's $param values, e.g. { here: '40.0150,-105.2705' }.
options.include'valid' | 'all''valid' (the default) or 'all'.
options.limitnumberThe page size. It defaults to the query's limit, else the platform's.
options.cursorstringThe previous page's cursor.
options.countbooleanAlso count what the query answers you. The page gains count and capped.

Returns Page<T>

NameTypeWhat it is
itemsValidItem<T>[]In the query's order. With include: 'all', Item<T>[].
cursorstring | undefinedPass it back for the next page. Absent on the last.
countnumber | undefinedHow many records the query answers you, before include. Only with count.
cappedboolean | undefinedTrue when counting stopped at the platform's cap. Only with count.

Each item

uriUri<T>The record's address.
cidstringThe version's content hash.
recordTThe record itself.
verdict'valid' | 'pending' | 'invalid'The SDK's own check of the record.
problemsstring[]Why it is not valid, or what it waits for.
curatedbooleanA curated record, composed from people's versions.
bylineByline | nullWhose version of a curated record speaks first.
Places within 5 km, nearest first, and a count
The same read in React

useRecordQuery is useQuery(techne.queryOptions(query, options)).

Calls pub.techne.draft.query.listRecords → once for each page