// This file is auto-generated by @hey-api/openapi-ts

import type { CancelablePromise } from "./core/CancelablePromise"
import { OpenAPI } from "./core/OpenAPI"
import { request as __request } from "./core/request"
import type {
  TranslateFileV1AudioTranslationsPostData,
  TranslateFileV1AudioTranslationsPostResponse,
  TranscribeFileV1AudioTranscriptionsPostData,
  TranscribeFileV1AudioTranscriptionsPostResponse,
  HandleCompletionsV1ChatCompletionsPostData,
  HandleCompletionsV1ChatCompletionsPostResponse,
  HealthHealthGetResponse,
  GetRunningModelsApiPsGetResponse,
  LoadModelRouteApiPsModelIdPostData,
  LoadModelRouteApiPsModelIdPostResponse,
  StopRunningModelApiPsModelIdDeleteData,
  StopRunningModelApiPsModelIdDeleteResponse,
  ListLocalModelsV1ModelsGetData,
  ListLocalModelsV1ModelsGetResponse,
  GetLocalModelV1ModelsModelIdGetData,
  GetLocalModelV1ModelsModelIdGetResponse,
  DownloadRemoteModelV1ModelsModelIdPostData,
  DownloadRemoteModelV1ModelsModelIdPostResponse,
  DeleteModelV1ModelsModelIdDeleteData,
  DeleteModelV1ModelsModelIdDeleteResponse,
  GetRemoteModelsV1RegistryGetData,
  GetRemoteModelsV1RegistryGetResponse,
  RealtimeWebrtcV1RealtimePostData,
  RealtimeWebrtcV1RealtimePostResponse,
  SynthesizeV1AudioSpeechPostData,
  SynthesizeV1AudioSpeechPostResponse,
  DetectSpeechTimestampsV1AudioSpeechTimestampsPostData,
  DetectSpeechTimestampsV1AudioSpeechTimestampsPostResponse,
} from "./types.gen"

