initial commit
This commit is contained in:
parent
6b6765b2e4
commit
2c58b4626f
|
@ -0,0 +1,44 @@
|
|||
ACTION=$1
|
||||
|
||||
BASE_URL="http://localhost:1337"
|
||||
|
||||
print_help() {
|
||||
echo "./manager.sh [ACTION] [ARGUMENTS] <UNNECESSARY ARGUMENTS>"
|
||||
echo "./manager.sh login [login] [password]"
|
||||
echo "./manager.sh create_board [boardId] [boardTitle]"
|
||||
echo "./manager.sh create_thread [boardId] [threadTitle] [content] <isLocked> <isPinned> <options>"
|
||||
echo "./manager.sh get_boards"
|
||||
echo "./manager.sh get_threads [boardId]"
|
||||
}
|
||||
|
||||
curl_post() {
|
||||
curl -X POST -H "Content-Type: application/json" -b cookies.txt -c cookies.txt --data $*
|
||||
}
|
||||
|
||||
curl_get() {
|
||||
curl -X GET -c cookies.txt -b cookies.txt ${BASE_URL}$*
|
||||
}
|
||||
|
||||
case $ACTION in
|
||||
"help")
|
||||
print_help
|
||||
;;
|
||||
"login")
|
||||
curl_post '{"login":"'${2}'","password":"'${3}'"}' ${BASE_URL}/api/login
|
||||
;;
|
||||
"create_board")
|
||||
curl_post '{"boardId":"'${2}'","boardTitle":"'${3}'"}' ${BASE_URL}/api/createBoard
|
||||
;;
|
||||
"get_boards")
|
||||
curl_get /api/getBoards
|
||||
;;
|
||||
"create_thread")
|
||||
curl_post '{"boardId":"'${2}'","threadTitle":"'${3}'","content":"'${4}'","isLocked":"'${5}'","isPinned":"'${6}'","options":"'${7}'"}' ${BASE_URL}/api/createThread
|
||||
;;
|
||||
"get_threads")
|
||||
curl_get /api/getThreads/${2}
|
||||
;;
|
||||
*)
|
||||
print_help
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue