Skip to content

Commit

Permalink
Merge pull request #4 from Bynder/RETRIEVE_MEDIA_ID
Browse files Browse the repository at this point in the history
Get the media id from the response
  • Loading branch information
MartenSies authored Jan 5, 2018
2 parents b738c1b + a3b756d commit 8b98fc1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions bynder_sdk/client/asset_bank_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,25 @@ def delete_usage(self, integration_id, asset_id, query: dict = None):
params=query
)

def upload_file(self, file_path, brand_id, media_id: str = '', query: dict = None):
def upload_file(self, file_path: str, brand_id: str,
media_id: str = '', query: dict = None) -> dict:
""" Upload file.
Params:
file_path: the local filepath of the file to upload.
brand_id: the brandid of the brand that belong the asset.
query: extra dict parameters of information to add to the
asset. (See api documentation for more information)
Return a dict with the keys:
- success: boolean that indicate the result of the upload call.
- mediaitems: a list of mediaitems created, with at least the
original.
- batchId: the batchId of the upload.
- mediaid: the mediaId update or created.
"""
if query is None:
query = {}
query['brandId'] = brand_id
self.upload_client.upload(
return self.upload_client.upload(
file_path=file_path,
media_id=media_id,
upload_data=query
Expand Down
2 changes: 1 addition & 1 deletion bynder_sdk/client/upload_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _save_media(self, import_id, data, media_id=None):
save_endpoint = '/api/v4/media/{}/save/{}/'.format(media_id, import_id)
data = {}

save_success = self.bynder_request_handler.post(
return self.bynder_request_handler.post(
endpoint=save_endpoint,
payload=data
)
Expand Down

0 comments on commit 8b98fc1

Please sign in to comment.