export class AutomaticSpeechRecognitionService {
  /**
   * Translate File
   * @param data The data for the request.
   * @param data.formData
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static translateFileV1AudioTranslationsPost(
    data: TranslateFileV1AudioTranslationsPostData,
  ): CancelablePromise<TranslateFileV1AudioTranslationsPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/audio/translations",
      formData: data.formData,
      mediaType: "application/x-www-form-urlencoded",
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Transcribe File
   * @param data The data for the request.
   * @param data.formData
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static transcribeFileV1AudioTranscriptionsPost(
    data: TranscribeFileV1AudioTranscriptionsPostData,
  ): CancelablePromise<TranscribeFileV1AudioTranscriptionsPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/audio/transcriptions",
      formData: data.formData,
      mediaType: "application/x-www-form-urlencoded",
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class DefaultService {
  /**
   * Handle Completions
   * @param data The data for the request.
   * @param data.requestBody
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static handleCompletionsV1ChatCompletionsPost(
    data: HandleCompletionsV1ChatCompletionsPostData,
  ): CancelablePromise<HandleCompletionsV1ChatCompletionsPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/chat/completions",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class DiagnosticService {
  /**
   * Health
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static healthHealthGet(): CancelablePromise<HealthHealthGetResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/health",
    })
  }
}

export class ExperimentalService {
  /**
   * Get a list of loaded models.
   * @returns string Successful Response
   * @throws ApiError
   */
  public static getRunningModelsApiPsGet(): CancelablePromise<GetRunningModelsApiPsGetResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/api/ps",
    })
  }

  /**
   * Load a model into memory.
   * @param data The data for the request.
   * @param data.modelId
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static loadModelRouteApiPsModelIdPost(
    data: LoadModelRouteApiPsModelIdPostData,
  ): CancelablePromise<LoadModelRouteApiPsModelIdPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/api/ps/{model_id}",
      path: {
        model_id: data.modelId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Unload a model from memory.
   * @param data The data for the request.
   * @param data.modelId
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static stopRunningModelApiPsModelIdDelete(
    data: StopRunningModelApiPsModelIdDeleteData,
  ): CancelablePromise<StopRunningModelApiPsModelIdDeleteResponse> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/api/ps/{model_id}",
      path: {
        model_id: data.modelId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class ModelsService {
  /**
   * List Local Models
   * @param data The data for the request.
   * @param data.task
   * @returns ListModelsResponse Successful Response
   * @throws ApiError
   */
  public static listLocalModelsV1ModelsGet(
    data: ListLocalModelsV1ModelsGetData = {},
  ): CancelablePromise<ListLocalModelsV1ModelsGetResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/models",
      query: {
        task: data.task,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Local Model
   * @param data The data for the request.
   * @param data.modelId
   * @returns Model Successful Response
   * @throws ApiError
   */
  public static getLocalModelV1ModelsModelIdGet(
    data: GetLocalModelV1ModelsModelIdGetData,
  ): CancelablePromise<GetLocalModelV1ModelsModelIdGetResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/models/{model_id}",
      path: {
        model_id: data.modelId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Download Remote Model
   * @param data The data for the request.
   * @param data.modelId
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static downloadRemoteModelV1ModelsModelIdPost(
    data: DownloadRemoteModelV1ModelsModelIdPostData,
  ): CancelablePromise<DownloadRemoteModelV1ModelsModelIdPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/models/{model_id}",
      path: {
        model_id: data.modelId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Delete Model
   * @param data The data for the request.
   * @param data.modelId
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static deleteModelV1ModelsModelIdDelete(
    data: DeleteModelV1ModelsModelIdDeleteData,
  ): CancelablePromise<DeleteModelV1ModelsModelIdDeleteResponse> {
    return __request(OpenAPI, {
      method: "DELETE",
      url: "/v1/models/{model_id}",
      path: {
        model_id: data.modelId,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }

  /**
   * Get Remote Models
   * @param data The data for the request.
   * @param data.task
   * @returns ListModelsResponse Successful Response
   * @throws ApiError
   */
  public static getRemoteModelsV1RegistryGet(
    data: GetRemoteModelsV1RegistryGetData = {},
  ): CancelablePromise<GetRemoteModelsV1RegistryGetResponse> {
    return __request(OpenAPI, {
      method: "GET",
      url: "/v1/registry",
      query: {
        task: data.task,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class RealtimeService {
  /**
   * Realtime Webrtc
   * @param data The data for the request.
   * @param data.model
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static webrtcV1RealtimePost(
    data: RealtimeWebrtcV1RealtimePostData,
  ): CancelablePromise<RealtimeWebrtcV1RealtimePostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/realtime",
      query: {
        model: data.model,
      },
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class SpeechToTextService {
  /**
   * Synthesize
   * @param data The data for the request.
   * @param data.requestBody
   * @returns unknown Successful Response
   * @throws ApiError
   */
  public static synthesizeV1AudioSpeechPost(
    data: SynthesizeV1AudioSpeechPostData,
  ): CancelablePromise<SynthesizeV1AudioSpeechPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/audio/speech",
      body: data.requestBody,
      mediaType: "application/json",
      errors: {
        422: "Validation Error",
      },
    })
  }
}

export class VoiceActivityDetectionService {
  /**
   * Detect Speech Timestamps
   * @param data The data for the request.
   * @param data.formData
   * @returns SpeechTimestamp Successful Response
   * @throws ApiError
   */
  public static detectSpeechTimestampsV1AudioSpeechTimestampsPost(
    data: DetectSpeechTimestampsV1AudioSpeechTimestampsPostData,
  ): CancelablePromise<DetectSpeechTimestampsV1AudioSpeechTimestampsPostResponse> {
    return __request(OpenAPI, {
      method: "POST",
      url: "/v1/audio/speech/timestamps",
      formData: data.formData,
      mediaType: "application/x-www-form-urlencoded",
      errors: {
        422: "Validation Error",
      },
    })
  }
}
