openapi: 3.0.0
info:
  title: auraline conversation API
  description: Set of endpoints that support the auraline channel conversation token
  version: 1.0.0
tags:
  - name: auraline
    description: Manage creation and refresh conversation tokens for auraline.
servers:
  - url: 'http://localhost:8045'
    description: Local server
  - url: 'https://svc-ap-current.auracognitive.com'
    description: ap-current
paths:
  # Conversation Manager
  # Create Conversation
  /aura-services/v1/auraline/conversations:
    post:
      security:
        - ApiKeyHeaderAuth: [ ]
      parameters:
        - name: correlator
          in: header
          description: correlator to identify the request
          required: false
          schema:
            type: string
      tags:
        - auraline
      description: >-
        Receiving a message from client to get a conversation Id.
      operationId: createConversation
      x-router-controller: plugins
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationManagerResponse'
        '400':
          description: The URL, body, or headers in the request are malformed or invalid.
        '401':
          description: The operation includes an invalid or missing Authorization header.
        '500':
          description: There is an unexpected error while processing the request.
  # Refresh Conversation Token
  /aura-services/v1/auraline/conversations/{conversationId}/refresh:
    post:
      security:
        - ApiKeyHeaderAuth: [ ]
      parameters:
        - name: correlator
          in: header
          description: correlator to identify the request
          required: false
          schema:
            type: string
        - name: conversationId
          in: path
          description: Aura internal identifier for channel for the corresponding whatsapp number
          required: true
          schema:
            type: string
      tags:
        - auraline
      description: >-
        Refresh conversation token.
      operationId: refreshConversation
      x-router-controller: plugins
      responses:
        '200':
          description: Accepted
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConversationManagerResponse'
        '400':
          description: The URL, body, or headers in the request are malformed or invalid.
        '401':
          description: The operation includes an invalid or missing Authorization header.
        '500':
          description: There is an unexpected error while processing the request.
components:
  securitySchemes:
    ApiKeyHeaderAuth:
      type: apiKey
      in: header     # can be "header", "query" or "cookie"
      name: Authorization
  schemas:
    #-------------------------------
    # Auraline schemas
    #-------------------------------
    ConversationManagerResponse:
      type: object
      required:
        - conversationId
        - token
        - expires_in
      properties:
        conversationId:
          type: string
          description: Identifier of the conversation
        token:
          type: string
          description: Token to be used in the conversation
        expires_in:
          type: integer
          description: Time in seconds that the token is valid