Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _object_collection_instance( # pylint:disable=arguments-differ
self,
session,
limit,
return_full_pages=False,
starting_pointer=None,
supports_limit_offset_paging=False
):
"""Baseclass override."""
return MarkerBasedObjectCollection(
session,
'/some/endpoint',
limit=limit,
return_full_pages=return_full_pages,
marker=starting_pointer,
supports_limit_offset_paging=supports_limit_offset_paging,
)
:type limit:
`int` or None
:param marker:
The paging marker to start returning items from when using marker-based paging.
:type marker:
`unicode` or None
:param fields:
List of fields to request.
:type fields:
`Iterable` of `unicode`
:returns:
Returns the storage policies available for the current enterprise.
:rtype:
:class:`BoxObjectCollection`
"""
return MarkerBasedObjectCollection(
session=self._session,
url=self.get_url('storage_policies'),
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)
def get_assignments(self, fields=None):
"""
Get the entries in the file task assignment.
:param fields:
List of fields to request.
:type fields:
`Iterable` of `unicode`
:returns:
An iterator of the entries in the file task assignment.
:rtype:
:class:`BoxObjectCollection`
"""
return MarkerBasedObjectCollection(
session=self._session,
url=self.get_url('assignments'),
limit=None,
marker=None,
fields=fields,
return_full_pages=False,
)
`int` or None
:param marker:
The paging marker to start returning items from when using marker-based paging.
:type marker:
`unicode` or None
:param fields:
List of fields to request.
:type fields:
`Iterable` of `unicode`
:returns:
An iterator of the entries in the collaboration.
:rtype:
:class:`BoxObjectCollection`
"""
self.validate_item_id(self._object_id)
return MarkerBasedObjectCollection(
session=self._session,
url=self.get_url('collaborations'),
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)
:param fields:
List of fields to request.
:type fields:
`Iterable` of `unicode`
:returns:
An iterator of the cascade policies attached on the folder.
:rtype:
:class:`BoxObjectCollection`
"""
additional_params = {
'folder_id': self.object_id,
}
if owner_enterprise is not None:
additional_params['owner_enterprise_id'] = owner_enterprise.object_id
return MarkerBasedObjectCollection(
url=self._session.get_url('metadata_cascade_policies'),
session=self._session,
additional_params=additional_params,
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)
: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`
:returns:
The collection of metadata templates for the given scope
:rtype:
:class:`BoxObjectCollection`
"""
return MarkerBasedObjectCollection(
url=self._session.get_url('metadata_templates', scope),
session=self._session,
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)
List of fields to request
:type fields:
`Iterable` of `unicode`
:returns:
An iterator of the entries in the retention policy
:rtype:
:class:`BoxObjectCollection`
"""
additional_params = {}
if policy_name is not None:
additional_params['policy_name'] = policy_name
if policy_type is not None:
additional_params['policy_type'] = policy_type
if user is not None:
additional_params['created_by_user_id'] = user.object_id
return MarkerBasedObjectCollection(
session=self._session,
url=self._session.get_url('retention_policies'),
additional_params=additional_params,
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)
: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`
:returns:
An iterator of the exemptions to the whitelist.
:rtype:
:class:`BoxObjectCollection`
"""
return MarkerBasedObjectCollection(
session=self._session,
url=self.get_url('collaboration_whitelist_exempt_targets'),
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)
return_full_pages=False,
marker=None,
supports_limit_offset_paging=False,
):
"""
:param marker:
The offset index to start paging from.
:type marker:
`str` or None
:param supports_limit_offset_paging:
Does this particular endpoint also support limit-offset paging? This information is needed, as
the endpoints that support both require an special extra request parameter.
:type supports_limit_offset_paging:
`bool`
"""
super(MarkerBasedObjectCollection, self).__init__(
session,
url,
limit=limit,
fields=fields,
additional_params=additional_params,
return_full_pages=return_full_pages,
)
self._marker = marker
self._supports_limit_offset_paging = supports_limit_offset_paging
List of fields to request
:type fields:
`Iterable` of `unicode`
:returns:
An iterator of the entries in the legal hold policy assignment
:rtype:
:class:`BoxObjectCollection`
"""
additional_params = {
'policy_id': self.object_id,
}
if assign_to_type is not None:
additional_params['assign_to_type'] = assign_to_type
if assign_to_id is not None:
additional_params['assign_to_id'] = assign_to_id
return MarkerBasedObjectCollection(
session=self._session,
url=self._session.get_url('legal_hold_policy_assignments'),
additional_params=additional_params,
limit=limit,
marker=marker,
fields=fields,
return_full_pages=False,
)