openapi: 3.0.1
info:
  version: 2.0.0
  title: Spiky API V2
  description: |-
    How to use:
      1. Open a spiky account 
      2. Get authentication tokens
      3. Send POST /platform/meeting-reports for fetching upload URLs. The integration name must be given "MANUALTIMELINE" for manual timeline upload flow.
      4. Upload timeline file to S3 via given signed URL (if manual timeline flow is selected)
      5. Upload a video or audio file to the given URL 
      6. Analysis will start by itself
      7. GET /platform/meeting-reports/<analysis-id> can be used for getting the latest status of the meeting. “analysisStatus” will be set as “ANALYSIS_READY” if analysis is finished.
      8. GET /platform/ml-data/<analysis-id> can be used for getting the ML data
      9. POST /platform/public/token/refresh can be used for refreshing the token.


    Some useful links:
    - [Spiky AI Website](https://spiky.ai)

  termsOfService: https://spiky.ai/terms-of-service
  contact:
    email: info@spiky.ai

servers:
  - url:  https://apiv2.spiky.ai

tags:
  - name: authorization
    description: Authorization operations
  - name: meeting-reports
    description: Meeting Report Endpoints
  - name: ml-data
    description: Machine learning model outputs
  - name: user
    description: Operations about user
paths:
  /public/token:
    post:
      tags:
        - authorization
      summary: Get an authorization token
      operationId: getToken
      requestBody: 
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CredentialInput'
      responses:
        '200':
          description: Credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CredentialOutput'



  /public/token/refresh:
    post:
      tags:
        - authorization
      summary: Refresh an authorization token
      operationId: refreshToken
      

  /platform/meeting-reports:
    post:
      tags:
        - meeting-reports
      summary: Create a new analysis
      operationId: createAnalysis
      parameters:
        - in: body
          name: analysis
          required: true
          schema: 
            $ref: '#/components/schemas/AnalysisInput'
      requestBody:
        description: Create a new analysis
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Analysis'
      responses: 
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Analysis'
          
    get:
      tags:
        - meeting-reports
      summary: Get an analysis
      operationId: getAnalysis
      responses: 
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Analysis'

  /platform/ml-data/{analysisId}:
    get:
      tags:
        - ml-data
      summary: Get data studies for an analysis
      responses:
        200:
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArrayOfMLData'
      


components:
  schemas:
    AnalysisInput:
      type: object
      properties:
        id:
          type: integer
          format: int64
          example: 10
        meetingName:
          type: string
        meetingDate:
          type: string
        integrationName:
          type: string

    Analysis:
      type: object
      properties:
        id:
          type: string
          format: uuid
        meetingName:
          type: string
        meetingDate:
          type: string
        ownerID:
          type: string
        analysisStatus:
          type: string
          enum:
            - UPLOAD_IN_PROGRESS
            - UPLOAD_ERROR
            - ANALYSIS_IN_PROGRESS
            - ANALYSIS_ERROR
            - ANALYSIS_READY
            - CANCELLED
        timelineUploadURL:
          type: string
          format: uri
        s3UploadURL:
          type: string
          format: uri
          
        isSample:
          type: boolean
        failureMessage:
          type: string

    MLData:
      type: object
      properties:
        id:
          type: string
          format: uuid
        mlDataID:
          type: string
          enum:
            - faceAttention
            - faceEmotion
            - generalSummary
            - languageAveragePatience
            - languageControlLevel
            - languageEmotion
            - languageFillerWords
            - languageHedgingWords
            - languageInteraction
            - languageLongestPatience
            - languageNextStep
            - languagePerceivedStatus
            - languagePositivity
            - languageQuestionRatio
            - languageQuestionStats
            - languageTalkRatio
            - languageTalkingInteraction
            - languageTalkingSpeed
            - meetingFeedback
            - meetingSpeakIntervals
            - meetingTranscript
            - moments
            - momentsPeopleOverview
            - participants
            - questionInsight
            - spikyScore
            - transcriptLanguage
            - voiceEmotion
            - voiceEnergy
        mlData:
          type: object

    ArrayOfMLData:
      type: array
      items:
        $ref: '#/components/schemas/MLData'

    CredentialInput:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
    CredentialOutput:
      type: object
      properties:
        result:
          type: object
          properties:
            AccessToken:
              type: string
            ExpiresIn:
              type: integer
            TokenType:
              type: string
            RefreshToken:
              type: string
            IDToken:
              type: string


    ApiResponse:
      type: object
      properties:
        code:
          type: integer
          format: int32
        type:
          type: string
        message:
          type: string
      xml:
        name: '##default'

    UserArray:
      description: List of user object
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/User'
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT

security:
  - bearer_auth: []  