import type { InternalAxiosRequestConfig } from 'axios'; import { OpenFlareBaseService } from './base.service'; import type { ConfigDiffResult, ConfigPreviewResult, ConfigVersionCleanupPayload, ConfigVersionCleanupResult, ConfigVersionDetail, ConfigVersionSummary, } from './types'; export class ConfigVersionService extends OpenFlareBaseService { protected static override readonly basePath: string = '/api/v1/d/config-versions'; static list(): Promise { return this.get('/'); } static getActive(): Promise { return this.get('/active'); } static preview(): Promise { return this.get('/preview'); } static diff(): Promise { return this.get('/diff'); } static getById(id: string): Promise { return this.get(`/${id}`); } static publish(force?: boolean): Promise { return this.post( '/publish', undefined, force ? ({ params: { force: true } } as InternalAxiosRequestConfig) : undefined, ); } static activate(id: string): Promise { return this.post(`/${id}/activate`); } static cleanup( payload: ConfigVersionCleanupPayload, ): Promise { return this.post('/cleanup', payload); } }