import axios, { AxiosInstance } from 'axios' import { getBaseUrl } from './api.utils' import { Batch } from '../types' class Api { #instance: AxiosInstance | null = null init(publicApiKey: string, platform: string) { this.#instance = axios.create({ baseURL: getBaseUrl(publicApiKey), // eslint-disable-next-line @typescript-eslint/naming-convention headers: { 'public-api-key': publicApiKey, 'X-Platform': platform }, }) } sendBatch(batches: Batch[]) { return this.#instance?.post('/sdk-event-log/publish', { batch: batches}) } getInstances() { return this.#instance } } export const api = new Api()