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