From eb9b5cf9bb325c68fa9c6b29fd57017eb1da7586 Mon Sep 17 00:00:00 2001 From: Jamie Pine Date: Sun, 25 Jan 2026 04:57:55 -0800 Subject: [PATCH] api --- app/src/lib/api/core/ApiError.ts | 25 + app/src/lib/api/core/ApiRequestOptions.ts | 17 + app/src/lib/api/core/ApiResult.ts | 11 + app/src/lib/api/core/CancelablePromise.ts | 131 +++++ app/src/lib/api/core/OpenAPI.ts | 32 ++ app/src/lib/api/core/request.ts | 322 ++++++++++++ app/src/lib/api/index.ts | 44 ++ ...mple_profiles__profile_id__samples_post.ts | 9 + .../Body_transcribe_audio_transcribe_post.ts | 9 + app/src/lib/api/models/GenerationRequest.ts | 15 + app/src/lib/api/models/GenerationResponse.ts | 18 + app/src/lib/api/models/HTTPValidationError.ts | 9 + app/src/lib/api/models/HealthResponse.ts | 16 + app/src/lib/api/models/HistoryListResponse.ts | 13 + app/src/lib/api/models/HistoryResponse.ts | 19 + .../lib/api/models/ModelDownloadRequest.ts | 11 + app/src/lib/api/models/ModelStatus.ts | 15 + .../lib/api/models/ModelStatusListResponse.ts | 12 + .../lib/api/models/ProfileSampleResponse.ts | 14 + .../lib/api/models/TranscriptionResponse.ts | 12 + app/src/lib/api/models/ValidationError.ts | 10 + app/src/lib/api/models/VoiceProfileCreate.ts | 13 + .../lib/api/models/VoiceProfileResponse.ts | 16 + ...mple_profiles__profile_id__samples_post.ts | 17 + .../$Body_transcribe_audio_transcribe_post.ts | 21 + app/src/lib/api/schemas/$GenerationRequest.ts | 40 ++ .../lib/api/schemas/$GenerationResponse.ts | 47 ++ .../lib/api/schemas/$HTTPValidationError.ts | 14 + app/src/lib/api/schemas/$HealthResponse.ts | 45 ++ .../lib/api/schemas/$HistoryListResponse.ts | 20 + app/src/lib/api/schemas/$HistoryResponse.ts | 51 ++ .../lib/api/schemas/$ModelDownloadRequest.ts | 13 + app/src/lib/api/schemas/$ModelStatus.ts | 32 ++ .../api/schemas/$ModelStatusListResponse.ts | 16 + .../lib/api/schemas/$ProfileSampleResponse.ts | 25 + .../lib/api/schemas/$TranscriptionResponse.ts | 17 + app/src/lib/api/schemas/$ValidationError.ts | 28 ++ .../lib/api/schemas/$VoiceProfileCreate.ts | 28 ++ .../lib/api/schemas/$VoiceProfileResponse.ts | 40 ++ app/src/lib/api/services/DefaultService.ts | 459 ++++++++++++++++++ 40 files changed, 1706 insertions(+) create mode 100644 app/src/lib/api/core/ApiError.ts create mode 100644 app/src/lib/api/core/ApiRequestOptions.ts create mode 100644 app/src/lib/api/core/ApiResult.ts create mode 100644 app/src/lib/api/core/CancelablePromise.ts create mode 100644 app/src/lib/api/core/OpenAPI.ts create mode 100644 app/src/lib/api/core/request.ts create mode 100644 app/src/lib/api/index.ts create mode 100644 app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts create mode 100644 app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts create mode 100644 app/src/lib/api/models/GenerationRequest.ts create mode 100644 app/src/lib/api/models/GenerationResponse.ts create mode 100644 app/src/lib/api/models/HTTPValidationError.ts create mode 100644 app/src/lib/api/models/HealthResponse.ts create mode 100644 app/src/lib/api/models/HistoryListResponse.ts create mode 100644 app/src/lib/api/models/HistoryResponse.ts create mode 100644 app/src/lib/api/models/ModelDownloadRequest.ts create mode 100644 app/src/lib/api/models/ModelStatus.ts create mode 100644 app/src/lib/api/models/ModelStatusListResponse.ts create mode 100644 app/src/lib/api/models/ProfileSampleResponse.ts create mode 100644 app/src/lib/api/models/TranscriptionResponse.ts create mode 100644 app/src/lib/api/models/ValidationError.ts create mode 100644 app/src/lib/api/models/VoiceProfileCreate.ts create mode 100644 app/src/lib/api/models/VoiceProfileResponse.ts create mode 100644 app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts create mode 100644 app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts create mode 100644 app/src/lib/api/schemas/$GenerationRequest.ts create mode 100644 app/src/lib/api/schemas/$GenerationResponse.ts create mode 100644 app/src/lib/api/schemas/$HTTPValidationError.ts create mode 100644 app/src/lib/api/schemas/$HealthResponse.ts create mode 100644 app/src/lib/api/schemas/$HistoryListResponse.ts create mode 100644 app/src/lib/api/schemas/$HistoryResponse.ts create mode 100644 app/src/lib/api/schemas/$ModelDownloadRequest.ts create mode 100644 app/src/lib/api/schemas/$ModelStatus.ts create mode 100644 app/src/lib/api/schemas/$ModelStatusListResponse.ts create mode 100644 app/src/lib/api/schemas/$ProfileSampleResponse.ts create mode 100644 app/src/lib/api/schemas/$TranscriptionResponse.ts create mode 100644 app/src/lib/api/schemas/$ValidationError.ts create mode 100644 app/src/lib/api/schemas/$VoiceProfileCreate.ts create mode 100644 app/src/lib/api/schemas/$VoiceProfileResponse.ts create mode 100644 app/src/lib/api/services/DefaultService.ts diff --git a/app/src/lib/api/core/ApiError.ts b/app/src/lib/api/core/ApiError.ts new file mode 100644 index 00000000..ec7b16af --- /dev/null +++ b/app/src/lib/api/core/ApiError.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; + +export class ApiError extends Error { + public readonly url: string; + public readonly status: number; + public readonly statusText: string; + public readonly body: any; + public readonly request: ApiRequestOptions; + + constructor(request: ApiRequestOptions, response: ApiResult, message: string) { + super(message); + + this.name = 'ApiError'; + this.url = response.url; + this.status = response.status; + this.statusText = response.statusText; + this.body = response.body; + this.request = request; + } +} diff --git a/app/src/lib/api/core/ApiRequestOptions.ts b/app/src/lib/api/core/ApiRequestOptions.ts new file mode 100644 index 00000000..93143c3c --- /dev/null +++ b/app/src/lib/api/core/ApiRequestOptions.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiRequestOptions = { + readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH'; + readonly url: string; + readonly path?: Record; + readonly cookies?: Record; + readonly headers?: Record; + readonly query?: Record; + readonly formData?: Record; + readonly body?: any; + readonly mediaType?: string; + readonly responseHeader?: string; + readonly errors?: Record; +}; diff --git a/app/src/lib/api/core/ApiResult.ts b/app/src/lib/api/core/ApiResult.ts new file mode 100644 index 00000000..ee1126e2 --- /dev/null +++ b/app/src/lib/api/core/ApiResult.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ApiResult = { + readonly url: string; + readonly ok: boolean; + readonly status: number; + readonly statusText: string; + readonly body: any; +}; diff --git a/app/src/lib/api/core/CancelablePromise.ts b/app/src/lib/api/core/CancelablePromise.ts new file mode 100644 index 00000000..d70de929 --- /dev/null +++ b/app/src/lib/api/core/CancelablePromise.ts @@ -0,0 +1,131 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export class CancelError extends Error { + + constructor(message: string) { + super(message); + this.name = 'CancelError'; + } + + public get isCancelled(): boolean { + return true; + } +} + +export interface OnCancel { + readonly isResolved: boolean; + readonly isRejected: boolean; + readonly isCancelled: boolean; + + (cancelHandler: () => void): void; +} + +export class CancelablePromise implements Promise { + #isResolved: boolean; + #isRejected: boolean; + #isCancelled: boolean; + readonly #cancelHandlers: (() => void)[]; + readonly #promise: Promise; + #resolve?: (value: T | PromiseLike) => void; + #reject?: (reason?: any) => void; + + constructor( + executor: ( + resolve: (value: T | PromiseLike) => void, + reject: (reason?: any) => void, + onCancel: OnCancel + ) => void + ) { + this.#isResolved = false; + this.#isRejected = false; + this.#isCancelled = false; + this.#cancelHandlers = []; + this.#promise = new Promise((resolve, reject) => { + this.#resolve = resolve; + this.#reject = reject; + + const onResolve = (value: T | PromiseLike): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isResolved = true; + if (this.#resolve) this.#resolve(value); + }; + + const onReject = (reason?: any): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isRejected = true; + if (this.#reject) this.#reject(reason); + }; + + const onCancel = (cancelHandler: () => void): void => { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#cancelHandlers.push(cancelHandler); + }; + + Object.defineProperty(onCancel, 'isResolved', { + get: (): boolean => this.#isResolved, + }); + + Object.defineProperty(onCancel, 'isRejected', { + get: (): boolean => this.#isRejected, + }); + + Object.defineProperty(onCancel, 'isCancelled', { + get: (): boolean => this.#isCancelled, + }); + + return executor(onResolve, onReject, onCancel as OnCancel); + }); + } + + get [Symbol.toStringTag]() { + return "Cancellable Promise"; + } + + public then( + onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, + onRejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Promise { + return this.#promise.then(onFulfilled, onRejected); + } + + public catch( + onRejected?: ((reason: any) => TResult | PromiseLike) | null + ): Promise { + return this.#promise.catch(onRejected); + } + + public finally(onFinally?: (() => void) | null): Promise { + return this.#promise.finally(onFinally); + } + + public cancel(): void { + if (this.#isResolved || this.#isRejected || this.#isCancelled) { + return; + } + this.#isCancelled = true; + if (this.#cancelHandlers.length) { + try { + for (const cancelHandler of this.#cancelHandlers) { + cancelHandler(); + } + } catch (error) { + console.warn('Cancellation threw an error', error); + return; + } + } + this.#cancelHandlers.length = 0; + if (this.#reject) this.#reject(new CancelError('Request aborted')); + } + + public get isCancelled(): boolean { + return this.#isCancelled; + } +} diff --git a/app/src/lib/api/core/OpenAPI.ts b/app/src/lib/api/core/OpenAPI.ts new file mode 100644 index 00000000..0cfae5db --- /dev/null +++ b/app/src/lib/api/core/OpenAPI.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ApiRequestOptions } from './ApiRequestOptions'; + +type Resolver = (options: ApiRequestOptions) => Promise; +type Headers = Record; + +export type OpenAPIConfig = { + BASE: string; + VERSION: string; + WITH_CREDENTIALS: boolean; + CREDENTIALS: 'include' | 'omit' | 'same-origin'; + TOKEN?: string | Resolver | undefined; + USERNAME?: string | Resolver | undefined; + PASSWORD?: string | Resolver | undefined; + HEADERS?: Headers | Resolver | undefined; + ENCODE_PATH?: ((path: string) => string) | undefined; +}; + +export const OpenAPI: OpenAPIConfig = { + BASE: '', + VERSION: '0.1.0', + WITH_CREDENTIALS: false, + CREDENTIALS: 'include', + TOKEN: undefined, + USERNAME: undefined, + PASSWORD: undefined, + HEADERS: undefined, + ENCODE_PATH: undefined, +}; diff --git a/app/src/lib/api/core/request.ts b/app/src/lib/api/core/request.ts new file mode 100644 index 00000000..f83d7119 --- /dev/null +++ b/app/src/lib/api/core/request.ts @@ -0,0 +1,322 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import { ApiError } from './ApiError'; +import type { ApiRequestOptions } from './ApiRequestOptions'; +import type { ApiResult } from './ApiResult'; +import { CancelablePromise } from './CancelablePromise'; +import type { OnCancel } from './CancelablePromise'; +import type { OpenAPIConfig } from './OpenAPI'; + +export const isDefined = (value: T | null | undefined): value is Exclude => { + return value !== undefined && value !== null; +}; + +export const isString = (value: any): value is string => { + return typeof value === 'string'; +}; + +export const isStringWithValue = (value: any): value is string => { + return isString(value) && value !== ''; +}; + +export const isBlob = (value: any): value is Blob => { + return ( + typeof value === 'object' && + typeof value.type === 'string' && + typeof value.stream === 'function' && + typeof value.arrayBuffer === 'function' && + typeof value.constructor === 'function' && + typeof value.constructor.name === 'string' && + /^(Blob|File)$/.test(value.constructor.name) && + /^(Blob|File)$/.test(value[Symbol.toStringTag]) + ); +}; + +export const isFormData = (value: any): value is FormData => { + return value instanceof FormData; +}; + +export const base64 = (str: string): string => { + try { + return btoa(str); + } catch (err) { + // @ts-ignore + return Buffer.from(str).toString('base64'); + } +}; + +export const getQueryString = (params: Record): string => { + const qs: string[] = []; + + const append = (key: string, value: any) => { + qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`); + }; + + const process = (key: string, value: any) => { + if (isDefined(value)) { + if (Array.isArray(value)) { + value.forEach(v => { + process(key, v); + }); + } else if (typeof value === 'object') { + Object.entries(value).forEach(([k, v]) => { + process(`${key}[${k}]`, v); + }); + } else { + append(key, value); + } + } + }; + + Object.entries(params).forEach(([key, value]) => { + process(key, value); + }); + + if (qs.length > 0) { + return `?${qs.join('&')}`; + } + + return ''; +}; + +const getUrl = (config: OpenAPIConfig, options: ApiRequestOptions): string => { + const encoder = config.ENCODE_PATH || encodeURI; + + const path = options.url + .replace('{api-version}', config.VERSION) + .replace(/{(.*?)}/g, (substring: string, group: string) => { + if (options.path?.hasOwnProperty(group)) { + return encoder(String(options.path[group])); + } + return substring; + }); + + const url = `${config.BASE}${path}`; + if (options.query) { + return `${url}${getQueryString(options.query)}`; + } + return url; +}; + +export const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData) { + const formData = new FormData(); + + const process = (key: string, value: any) => { + if (isString(value) || isBlob(value)) { + formData.append(key, value); + } else { + formData.append(key, JSON.stringify(value)); + } + }; + + Object.entries(options.formData) + .filter(([_, value]) => isDefined(value)) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + value.forEach(v => process(key, v)); + } else { + process(key, value); + } + }); + + return formData; + } + return undefined; +}; + +type Resolver = (options: ApiRequestOptions) => Promise; + +export const resolve = async (options: ApiRequestOptions, resolver?: T | Resolver): Promise => { + if (typeof resolver === 'function') { + return (resolver as Resolver)(options); + } + return resolver; +}; + +export const getHeaders = async (config: OpenAPIConfig, options: ApiRequestOptions): Promise => { + const [token, username, password, additionalHeaders] = await Promise.all([ + resolve(options, config.TOKEN), + resolve(options, config.USERNAME), + resolve(options, config.PASSWORD), + resolve(options, config.HEADERS), + ]); + + const headers = Object.entries({ + Accept: 'application/json', + ...additionalHeaders, + ...options.headers, + }) + .filter(([_, value]) => isDefined(value)) + .reduce((headers, [key, value]) => ({ + ...headers, + [key]: String(value), + }), {} as Record); + + if (isStringWithValue(token)) { + headers['Authorization'] = `Bearer ${token}`; + } + + if (isStringWithValue(username) && isStringWithValue(password)) { + const credentials = base64(`${username}:${password}`); + headers['Authorization'] = `Basic ${credentials}`; + } + + if (options.body !== undefined) { + if (options.mediaType) { + headers['Content-Type'] = options.mediaType; + } else if (isBlob(options.body)) { + headers['Content-Type'] = options.body.type || 'application/octet-stream'; + } else if (isString(options.body)) { + headers['Content-Type'] = 'text/plain'; + } else if (!isFormData(options.body)) { + headers['Content-Type'] = 'application/json'; + } + } + + return new Headers(headers); +}; + +export const getRequestBody = (options: ApiRequestOptions): any => { + if (options.body !== undefined) { + if (options.mediaType?.includes('/json')) { + return JSON.stringify(options.body) + } else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) { + return options.body; + } else { + return JSON.stringify(options.body); + } + } + return undefined; +}; + +export const sendRequest = async ( + config: OpenAPIConfig, + options: ApiRequestOptions, + url: string, + body: any, + formData: FormData | undefined, + headers: Headers, + onCancel: OnCancel +): Promise => { + const controller = new AbortController(); + + const request: RequestInit = { + headers, + body: body ?? formData, + method: options.method, + signal: controller.signal, + }; + + if (config.WITH_CREDENTIALS) { + request.credentials = config.CREDENTIALS; + } + + onCancel(() => controller.abort()); + + return await fetch(url, request); +}; + +export const getResponseHeader = (response: Response, responseHeader?: string): string | undefined => { + if (responseHeader) { + const content = response.headers.get(responseHeader); + if (isString(content)) { + return content; + } + } + return undefined; +}; + +export const getResponseBody = async (response: Response): Promise => { + if (response.status !== 204) { + try { + const contentType = response.headers.get('Content-Type'); + if (contentType) { + const jsonTypes = ['application/json', 'application/problem+json'] + const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type)); + if (isJSON) { + return await response.json(); + } else { + return await response.text(); + } + } + } catch (error) { + console.error(error); + } + } + return undefined; +}; + +export const catchErrorCodes = (options: ApiRequestOptions, result: ApiResult): void => { + const errors: Record = { + 400: 'Bad Request', + 401: 'Unauthorized', + 403: 'Forbidden', + 404: 'Not Found', + 500: 'Internal Server Error', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + ...options.errors, + } + + const error = errors[result.status]; + if (error) { + throw new ApiError(options, result, error); + } + + if (!result.ok) { + const errorStatus = result.status ?? 'unknown'; + const errorStatusText = result.statusText ?? 'unknown'; + const errorBody = (() => { + try { + return JSON.stringify(result.body, null, 2); + } catch (e) { + return undefined; + } + })(); + + throw new ApiError(options, result, + `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}` + ); + } +}; + +/** + * Request method + * @param config The OpenAPI configuration object + * @param options The request options from the service + * @returns CancelablePromise + * @throws ApiError + */ +export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { + return new CancelablePromise(async (resolve, reject, onCancel) => { + try { + const url = getUrl(config, options); + const formData = getFormData(options); + const body = getRequestBody(options); + const headers = await getHeaders(config, options); + + if (!onCancel.isCancelled) { + const response = await sendRequest(config, options, url, body, formData, headers, onCancel); + const responseBody = await getResponseBody(response); + const responseHeader = getResponseHeader(response, options.responseHeader); + + const result: ApiResult = { + url, + ok: response.ok, + status: response.status, + statusText: response.statusText, + body: responseHeader ?? responseBody, + }; + + catchErrorCodes(options, result); + + resolve(result.body); + } + } catch (error) { + reject(error); + } + }); +}; diff --git a/app/src/lib/api/index.ts b/app/src/lib/api/index.ts new file mode 100644 index 00000000..58d71cd4 --- /dev/null +++ b/app/src/lib/api/index.ts @@ -0,0 +1,44 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export { ApiError } from './core/ApiError'; +export { CancelablePromise, CancelError } from './core/CancelablePromise'; +export { OpenAPI } from './core/OpenAPI'; +export type { OpenAPIConfig } from './core/OpenAPI'; + +export type { Body_add_profile_sample_profiles__profile_id__samples_post } from './models/Body_add_profile_sample_profiles__profile_id__samples_post'; +export type { Body_transcribe_audio_transcribe_post } from './models/Body_transcribe_audio_transcribe_post'; +export type { GenerationRequest } from './models/GenerationRequest'; +export type { GenerationResponse } from './models/GenerationResponse'; +export type { HealthResponse } from './models/HealthResponse'; +export type { HistoryListResponse } from './models/HistoryListResponse'; +export type { HistoryResponse } from './models/HistoryResponse'; +export type { HTTPValidationError } from './models/HTTPValidationError'; +export type { ModelDownloadRequest } from './models/ModelDownloadRequest'; +export type { ModelStatus } from './models/ModelStatus'; +export type { ModelStatusListResponse } from './models/ModelStatusListResponse'; +export type { ProfileSampleResponse } from './models/ProfileSampleResponse'; +export type { TranscriptionResponse } from './models/TranscriptionResponse'; +export type { ValidationError } from './models/ValidationError'; +export type { VoiceProfileCreate } from './models/VoiceProfileCreate'; +export type { VoiceProfileResponse } from './models/VoiceProfileResponse'; + +export { $Body_add_profile_sample_profiles__profile_id__samples_post } from './schemas/$Body_add_profile_sample_profiles__profile_id__samples_post'; +export { $Body_transcribe_audio_transcribe_post } from './schemas/$Body_transcribe_audio_transcribe_post'; +export { $GenerationRequest } from './schemas/$GenerationRequest'; +export { $GenerationResponse } from './schemas/$GenerationResponse'; +export { $HealthResponse } from './schemas/$HealthResponse'; +export { $HistoryListResponse } from './schemas/$HistoryListResponse'; +export { $HistoryResponse } from './schemas/$HistoryResponse'; +export { $HTTPValidationError } from './schemas/$HTTPValidationError'; +export { $ModelDownloadRequest } from './schemas/$ModelDownloadRequest'; +export { $ModelStatus } from './schemas/$ModelStatus'; +export { $ModelStatusListResponse } from './schemas/$ModelStatusListResponse'; +export { $ProfileSampleResponse } from './schemas/$ProfileSampleResponse'; +export { $TranscriptionResponse } from './schemas/$TranscriptionResponse'; +export { $ValidationError } from './schemas/$ValidationError'; +export { $VoiceProfileCreate } from './schemas/$VoiceProfileCreate'; +export { $VoiceProfileResponse } from './schemas/$VoiceProfileResponse'; + +export { DefaultService } from './services/DefaultService'; diff --git a/app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts b/app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts new file mode 100644 index 00000000..638e5857 --- /dev/null +++ b/app/src/lib/api/models/Body_add_profile_sample_profiles__profile_id__samples_post.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type Body_add_profile_sample_profiles__profile_id__samples_post = { + file: Blob; + reference_text: string; +}; + diff --git a/app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts b/app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts new file mode 100644 index 00000000..30230084 --- /dev/null +++ b/app/src/lib/api/models/Body_transcribe_audio_transcribe_post.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type Body_transcribe_audio_transcribe_post = { + file: Blob; + language?: (string | null); +}; + diff --git a/app/src/lib/api/models/GenerationRequest.ts b/app/src/lib/api/models/GenerationRequest.ts new file mode 100644 index 00000000..e158d673 --- /dev/null +++ b/app/src/lib/api/models/GenerationRequest.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Request model for voice generation. + */ +export type GenerationRequest = { + profile_id: string; + text: string; + language?: string; + seed?: (number | null); + model_size?: (string | null); +}; + diff --git a/app/src/lib/api/models/GenerationResponse.ts b/app/src/lib/api/models/GenerationResponse.ts new file mode 100644 index 00000000..cbab3ce4 --- /dev/null +++ b/app/src/lib/api/models/GenerationResponse.ts @@ -0,0 +1,18 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for voice generation. + */ +export type GenerationResponse = { + id: string; + profile_id: string; + text: string; + language: string; + audio_path: string; + duration: number; + seed: (number | null); + created_at: string; +}; + diff --git a/app/src/lib/api/models/HTTPValidationError.ts b/app/src/lib/api/models/HTTPValidationError.ts new file mode 100644 index 00000000..f9b1a79e --- /dev/null +++ b/app/src/lib/api/models/HTTPValidationError.ts @@ -0,0 +1,9 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ValidationError } from './ValidationError'; +export type HTTPValidationError = { + detail?: Array; +}; + diff --git a/app/src/lib/api/models/HealthResponse.ts b/app/src/lib/api/models/HealthResponse.ts new file mode 100644 index 00000000..2dc89979 --- /dev/null +++ b/app/src/lib/api/models/HealthResponse.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for health check. + */ +export type HealthResponse = { + status: string; + model_loaded: boolean; + model_downloaded?: (boolean | null); + model_size?: (string | null); + gpu_available: boolean; + vram_used_mb?: (number | null); +}; + diff --git a/app/src/lib/api/models/HistoryListResponse.ts b/app/src/lib/api/models/HistoryListResponse.ts new file mode 100644 index 00000000..7b92bc70 --- /dev/null +++ b/app/src/lib/api/models/HistoryListResponse.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { HistoryResponse } from './HistoryResponse'; +/** + * Response model for history list. + */ +export type HistoryListResponse = { + items: Array; + total: number; +}; + diff --git a/app/src/lib/api/models/HistoryResponse.ts b/app/src/lib/api/models/HistoryResponse.ts new file mode 100644 index 00000000..afcec693 --- /dev/null +++ b/app/src/lib/api/models/HistoryResponse.ts @@ -0,0 +1,19 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for history entry (includes profile name). + */ +export type HistoryResponse = { + id: string; + profile_id: string; + profile_name: string; + text: string; + language: string; + audio_path: string; + duration: number; + seed: (number | null); + created_at: string; +}; + diff --git a/app/src/lib/api/models/ModelDownloadRequest.ts b/app/src/lib/api/models/ModelDownloadRequest.ts new file mode 100644 index 00000000..bac06d16 --- /dev/null +++ b/app/src/lib/api/models/ModelDownloadRequest.ts @@ -0,0 +1,11 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Request model for triggering model download. + */ +export type ModelDownloadRequest = { + model_name: string; +}; + diff --git a/app/src/lib/api/models/ModelStatus.ts b/app/src/lib/api/models/ModelStatus.ts new file mode 100644 index 00000000..3824e4e0 --- /dev/null +++ b/app/src/lib/api/models/ModelStatus.ts @@ -0,0 +1,15 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for model status. + */ +export type ModelStatus = { + model_name: string; + display_name: string; + downloaded: boolean; + size_mb?: (number | null); + loaded?: boolean; +}; + diff --git a/app/src/lib/api/models/ModelStatusListResponse.ts b/app/src/lib/api/models/ModelStatusListResponse.ts new file mode 100644 index 00000000..d6fa3b7b --- /dev/null +++ b/app/src/lib/api/models/ModelStatusListResponse.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { ModelStatus } from './ModelStatus'; +/** + * Response model for model status list. + */ +export type ModelStatusListResponse = { + models: Array; +}; + diff --git a/app/src/lib/api/models/ProfileSampleResponse.ts b/app/src/lib/api/models/ProfileSampleResponse.ts new file mode 100644 index 00000000..2f55b4d2 --- /dev/null +++ b/app/src/lib/api/models/ProfileSampleResponse.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for profile sample. + */ +export type ProfileSampleResponse = { + id: string; + profile_id: string; + audio_path: string; + reference_text: string; +}; + diff --git a/app/src/lib/api/models/TranscriptionResponse.ts b/app/src/lib/api/models/TranscriptionResponse.ts new file mode 100644 index 00000000..011724ea --- /dev/null +++ b/app/src/lib/api/models/TranscriptionResponse.ts @@ -0,0 +1,12 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for transcription. + */ +export type TranscriptionResponse = { + text: string; + duration: number; +}; + diff --git a/app/src/lib/api/models/ValidationError.ts b/app/src/lib/api/models/ValidationError.ts new file mode 100644 index 00000000..aaf1c921 --- /dev/null +++ b/app/src/lib/api/models/ValidationError.ts @@ -0,0 +1,10 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export type ValidationError = { + loc: Array<(string | number)>; + msg: string; + type: string; +}; + diff --git a/app/src/lib/api/models/VoiceProfileCreate.ts b/app/src/lib/api/models/VoiceProfileCreate.ts new file mode 100644 index 00000000..4f6d8929 --- /dev/null +++ b/app/src/lib/api/models/VoiceProfileCreate.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Request model for creating a voice profile. + */ +export type VoiceProfileCreate = { + name: string; + description?: (string | null); + language?: string; +}; + diff --git a/app/src/lib/api/models/VoiceProfileResponse.ts b/app/src/lib/api/models/VoiceProfileResponse.ts new file mode 100644 index 00000000..c4718533 --- /dev/null +++ b/app/src/lib/api/models/VoiceProfileResponse.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +/** + * Response model for voice profile. + */ +export type VoiceProfileResponse = { + id: string; + name: string; + description: (string | null); + language: string; + created_at: string; + updated_at: string; +}; + diff --git a/app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts b/app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts new file mode 100644 index 00000000..cf3a1ac5 --- /dev/null +++ b/app/src/lib/api/schemas/$Body_add_profile_sample_profiles__profile_id__samples_post.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $Body_add_profile_sample_profiles__profile_id__samples_post = { + properties: { + file: { + type: 'binary', + isRequired: true, + format: 'binary', + }, + reference_text: { + type: 'string', + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts b/app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts new file mode 100644 index 00000000..574f769f --- /dev/null +++ b/app/src/lib/api/schemas/$Body_transcribe_audio_transcribe_post.ts @@ -0,0 +1,21 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $Body_transcribe_audio_transcribe_post = { + properties: { + file: { + type: 'binary', + isRequired: true, + format: 'binary', + }, + language: { + type: 'any-of', + contains: [{ + type: 'string', + }, { + type: 'null', + }], + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$GenerationRequest.ts b/app/src/lib/api/schemas/$GenerationRequest.ts new file mode 100644 index 00000000..8614d1e1 --- /dev/null +++ b/app/src/lib/api/schemas/$GenerationRequest.ts @@ -0,0 +1,40 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $GenerationRequest = { + description: `Request model for voice generation.`, + properties: { + profile_id: { + type: 'string', + isRequired: true, + }, + text: { + type: 'string', + isRequired: true, + maxLength: 5000, + minLength: 1, + }, + language: { + type: 'string', + pattern: '^(en|zh)$', + }, + seed: { + type: 'any-of', + contains: [{ + type: 'number', + }, { + type: 'null', + }], + }, + model_size: { + type: 'any-of', + contains: [{ + type: 'string', + pattern: '^(1\\.7B|0\\.6B)$', + }, { + type: 'null', + }], + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$GenerationResponse.ts b/app/src/lib/api/schemas/$GenerationResponse.ts new file mode 100644 index 00000000..bfcf2f60 --- /dev/null +++ b/app/src/lib/api/schemas/$GenerationResponse.ts @@ -0,0 +1,47 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $GenerationResponse = { + description: `Response model for voice generation.`, + properties: { + id: { + type: 'string', + isRequired: true, + }, + profile_id: { + type: 'string', + isRequired: true, + }, + text: { + type: 'string', + isRequired: true, + }, + language: { + type: 'string', + isRequired: true, + }, + audio_path: { + type: 'string', + isRequired: true, + }, + duration: { + type: 'number', + isRequired: true, + }, + seed: { + type: 'any-of', + contains: [{ + type: 'number', + }, { + type: 'null', + }], + isRequired: true, + }, + created_at: { + type: 'string', + isRequired: true, + format: 'date-time', + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$HTTPValidationError.ts b/app/src/lib/api/schemas/$HTTPValidationError.ts new file mode 100644 index 00000000..608fcce9 --- /dev/null +++ b/app/src/lib/api/schemas/$HTTPValidationError.ts @@ -0,0 +1,14 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $HTTPValidationError = { + properties: { + detail: { + type: 'array', + contains: { + type: 'ValidationError', + }, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$HealthResponse.ts b/app/src/lib/api/schemas/$HealthResponse.ts new file mode 100644 index 00000000..b823e1d7 --- /dev/null +++ b/app/src/lib/api/schemas/$HealthResponse.ts @@ -0,0 +1,45 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $HealthResponse = { + description: `Response model for health check.`, + properties: { + status: { + type: 'string', + isRequired: true, + }, + model_loaded: { + type: 'boolean', + isRequired: true, + }, + model_downloaded: { + type: 'any-of', + contains: [{ + type: 'boolean', + }, { + type: 'null', + }], + }, + model_size: { + type: 'any-of', + contains: [{ + type: 'string', + }, { + type: 'null', + }], + }, + gpu_available: { + type: 'boolean', + isRequired: true, + }, + vram_used_mb: { + type: 'any-of', + contains: [{ + type: 'number', + }, { + type: 'null', + }], + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$HistoryListResponse.ts b/app/src/lib/api/schemas/$HistoryListResponse.ts new file mode 100644 index 00000000..e592c9fd --- /dev/null +++ b/app/src/lib/api/schemas/$HistoryListResponse.ts @@ -0,0 +1,20 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $HistoryListResponse = { + description: `Response model for history list.`, + properties: { + items: { + type: 'array', + contains: { + type: 'HistoryResponse', + }, + isRequired: true, + }, + total: { + type: 'number', + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$HistoryResponse.ts b/app/src/lib/api/schemas/$HistoryResponse.ts new file mode 100644 index 00000000..ca13329b --- /dev/null +++ b/app/src/lib/api/schemas/$HistoryResponse.ts @@ -0,0 +1,51 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $HistoryResponse = { + description: `Response model for history entry (includes profile name).`, + properties: { + id: { + type: 'string', + isRequired: true, + }, + profile_id: { + type: 'string', + isRequired: true, + }, + profile_name: { + type: 'string', + isRequired: true, + }, + text: { + type: 'string', + isRequired: true, + }, + language: { + type: 'string', + isRequired: true, + }, + audio_path: { + type: 'string', + isRequired: true, + }, + duration: { + type: 'number', + isRequired: true, + }, + seed: { + type: 'any-of', + contains: [{ + type: 'number', + }, { + type: 'null', + }], + isRequired: true, + }, + created_at: { + type: 'string', + isRequired: true, + format: 'date-time', + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$ModelDownloadRequest.ts b/app/src/lib/api/schemas/$ModelDownloadRequest.ts new file mode 100644 index 00000000..55548074 --- /dev/null +++ b/app/src/lib/api/schemas/$ModelDownloadRequest.ts @@ -0,0 +1,13 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ModelDownloadRequest = { + description: `Request model for triggering model download.`, + properties: { + model_name: { + type: 'string', + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$ModelStatus.ts b/app/src/lib/api/schemas/$ModelStatus.ts new file mode 100644 index 00000000..d4c65e2e --- /dev/null +++ b/app/src/lib/api/schemas/$ModelStatus.ts @@ -0,0 +1,32 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ModelStatus = { + description: `Response model for model status.`, + properties: { + model_name: { + type: 'string', + isRequired: true, + }, + display_name: { + type: 'string', + isRequired: true, + }, + downloaded: { + type: 'boolean', + isRequired: true, + }, + size_mb: { + type: 'any-of', + contains: [{ + type: 'number', + }, { + type: 'null', + }], + }, + loaded: { + type: 'boolean', + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$ModelStatusListResponse.ts b/app/src/lib/api/schemas/$ModelStatusListResponse.ts new file mode 100644 index 00000000..91dc442f --- /dev/null +++ b/app/src/lib/api/schemas/$ModelStatusListResponse.ts @@ -0,0 +1,16 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ModelStatusListResponse = { + description: `Response model for model status list.`, + properties: { + models: { + type: 'array', + contains: { + type: 'ModelStatus', + }, + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$ProfileSampleResponse.ts b/app/src/lib/api/schemas/$ProfileSampleResponse.ts new file mode 100644 index 00000000..d9d6a097 --- /dev/null +++ b/app/src/lib/api/schemas/$ProfileSampleResponse.ts @@ -0,0 +1,25 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ProfileSampleResponse = { + description: `Response model for profile sample.`, + properties: { + id: { + type: 'string', + isRequired: true, + }, + profile_id: { + type: 'string', + isRequired: true, + }, + audio_path: { + type: 'string', + isRequired: true, + }, + reference_text: { + type: 'string', + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$TranscriptionResponse.ts b/app/src/lib/api/schemas/$TranscriptionResponse.ts new file mode 100644 index 00000000..d3970857 --- /dev/null +++ b/app/src/lib/api/schemas/$TranscriptionResponse.ts @@ -0,0 +1,17 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $TranscriptionResponse = { + description: `Response model for transcription.`, + properties: { + text: { + type: 'string', + isRequired: true, + }, + duration: { + type: 'number', + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$ValidationError.ts b/app/src/lib/api/schemas/$ValidationError.ts new file mode 100644 index 00000000..efe89ba1 --- /dev/null +++ b/app/src/lib/api/schemas/$ValidationError.ts @@ -0,0 +1,28 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $ValidationError = { + properties: { + loc: { + type: 'array', + contains: { + type: 'any-of', + contains: [{ + type: 'string', + }, { + type: 'number', + }], + }, + isRequired: true, + }, + msg: { + type: 'string', + isRequired: true, + }, + type: { + type: 'string', + isRequired: true, + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$VoiceProfileCreate.ts b/app/src/lib/api/schemas/$VoiceProfileCreate.ts new file mode 100644 index 00000000..4272d2ac --- /dev/null +++ b/app/src/lib/api/schemas/$VoiceProfileCreate.ts @@ -0,0 +1,28 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $VoiceProfileCreate = { + description: `Request model for creating a voice profile.`, + properties: { + name: { + type: 'string', + isRequired: true, + maxLength: 100, + minLength: 1, + }, + description: { + type: 'any-of', + contains: [{ + type: 'string', + maxLength: 500, + }, { + type: 'null', + }], + }, + language: { + type: 'string', + pattern: '^(en|zh)$', + }, + }, +} as const; diff --git a/app/src/lib/api/schemas/$VoiceProfileResponse.ts b/app/src/lib/api/schemas/$VoiceProfileResponse.ts new file mode 100644 index 00000000..99d7f177 --- /dev/null +++ b/app/src/lib/api/schemas/$VoiceProfileResponse.ts @@ -0,0 +1,40 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +export const $VoiceProfileResponse = { + description: `Response model for voice profile.`, + properties: { + id: { + type: 'string', + isRequired: true, + }, + name: { + type: 'string', + isRequired: true, + }, + description: { + type: 'any-of', + contains: [{ + type: 'string', + }, { + type: 'null', + }], + isRequired: true, + }, + language: { + type: 'string', + isRequired: true, + }, + created_at: { + type: 'string', + isRequired: true, + format: 'date-time', + }, + updated_at: { + type: 'string', + isRequired: true, + format: 'date-time', + }, + }, +} as const; diff --git a/app/src/lib/api/services/DefaultService.ts b/app/src/lib/api/services/DefaultService.ts new file mode 100644 index 00000000..29af6911 --- /dev/null +++ b/app/src/lib/api/services/DefaultService.ts @@ -0,0 +1,459 @@ +/* generated using openapi-typescript-codegen -- do not edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ +import type { Body_add_profile_sample_profiles__profile_id__samples_post } from '../models/Body_add_profile_sample_profiles__profile_id__samples_post'; +import type { Body_transcribe_audio_transcribe_post } from '../models/Body_transcribe_audio_transcribe_post'; +import type { GenerationRequest } from '../models/GenerationRequest'; +import type { GenerationResponse } from '../models/GenerationResponse'; +import type { HealthResponse } from '../models/HealthResponse'; +import type { HistoryListResponse } from '../models/HistoryListResponse'; +import type { HistoryResponse } from '../models/HistoryResponse'; +import type { ModelDownloadRequest } from '../models/ModelDownloadRequest'; +import type { ModelStatusListResponse } from '../models/ModelStatusListResponse'; +import type { ProfileSampleResponse } from '../models/ProfileSampleResponse'; +import type { TranscriptionResponse } from '../models/TranscriptionResponse'; +import type { VoiceProfileCreate } from '../models/VoiceProfileCreate'; +import type { VoiceProfileResponse } from '../models/VoiceProfileResponse'; +import type { CancelablePromise } from '../core/CancelablePromise'; +import { OpenAPI } from '../core/OpenAPI'; +import { request as __request } from '../core/request'; +export class DefaultService { + /** + * Root + * Root endpoint. + * @returns any Successful Response + * @throws ApiError + */ + public static rootGet(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/', + }); + } + /** + * Health + * Health check endpoint. + * @returns HealthResponse Successful Response + * @throws ApiError + */ + public static healthHealthGet(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/health', + }); + } + /** + * List Profiles + * List all voice profiles. + * @returns VoiceProfileResponse Successful Response + * @throws ApiError + */ + public static listProfilesProfilesGet(): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/profiles', + }); + } + /** + * Create Profile + * Create a new voice profile. + * @returns VoiceProfileResponse Successful Response + * @throws ApiError + */ + public static createProfileProfilesPost({ + requestBody, + }: { + requestBody: VoiceProfileCreate, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/profiles', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get Profile + * Get a voice profile by ID. + * @returns VoiceProfileResponse Successful Response + * @throws ApiError + */ + public static getProfileProfilesProfileIdGet({ + profileId, + }: { + profileId: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/profiles/{profile_id}', + path: { + 'profile_id': profileId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Update Profile + * Update a voice profile. + * @returns VoiceProfileResponse Successful Response + * @throws ApiError + */ + public static updateProfileProfilesProfileIdPut({ + profileId, + requestBody, + }: { + profileId: string, + requestBody: VoiceProfileCreate, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'PUT', + url: '/profiles/{profile_id}', + path: { + 'profile_id': profileId, + }, + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Delete Profile + * Delete a voice profile. + * @returns any Successful Response + * @throws ApiError + */ + public static deleteProfileProfilesProfileIdDelete({ + profileId, + }: { + profileId: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/profiles/{profile_id}', + path: { + 'profile_id': profileId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Add Profile Sample + * Add a sample to a voice profile. + * @returns ProfileSampleResponse Successful Response + * @throws ApiError + */ + public static addProfileSampleProfilesProfileIdSamplesPost({ + profileId, + formData, + }: { + profileId: string, + formData: Body_add_profile_sample_profiles__profile_id__samples_post, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/profiles/{profile_id}/samples', + path: { + 'profile_id': profileId, + }, + formData: formData, + mediaType: 'multipart/form-data', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get Profile Samples + * Get all samples for a profile. + * @returns ProfileSampleResponse Successful Response + * @throws ApiError + */ + public static getProfileSamplesProfilesProfileIdSamplesGet({ + profileId, + }: { + profileId: string, + }): CancelablePromise> { + return __request(OpenAPI, { + method: 'GET', + url: '/profiles/{profile_id}/samples', + path: { + 'profile_id': profileId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Delete Profile Sample + * Delete a profile sample. + * @returns any Successful Response + * @throws ApiError + */ + public static deleteProfileSampleProfilesSamplesSampleIdDelete({ + sampleId, + }: { + sampleId: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/profiles/samples/{sample_id}', + path: { + 'sample_id': sampleId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Generate Speech + * Generate speech from text using a voice profile. + * @returns GenerationResponse Successful Response + * @throws ApiError + */ + public static generateSpeechGeneratePost({ + requestBody, + }: { + requestBody: GenerationRequest, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/generate', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * List History + * List generation history with optional filters. + * @returns HistoryListResponse Successful Response + * @throws ApiError + */ + public static listHistoryHistoryGet({ + profileId, + search, + limit = 50, + offset, + }: { + profileId?: (string | null), + search?: (string | null), + limit?: number, + offset?: number, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/history', + query: { + 'profile_id': profileId, + 'search': search, + 'limit': limit, + 'offset': offset, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get Generation + * Get a generation by ID. + * @returns HistoryResponse Successful Response + * @throws ApiError + */ + public static getGenerationHistoryGenerationIdGet({ + generationId, + }: { + generationId: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/history/{generation_id}', + path: { + 'generation_id': generationId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Delete Generation + * Delete a generation. + * @returns any Successful Response + * @throws ApiError + */ + public static deleteGenerationHistoryGenerationIdDelete({ + generationId, + }: { + generationId: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'DELETE', + url: '/history/{generation_id}', + path: { + 'generation_id': generationId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get Stats + * Get generation statistics. + * @returns any Successful Response + * @throws ApiError + */ + public static getStatsHistoryStatsGet(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/history/stats', + }); + } + /** + * Transcribe Audio + * Transcribe audio file to text. + * @returns TranscriptionResponse Successful Response + * @throws ApiError + */ + public static transcribeAudioTranscribePost({ + formData, + }: { + formData: Body_transcribe_audio_transcribe_post, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/transcribe', + formData: formData, + mediaType: 'multipart/form-data', + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get Audio + * Serve generated audio file. + * @returns any Successful Response + * @throws ApiError + */ + public static getAudioAudioGenerationIdGet({ + generationId, + }: { + generationId: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/audio/{generation_id}', + path: { + 'generation_id': generationId, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Load Model + * Manually load TTS model. + * @returns any Successful Response + * @throws ApiError + */ + public static loadModelModelsLoadPost({ + modelSize = '1.7B', + }: { + modelSize?: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/models/load', + query: { + 'model_size': modelSize, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Unload Model + * Unload TTS model to free memory. + * @returns any Successful Response + * @throws ApiError + */ + public static unloadModelModelsUnloadPost(): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/models/unload', + }); + } + /** + * Get Model Progress + * Get model download progress via Server-Sent Events. + * @returns any Successful Response + * @throws ApiError + */ + public static getModelProgressModelsProgressModelNameGet({ + modelName, + }: { + modelName: string, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/models/progress/{model_name}', + path: { + 'model_name': modelName, + }, + errors: { + 422: `Validation Error`, + }, + }); + } + /** + * Get Model Status + * Get status of all available models. + * @returns ModelStatusListResponse Successful Response + * @throws ApiError + */ + public static getModelStatusModelsStatusGet(): CancelablePromise { + return __request(OpenAPI, { + method: 'GET', + url: '/models/status', + }); + } + /** + * Trigger Model Download + * Trigger download of a specific model. + * @returns any Successful Response + * @throws ApiError + */ + public static triggerModelDownloadModelsDownloadPost({ + requestBody, + }: { + requestBody: ModelDownloadRequest, + }): CancelablePromise { + return __request(OpenAPI, { + method: 'POST', + url: '/models/download', + body: requestBody, + mediaType: 'application/json', + errors: { + 422: `Validation Error`, + }, + }); + } +}