diff --git a/test-api.sh b/test-api.sh index b9bc2f7..f9d5d3c 100755 --- a/test-api.sh +++ b/test-api.sh @@ -19,5 +19,8 @@ abc=$(echo "$chatIDs" | jq -r .aGroupChats[0].id) echo echo Send a private/group message: -#echo "{\"pwHash\":\"1234567890\",\"a\":\"$a\",\"bChat\":\"$ab\",\"abc\":\"$abc\",\"msg\":{\"msgType\":\"TEXT\",\"content\":\"Test\"}}" | jq . -curl "localhost:8080/graphql" -X POST -H "content-type: application/json" --data "{\"query\":\"mutation sendMessages(\$a: ID!, \$pwHash: String!, \$bChat: ID!, \$abc: ID!, \$msg: MessageInput!) {\n chat: sendMessage(user: \$a, passwordHash: \$pwHash, chat: \$bChat, msg: \$msg)\n group: sendMessage(user: \$a, passwordHash: \$pwHash, chat: \$abc, msg: \$msg)\n}\",\"variables\":{\"pwHash\":\"1234567890\",\"a\":\"$a\",\"bChat\":\"$ab\",\"abc\":\"$abc\",\"msg\":{\"msgType\":\"TEXT\",\"content\":\"Test\"}},\"operationName\":\"sendMessages\"}" | jq . \ No newline at end of file +curl "localhost:8080/graphql" -X POST -H "content-type: application/json" --data "{\"query\":\"mutation sendMessages(\$a: ID!, \$pwHash: String!, \$bChat: ID!, \$abc: ID!, \$msg: MessageInput!) {\n chat: sendMessage(user: \$a, passwordHash: \$pwHash, chat: \$bChat, msg: \$msg)\n group: sendMessage(user: \$a, passwordHash: \$pwHash, chat: \$abc, msg: \$msg)\n}\",\"variables\":{\"pwHash\":\"1234567890\",\"a\":\"$a\",\"bChat\":\"$ab\",\"abc\":\"$abc\",\"msg\":{\"msgType\":\"TEXT\",\"content\":\"Test\"}},\"operationName\":\"sendMessages\"}" | jq . + +echo +echo Get private/group messages: +curl "localhost:8080/graphql" -X POST -H "content-type: application/json" --data "{\"query\":\"query getMessages(\$a: ID!, \$pwHash: String!, \$chat: ID!, \$groupChat: ID!) {\n chat: getMessages(user: \$a, passwordHash: \$pwHash, chat: \$chat) {\n id\n timestamp\n sender\n msgType\n content\n hideFor\n seenBy\n }\n groupChat: getMessages(user: \$a, passwordHash: \$pwHash, chat: \$groupChat) {\n id\n timestamp\n sender\n msgType\n content\n hideFor\n seenBy\n }\n}\",\"variables\":{\"a\":\"$a\",\"pwHash\":\"1234567890\",\"chat\":\"$ab\",\"groupChat\":\"$abc\"},\"operationName\":\"getMessages\"}" | jq .data \ No newline at end of file