openapi: 3.1.0
info:
  title: CogniCo Recognition API
  version: 0.0.1
paths:
  /api/v1/speech-to-text/sync:
    post:
      tags:
      - Recognition
      summary: Speech To Text Sync
      operationId: speech_to_text_sync
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_speech_to_text_sync'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecognitionResultData'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/speech-to-text/async:
    post:
      tags:
      - Recognition
      summary: Speech To Text Async
      operationId: speech_to_text_async
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_speech_to_text_async'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecognitionTaskData'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/v1/speech-to-text/async/{task_id}:
    get:
      tags:
      - Recognition
      summary: Speech To Text Async Result
      operationId: speech_to_text_async_result
      parameters:
      - name: task_id
        in: path
        required: true
        schema:
          type: string
          title: Task Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecognitionResultData'
        '202':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecognitionTaskData'
          description: Accepted
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_speech_to_text_async:
      properties:
        file:
          type: string
          format: binary
          title: File
        lang:
          anyOf:
          - type: string
          - type: 'null'
          title: Lang
      type: object
      required:
      - file
      title: Body_speech_to_text_async
    Body_speech_to_text_sync:
      properties:
        file:
          type: string
          format: binary
          title: File
        lang:
          anyOf:
          - type: string
          - type: 'null'
          title: Lang
      type: object
      required:
      - file
      title: Body_speech_to_text_sync
    EmotionType:
      type: string
      enum:
      - positive
      - angry
      - sad
      - neutral
      title: EmotionType
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RecognitionResultData:
      properties:
        text:
          type: string
          title: Text
        transcription:
          $ref: '#/components/schemas/TranscriptionData'
      type: object
      required:
      - text
      - transcription
      title: RecognitionResultData
    RecognitionTaskData:
      properties:
        task_id:
          type: string
          title: Task Id
        filename:
          type: string
          title: Filename
        size_kbytes:
          type: integer
          title: Size Kbytes
        duration_sec:
          type: integer
          title: Duration Sec
        format:
          type: string
          title: Format
      type: object
      required:
      - task_id
      - filename
      - size_kbytes
      - duration_sec
      - format
      title: RecognitionTaskData
    SpeakerData:
      properties:
        id:
          type: string
          title: Id
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
        ref:
          anyOf:
          - type: string
          - type: 'null'
          title: Ref
      type: object
      required:
      - id
      title: SpeakerData
    SpeechSegment:
      properties:
        start:
          type: number
          title: Start
        text:
          type: string
          title: Text
        end:
          anyOf:
          - type: number
          - type: 'null'
          title: End
        vad_prob:
          anyOf:
          - type: number
          - type: 'null'
          title: Vad Prob
        speech_prob:
          anyOf:
          - type: number
          - type: 'null'
          title: Speech Prob
        volume_70:
          anyOf:
          - type: number
          - type: 'null'
          title: Volume 70
        words:
          anyOf:
          - items:
              $ref: '#/components/schemas/SpeechWord'
            type: array
          - type: 'null'
          title: Words
        channel:
          anyOf:
          - type: string
          - type: 'null'
          title: Channel
        speaker:
          anyOf:
          - type: string
          - type: 'null'
          title: Speaker
        emotion:
          anyOf:
          - additionalProperties:
              type: number
            propertyNames:
              $ref: '#/components/schemas/EmotionType'
            type: object
          - type: 'null'
          title: Emotion
      type: object
      required:
      - start
      - text
      title: SpeechSegment
    SpeechWord:
      properties:
        word:
          type: string
          title: Word
        start:
          type: number
          title: Start
        end:
          type: number
          title: End
        speech_prob:
          type: number
          title: Speech Prob
        volume_avg:
          type: number
          title: Volume Avg
      type: object
      required:
      - word
      - start
      - end
      - speech_prob
      - volume_avg
      title: SpeechWord
    TranscriptionData:
      properties:
        segments:
          items:
            $ref: '#/components/schemas/SpeechSegment'
          type: array
          title: Segments
        speakers:
          items:
            $ref: '#/components/schemas/SpeakerData'
          type: array
          title: Speakers
          default: []
      type: object
      required:
      - segments
      title: TranscriptionData
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
