| Crates.io | haystack-client |
| lib.rs | haystack-client |
| version | 0.1.3 |
| created_at | 2025-05-09 23:06:24.529085+00 |
| updated_at | 2025-05-16 20:18:03.504338+00 |
| description | Client library and CLI tool for interacting with haystack servers |
| homepage | https://candronikos.com/projects/haystack-rust/ |
| repository | https://github.com/candronikos/haystack |
| max_upload_size | |
| id | 1667863 |
| size | 168,570 |
Rust implementation of an async haystack client library and CLI tool and REPL.
filter: (optional), limit: (optional)filter: (optional), limit: (optional)filter: (optional), limit: (optional)filter: (optional), limit: (optional)filter / idnavId: (optional)watchDis / watchId, lease: (optional)watchId, id / close: (optional)watchId, refresh: (optional)range, ids: (1+), timezone: (optional)data# Reuse haystack bearer token
( # () Opens a sub-shell
export HAYSTACK_AUTH_CONFIG=`hs default auth`;
# Destination does not need to be included if the environment variable
# HAYSTACK_AUTH_CONFIG is set.
# I also set up my .bashrc to use the alias "hs" instead of the full name.
# Stick with `haystack-client` if you haven't configured your .bashrc this way
hs read --filter "point" --limit=1
# Example below of correct character escaping in bash shell when passing
# filters enclosed by either single or double quotes.
hs read --filter 'point and unit==\"kWh\" and equipRef->siteRef'
hs read --filter "point and unit==\\\"kWh\\\" and equipRef->siteRef"
)
# Read–eval–print loop (REPL) You will see the prompt "hs〉"
# To learn about the $DEST argument, see the configuration section below.
haystack-client $DEST repl
hs〉about
# About
haystack-client $DEST about
# Read by filter
haystack-client $DEST read --filter "point and unit==\"kWh\" and equipRef->siteRef"
# Read by ids
haystack-client $DEST read --ids @p:demo:r:2f70054a-87f6d1de @p:demo:r:2f70054a-314342cd
# His Read (single)
haystack-client $DEST hisRead yesterday @p:demo:r:2f70054a-87f6d1de
# His Read (batch, could use the optional --timezone argument)
haystack-client $DEST hisRead yesterday @p:demo:r:2f70054a-87f6d1de @p:demo:r:2f70054a-314342cd
# WatchSub
## Can create watches with or without an id list
haystack-client $DEST watchSub -c "test" @p:demo:r:2f70054a-51d71f8e
## Subscribing points to a watch
haystack-client $DEST watchSub -s "w-2f8e0d48-64f17e75" @p:demo:r:2f70054a-51d71f8e @p:demo:r:2f70054a-69f26216
# Unsubscribing and closing a watch
haystack-client $DEST watchUnsub --close w-2f8e1d8b-8efac249
haystack-client $DEST watchUnsub @p:demo:r:2f70054a-51d71f8e
# Watch Poll (with or without --refresh)
haystack-client $DEST watchPoll w-2f8e2739-3c4b3bde --refresh
# Defs
haystack-client $DEST defs "name==\\\"testJob\\\"" --limit 1
watchId only.hisWrite