Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@api_call
def api_call_method(self, *args, **kwargs):
return self, args, kwargs, api_call_result
@api_call
def get_shared_link_download_url(
self,
access=None,
etag=None,
unshared_at=None,
allow_preview=None,
password=None,
):
"""
Get a shared link download url for the file with the given access permissions.
This url is a direct download url for the file.
:param access:
Determines who can access the shared link. May be open, company, or collaborators. If no access is
specified, the default access will be used.
:type access:
@api_call
def create_task(self, message=None, due_at=None):
"""
Create a task on the given file.
:param message:
An optional message to include in the task.
:type message:
`unicode` or None
:param due_at:
When this task is due.
:type due_at:
`unicode` or None
:return:
The newly created task
:rtype:
:class:`Task`
@api_call
def assign(self, assignee):
"""Assign legal hold policy
:param assignee:
The `file_version`, `file`, `folder`, or `user` to assign the legal hold policy to.
:type assignee:
:class:`FileVersion` :class:`File` or :class:`Folder` or :class:`User`
:returns:
A legal hold policy assignment object
:rtype:
:class:`LegalHoldPolicyAssignment`
"""
url = self._session.get_url('legal_hold_policy_assignments')
body = {
'policy_id': self.object_id,
'assign_to': {
@api_call
def assign(self, assignee, fields=None):
"""Assign a retention policy to a Box item
:param assignee:
The item to assign the retention policy on.
:type assignee:
:class:`Folder`, :class:`Enterprise`, or :class:`MetadataTemplate`
:param fields:
List of fields to request.
:type fields:
`Iterable` of `unicode`
:returns:
A :class:`RetentionPolicyAssignment` object.
:rtype:
:class:`RetentionPolicyAssignment`
"""
@api_call
def get_previous_versions(self, limit=None, offset=None, fields=None):
"""
Get previous versions of the file.
:param limit:
The maximum number of items to return per page. If not specified, then will use the server-side default.
:type limit:
`int` or None
:param offset:
The index at which to start returning items.
:type offset:
`int`
:param fields:
List of fields to request.
:type fields:
`Iterable` of `unicode`
@api_call
def get_recent_items(self, limit=None, marker=None, fields=None, **collection_kwargs):
"""
Get the user's recently accessed items.
:param: limit
The maximum number of items to return. If limit is set to None, then the default
limit (returned by Box in the response) is used. See https://developer.box.com/en/reference/get-recent-items/
for default.
:type: limit
`int` or None
:param marker:
The index at which to start returning items.
:type marker:
`str` or None
:param fields:
List of fields to request on the file or folder which the `RecentItem` references.
@api_call
def get_file_version_legal_holds(self, limit=None, marker=None, fields=None):
"""
Get legal holds for a file version.
:param limit:
The maximum number of entries to return per page. If not specified, then will use the server-side default.
:type limit:
`int` or None
:param marker:
The paging marker to start paging from
:type marker:
`unicode` or None
:param fields:
List of fields to request
:type fields:
`Iterable` of `unicode`
@api_call
def collaborate(self, accessible_by, role, can_view_path=None, notify=None, fields=None):
"""Collaborate user or group onto a Box item.
:param accessible_by:
An object containing the collaborator.
:type accessible_by:
class:`User` or class:`Group`
:param role:
The permission level to grant the collaborator.
:type role:
`unicode`
:param can_view_path:
Indicates whether the user can view the path of the item collaborated into. This can only be set for
collaborations on folders.
:type can_view_path:
`bool` or None
@api_call
def get_metadata_templates(self, scope='enterprise', limit=None, marker=None, fields=None):
"""
Get all metadata templates for a given scope. By default, retrieves all metadata templates for the current
enterprise.
:param scope:
The scope to retrieve templates for
:type scope:
`unicode`
:type limit:
`int` or None
:param marker:
The paging marker to start paging from.
:type marker:
`unicode` or None
:param fields: