blob: 41db829d35b1d7ac7548feeb7848efc1b836326e [file] [log] [blame]
Oleksiy Petrenko2652ac12018-04-16 17:40:13 +03001try:
2 from urllib.parse import urlencode
3except ImportError:
4 from urllib import urlencode
5from glancev2.common import send
6
7
8@send('post')
9def task_create(task_type, task_input, **kwargs):
Oleh Hryhorov6de49c92018-05-21 12:53:59 +000010 url = '/tasks'
Oleksiy Petrenko2652ac12018-04-16 17:40:13 +030011 json = {
12 'type': task_type,
13 'input': task_input
14 }
15 return url, {'json': json}
16
17
18@send('get')
19def task_list(**kwargs):
Oleh Hryhorov6de49c92018-05-21 12:53:59 +000020 url = '/tasks?{}'.format(urlencode(kwargs))
Oleksiy Petrenko2652ac12018-04-16 17:40:13 +030021 return url, {}
22
23
24@send('get')
25def task_show(task_id, **kwargs):
Oleh Hryhorov6de49c92018-05-21 12:53:59 +000026 url = '/tasks/{}'.format(task_id)
Oleksiy Petrenko2652ac12018-04-16 17:40:13 +030027 return url, {}