Skip to content

Commit 07e35c2

Browse files
committed
Fix move_asset() and add bulk_move_asset()
1 parent 2748850 commit 07e35c2

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

frameioclient/client.py

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def get_asset_children(self, asset_id, **kwargs):
219219
endpoint = '/assets/{}/children'.format(asset_id)
220220
return self._api_call('get', endpoint, kwargs)
221221

222-
def move_asset(self, destination_folder, id)
222+
def move_asset(self, destination_folder, **kwargs):
223223
"""
224224
Move an asset.
225225
@@ -235,9 +235,34 @@ def move_asset(self, destination_folder, id)
235235
id="123abc",
236236
)
237237
"""
238-
endpoint = '/assets/{}/children'.format(destination_folder)
238+
endpoint = '/assets/{}/move'.format(destination_folder)
239239
return self._api_call('post', endpoint, payload=kwargs)
240240

241+
def bulk_move_assets(self, destination_folder_id, asset_list=[]):
242+
"""
243+
Bulk copy assets
244+
245+
:Args:
246+
destination_folder_id (string): The id of the folder you want to move your assets into.
247+
:Kwargs:
248+
asset_list (list): A list of the asset IDs you want to move.
249+
250+
Example::
251+
client.bulk_copy_assets("adeffee123342", asset_list=["7ee008c5-49a2-f8b5-997d-8b64de153c30", \
252+
"7ee008c5-49a2-f8b5-997d-8b64de153c30"])
253+
"""
254+
255+
payload = {"batch": []}
256+
new_list = list()
257+
258+
for asset in asset_list:
259+
payload['batch'].append({"id": asset})
260+
261+
print(payload)
262+
263+
endpoint = '/batch/assets/{}/move'.format(destination_folder_id)
264+
return self._api_call('post', endpoint, payload)
265+
241266
def create_asset(self, parent_asset_id, **kwargs):
242267
"""
243268
Create an asset.

0 commit comments

Comments
 (0)