@@ -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,63 @@ 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+
243+ :param access:
244+ Determines who can access the shared link. May be open, company, or collaborators. If no access is
245+ specified, the default access will be used.
246+ :type access:
247+ `unicode` or None
248+ :param etag:
249+ If specified, instruct the Box API to create the link only if the current version's etag matches.
250+ :type etag:
251+ `unicode` or None
252+ :param unshared_at:
253+ The date on which this link should be disabled. May only be set if the current user is not a free user
254+ and has permission to set expiration dates.
255+ :type unshared_at:
256+ :class:`datetime.date` or None
257+ :param allow_download:
258+ Whether or not the item being shared can be downloaded when accessed via the shared link.
259+ If this parameter is None, the default setting will be used.
260+ :type allow_download:
261+ `bool` or None
262+ :param allow_preview:
263+ Whether or not the item being shared can be previewed when accessed via the shared link.
264+ If this parameter is None, the default setting will be used.
265+ :type allow_preview:
266+ `bool` or None
267+ :param password:
268+ The password required to view this link. If no password is specified then no password will be set.
269+ Please notice that this is a premium feature, which might not be available to your app.
270+ :type password:
271+ `unicode` or None
272+ :returns:
273+ The URL of the shared link.
274+ :rtype:
275+ `unicode`
276+ :raises: :class:`BoxAPIException` if the specified etag doesn't match the latest version of the item.
277+ """
278+ item = self .create_shared_link (
279+ access = access ,
280+ etag = etag ,
281+ unshared_at = unshared_at ,
282+ allow_download = allow_download ,
283+ allow_preview = allow_preview ,
284+ password = password ,
285+ )
220286 return item .shared_link ['url' ]
221287
222288 def remove_shared_link (self , etag = None ):
0 commit comments