mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 19:03:30 -05:00
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
29 lines
858 B
Python
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()
|