Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic share and comments API #7315

Closed
splitt3r opened this issue Nov 27, 2017 · 5 comments
Closed

Generic share and comments API #7315

splitt3r opened this issue Nov 27, 2017 · 5 comments

Comments

@splitt3r
Copy link
Contributor

splitt3r commented Nov 27, 2017

The current share api is pretty much limited to only allow file sharing but there are apps like polls, deck and others that want to share other content. It would be pretty awesome in case of privacy settings and databse design and DRY to have one central share / comments api under the OCP namespace. Also UI / UX changes and things like the circles api need to be adopted in a lot of different apps instead of one central place. Took me some time to go threw all the sharing frontend / backend stuff to get the parts i needed to implement it in my app. Especially with features like activity entries and share notifications it becomes a bunch of code to maintain and update.

@blizzz
Copy link
Member

blizzz commented Nov 28, 2017

Comments

Comments have a PHP API within OCP and also via WebDAV. Later is not documented, unfortunately, yet.

If it helps a brief intro:

The Comments resource has an endpoint:

remote.php/comments/$OBJECTTYPE/$OBJECTID [/$COMMENTID]

The ObjectID endpoint accepts:

  • POST for creating a comment
  • PROPFIND to list comments, and also the read mark. You need to specify
    attributes in the request.
  • PROPPATCH to update the read mark, property name:
    {http://owncloud.org/ns}readMarker
  • REPORT to search comments

The CommentID endpoint accepts:

  • PROPPATCH to update the comment
  • DELETE to delete it
  • PROPFIND to list all properties

For a list of properties, see:
https://github.com/nextcloud/server/blob/master/apps/dav/lib/Comments/CommentNode.php#L108

Examples of usage can be found in this PR (check the comments):
owncloud/core#21664

And if you want a usage example of it, the announcement center has comments implemented. See the comments related files in https://github.com/nextcloud/announcementcenter/tree/master/js for frontend matters. Backendwise OCP\Comments\ICommentsManager is mostly close for housekeeping. It was introduced in nextcloud/announcementcenter#12, but there also some follow up PRs.

Sharing

What might help in Sharing is that for 13 we introduced OCP\Collaboration\Collaborators\ISearch which on PHP level enables you to look for people , groups, etc. you can share to. Initially this was the driver behind file_sharing's sharee endpoint, which for instance is used by Deck. It was taken out of the Controller and refactored into this public API.

Then we also introduced an AutoCompletion Controller endpoint for frontend matters. It is used by Comments autocomplete, but can be reused for anything related to collaboration, like finding users, groups etc to share with. It makes use of the previously mentioned ISearch thing. See https://github.com/nextcloud/server/blob/master/core/Controller/AutoCompleteController.php#L67, endpoint path is /autocomplete/get.

@blizzz
Copy link
Member

blizzz commented Nov 28, 2017

P.S.: to comments: files also have comment related attributes (→webdav), comments-href, comments-count and comments-unread. First points to the related comments resource, the others just say how many comments were left and how many are unread.

@splitt3r
Copy link
Contributor Author

Thanks for the detailed response :) i will have a look at the mentioned apis.

@nickvergessen
Copy link
Member

Should be all good, closing

@blizzz
Copy link
Member

blizzz commented Apr 12, 2018

@tobiasKaminsky as discussed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants