See trustocracy-graph-generation repository.
run node app
topic
- returns a list of topics
- TODO: support sorted by created date, last updated opinion date, and opinion count
[
{
"created": "2016-11-06T00:36:59.525Z",
"id": 3,
"text": "Topic Thunder",
"opinionCount": 42,
"lastUpdated": "2017-02-07T12:43:52.415Z"
}
]
topic/:topicId
- returns a single topic by id
{
"created": "2016-11-06T00:36:59.525Z",
"id": 3,
"text": "Topic Thunder",
"opinionCount": 42,
"lastUpdated": "2017-02-07T12:43:52.415Z"
}
topic/:topicId/opinions
- returns all opinions sorted by influence for a topic
- authors are attached
[
{
"author": {
"name": "Julius Herzog",
"id": 1688
},
"id": 25,
"created": "2016-04-24T11:58:11.866Z",
"influence": 3159
}
]
opinion/:opinionId
- return full opinion with author and topic information
{
"author": {
"name": "Julius Herzog",
"id": 1688
},
"topic": {
"created": "2016-11-06T00:36:59.525Z",
"id": 3,
"text": "Topic Thunder"
},
"id": 25,
"created": "2016-04-24T11:58:11.866Z",
"influence": 3159,
"text": "This is the entirety of the opinion and could be quite long..."
}
user/:id/topic/:id/opinions
- returns any opinion within 4 edges (currently hard-coded)
- returns each possible path to those opinions
- each path starts with an immediate
friend
of the user - each path ends with the
opiner
who wrote the opinion - omits any paths which duplicate the same
friend
andopiner
node - in the case of duplicates the result with the lowest
score
is selected - to score, TRUSTS_EXPLICITLY = 1 and TRUSTS = 2
{
"paths": [{
"friend" : {
"name" : String,
"id" : Int
},
"path" : [
TRUSTS_EXPLICITLY | TRUSTS,
...
],
"opiner" : {
"name" : String,
"id" : Int
},
"opinion" : Int,
"score" : Int,
"key" : String => Id:Id
}]
}
user/:id
{
"user" : {
"name" : String,
"id" : Int
},
"neighbors" : [
{
"rel" : TRUSTS_EXPLICITLY | TRUSTS,
"friend" : {
"name" : String,
"id" : Int
}
}
]
}