In my opinion API changes should be announced and removed functions should be deprecated for at least one nc version.
There is a issue for NC14. #7827
What about documentation? I love writing apps for Nextcloud, but their lack of (good) documentation prevents me from integrating nicely with their API's. Or even worse breaking apps.
Just checked, the functions DO exist in NC12, so why are they removed without notice in NC13?
In NC 13 / 14 i can't find such methods, are they simply (re)moved?
Yes, because this was the old way of sharing, that had some serious design flaws. So we introduced some versions back (9 or 10 IIRC) a new share manager which provides this functionality in a better way with a cleaner API.
Just inject this interface as dependency to your controller or class in general: https://github.com/nextcloud/server/blob/master/lib/public/Share/IManager.php
Then you can create, update and delete shares.
cc @nextcloud/sharing
Just checked, the functions DO exist in NC12, so why are they removed without notice in NC13?
Ummm ... good question. We checked all apps in the App Store usually and only removed stuff, that was dysfunctional. I can't recall it on those functions.
@MorrisJobke Any examples would be very helpful.
That was removed by a cleanup where we checked if they are used out there:
https://github.com/nextcloud/server/pull/6116 - sorry for the problems here. That was also one reason why we introduced this long list with changes for 14 (even if they were announced some time back).
Let me check for an example.
You can see how to get shares that are shared with a user in here:
In the same file also shares are created, updated and deleted. @nextcloud/sharing Where is the documentation for the new sharing?
The sharing 2.0 was tracked in https://github.com/owncloud/core/issues/19331
But @param suggests that only File or Folder can be used?
But @param suggests that only File or Folder can be used?
Correct - sharing is restricted to files and folders at least the part we provide in the server. What is your use case?
cc @nextcloud/sharing for potential other share types.
@MorrisJobke I can fix it in a quick way.
The fix is just a class that extends share, and adds the old methods back:
https://github.com/brantje/nextnote/commit/1099e0ec3ba795d0b77b39416daf5f5479b5626c
@brantje ai sorry for this. Let me explain a bit of the background here.
The old sharing stuff (so OCP\Share) was just extended and extended. At some point people used it to get stuff in and out of the share table in all kinds of ways. While this is fine in principle the code was not maintainable at all (see the actual code there :wink: ). Then a few years ago we decided to move on to the new sharing code and to only focus on files. This since it is the core of what we do. And we first want to get that 100% right and fast etc.
The issue we have now is that files shared with the old system are not 100% compatible with the new system etc.
For a quick hack you could either write a few small functions that directly manipulate the DB. Or copy over the old code.
For a few apps I have I just wrote a tiny share part myself (with my own share table). Because I don't want other apps to maybe collide with my code or db rows etc. Most of the time sharing in apps is a lot simpler than sharing files.
I'm however glad that I now know of a community member that is using it in a different way. Because now we can actually gather the use cases etc. And also ask for feedback of people using sharing for other things than files.
So again sorry. I hope we can solve it in a somewhat simple way for you. And lets discuss how we can improve and move this forward.
The biggest problem I have noticed while developing nextcloud apps it's the lack of good app API documentation and the sudden API changes between versions.
Also a mailing list or something in the like notifying breaking API changes to app developers would be awesome for a system like Nextcloud.
Also a mailing list or something in the like notifying breaking API changes to app developers would be awesome for a system like Nextcloud.
That's what we started to do, because we noticed it. So for 14 and onwards we use something like this #7827 and already ping affected developers before the version actually is released.
The biggest problem I have noticed while developing nextcloud apps it's the lack of good app API documentation and the sudden API changes between versions.
This should usually never happened. It only happened in the OCP\Share space, because there were serious harm done to existing data and it never properly worked for all cases. So if you use any OCP stuff, then the app and API should not break (at least until it is deprecated + 3 years). For the OC namespace we don't guarantee anything and it can break at anytime, because it is the internal namespace. Could you tell us the APIs that broke for you?
Question when using OC\Share\Share::shareItem to share an item with a local group, i get:
Doctrine\DBAL\Exception\SyntaxErrorException: An exception occurred while executing 'SELECT `uid` FROM `oc_group_user` WHERE `gid` = ? ORDER BY `uid` ASC LIMIT -1 OFFSET 0' with params ["test2"]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1 OFFSET 0' at line 1
If i remove ,-1,0 from this line, it works.
@rullzer If you could help me with a own sharing mechanism in NextNote that would be awesome.
No pressure though, i've managed to get everything working =).
cc @rullzer
@brantje be sure to come to the conf to discuss such things! https://nextcloud.com/conf :eyes:
So public sharing is not possible anymore? That's just bad because that's all I use nextcloud for.
@philippludwig No. This issue is about the api for applications. It has nothing to do with the basic file-sharing functionality itself.
@go2sh Allright, then there must be another reason why it's gone from my nextcloud instance even though it is enabled in the settings. Thanks for the explanation.
@brantje meanwhile - let me repeat the invitation to come discuss it so we can implement a better solution, perhaps https://nextcloud.com/blog/join-us-at-our-next-contributor-week/ this time.