-
Notifications
You must be signed in to change notification settings - Fork 0
GUI Pipe API
Long Hoang edited this page Feb 13, 2017
·
3 revisions
The PeerBackend
and Frontend
is communicating via stdin
/ stdout
pipes.
{"command":"postPost", "arguments": {"content": "Life tiny, die never!"}}
{"hash": "QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP"}
{"command":"getPost", "arguments": {"hash": "QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP"}}
{
"Alias":"Long",
"Content":"Life tiny, die never!",
"Timestamp":1486967871,
"Hash":"QmS2LEajk9jBm9YRnKMz3ukchmcWymF89d4MFpezYBBCMm",
"Key":"TODO",
"UserData":{
"Score":11,
"Flagged":false
}
}
{"command":"getPosts"}
[
{
"Alias":"Long",
"Content":"Life tiny, die never!",
"Timestamp":1486967871,
"Hash":"QmS2LEajk9jBm9YRnKMz3ukchmcWymF89d4MFpezYBBCMm",
"Key":"TODO",
"UserData":{
"Score":11,
"Flagged":false
}
},
{
"Alias":"Long",
"Content":"Life tiny, die never!",
"Timestamp":1486997097,
"Hash":"QmeyRdWCpeReyUdfcyMiaXEBJbZvvUwe5BFroTHZ1Lh9k4",
"Key":"TODO",
"UserData":{
"Score":0,
"Flagged":false
}
}
]
{
"command":"postComment",
"arguments":{
"post":"QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP",
"content":"Tardigrades FTW",
"parent":"QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP"
}
}
{"hash": "QmTjyYMFaK3Djsm2Aaezy3FoFBHCnHpo6stMRTE6x9F4Gm"}
Note that parent hash refers to the comment it replies to, while post hash still refers to the same post.
{
"command":"postComment",
"arguments":{
"post":"QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP",
"content":"I agree that Tardigrades are amazing!",
"parent":"QmTjyYMFaK3Djsm2Aaezy3FoFBHCnHpo6stMRTE6x9F4Gm"
}
}
{"hash": "QmTdhGNVMQq83S8Ns2XZFaRNuzkrVC4rtBdWniKTZTjwhd"}
{"command":"getCommentsFromPost", "arguments": {"hash": "QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP"}}
[
{
"Post":"QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP",
"Parent":"QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP",
"Alias":"Long",
"Content":"Tardigrades FTW",
"Timestamp":1486890516,
"Hash":"QmTjyYMFaK3Djsm2Aaezy3FoFBHCnHpo6stMRTE6x9F4Gm",
"Key":"TODO"
},
{
"Post":"QmdFWdZTL5dujL1woPMSe1kpzzTxJdKYpHfL35y5uikkqP",
"Parent":"QmTjyYMFaK3Djsm2Aaezy3FoFBHCnHpo6stMRTE6x9F4Gm",
"Alias":"Long",
"Content":"I agree that Tardigrades are amazing!",
"Timestamp":1486890532,
"Hash":"QmTdhGNVMQq83S8Ns2XZFaRNuzkrVC4rtBdWniKTZTjwhd",
"Key":"TODO"
}
]
E.g. change score to 4711 and change flagged status
{
"command":"setPostUserData",
"arguments":{
"hash":"QmS2LEajk9jBm9YRnKMz3ukchmcWymF89d4MFpezYBBCMm",
"UserData":{
"Score":4711,
"Flagged":true
}
}
}
{"status": "success"}
Note: Works similarly for Comments, just use setCommentUserData
as command