[Owncloud] Share API
Michael Gapczynski
mtgap at owncloud.com
Sat Jun 16 00:57:43 UTC 2012
I just pushed the current state of the share API to the branch share_api. It's
incomplete, and no backends have been written, but I wanted to put the code
out in the open for review and feedback. The goal is for all apps to be able
to share their content easily and in a manner that is consistent across
ownCloud. Apps register a backend class which implements the functions
getSource, generateTarget, and translateItem. There is already some
documentation on these functions in the code, but a quick overview:
getSource - gets a value to store in the sharing database for the item e.g.
the id of the item in the app's database table
generateTarget - generates a unique target name of the item for the user being
shared with. This will prevent any item name conflicts.
translateItem - translates the stored value back into the item for the app to
use. This function should format the item so it can be used by the app's
template as a regular item
I'm planning on refactoring the existing sharing dropdown UI in order to make
it generic and allow apps to use it in their pages. The unique feature of this
API is that files will be converted to matching item types of apps that are
dependent on files. For example, if an image is shared in the files app it
will automatically appear in the gallery app, and vice-versa. An app developer
should only need to create the share backend, use the helper functions to get
the shared items for their app, and append the dropdown to items.
I'm hoping to finish up the API and implement the backend for files next week.
After that, I'd be more than happy to help others out with integrating sharing
into apps.
Michael
More information about the Owncloud
mailing list