From 0356b0c319a7efba8b0b5eec4fd0c6818d0a16f5 Mon Sep 17 00:00:00 2001 From: Vahid Vaezian Date: Thu, 4 Jul 2024 19:06:20 -0700 Subject: [PATCH] Added 'return_card' argument to the `copy_card` function. --- CHANGELOG.md | 4 ++++ metabase_api/copy_methods.py | 5 ++--- setup.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a9584b..143754d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.4.2 +### Changed +- Added 'return_card' argument to the `copy_card` function. + ## 3.4.1 ### Changed - PR #54 (fixes a typo in the `clone_card` function) diff --git a/metabase_api/copy_methods.py b/metabase_api/copy_methods.py index 12b8224..cd69b53 100644 --- a/metabase_api/copy_methods.py +++ b/metabase_api/copy_methods.py @@ -3,7 +3,7 @@ def copy_card(self, source_card_name=None, source_card_id=None, source_collection_name=None, source_collection_id=None, destination_card_name=None, destination_collection_name=None, destination_collection_id=None, - postfix='', verbose=False): + postfix='', verbose=False, return_card=False): """ Copy the card with the given name/id to the given destination collection. @@ -55,8 +55,7 @@ def copy_card(self, source_card_name=None, source_card_id=None, # Save as a new card res = self.create_card(custom_json=card_json, verbose=verbose, return_card=True) - # Return the id of the created card - return res['id'] + return res if return_card else res['id'] diff --git a/setup.py b/setup.py index f01c5e5..d0c6b09 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="metabase-api", - version="3.4.1", + version="3.4.2", author="Vahid Vaezian", author_email="vahid.vaezian@gmail.com", description="A Python Wrapper for Metabase API",