Files
notifications-admin/app/notify_client/template_folder_api_client.py
Leo Hemsted 7cbf5de240 add new template folder
The add new templates page now has option to add template folders.
Tweaked wording of other options and h1 to clarify options since it's
not all about templates any more.

Added api client and stuff for it
2018-11-06 13:13:12 +00:00

29 lines
858 B
Python

from app.notify_client import NotifyAdminAPIClient, cache
class TemplateFolderAPIClient(NotifyAdminAPIClient):
# Fudge assert in the super __init__ so
# we can set those variables later.
def __init__(self):
super().__init__('a' * 73, 'b')
@cache.delete('service-{service_id}-template-folders')
def create_template_folder(
self,
service_id,
name,
parent_id=None
):
data = {
'name': name,
'parent_id': parent_id
}
return self.post('/service/{}/template-folder'.format(service_id), data)['data']['id']
@cache.set('service-{service_id}-template-folders')
def get_template_folders(self, service_id):
return self.get('/service/{}/template-folder'.format(service_id))['data']
template_folder_api_client = TemplateFolderAPIClient()