-
Notifications
You must be signed in to change notification settings - Fork 0
REST API
[TODO] Log-in
[TODO] Address authentication generally
[TODO] Handle whether a user is logged in or not
[TODO] Saving / persisting to db
[TODO] Handle posting likes
GET /sort=:'recent'-or-'popular'-or-'random'
NOTE: The code
attribute of the contribution
object is intended to be for a specific contribution. That is, it's expected that server has integrated the code from the content-engine and the inputs specified by the contributor, and provided it as said code
attribute.
[
{
"content-engine" : {
"_id" : <mongodb-content-engine-id>,
"title" : <developer-provided-string>,
"developer" : {
"_id" : <mongodb-user-id>,
"username" : <user-provided-string>
},
"number-contributions" : <length-of-contributions>,
"number-likes" : <length-of-likes>,
"sources" : [
<developer-provided-string-1>,
...
<developer-provided-string-2>
],
"tags" : [
<tag-1>,
...
<tag-n>
]
},
"contribution" : {
"_id" : <mongodb-contribution-id>,
"title" : <contributor-provided-string>,
"code" : {
"configure" : <developer-provided-code>,
"html" : <developer-provided-code>,
"css" : <developer-provided-code>,
"javascript" : <developer-provided-code>
},
"contributor" : {
"_id" : <mongodb-user-id>,
"username" : <user-provided-string>
},
"number-likes" : <length-of-likes>,
"sources" : [
<developer-provided-string-1>,
...
<developer-provided-string-2>
],
"tags" : [
<tag-1>,
...
<tag-n>
]
}
},
...
]
GET /content-engines/:content-engine-id&sort=:'recent'-or-'popular'-or-'random'
{
"content-engine" : {
"_id" : <mongodb-content-engine-id>,
"title" : <developer-provided-string>,
"developer" : {
"_id" : <mongodb-user-id>,
"username" : <user-provided-string>
},
"number-contributions" : <length-of-contributions>,
"number-likes" : <length-of-likes>,
"sources" : [
<developer-provided-string-1>,
...
<developer-provided-string-2>
],
"tags" : [
<tag-1>,
...
<tag-n>
]
},
"contributions" : [
{
"_id" : <mongodb-contribution-id>,
"title" : <contributor-provided-string>,
"code" : {
"configure" : <developer-provided-code>,
"html" : <developer-provided-code>,
"css" : <developer-provided-code>,
"javascript" : <developer-provided-code>
},
"contributor" : {
"_id" : <mongodb-user-id>,
"username" : <user-provided-string>
},
"number-likes" : <length-of-likes>,
"sources" : [
<developer-provided-string-1>,
...
<developer-provided-string-2>
],
"tags" : [
<tag-1>,
...
<tag-n>
]
},
...
]
}
POST ...
[TODO]
GET /users/new
POST ...
[TODO]
PATCH /users/:user-id
GET /users/:user-id
{
"user" : {
"_id": <mongodb-user-id>,
"username" : <user-chosen-string>,
"fname" : <user-provided-first-name>,
"lname" : <user-provided-last-name>,
"role" : <'explorer'-or-'contributor'-or-'developer'>,
"image" : <uri-to-profile-image>,
"joined" : <when-account-created>,
"bio" : <user-provided-text>
},
"activities" : {
[
{
"_id": <mongodb-activity-id>,
"type" : <'like'-or-'contribute'-or-'develop'>,
"content_engine" : <content-engine-id>,
"contribution" : <contribution-id>,
"when" : <when-activity-logged>,
},
...
{
"_id": <mongodb-activity-id>,
"type" : <'like'-or-'contribute'-or-'develop'>,
"content_engine" : <content-engine-id>,
"contribution" : <contribution-id>,
"when" : <when-activity-logged>,
}
]
}
}
GET /content-engines/new
[TODO]
PATCH ...
[TODO]
GET /content-engines/:content-engine-id
{
"content-engine" : {
"_id" : <mongodb-content-engine-id>,
"title" : <developer-provided-string>,
"inputs" : [
<input-type>,
...
<input-type>
],
"developer" : {
"username" : <user-chosen-string>,
"_id" : <mongodb-user-id>
},
"parent" : <mongodb-content-engine-id>,
"code" : {
"configure" : <developer-provided-code>,
"html" : <developer-provided-code>,
"css" : <developer-provided-code>,
"javascript" : <developer-provided-code>
}
}
}
PUT /contributions/new
[TODO]
GET /contributions/:contribution-id
{
"content-engine" : {
"_id" : <mongodb-content-engine-id>,
"title" : <developer-provided-string>,
"inputs" : [
<input-type>,
...
<input-type>
],
"developer" : {
"username" : <user-chosen-string>,
"_id" : <mongodb-user-id>
},
"parent" : <mongodb-content-engine-id>,
"code" : {
"configure" : <developer-provided-code>,
"html" : <developer-provided-code>,
"css" : <developer-provided-code>,
"javascript" : <developer-provided-code>
}
},
"contribution" : {
"_id" : <mongodb-contribution-id>,
"contributor" : <mongodb-user-id>,
"title" : <contributor-provided-string>,
"content-engine" : <mongodb-content-engine-id>,
"likes" : [
<user-id-1>,
...
<user-id-n>
],
"sources" : [
<developer-provided-string-1>,
...
<developer-provided-string-2>
],
"inputs" : [
{
"type" : <type-identifier>,
"name" : <developer-provided-name>,
"value" : <contributor-provided-value>
},
...
{
"type" : <type-identifier>,
"name" : <developer-provided-name>,
"value" : <contributor-provided-value>
}
]
}
}