Files
peernet/demo_server/test.sh
2024-04-06 20:45:15 -07:00

94 lines
2.1 KiB
Bash
Executable File

#!/bin/zsh
curl -X 'POST' \
'http://localhost:8080/v1/servers' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "my server",
"rooms": [
"myroom"
],
"authToken": "string",
"displayName": "Hello",
"services": [
{
"name": "http1",
"protocol": "peernet.http",
"version": "v1"
}
]
}'
curl -X 'GET' \
'http://localhost:8080/v1/rooms/myroom' \
-H 'accept: application/json'
# Simulate a knock
curl -X 'POST' \
'http://127.0.0.1:8080/v1/servers/my%20server/services/http1/knocks' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "knockname",
"offer": {
"name": "name1",
"sdpType": "string",
"sdp": "string"
},
"answer": {
"name": "string",
"sdpType": "string",
"sdp": "string"
}
}'
echo "http://127.0.0.1:8080/v1/servers/my%20server/services/http1/knocks"
curl -X 'GET' \
'http://127.0.0.1:8080/v1/servers/my%20server/services/http1/knocks' \
-H 'accept: application/json'
echo
echo "http://127.0.0.1:8080/v1/servers/my%20server/services/http1/knocks/knockname"
curl -X 'PATCH' \
'http://127.0.0.1:8080/v1/servers/my%20server/services/http1/knocks/knockname' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "knockname",
"offer": {
"name": "name1",
"sdpType": "string",
"sdp": "string"
},
"offer": {
"name": "name1",
"sdpType": "string",
"sdp": "string"
},
"answer": {
"name": "name2",
"sdpType": "name2",
"sdp": "string"
}
}'
curl -X 'POST' \
'http://127.0.0.1:8080/v1/sessions/name2/candidates' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "mycandidate",
"candidate": "string",
"sdpMid": "string",
"sdpLineIndex": 0,
"usernameFragment": "string"
}'
curl -X 'GET' \
'http://127.0.0.1:8080/v1/sessions/name2/claim/candidates' \
-H 'accept: application/json'
curl -X 'GET' \
'http://127.0.0.1:8080/v1/sessions/name2/claim/candidates' \
-H 'accept: application/json'