chore: rename feature elements

rename automations > triggers
rename blueprints > automations

chore: add link to documentation
This commit is contained in:
Carlos Valente
2025-01-20 19:22:00 +01:00
committed by Carlos Valente
parent f4f266dbd4
commit efe5ac16f2
30 changed files with 1125 additions and 1155 deletions
+27 -27
View File
@@ -1,11 +1,11 @@
import axios from 'axios';
import type {
Automation,
AutomationBlueprint,
AutomationBlueprintDTO,
AutomationDTO,
AutomationOutput,
AutomationSettings,
Trigger,
TriggerDTO,
} from 'ontime-types';
import { apiEntryUrl } from './constants';
@@ -30,6 +30,29 @@ export async function editAutomationSettings(
return res.data;
}
/**
* HTTP request to create a new automation trigger
*/
export async function addTrigger(trigger: TriggerDTO): Promise<Trigger> {
const res = await axios.post(`${automationsPath}/trigger`, trigger);
return res.data;
}
/**
* HTTP request to update an automation trigger
*/
export async function editTrigger(id: string, trigger: Trigger): Promise<Trigger> {
const res = await axios.put(`${automationsPath}/trigger/${id}`, trigger);
return res.data;
}
/**
* HTTP request to delete an automation trigger
*/
export function deleteTrigger(id: string): Promise<void> {
return axios.delete(`${automationsPath}/trigger/${id}`);
}
/**
* HTTP request to create a new automation
*/
@@ -39,7 +62,7 @@ export async function addAutomation(automation: AutomationDTO): Promise<Automati
}
/**
* HTTP request to update an automation
* HTTP request to update a automation
*/
export async function editAutomation(id: string, automation: Automation): Promise<Automation> {
const res = await axios.put(`${automationsPath}/automation/${id}`, automation);
@@ -47,35 +70,12 @@ export async function editAutomation(id: string, automation: Automation): Promis
}
/**
* HTTP request to delete an automation
* HTTP request to delete a automation
*/
export function deleteAutomation(id: string): Promise<void> {
return axios.delete(`${automationsPath}/automation/${id}`);
}
/**
* HTTP request to create a new blueprint
*/
export async function addBlueprint(blueprint: AutomationBlueprintDTO): Promise<AutomationBlueprint> {
const res = await axios.post(`${automationsPath}/blueprint`, blueprint);
return res.data;
}
/**
* HTTP request to update a blueprint
*/
export async function editBlueprint(id: string, blueprint: AutomationBlueprint): Promise<AutomationBlueprint> {
const res = await axios.put(`${automationsPath}/blueprint/${id}`, blueprint);
return res.data;
}
/**
* HTTP request to delete a blueprint
*/
export function deleteBlueprint(id: string): Promise<void> {
return axios.delete(`${automationsPath}/blueprint/${id}`);
}
/**
* HTTP request to test automation output
* The return is irrelevant as we care for the resolution of the promise