Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client function to update widgets #127

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions redash_toolbelt/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ def create_widget(self, dashboard_id, visualization_id, text, options):
}
return self._post("api/widgets", json=data)

def update_widget(self, widget_id, data):
"""POST /api/widgets/{widget_id} with the provided data object."""
return self._post("api/widgets/{}".format(widget_id), json=data)

def duplicate_dashboard(self, slug, new_name=None):
current_dashboard = self.dashboard(slug)

Expand All @@ -128,7 +132,6 @@ def duplicate_dashboard(self, slug, new_name=None):
return new_dashboard

def duplicate_query(self, query_id, new_name=None):

response = self._post(f"api/queries/{query_id}/fork")
new_query = response.json()

Expand Down Expand Up @@ -174,7 +177,6 @@ def create_alert(self, name, options, query_id):
return self._post(f"api/alerts", json=payload).json()

def update_alert(self, id, name=None, options=None, query_id=None, rearm=None):

payload = dict(name=name, options=options, query_id=query_id, rearm=rearm)

no_none = {key: val for key, val in payload.items() if val is not None}
Expand Down