Created
September 29, 2022 18:51
-
-
Save gmelodie/706feaa79c1b76fa66cfa3021b646f1f to your computer and use it in GitHub Desktop.
Estuary bash utilities and shortcuts
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
estuary_set_auth() { | |
export APIKEY=$1 | |
} | |
estuary_create_collection() { | |
coluuid=$(curl -X POST -H "Authorization: Bearer $APIKEY" "http://localhost:3004/collections/" -d '{ "name": "A new collection", "description": "A new collection test" }' -s | jq | grep uuid | cut -d '"' -f 4) | |
export LAST_COLLECTION=$coluuid | |
echo $coluuid | |
} | |
# usage: estuary_create_collection | estuary_add_content | |
estuary_add_content() { | |
filename=/tmp/dummy_file_$RANDOM | |
fallocate -l 500K $filename | |
coluuid=$(read in echo $in) | |
curl -X POST "http://localhost:3004/content/add?coluuid=$coluuid" -H "Authorization: Bearer $APIKEY" -H "Accept: application/json" -H "Content-Type: multipart/form-data" -F "data=@$filename" -s | jq | grep cid | cut -d '"' -f 4 | |
} | |
estuary_add_content_to_collection() { | |
estuary_create_collection | tee /dev/tty | estuary_add_content | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment