import { getConfig as apiGetConfig, getProviderModels as apiGetProviderModels, getAllModels as apiGetAllModels, updateDefaults as apiUpdateDefaults, } from '@ottocode/api';
import { extractErrorMessage } from './utils';
export const configMixin = {
    async getConfig() {
        const response = await apiGetConfig();
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        // biome-ignore lint/suspicious/noExplicitAny: API response structure
        return response.data;
    },
    async getModels(providerId) {
        const response = await apiGetProviderModels({
            // biome-ignore lint/suspicious/noExplicitAny: API type mismatch
            path: { provider: providerId },
        });
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        // biome-ignore lint/suspicious/noExplicitAny: API response structure
        return response.data;
    },
    async getAllModels() {
        const response = await apiGetAllModels();
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        return response.data;
    },
    async updateDefaults(data) {
        const response = await apiUpdateDefaults({
            // biome-ignore lint/suspicious/noExplicitAny: API type mismatch
            body: data,
        });
        if (response.error)
            throw new Error(extractErrorMessage(response.error));
        // biome-ignore lint/suspicious/noExplicitAny: API response structure
        return response.data;
    },
};
//# sourceMappingURL=config.js.map