openapi: 3.1.0
info:
  title: TMT API
  description: API working with Test folders in TMT
  version: 1.0.0
paths:
  /api/v2/rpc (GET_DOCUMENT):
    post:
      summary: Get task request
      description: Get content of a task request by given document reference
      parameters:
        - $ref: '#/components/parameters/ProjectIdHeader'
        - $ref: '#/components/parameters/SubProjectIdHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetDocumentRequest'
              examples:
                $ref: example/GET_TASK_REQUEST-request.json
      responses:
        '200':
          description: Content of the test request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskRequestDocumentResponse'
                examples:
                  $ref: example/GET_TASK_REQUEST-response.json
security:
  - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    TaskRequestDocumentResponse:
      allOf:
        - $ref: '#/components/schemas/RpcResult'
        - type: object
          properties:
            result:
              allOf:
                - $ref: '#/components/schemas/TaskRequestDocumentResult'
      examples:
        - jsonrpc: '2.0'
          id: get-task-request-98
          result:
            docRef: TaskRequest-dm/484103c3-b70a-42c4-b4d9-2b0e5369cdcb
            documentModelName: TaskRequest-dm
            document:
              Root:
                General:
                  Status: DONE
                  Visibility: SHOW
                  Type: CREATE_PROJECT_VERSION
                  TenantId: T_1
                  ProjectId: P_186
                  SubprojectId: _
                  ProjectVersionNumber: 1.0.1
                Metadata:
                  CreatedBy: trung
                  DisplayCreatedOn: '2024-11-08T08:51:37'
                  CreatedOn: 1731055897371
                  EditedBy: trung
                  DisplayEditedOn: '2024-11-08T08:51:49'
                  EditedOn: 1731055909193
                DisplayFields:
                  EstimatedTime: 7980
                Parameters:
                  - Key: versionDocument
                    Value: >-
                      {"Root":{"General":{"ProjectId":"P_186","SubprojectId":"_","VersionNumber":"1.0.1","DerivedVersionNumber":"1.0.0","DerivedVersionCreatedOn":1717473233273,"DerivedVersionTitle":"2_Export
                      QF","Status":"open","Title":"Version
                      1.0.1","KeyPoints":"this is the
                      keypoints","Description":"this is the
                      description","TenantId":"T_1"},"Attachments":[{"FileName":"Screenshot
                      2024-11-06 at
                      15.43.34.png","File":{"content":null,"attachment_id":"17779c20-8c31-4502-8d20-1de4b3028ee4","internal_filename":"1731055890896-d57cd3f6-a4b3-4a78-ae46-4a54381b48b9.png","original_filename":"Screenshot
                      2024-11-06 at
                      15.43.34.png","size":183806,"mime_type":"image/png"},"CreatedAt":"2024-11-08T08:51:32","UploadOn":"2024-11-08","OriginalFileName":"Screenshot
                      2024-11-06 at
                      15.43.34.png","UploadBy":"trung","Referenced":false,"CopyNumber":0,"ThumbnailId":"7b81f0ae-b402-49f7-982f-58ba868a70b3"}]}}
              __meta:
                creator: trung
                modifier: SYSTEM
                createdAt: '2024-11-08T08:51:37'
                modifiedAt: '2024-11-08T08:51:49'
                modelReference: TaskRequest-dm
                docRef: TaskRequest-dm/484103c3-b70a-42c4-b4d9-2b0e5369cdcb
                modelVersion: null
    TaskRequestDocumentResult:
      allOf:
        - $ref: '#/components/schemas/DocumentResult'
        - type: object
        - properties:
            document:
              description: Task request document
              $ref: '#/components/schemas/TaskRequestDocument'
    TaskRequestDocument:
      type: object
      properties:
        Root:
          $ref: '#/components/schemas/Root'
        meta:
          $ref: '#/components/schemas/Meta'
    Root:
      type: object
      properties:
        General:
          type: object
          description: General information about the project version.
          properties:
            Status:
              type: string
              description: The status of the operation associated with this task request
              enum:
                - NEW
                - RUNNING
                - DONE
                - ERROR
            Visibility:
              type: string
              description: Visibility status
              enum:
                - SHOW
                - HIDE
            Type:
              type: string
              description: The type of action being performed
              enum:
                - GENERATE_REPORT
                - CREATE_PROJECT_VERSION
                - COPY_TEST_RUN
                - CLOSE_TEST_RUN
                - GENERATE_CSV_REPORT
                - SET_TEST_CASE_PROPERTY
                - DELETE_TEST_SUITE
                - SET_TEST_SUITE_PROPERTY
                - SET_TEST_EXECUTION_PROPERTY
                - UPDATE_PIN_STATUS
                - COPY_TEST_FOLDER
                - MOVE_TEST_FOLDER
                - DELETE_PROJECT_VERSION
                - DELETE_PINNED_DOCUMENTS
                - RESET_TEST_SUITES_ORDER
                - HANDLE_AFTER_DELETING_USER
                - COPY_ITEMS_IN_TEST_SUITE
                - MOVE_ITEMS_IN_TEST_SUITE
                - EXPORT_QF_DATA_STRUCTURE
                - EXPORT_QF_DATA_DETAIL
                - CREATE_RUN_BY_RISK_LEVEL
                - REBUILD_RISK_LEVEL_DOCUMENTS
                - ADD_TEST_CASES_TO_RUN_ASYNC
                - SAVE_TEST_EXECUTIONS_ASYNC
                - DELETE_PROJECT
                - COPY_TEST_SUITE
            TenantId:
              type: string
              description: Identifier for the tenant.
            ProjectId:
              type: string
              description: Identifier for the project.
            SubprojectId:
              type: string
              description: Identifier for the subproject.
            ProjectVersionNumber:
              type: string
              description: The version number of the project.
        DisplayFields:
          type: object
          description: Additional fields for display purposes.
          properties:
            EstimatedTime:
              type: integer
              description: Estimated time in seconds.
        Metadata:
          $ref: '#/components/schemas/Metadata'
        Parameters:
          type: array
          description: A list of parameters associated with the request.
          items:
            type: object
            properties:
              Key:
                type: string
                description: The key of the parameter.
              Value:
                type: string
                description: The value of the parameter in a form of an JSON string.
    RpcRequestWithIdAndJsonRpc:
      type: object
      required:
        - id
        - jsonrpc
      properties:
        id:
          type: string
          description: id of the operation
        jsonrpc:
          type: string
          description: must be 2.0
          example: '2.0'
    GetDocumentRequest:
      allOf:
        - $ref: '#/components/schemas/RpcRequestWithIdAndJsonRpc'
        - type: object
          required:
            - method
            - params
          properties:
            method:
              type: string
              description: GET_DOCUMENT
            params:
              required:
                - docRef
              properties:
                docRef:
                  type: string
                  description: document reference
      examples:
        - id: get-task-request-98
          jsonrpc: '2.0'
          method: GET_DOCUMENT
          params:
            docRef: TaskRequest-dm/484103c3-b70a-42c4-b4d9-2b0e5369cdcb
    RpcResult:
      type: object
      properties:
        jsonrpc:
          type: string
          description: request jsonrpc version
        id:
          type: string
          description: id of the operation
        result:
          type: object
    DocumentResult:
      type: object
      properties:
        docRef:
          type: string
          description: document reference
        documentModelName:
          type: string
          description: model name
        document:
          type: object
    Metadata:
      type: object
      readOnly: true
      description: >-
        \[**Read only**] Metadata of the document. It will be ignored if
        included in the request of the add/update operations (e.g ADD_DOCUMENT,
        MODIFY_DOCUMENT)
      properties:
        CreatedBy:
          type: string
          description: who created this project
        DisplayCreatedOn:
          type: string
          format: date-time
          description: creation time in the human readable format (UTC time zone)
        CreatedOn:
          type: integer
          description: creation time of the project
        EditedBy:
          description: the last person who edited this project document
          type: string
        DisplayEditedOn:
          type: string
          format: date-time
          description: edited time in the human readable format (UTC time zone)
        EditedOn:
          description: the last edited time of the project
          type: integer
    Meta:
      type: object
      readOnly: true
      description: >-
        \[**Read only**] Contain the meta data information of the document. **It
        will be ignored if included in the request of the update operations**
        (e.g MODIFY_DOCUMENT)
      properties:
        creator:
          type: string
          readOnly: true
          description: The user who created the document
        modifier:
          type: string
          readOnly: true
          description: The user who last modified the document
        docRef:
          type: string
          description: Reference to the document
        modelReference:
          type: string
          description: Reference to the model associated with the document
        createdAt:
          type: string
          format: date-time
          description: Timestamp when the document was created
        modifiedAt:
          type: string
          format: date-time
          description: Timestamp when the document was last modified
        modelVersion:
          type: string
          nullable: true
          description: Version of the model associated with the document
  parameters:
    ProjectIdHeader:
      name: Project-Id
      in: header
      required: true
      schema:
        type: string
      description: Project Id or the project document reference
    SubProjectIdHeader:
      name: Subproject-Id
      in: header
      required: false
      schema:
        type: string
      description: >-
        Sub Project Id or the project document reference. It might be required
        if you want to access the sub project's resource
