From d3b5509b333f9bfc4641683572039bc8d4eaef88 Mon Sep 17 00:00:00 2001 From: friendica Date: Thu, 8 May 2014 22:44:12 -0700 Subject: shred: ability to execute somewhat arbitrary API functions and echo results --- util/shred/FriendicaOAuth.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'util/shred/FriendicaOAuth.sh') 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 +} -- cgit v1.2.3 From 3eae3fd496abcd843d18a36e042f2185527d8803 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 11 May 2014 18:36:00 -0700 Subject: a bit more progress on using shred to pick through API results. Commented out because the array storage is kindof weird so the first try (assuming simple arrays) didn't work out. I'll have to rethink how to index these things and may have to rewrite the js() function to do the kinds of things I want. --- util/shred/FriendicaOAuth.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'util/shred/FriendicaOAuth.sh') diff --git a/util/shred/FriendicaOAuth.sh b/util/shred/FriendicaOAuth.sh index 4055e44a9..76858d73c 100755 --- a/util/shred/FriendicaOAuth.sh +++ b/util/shred/FriendicaOAuth.sh @@ -175,10 +175,10 @@ FO_statuses_home_timeline () { FO_command () { local command="$1" - local params=( - $(OAuth_param 'screen_name' $screen_name) - $(OAuth_param 'count' $count) - ) + 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[@]}) -- cgit v1.2.3