public api for collaboration features#22
Conversation
|
I'll need this in master to run the wiki tests on Jenkins 😢 |
|
@datastrid I have added upload for a file attachment of an article, can you check it works ok before merging (and forgetting about the poor home pages :p ) |
|
@spicquenot the file upload works but it doesn't handle encoding right ("héhéhé.pdf" gives "heÌ�heÌ�heÌ�.pdf" in dss) ❌ |
|
@datastrid yes it is known and there is an story in ch https://app.clubhouse.io/dataiku/story/8245/non-ascii-characters-are-messed-up-in-file-names-also-can-upload-in-articles-with-weird-names |
|
Sorry but this does not work. Let's talk to rewrite this API using our newer design elements, and to provide useful helpers. |
|
Proposed draft for wiki API: |
|
Proposal for discussion API: |
|
Also: all methods in PublicAPIDiscussionsController uses checkPerm(req) which only works with UI users, so it just doesn't work with generic API keys. You need to use authCtx = getTicketOrKey() and checkPerm(authCtx) |
|
Generic things: use newer-style comments as found in ml.py, document all return types |
|
@cstenac what is not working? did I test badly? did an issue come back from hell? |
|
Should be more or less okay |
dataikuapi/dss/discussion.py
Outdated
| """ | ||
| data = self.client._perform_json("GET", "/projects/%s/discussions/%s/%s/" % (self.project_key, self.object_type, self.object_id)) | ||
|
|
||
| discu_list = [] |
There was a problem hiding this comment.
Nitpick: pythonic way would be a single line
return [DSSDiscussion(x.blablabla) for x in data]
|
|
||
| class DSSObjectDiscussions(object): | ||
| """ | ||
| A handle to manage discussions on a DSS object |
There was a problem hiding this comment.
Indicate that users should not create this object themselves and how to create it (same thing for all objects of this PR)
For example, we have that in ML:
"""Do not call directly, use :meth:`DSSMLTaskSettings.get_split_params`"""
dataikuapi/dss/discussion.py
Outdated
| """ | ||
| self.reply_data = reply_data | ||
|
|
||
| def get_reply_data(self): |
There was a problem hiding this comment.
Should probably include "raw" in the name to make it clear that it's "hardcore" stuff. In many cases, we just use "get_raw". "get_raw_data" would work too. Having "reply" in the name is generally not required for methods in a class called "reply"
dataikuapi/dss/project.py
Outdated
| Get the wiki | ||
|
|
||
| :returns: the wiki associated to the project | ||
| :rtype: DSSWiki |
There was a problem hiding this comment.
Ideally, this should be a link to the class
:rtype: :class:`dataiku.dss.DSSWiki`
dataikuapi/dss/wiki.py
Outdated
| """ | ||
| Get wiki settings | ||
|
|
||
| :returns: an handle to manage the wiki settings (taxonomy, home article) |
dataikuapi/dss/wiki.py
Outdated
|
|
||
| def list_articles(self): | ||
| """ | ||
| Get a list of all the articles |
There was a problem hiding this comment.
should mention that each itme in the returned list will be a DSSWikiArticle (with link to the class)
dataikuapi/dss/wiki.py
Outdated
| Get a list of all the articles | ||
|
|
||
| :returns: list of articles | ||
| :rtype: list |
There was a problem hiding this comment.
same: you can use "list of :class:`...."
|
|
||
| def get_taxonomy(self): | ||
| """ | ||
| Get the taxonomy |
There was a problem hiding this comment.
This would require a bit more documentation about what kind of things are in the taxonomy. It seems that the helper "move article in taxonomy" is missing :)
There was a problem hiding this comment.
Also need to explain that you get a direct reference, not a copy, so modifications to the returned object will be reflected when saving
dataikuapi/dss/wiki.py
Outdated
| article_data = self.client._perform_json("GET", "/projects/%s/wiki/%s" % (self.project_key, dku_quote_fn(self.article_id))) | ||
| return DSSWikiArticleData(self.client, self.project_key, self.article_id, article_data) | ||
|
|
||
| def upload_attachement(self, fp): |
Adding public api for collaboration features: