@@ -159,8 +159,17 @@ def move(self, parent_folder):
159159 }
160160 return self .update_info (data )
161161
162- def get_shared_link (self , access = None , etag = None , unshared_at = None , allow_download = None , allow_preview = None , password = None ):
163- """Get a shared link for the item with the given access permissions.
162+ def create_shared_link (
163+ self ,
164+ access = None ,
165+ etag = None ,
166+ unshared_at = None ,
167+ allow_download = None ,
168+ allow_preview = None ,
169+ password = None ,
170+ ):
171+ """
172+ Create a shared link for the item with the given access permissions.
164173
165174 :param access:
166175 Determines who can access the shared link. May be open, company, or collaborators. If no access is
@@ -191,10 +200,11 @@ def get_shared_link(self, access=None, etag=None, unshared_at=None, allow_downlo
191200 Please notice that this is a premium feature, which might not be available to your app.
192201 :type password:
193202 `unicode` or None
194- :returns:
195- The URL of the shared link.
203+ :return:
204+ The updated object with s shared link.
205+ Returns a new object of the same type, without modifying the original object passed as self.
196206 :rtype:
197- `unicode `
207+ :class:`Item `
198208 :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
199209 """
200210 data = {
@@ -216,7 +226,64 @@ def get_shared_link(self, access=None, etag=None, unshared_at=None, allow_downlo
216226 if password is not None :
217227 data ['shared_link' ]['password' ] = password
218228
219- item = self .update_info (data , etag = etag )
229+ return self .update_info (data , etag = etag )
230+
231+ def get_shared_link (
232+ self ,
233+ access = None ,
234+ etag = None ,
235+ unshared_at = None ,
236+ allow_download = None ,
237+ allow_preview = None ,
238+ password = None ,
239+ ):
240+ """
241+ Get a shared link for the item with the given access permissions.
242+ This url leads to a Box.com shared link page, where the item can be previewed, downloaded, etc.
243+
244+ :param access:
245+ Determines who can access the shared link. May be open, company, or collaborators. If no access is
246+ specified, the default access will be used.
247+ :type access:
248+ `unicode` or None
249+ :param etag:
250+ If specified, instruct the Box API to create the link only if the current version's etag matches.
251+ :type etag:
252+ `unicode` or None
253+ :param unshared_at:
254+ The date on which this link should be disabled. May only be set if the current user is not a free user
255+ and has permission to set expiration dates.
256+ :type unshared_at:
257+ :class:`datetime.date` or None
258+ :param allow_download:
259+ Whether or not the item being shared can be downloaded when accessed via the shared link.
260+ If this parameter is None, the default setting will be used.
261+ :type allow_download:
262+ `bool` or None
263+ :param allow_preview:
264+ Whether or not the item being shared can be previewed when accessed via the shared link.
265+ If this parameter is None, the default setting will be used.
266+ :type allow_preview:
267+ `bool` or None
268+ :param password:
269+ The password required to view this link. If no password is specified then no password will be set.
270+ Please notice that this is a premium feature, which might not be available to your app.
271+ :type password:
272+ `unicode` or None
273+ :returns:
274+ The URL of the shared link.
275+ :rtype:
276+ `unicode`
277+ :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
278+ """
279+ item = self .create_shared_link (
280+ access = access ,
281+ etag = etag ,
282+ unshared_at = unshared_at ,
283+ allow_download = allow_download ,
284+ allow_preview = allow_preview ,
285+ password = password ,
286+ )
220287 return item .shared_link ['url' ]
221288
222289 def remove_shared_link (self , etag = None ):
0 commit comments