import axios from 'axios';
import { request as __request } from './generated/core/request';
import { CancelablePromise } from './generated/core/CancelablePromise';
import { BaseHttpRequest } from './generated/core/BaseHttpRequest';
import { ApiRequestOptions } from './generated/core/ApiRequestOptions';
import type { OpenAPIConfig } from './generated/core/OpenAPI';

export class AxiosHttpRequestWithTimeout extends BaseHttpRequest {
  axiosInstance = axios.create({
    timeout: 5000,
  });

  constructor(config: OpenAPIConfig) {
    super(config);
  }

  public override request<T>(options: ApiRequestOptions): CancelablePromise<T> {
    return __request(this.config, options, this.axiosInstance);
  }
}
