diff options
author | friendica <info@friendica.com> | 2014-05-08 22:44:12 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-05-08 22:44:12 -0700 |
commit | d3b5509b333f9bfc4641683572039bc8d4eaef88 (patch) | |
tree | 6aa1a7da597b19865ba5c137aeee9a79263b7305 /util | |
parent | 831b18cf283cd52fd1b01d6c6c4648b8351985a7 (diff) | |
download | volse-hubzilla-d3b5509b333f9bfc4641683572039bc8d4eaef88.tar.gz volse-hubzilla-d3b5509b333f9bfc4641683572039bc8d4eaef88.tar.bz2 volse-hubzilla-d3b5509b333f9bfc4641683572039bc8d4eaef88.zip |
shred: ability to execute somewhat arbitrary API functions and echo results
Diffstat (limited to 'util')
-rwxr-xr-x | util/shred/FriendicaOAuth.sh | 18 | ||||
-rwxr-xr-x | util/shred/shred | 6 |
2 files changed, 23 insertions, 1 deletions
diff --git a/util/shred/FriendicaOAuth.sh b/util/shred/FriendicaOAuth.sh index 7f368508b..4055e44a9 100755 --- a/util/shred/FriendicaOAuth.sh +++ b/util/shred/FriendicaOAuth.sh @@ -171,3 +171,21 @@ FO_statuses_home_timeline () { return $FO_rval } + +FO_command () { + local command="$1" + + local params=( + $(OAuth_param 'screen_name' $screen_name) + $(OAuth_param 'count' $count) + ) + + + local auth_header=$(OAuth_authorization_header 'Authorization' "$redmatrix_url" '' '' 'GET' "${redmatrix_url}/api/${command}.json" ${params[@]}) + + convscreen=$(OAuth_PE "$screen_name"); + FO_ret=$(curl -s --get "${redmatrix_url}/api/${command}.json" --data "screen_name=${convscreen}&count=${count}" --header "${auth_header}") + FO_rval=$? + + return $FO_rval +} diff --git a/util/shred/shred b/util/shred/shred index d6fa051c4..c46efa435 100755 --- a/util/shred/shred +++ b/util/shred/shred @@ -208,7 +208,11 @@ main () { return $FO_rval ;; *) - usage 1 + FO_command $fcli_command + JS_Parsed=$(echo "$FO_ret" | tokenize | parse) + echo "$JS_Parsed" + return $FO_rval + ;; esac return 0 |