def handle_delete_universal_template(**kwargs): log.debug(f"handle_push_universal_template(): got {kwargs}") template_mgr = unvrsl() result = template_mgr.remove_template(payload=kwargs) status = result["status"] if status == "error": log.error(f"Failed to push template {kwargs} with error: {result['data']}") return log.info(f"Result: {result['data']}")
def remove_webhook_script_file(template: UnivsersalTemplateRemove): try: req_data = template.dict() req_data["route_type"] = "custom_webhooks" add_transaction_log_entry(entry_type=TransactionLogEntryType.unvrsl_tmp_delete, data=req_data) tmplate_mgr = unvrsl() r = tmplate_mgr.remove_template(payload=req_data) except Exception as e: raise HTTPException(status_code=500, detail=str(e).split("\n"))
def add_webhook_script_file(template: UnivsersalTemplateAdd): try: req_data = template.dict() req_data["route_type"] = "custom_webhooks" add_transaction_log_entry(entry_type=TransactionLogEntryType.unvrsl_tmp_push, data=req_data) tmplate_mgr = unvrsl() r = tmplate_mgr.add_template(payload=req_data) resp = jsonable_encoder(r) return resp except Exception as e: raise HTTPException(status_code=500, detail=str(e).split("\n"))
async def return_specific_webhook_script_file(tmpname: str): try: send_payload = { "route_type": "custom_webhooks", "name": tmpname } tmplate_mgr = unvrsl() r = tmplate_mgr.get_template(payload=send_payload) resp = jsonable_encoder(r) return resp except Exception as e: raise HTTPException(status_code=500, detail=str(e).split("\n"))