Skip to content

Instantly share code, notes, and snippets.

@av
Created August 27, 2020 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save av/a5e52576b76bab5258e48e1ccf323993 to your computer and use it in GitHub Desktop.
Save av/a5e52576b76bab5258e48e1ccf323993 to your computer and use it in GitHub Desktop.
thng-query examples

Sample queries

thngs with name Advanced* where identifiers.ser^673
products named Robot*
thngs tagged "offline"
products where customFields.weight > 42

Programmatic use

const tq = require('tq');

tq.setup({
  authorization: process.env.OPERATOR_KEY
});

tq.run('thngs with name Advanced* where identifiers.ser^673')
    .then(console.log)
    .catch(console.error);

CLI use

# To see all available options
tq --help 
# Will dump output json straight to stdout
tq -k $OPERATOR_KEY 'thngs where properties.online = true'
# Could be used with formatters, like jq
tq -k $OPERATOR_KEY 'products with tag overcomplicated' | jq .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment