Added custom api requests

This commit is contained in:
localhost_frssoft 2022-08-02 17:45:08 +03:00
parent d721fdc833
commit b1ca069656

View file

@ -904,6 +904,30 @@ notif_api_remove_all()
post_request --url "$instance_point"/notifications/clear
}
custom_manual_api_request()
{
while true; do
echo 'Select request method:'
method=$(echo 'get\npost' | fzy)
echo 'Input api request: api/v1/...'
case $method in
'get')
read raw_api
default_curl_opt "https://$instance/$raw_api" | jj -p
;;
'post')
read raw_api
post_request --url "https://$instance/$raw_api" | jj -p
;;
esac
echo "Done, exit? (y/N)"
read yn
if [ "$yn" = 'y' ]; then
break
fi
done
}
menu_write_status='Write status'
menu_timeline='Timelines'
notif='Notifications'
@ -913,13 +937,14 @@ my_account='Account'
backup_restore='Backup/Restore'
manage_followings='Manage followings'
search_menu='Search'
custom_request='Make custom api request'
authmake='Auth'
switchinstance='Switch instance'
Exit='Exit'
while true; do
if [ -n "$auth" ]; then
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$my_account\n$search_menu\n$switchinstance\n$Exit" | fzy)
main_menu=$(echo "$menu_write_status\n$menu_timeline\n$notif\n$my_account\n$search_menu\n$custom_request\n$switchinstance\n$Exit" | fzy)
else
main_menu=$(echo "$authmake\n$menu_timeline\n$switchinstance\n$Exit" | fzy)
fi
@ -949,6 +974,7 @@ while true; do
esac
;;
"$search_menu") search_api_statuses ;;
"$custom_request") custom_manual_api_request ;;
"$switchinstance")
empty=0
case $(echo 'Recently used\nChoice from list\nManual input' | fzy) in