Skip to content

WIP move_asset() #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions frameioclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,48 @@ def get_asset_children(self, asset_id, **kwargs):
endpoint = '/assets/{}/children'.format(asset_id)
return self._api_call('get', endpoint, kwargs)

def move_asset(self, destination_folder, **kwargs):
"""
Move an asset.

:Args:
asset_id (string): The asset you're trying to move.
:Kwargs:
destination_folder (string): The destination folder you're moving the file into

Example::

client.move_asset(
destination_folder="123abc",
id="123abc",
)
"""
endpoint = '/assets/{}/move'.format(destination_folder)
return self._api_call('post', endpoint, payload=kwargs)

def bulk_move_assets(self, destination_folder_id, asset_list=[]):
"""
Bulk copy assets

:Args:
destination_folder_id (string): The id of the folder you want to move your assets into.
:Kwargs:
asset_list (list): A list of the asset IDs you want to move.

Example::
client.bulk_copy_assets("adeffee123342", asset_list=["7ee008c5-49a2-f8b5-997d-8b64de153c30", \
"7ee008c5-49a2-f8b5-997d-8b64de153c30"])
"""

payload = {"batch": []}
new_list = list()

for asset in asset_list:
payload['batch'].append({"id": asset})

endpoint = '/batch/assets/{}/move'.format(destination_folder_id)
return self._api_call('post', endpoint, payload)

def create_asset(self, parent_asset_id, **kwargs):
"""
Create an asset.
Expand Down