API's

All interactions with external services are abstracted into dedicated service classes to keep the business logic clean and testable.

DidApi (/lib/agent/apis/did_api.dart)

  • Purpose: Manages all communication for creating and interacting with D-ID agent streams.

  • Protocol: HTTPS (RESTful API calls).

  • Key Methods:

    • fetchAgents(): Retrieves the list of available agents.

    • createChat(): Initiates a new chat session.

    • createStream(): Establishes a new WebRTC stream.

    • sendMessage(): Sends the user's transcribed text to the agent.

    • sendAnswer() / sendIce(): Handles the WebRTC signaling process.

TranscriptService (/lib/agent/apis/transcript_service.dart)

  • Purpose: Manages the real-time, streaming voice-to-text transcription.

  • Protocol: WebSocket (Socket.IO).

  • Functionality: Establishes a persistent connection to the backend. When the user is recording, it streams raw audio chunks to the server and listens for incoming transcript events containing the transcribed text.

AuthApi (/lib/auth/apis/auth_api.dart)

  • Purpose: Handles user authentication.

  • Protocol: HTTPS (RESTful API calls).

  • Key Methods:

    • login(user, pass)

    • register(user, pass)

    • verify()

Last updated