semantic markup update
This commit is contained in:
@@ -4,6 +4,11 @@
|
||||
|
||||
const API_BASE = '/api/settings/connections';
|
||||
|
||||
// [DEF:getConnections:Function]
|
||||
/* @PURPOSE: Fetch a list of saved connections.
|
||||
@PRE: None.
|
||||
@POST: Returns a promise resolving to an array of connections.
|
||||
*/
|
||||
/**
|
||||
* Fetch a list of saved connections.
|
||||
* @returns {Promise<Array>} List of connections.
|
||||
@@ -15,7 +20,13 @@ export async function getConnections() {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:getConnections:Function]
|
||||
|
||||
// [DEF:createConnection:Function]
|
||||
/* @PURPOSE: Create a new connection configuration.
|
||||
@PRE: connectionData must be a valid object.
|
||||
@POST: Returns a promise resolving to the created connection.
|
||||
*/
|
||||
/**
|
||||
* Create a new connection configuration.
|
||||
* @param {Object} connectionData - The connection data.
|
||||
@@ -36,7 +47,13 @@ export async function createConnection(connectionData) {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:createConnection:Function]
|
||||
|
||||
// [DEF:deleteConnection:Function]
|
||||
/* @PURPOSE: Delete a connection configuration.
|
||||
@PRE: connectionId must be a valid string.
|
||||
@POST: Returns a promise that resolves when deletion is complete.
|
||||
*/
|
||||
/**
|
||||
* Delete a connection configuration.
|
||||
* @param {string} connectionId - The ID of the connection to delete.
|
||||
@@ -49,4 +66,5 @@ export async function deleteConnection(connectionId) {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to delete connection: ${response.statusText}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// [/DEF:deleteConnection:Function]
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
const API_BASE = '/api/tasks';
|
||||
|
||||
// [DEF:getTasks:Function]
|
||||
/* @PURPOSE: Fetch a list of tasks with pagination and optional status filter.
|
||||
@PRE: limit and offset are numbers.
|
||||
@POST: Returns a promise resolving to a list of tasks.
|
||||
*/
|
||||
/**
|
||||
* Fetch a list of tasks with pagination and optional status filter.
|
||||
* @param {number} limit - Maximum number of tasks to return.
|
||||
@@ -26,7 +31,13 @@ export async function getTasks(limit = 10, offset = 0, status = null) {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:getTasks:Function]
|
||||
|
||||
// [DEF:getTask:Function]
|
||||
/* @PURPOSE: Fetch details for a specific task.
|
||||
@PRE: taskId must be provided.
|
||||
@POST: Returns a promise resolving to task details.
|
||||
*/
|
||||
/**
|
||||
* Fetch details for a specific task.
|
||||
* @param {string} taskId - The ID of the task.
|
||||
@@ -39,7 +50,13 @@ export async function getTask(taskId) {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:getTask:Function]
|
||||
|
||||
// [DEF:getTaskLogs:Function]
|
||||
/* @PURPOSE: Fetch logs for a specific task.
|
||||
@PRE: taskId must be provided.
|
||||
@POST: Returns a promise resolving to a list of log entries.
|
||||
*/
|
||||
/**
|
||||
* Fetch logs for a specific task.
|
||||
* @param {string} taskId - The ID of the task.
|
||||
@@ -55,7 +72,13 @@ export async function getTaskLogs(taskId) {
|
||||
const task = await getTask(taskId);
|
||||
return task.logs || [];
|
||||
}
|
||||
// [/DEF:getTaskLogs:Function]
|
||||
|
||||
// [DEF:resumeTask:Function]
|
||||
/* @PURPOSE: Resume a task that is awaiting input (e.g., passwords).
|
||||
@PRE: taskId and passwords must be provided.
|
||||
@POST: Returns a promise resolving to the updated task object.
|
||||
*/
|
||||
/**
|
||||
* Resume a task that is awaiting input (e.g., passwords).
|
||||
* @param {string} taskId - The ID of the task.
|
||||
@@ -77,7 +100,13 @@ export async function resumeTask(taskId, passwords) {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:resumeTask:Function]
|
||||
|
||||
// [DEF:resolveTask:Function]
|
||||
/* @PURPOSE: Resolve a task that is awaiting mapping.
|
||||
@PRE: taskId and resolutionParams must be provided.
|
||||
@POST: Returns a promise resolving to the updated task object.
|
||||
*/
|
||||
/**
|
||||
* Resolve a task that is awaiting mapping.
|
||||
* @param {string} taskId - The ID of the task.
|
||||
@@ -99,7 +128,13 @@ export async function resolveTask(taskId, resolutionParams) {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:resolveTask:Function]
|
||||
|
||||
// [DEF:clearTasks:Function]
|
||||
/* @PURPOSE: Clear tasks based on status.
|
||||
@PRE: status is a string or null.
|
||||
@POST: Returns a promise that resolves when tasks are cleared.
|
||||
*/
|
||||
/**
|
||||
* Clear tasks based on status.
|
||||
* @param {string|null} status - Filter by task status (optional).
|
||||
@@ -117,4 +152,5 @@ export async function clearTasks(status = null) {
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to clear tasks: ${response.statusText}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
// [/DEF:clearTasks:Function]
|
||||
@@ -4,6 +4,11 @@
|
||||
|
||||
const API_BASE = '/api/tasks';
|
||||
|
||||
// [DEF:runTask:Function]
|
||||
/* @PURPOSE: Start a new task for a given plugin.
|
||||
@PRE: pluginId and params must be provided.
|
||||
@POST: Returns a promise resolving to the task instance.
|
||||
*/
|
||||
/**
|
||||
* Start a new task for a given plugin.
|
||||
* @param {string} pluginId - The ID of the plugin to run.
|
||||
@@ -25,7 +30,13 @@ export async function runTask(pluginId, params) {
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
// [/DEF:runTask:Function]
|
||||
|
||||
// [DEF:getTaskStatus:Function]
|
||||
/* @PURPOSE: Fetch details for a specific task (to poll status or get result).
|
||||
@PRE: taskId must be provided.
|
||||
@POST: Returns a promise resolving to task details.
|
||||
*/
|
||||
/**
|
||||
* Fetch details for a specific task (to poll status or get result).
|
||||
* @param {string} taskId - The ID of the task.
|
||||
@@ -37,4 +48,5 @@ export async function getTaskStatus(taskId) {
|
||||
throw new Error(`Failed to fetch task ${taskId}: ${response.statusText}`);
|
||||
}
|
||||
return await response.json();
|
||||
}
|
||||
}
|
||||
// [/DEF:getTaskStatus:Function]
|
||||
Reference in New Issue
Block a user