Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _get_new_item(self):
item = Item()
if self.new_parent_relpath != self.parent_relpath:
ref = ItemReference()
# Refer to https://dev.onedrive.com/items/move.htm for Move API request.
ref.path = '/drives/' + self.repo.drive.id + '/root:'
if self.new_parent_relpath != '':
ref.path += self.new_parent_relpath
item.parent_reference = ref
if self.new_name != self.item_name:
item.name = self.new_name
return item
def _init_item_to_update(self, item_id=None, item_path=None,
parent_id=None, parent_path=None):
"""
Init parent reference and item
:param item_id:
:param item_path:
:param parent_id:
:param parent_path:
:return: tuple
"""
ref = onedrivesdk.ItemReference()
ref.id = parent_id
ref.path = self._get_full_path(parent_path)
return self.client.item(id=item_id, path=item_path), ref