mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Add return ID for async API calls
* export_id, notification_id, and newsletter_notification_d
This commit is contained in:
parent
fe4fba353e
commit
3a1d6322ae
4 changed files with 15 additions and 15 deletions
|
@ -505,7 +505,8 @@ class API2(object):
|
|||
script_args (str): The arguments for script notifications
|
||||
|
||||
Returns:
|
||||
None
|
||||
json:
|
||||
{"notification_id": 1}
|
||||
```
|
||||
"""
|
||||
if not notifier_id:
|
||||
|
@ -527,14 +528,14 @@ class API2(object):
|
|||
body=body,
|
||||
**kwargs)
|
||||
|
||||
if success:
|
||||
if isinstance(success, int):
|
||||
self._api_msg = 'Notification sent.'
|
||||
self._api_result_type = 'success'
|
||||
return {'notification_id': success}
|
||||
else:
|
||||
self._api_msg = 'Notification failed.'
|
||||
self._api_result_type = 'error'
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
def notify_newsletter(self, newsletter_id='', subject='', body='', message='', **kwargs):
|
||||
""" Send a newsletter using Tautulli.
|
||||
|
@ -549,7 +550,8 @@ class API2(object):
|
|||
message (str): The message of the newsletter
|
||||
|
||||
Returns:
|
||||
None
|
||||
json:
|
||||
{"newsletter_notification_id": 1}
|
||||
```
|
||||
"""
|
||||
if not newsletter_id:
|
||||
|
@ -572,14 +574,14 @@ class API2(object):
|
|||
message=message,
|
||||
**kwargs)
|
||||
|
||||
if success:
|
||||
if isinstance(success, int):
|
||||
self._api_msg = 'Newsletter sent.'
|
||||
self._api_result_type = 'success'
|
||||
return {'newsletter_notification_id': success}
|
||||
else:
|
||||
self._api_msg = 'Newsletter failed.'
|
||||
self._api_result_type = 'error'
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
def _api_make_md(self):
|
||||
""" Tries to make a API.md to simplify the api docs. """
|
||||
|
|
|
@ -1837,7 +1837,7 @@ class Export(object):
|
|||
|
||||
threading.Thread(target=self._real_export).start()
|
||||
|
||||
return True
|
||||
return self.export_id
|
||||
|
||||
def add_export(self):
|
||||
keys = {
|
||||
|
|
|
@ -438,7 +438,7 @@ def notify(notifier_id=None, notify_action=None, stream_data=None, timeline_data
|
|||
|
||||
if success:
|
||||
set_notify_success(notification_id)
|
||||
return True
|
||||
return notification_id
|
||||
|
||||
|
||||
def get_notify_state(session):
|
||||
|
|
|
@ -7057,9 +7057,7 @@ class WebInterface(object):
|
|||
|
||||
Returns:
|
||||
json:
|
||||
{"result": "success",
|
||||
"message": "Metadata export has started."
|
||||
}
|
||||
{"export_id": 1}
|
||||
```
|
||||
"""
|
||||
individual_files = helpers.bool_true(individual_files)
|
||||
|
@ -7075,8 +7073,8 @@ class WebInterface(object):
|
|||
export_type=export_type,
|
||||
individual_files=individual_files).export()
|
||||
|
||||
if result is True:
|
||||
return {'result': 'success', 'message': 'Metadata export has started.'}
|
||||
if isinstance(result, int):
|
||||
return {'result': 'success', 'message': 'Metadata export has started.', 'export_id': result}
|
||||
else:
|
||||
return {'result': 'error', 'message': result}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue