import type { AxiosInstance } from "axios"; import { logWarning } from "./logger.js"; export type ServiceResult = { result: T; successful: boolean; }; export class API_Error { constructor(public error: string) {} } export abstract class BaseClient { private axiosInstance: AxiosInstance; constructor(axiosInstance: AxiosInstance) { this.axiosInstance = axiosInstance; } getAxios(): AxiosInstance { return this.axiosInstance; } } export abstract class BaseService { private client: T; constructor(client: T) { this.client = client; } getClient(): T { return this.client; } getSuccessfulResult(result: R): ServiceResult { return { result, successful: true, }; } getErrorResult(error: string): ServiceResult { logWarning(error); return { result: error, successful: false, }; } }