openapi: "3.0.1"
info:
  title: "Rasa Platform - Intents"
  version: "1.0.0"
  description: >-
    Rasa Platform messaging endpoints
servers:
- url: http://demo-bot.rasa.com/core
  description: Demo
paths:
  /projects/{project_id}/intents:
    get:
      tags:
        - Intents
      summary: Fetch list of intents
      operationId: getIntents
      parameters:
        - $ref: './common.yml#/components/parameters/projectId'
      responses:
        200:
          description: List of intents
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Intent'
    post:
      tags:
        - Intents
      summary: Create temporary intent
      operationId: createIntent
      parameters:
        - $ref: './common.yml#/components/parameters/projectId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                intent:
                  type: text
                  description: Name of the correct intent
                mapped_to:
                  type: text
                  description: Existing intent the temporary intent is mapped to
                user_goal:
                  type: text
                  description: User goal to which the intent is mapped
              required: ["intent"]
      responses:
        201:
          description: Successfully created temporary intent
        400:
          description: An error occurred while creating the temporary intent
  /projects/{project_id}/intents/{intent_id}:
    delete:
      tags:
        - Intents
      summary: Deletes a temporary intent
      operationId: deleteIntent
      parameters:
        - $ref: './common.yml#/components/parameters/projectId'
        - $ref: '#/components/parameters/intentId'
      responses:
        200:
          description: Successfully deleted intent
    put:
      tags:
        - Intents
      summary: Updates an intent
      operationId: updateIntent
      parameters:
        - $ref: './common.yml#/components/parameters/projectId'
        - $ref: '#/components/parameters/intentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntentObject'
      responses:
        200:
          description: Succesfully updated temporary intent
        400:
          description: An error occurred while creating the temporary intent
  /projects/{project_id}/userGoals:
    post:
      tags:
        - User Goal
      summary: Creates a user goal
      operationId: create_user_goal
      parameters:
        - $ref: './common.yml#/components/parameters/projectId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Intent'
      responses:
        201:
          description: Successfully created user goal
        400:
          description: Invalid request body
  /projects/{project_id}/userGoals/{user_goal}:
    delete:
      tags:
        - User Goal
      summary: Delete a user goal
      operationId: delete_user_goal
      parameters:
        - $ref: './common.yml#/components/parameters/projectId'
        - $ref: '#/components/parameters/userGoal'
      responses:
        200:
          description: Successfully deleted user goal
components:
  parameters:
    intentId:
      in: path
      name: intent_id
      schema:
        type: text
      required: true
    userGoal:
      in: path
      name: user_goal
      schema:
        type: text
      required: true
  schemas:
    Intent:
      type: object
      properties:
        intent:
          type: text
        mapped_to:
          type: text
        user_goal:
          type: text
        training_data:
          type: array
          items:
            type: text
        suggestions:
          type: array
          items:
            type: text
    IntentObject:
      type: object
      properties:
        intent:
          type: text
          description: Name of the correct intent
        mapped_to:
          type: text
          description: Existing intent the temporary intent is mapped to
        user_goal:
          type: text
          description: Maps the intent to a user goal
      required: ["intent"]
    UserGoal:
      type: object
      properties:
        name:
          type: text
          description: Name of the user goal
      required: ["name"]