/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 1c8e6b77a134
 */

import { audioVoicesCreate } from "../funcs/audioVoicesCreate.js";
import { audioVoicesDelete } from "../funcs/audioVoicesDelete.js";
import { audioVoicesGet } from "../funcs/audioVoicesGet.js";
import { audioVoicesGetSampleAudio } from "../funcs/audioVoicesGetSampleAudio.js";
import { audioVoicesList } from "../funcs/audioVoicesList.js";
import { audioVoicesUpdate } from "../funcs/audioVoicesUpdate.js";
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
import * as components from "../models/components/index.js";
import * as operations from "../models/operations/index.js";
import { unwrapAsync } from "../types/fp.js";

export class Voices extends ClientSDK {
  /**
   * List all voices
   *
   * @remarks
   * List all voices (excluding sample data)
   */
  async list(
    request?: operations.ListVoicesV1AudioVoicesGetRequest | undefined,
    options?: RequestOptions,
  ): Promise<components.VoiceListResponse> {
    return unwrapAsync(audioVoicesList(
      this,
      request,
      options,
    ));
  }

  /**
   * Create a new voice
   *
   * @remarks
   * Create a new voice with a base64-encoded audio sample
   */
  async create(
    request: components.VoiceCreateRequest,
    options?: RequestOptions,
  ): Promise<components.VoiceResponse> {
    return unwrapAsync(audioVoicesCreate(
      this,
      request,
      options,
    ));
  }

  /**
   * Delete a custom voice
   *
   * @remarks
   * Delete a custom voice
   */
  async delete(
    request: operations.DeleteVoiceV1AudioVoicesVoiceIdDeleteRequest,
    options?: RequestOptions,
  ): Promise<components.VoiceResponse> {
    return unwrapAsync(audioVoicesDelete(
      this,
      request,
      options,
    ));
  }

  /**
   * Update voice metadata
   *
   * @remarks
   * Update voice metadata (name, gender, languages, age, tags).
   */
  async update(
    request: operations.UpdateVoiceV1AudioVoicesVoiceIdPatchRequest,
    options?: RequestOptions,
  ): Promise<components.VoiceResponse> {
    return unwrapAsync(audioVoicesUpdate(
      this,
      request,
      options,
    ));
  }

  /**
   * Get voice details
   *
   * @remarks
   * Get voice details (excluding sample)
   */
  async get(
    request: operations.GetVoiceV1AudioVoicesVoiceIdGetRequest,
    options?: RequestOptions,
  ): Promise<components.VoiceResponse> {
    return unwrapAsync(audioVoicesGet(
      this,
      request,
      options,
    ));
  }

  /**
   * Get voice sample audio
   *
   * @remarks
   * Get the audio sample for a voice
   */
  async getSampleAudio(
    request: operations.GetVoiceSampleAudioV1AudioVoicesVoiceIdSampleGetRequest,
    options?: RequestOptions,
  ): Promise<ReadableStream<Uint8Array>> {
    return unwrapAsync(audioVoicesGetSampleAudio(
      this,
      request,
      options,
    ));
  }
}
