Skip to content

Commit d11f746

Browse files
committed
Add bulk_copy_assets() function
1 parent eafd15f commit d11f746

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

frameioclient/client.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,33 @@ def copy_asset(self, destination_folder_id, **kwargs):
245245
endpoint = '/assets/{}/copy'.format(destination_folder_id)
246246
return self._api_call('post', endpoint, kwargs)
247247

248+
def bulk_copy_assets(self, destination_folder_id, asset_list=[], copy_comments=False):
249+
"""
250+
Bulk copy assets
251+
252+
:Args:
253+
destination_folder_id (string): The id of the folder you want to copy into.
254+
:Kwargs:
255+
asset_list (list): A list of the asset IDs you want to copy.
256+
copy_comments (boolean): Whether or not to copy comments: True or False.
257+
258+
Example::
259+
client.bulk_copy_assets("adeffee123342", asset_list=["7ee008c5-49a2-f8b5-997d-8b64de153c30", \
260+
"7ee008c5-49a2-f8b5-997d-8b64de153c30"], copy_comments=True)
261+
"""
262+
263+
payload = {"batch": []}
264+
new_list = list()
265+
266+
if copy_comments:
267+
payload['copy_comments'] = "all"
268+
269+
for asset in asset_list:
270+
payload['batch'].append({"id": asset})
271+
272+
endpoint = '/batch/assets/{}/copy'.format(destination_folder_id)
273+
return self._api_call('post', endpoint, payload)
274+
248275
def delete_asset(self, asset_id):
249276
"""
250277
Delete an asset

0 commit comments

Comments
 (0)