Created
July 28, 2023 16:06
-
-
Save tlehman/534cf9fbb1864d2a7c29396e25238f3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GRAPH_NAME=tlehman | |
function roam_api_get_blocks_containing_string() { | |
curl -X POST "https://api.roamresearch.com/api/graph/$GRAPH_NAME/q" --location-trusted \ | |
-H "accept: application/json" \ | |
-H "Authorization: Bearer $ROAM_API_KEY" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"query\" : \"[:find ?block-str :in \$ ?search-string :where [?b :block/uid ?block-uid] [?b :block/string ?block-str] [(clojure.string/includes? ?block-str ?search-string)]]\", \"args\": [\"$1\"]}" | |
} | |
function roam_api_create_block() { | |
local TODAY=$(date +"%m-%d-%Y") | |
curl -X POST "https://api.roamresearch.com/api/graph/$GRAPH_NAME/write" --location-trusted \ | |
-H "accept: application/json" \ | |
-H "Authorization: Bearer $ROAM_API_KEY" \ | |
-H "Content-Type: application/json" \ | |
-d "{\"action\":\"create-block\",\"location\":{\"parent-uid\":\"$TODAY\",\"order\":\"last\"},\"block\":{\"string\":\"$1\",\"open\":false,\"children-view-type\":\"document\"}}" | |
} | |
roam_api_create_block "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment