import { invoke } from "@tauri-apps/api/core"; import type { Project, TuleapCredentialsSafe, AgentConfig, FilterGroup, WatchedTracker, TrackerField, ProcessedTicket, } from "./types"; export async function createProject( name: string, pathOrUrl: string, baseBranch: string ): Promise { return invoke("create_project", { name, pathOrUrl, baseBranch, }); } export async function listProjects(): Promise { return invoke("list_projects"); } export async function getProject(id: string): Promise { return invoke("get_project", { id }); } export async function updateProject( id: string, name: string, baseBranch: string ): Promise { return invoke("update_project", { id, name, baseBranch }); } export async function deleteProject(id: string): Promise { return invoke("delete_project", { id }); } // Credentials export async function setTuleapCredentials(tuleapUrl: string, username: string, password: string): Promise { return invoke("set_tuleap_credentials", { tuleapUrl, username, password }); } export async function getTuleapCredentials(): Promise { return invoke("get_tuleap_credentials"); } export async function deleteTuleapCredentials(): Promise { return invoke("delete_tuleap_credentials"); } export async function testTuleapConnection(): Promise { return invoke("test_tuleap_connection"); } // Trackers export async function addTracker(projectId: string, trackerId: number, trackerLabel: string, pollingInterval: number, agentConfig: AgentConfig, filters: FilterGroup[]): Promise { return invoke("add_tracker", { projectId, trackerId, trackerLabel, pollingInterval, agentConfig, filters }); } export async function listTrackers(projectId: string): Promise { return invoke("list_trackers", { projectId }); } export async function updateTracker(id: string, pollingInterval: number, agentConfig: AgentConfig, filters: FilterGroup[], enabled: boolean): Promise { return invoke("update_tracker", { id, pollingInterval, agentConfig, filters, enabled }); } export async function removeTracker(id: string): Promise { return invoke("remove_tracker", { id }); } export async function getTrackerFields(trackerId: number): Promise { return invoke("get_tracker_fields", { trackerId }); } // Tickets & Polling export async function listProcessedTickets(projectId: string): Promise { return invoke("list_processed_tickets", { projectId }); } export async function manualPoll(trackerId: string): Promise { return invoke("manual_poll", { trackerId }); } export async function getQueueStatus(projectId: string): Promise { return invoke("get_queue_status", { projectId }); }