Skip to content
connercowling edited this page Apr 13, 2015 · 12 revisions

[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

Home

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>
		    ]
		}
    },
    ...
]

Content-engine feed

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>
		    ]
		},
		...
	]
}

User

Login:

POST ...

[TODO]

Creating a new user:

GET /users/new

POST ...

[TODO]

Updating user:

PATCH /users/:user-id

Accessing existing user:

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>,
	        }
	    ]
 	}   
}

Developer tools

Creating a new content-engine:

GET /content-engines/new

[TODO]

Updating content-engine:

PATCH ...

[TODO]

Accessing an existing content-engine:

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>
	     }
	}
}

Contribute

Creating a new contribution:

PUT /contributions/new

[TODO]

Accessing a saved contribution:

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>
            }
      ]
    }
}