Class AsyncPromiseStage

java.lang.Object
bg.codexio.ai.openai.api.sdk.voice.speech.SpeechConfigurationStage
bg.codexio.ai.openai.api.sdk.voice.speech.AsyncPromiseStage

public class AsyncPromiseStage extends SpeechConfigurationStage
Registers callbacks
  • Method Details

    • then

      public void then(Consumer<File> afterAll)
      Sends request in asynchronous fashion, registers a callback to be called when file is downloaded.
      Parameters:
      afterAll - a callback which accepts the downloaded audio File
    • then

      public void then(Consumer<File> afterAll, Consumer<Throwable> onError)
      Sends request in asynchronous fashion, registers a callback to be called when file is downloaded.
      Parameters:
      afterAll - a callback which accepts the downloaded audio File
      onError - a callback which will be invoked if an error occurs
    • onEachLine

      public void onEachLine(Consumer<String> onEachLine)
      Sends request in asynchronous fashion, registers a callback to be called when String/byteArray line of the response is received.
      Parameters:
      onEachLine - a callback which accepts a String line of the response
    • onEachLine

      public void onEachLine(Consumer<String> onEachLine, Consumer<Throwable> onError)
      Sends request in asynchronous fashion, registers a callback to be called when String/byteArray line of the response is received.
      Parameters:
      onEachLine - a callback which accepts a String line of the response
      onError - a callback which will be invoked if an error occurs
    • then

      public void then(Consumer<String> onEachLine, Consumer<File> afterAll, Consumer<Throwable> onError)
      Sends request in asynchronous fashion, registers a callback to be called when file is downloaded and a callback to be called when String/byteArray line
      Parameters:
      onEachLine - a callback which accepts a String line of the response
      afterAll - a callback which accepts the downloaded audio File
      onError - a callback which will be invoked if an error occurs