Added Node.share() and Node.get_share_links() methods.
This commit is contained in:
@@ -163,3 +163,33 @@ class Node(List, Find, Create, Post, Update, Delete, Replace):
|
||||
import mimetypes
|
||||
mimetype, _ = mimetypes.guess_type(filename, strict=False)
|
||||
return mimetype
|
||||
|
||||
def share(self, api=None):
|
||||
"""Creates a short-link.
|
||||
|
||||
:returns: a dict like {
|
||||
'short_code': 'XXXXXX',
|
||||
'short_link': 'https://blender.cloud/r/XXXXX',
|
||||
'theatre_link': 'https://blender.cloud/r/XXXXX?t',
|
||||
}
|
||||
:rtype: dict
|
||||
"""
|
||||
|
||||
api = api or Api.Default()
|
||||
|
||||
return api.post('nodes/%s/share' % self['_id'])
|
||||
|
||||
def get_share_links(self, api=None):
|
||||
"""Returns short-link info for this node.
|
||||
|
||||
:returns: a dict like {
|
||||
'short_code': 'XXXXXX',
|
||||
'short_link': 'https://blender.cloud/r/XXXXX',
|
||||
'theatre_link': 'https://blender.cloud/r/XXXXX?t',
|
||||
}, or an empty dict if the node wasn't shared.
|
||||
:rtype: dict
|
||||
"""
|
||||
|
||||
api = api or Api.Default()
|
||||
|
||||
return api.get('nodes/%s/share' % self['_id'])
|
||||
|
||||
Reference in New Issue
Block a user