feat: TFS Sync
This commit is contained in:
66
src/clients/tfs-client.ts
Normal file
66
src/clients/tfs-client.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* Client HTTP pour TFS/Azure DevOps
|
||||
* Gère les appels API côté frontend
|
||||
*/
|
||||
|
||||
import { HttpClient } from './base/http-client';
|
||||
|
||||
export interface TfsSchedulerStatus {
|
||||
running: boolean;
|
||||
lastSync?: string;
|
||||
nextSync?: string;
|
||||
interval: 'hourly' | 'daily' | 'weekly';
|
||||
tfsConfigured: boolean;
|
||||
}
|
||||
|
||||
export class TfsClient extends HttpClient {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance la synchronisation manuelle des Pull Requests TFS
|
||||
*/
|
||||
async syncPullRequests() {
|
||||
return this.post('/api/tfs/sync', {});
|
||||
}
|
||||
|
||||
/**
|
||||
* Teste la connexion TFS
|
||||
*/
|
||||
async testConnection() {
|
||||
return this.get('/api/tfs/sync');
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure le scheduler TFS
|
||||
*/
|
||||
async configureScheduler(enabled: boolean, interval: 'hourly' | 'daily' | 'weekly') {
|
||||
return this.post('/api/tfs/sync', {
|
||||
action: 'config',
|
||||
tfsAutoSync: enabled,
|
||||
tfsSyncInterval: interval
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Démarre/arrête le scheduler TFS
|
||||
*/
|
||||
async toggleScheduler(enabled: boolean) {
|
||||
return this.post('/api/tfs/sync', {
|
||||
action: 'scheduler',
|
||||
enabled
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Récupère le statut du scheduler TFS
|
||||
*/
|
||||
async getSchedulerStatus(): Promise<TfsSchedulerStatus> {
|
||||
return this.get<TfsSchedulerStatus>('/api/tfs/scheduler/status');
|
||||
}
|
||||
}
|
||||
|
||||
// Export d'une instance singleton
|
||||
export const tfsClient = new TfsClient();
|
||||
|
||||
Reference in New Issue
Block a user