Mobile web projects/Collections Backend

This is a draft space for Collections, spring zero backend spike results

Non-MVP Collections schema draft
Collections table:
 * collection_id ( auto increment )
 * user_id ( index )
 * label
 * description
 * private flag ( default false )
 * timestamp ( time created )

Collection_pages table
 * item id ( auto increment )
 * collection id ( index )
 * page id
 * order ( default 0 )
 * timestamp ( time added )

action=editcollection
Create, edit, or delete a collection. If collection ID is given, treat this as an edit request. If only label is given, treat as a creation request. All other parameters are optional. If given, they set/modify collection information. If missing, no changes are done to them. To delete an existing collection, use the deletecollection=1 parameter.

This action also allows pages to be added or removed from the collection. Just like action=watch, it supports titles, pagids, revids, and generator queries.

Parameters

 * : Collection ID of the existing collection you want to edit.
 * : Title of the collection you want to create (if id is not given), or new label if it already exists.
 * : Collection description (optional)
 * : Collection flags (optional)
 * : When adding pages, include missing pages in the list (optional, false by default)
 * : If set, pages will be removed rather than added (optional,  must be present)
 * : Boolean - if given, the collection will be deleted (optional,  must be present)
 * : A "watch" token retrieved from action=query&meta=tokens (TBD)

Statuses

 * created: new collection was created
 * updated: existing collection was updated. This status is returned even if no actual changes were done to the collection
 * deleted: collection was deleted

Errors

 * badid: collection id does not exist
 * exists: a collection with this label already exists
 * noidlabel: either label or id must be given
 * noid: id must be given

action=query &amp; list=collections
List all available collections. For now, lists only collections that belong to a current user. Eventually might make it possible to enumerate collections of other users.

Parameters

 * : Optional list of values to get in addition to id. Default = label. Can be label, desc, pages, eventually - flags, etc.
 * : Optional collection id to limit info to just one collection
 * : Optional collection label to limit info to just one collection

action=query &amp; list=collectionpages
List all pages in a collection. This list can be used as a generator. Eventually this module may support the same parameters as in query/allpages, and/or replace the query/watchlistraw.

Parameters

 * : Optional collection id to limit info to just one collection
 * : Optional collection label to limit info to just one collection