Skip to content

Commit 9071cc1

Browse files
committed
Fix move_asset() and add bulk_move_asset()
1 parent 9b426d9 commit 9071cc1

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
@@ -193,7 +193,7 @@ def get_asset_children(self, asset_id, **kwargs):
193193
endpoint = '/assets/{}/children'.format(asset_id)
194194
return self._api_call('get', endpoint, kwargs)
195195

196-
def move_asset(self, destination_folder, id)
196+
def move_asset(self, destination_folder, **kwargs):
197197
"""
198198
Move an asset.
199199
@@ -209,9 +209,34 @@ def move_asset(self, destination_folder, id)
209209
id="123abc",
210210
)
211211
"""
212-
endpoint = '/assets/{}/children'.format(destination_folder)
212+
endpoint = '/assets/{}/move'.format(destination_folder)
213213
return self._api_call('post', endpoint, payload=kwargs)
214214

215+
def bulk_move_assets(self, destination_folder_id, asset_list=[]):
216+
"""
217+
Bulk copy assets
218+
219+
:Args:
220+
destination_folder_id (string): The id of the folder you want to move your assets into.
221+
:Kwargs:
222+
asset_list (list): A list of the asset IDs you want to move.
223+
224+
Example::
225+
client.bulk_copy_assets("adeffee123342", asset_list=["7ee008c5-49a2-f8b5-997d-8b64de153c30", \
226+
"7ee008c5-49a2-f8b5-997d-8b64de153c30"])
227+
"""
228+
229+
payload = {"batch": []}
230+
new_list = list()
231+
232+
for asset in asset_list:
233+
payload['batch'].append({"id": asset})
234+
235+
print(payload)
236+
237+
endpoint = '/batch/assets/{}/move'.format(destination_folder_id)
238+
return self._api_call('post', endpoint, payload)
239+
215240
def create_asset(self, parent_asset_id, **kwargs):
216241
"""
217242
Create an asset.

0 commit comments

Comments
 (0)