openapi: 3.0.1
info:
  title: Processes Rest Api
  description: Processes addon rest endpoints
  license:
    name: AGPL
    url: https://www.gnu.org/licenses/agpl-3.0.en.html
  version: "1.0"
tags:
- name: /v1/processes
  description: Manages processes
paths:
  /v1/processes/attachment/newDoc:
    post:
      tags:
      - /v1/processes
      summary: create new form document
      description: create new form document
      operationId: createNewFormDocument
      requestBody:
        content:
          '*/*':
            schema:
              required:
              - path
              - pathDrive
              - templateName
              - title
              type: object
              properties:
                title:
                  type: string
                  description: title
                  default: "20"
                path:
                  type: string
                  description: path of new document
                pathDrive:
                  type: string
                  description: New destination path's drive
                templateName:
                  type: string
                  description: template name of new document
                  default: "20"
                entityType:
                  type: string
                  description: entity type
                entityId:
                  type: integer
                  description: entity id
                  format: int64
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "404":
          description: Not found
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/countWorks/{projectId}:
    get:
      tags:
      - /v1/processes
      summary: Count tasks by completed and uncompleted status
      description: Count tasks by completed and uncompleted status
      operationId: countWorksByWorkflow
      parameters:
      - name: projectId
        in: path
        description: Tasks project id
        required: true
        schema:
          type: integer
          format: int64
      - name: isCompleted
        in: query
        description: Processes properties to expand.
        schema:
          type: boolean
          default: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "404":
          description: Object not found
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/illustration/{workflowId}:
    get:
      tags:
      - /v1/processes
      summary: Gets a workflow illustration image by its id
      description: Gets a workflow illustration image by its id
      operationId: getImageIllustration
      parameters:
      - name: workflowId
        in: path
        description: workflow id
        required: true
        schema:
          type: integer
          format: int64
      - name: v
        in: query
        description: Optional last modified parameter
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: Request fulfilled
        "500":
          description: Internal server error
        "400":
          description: Invalid query input
        "404":
          description: Resource not found
  /v1/processes/permissions:
    get:
      tags:
      - /v1/processes
      summary: checks is current user is a processes manager
      description: checks is current user is a processes manager
      operationId: isProcessesManager
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/work/{workId}:
    delete:
      tags:
      - /v1/processes
      summary: delete a work by its id
      description: delete a work by its id
      operationId: deleteWork
      parameters:
      - name: workId
        in: path
        description: work id to delete
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
    patch:
      tags:
      - /v1/processes
      summary: cancel or resume a work by its id
      description: cancel or resume a work by its id
      operationId: updateWorkCompleted
      parameters:
      - name: workId
        in: path
        description: work id to be updated
        required: true
        schema:
          type: integer
          format: int64
      requestBody:
        description: completed object property
        content:
          '*/*':
            schema:
              type: object
              additionalProperties:
                type: boolean
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/workDraft:
    put:
      tags:
      - /v1/processes
      summary: Updates a new workDraft
      description: Updates a new workDraft
      operationId: updateWorkDraft
      requestBody:
        description: Work object to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkEntity'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
    post:
      tags:
      - /v1/processes
      summary: Creates a new WorkDraft
      description: Creates a new WorkDraft
      operationId: createWorkDraft
      requestBody:
        description: WorkDaft object to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkEntity'
        required: true
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/workDraft/{draftId}:
    delete:
      tags:
      - /v1/processes
      summary: delete a work draft by its id
      description: delete a work draft by its id
      operationId: deleteWorkDraft
      parameters:
      - name: draftId
        in: path
        description: Work draft id to delete
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "404":
          description: Object not found
        "500":
          description: Internal server error
  /v1/processes/workDrafts:
    get:
      tags:
      - /v1/processes
      summary: Retrieves the list of workDrafts
      description: Retrieves the list of workDrafts for an authenticated user
      operationId: getWorkDrafts
      parameters:
      - name: userId
        in: query
        description: Identity technical identifier
        schema:
          type: integer
          format: int64
      - name: expand
        in: query
        description: Processes properties to expand.
        schema:
          type: string
      - name: query
        in: query
        description: Work query.
        schema:
          type: string
      - name: offset
        in: query
        description: Offset of results to return
        schema:
          type: integer
          format: int32
          default: 0
      - name: limit
        in: query
        description: Limit of results to return
        schema:
          type: integer
          format: int32
          default: 10
      responses:
        "200":
          description: Request fulfilled
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/workflow/{workflowId}:
    delete:
      tags:
      - /v1/processes
      summary: delete a workflow by its id
      description: delete a workflow by its id
      operationId: deleteWorkflow
      parameters:
      - name: workflowId
        in: path
        description: Workflow id to delete
        required: true
        schema:
          type: integer
          format: int64
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "404":
          description: Object not found
        "500":
          description: Internal server error
  /v1/processes/workflows:
    get:
      tags:
      - /v1/processes
      summary: Retrieves the list of workFlows
      description: Retrieves the list of workFlows for an authenticated user
      operationId: getWorkFlows
      parameters:
      - name: Identity technical identifier
        in: query
        schema:
          type: integer
          format: int64
      - name: enabled
        in: query
        description: filter workflow by status
        schema:
          type: boolean
      - name: manager
        in: query
        description: filter workflow that i manage
        schema:
          type: boolean
      - name: query
        in: query
        description: Search query entered by the user
        schema:
          type: string
      - name: expand
        in: query
        description: Processes properties to expand.
        schema:
          type: string
      - name: offset
        in: query
        description: Offset of results to return
        schema:
          type: integer
          format: int32
          default: 0
      - name: limit
        in: query
        description: Limit of results to return
        schema:
          type: integer
          format: int32
          default: 10
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "404":
          description: Not found
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
    put:
      tags:
      - /v1/processes
      summary: Updates a workFlow
      description: Updates a workFlow
      operationId: updateWorkFlow
      requestBody:
        description: WorkFlow object to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkFlowEntity'
        required: true
      responses:
        "204":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "404":
          description: Object to update not found
        "500":
          description: Internal server error
    post:
      tags:
      - /v1/processes
      summary: Creates a new WorkFlow
      description: Creates a new WorkFlow
      operationId: createWorkFlow
      requestBody:
        description: WorkFlow object to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkFlowEntity'
        required: true
      responses:
        "204":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/workflows/{workflowId}:
    get:
      tags:
      - /v1/processes
      summary: Retrieves a workflow by its given id
      description: Retrieves a workflow by its given id
      operationId: getWorkFlowById
      parameters:
      - name: workflowId
        in: path
        description: workflow id
        required: true
        schema:
          type: integer
          format: int64
      - name: expand
        in: query
        description: Processes properties to expand
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "404":
          description: Not found
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/works:
    get:
      tags:
      - /v1/processes
      summary: Retrieves the list of works
      description: Retrieves the list of works for an authenticated user
      operationId: getWorks
      parameters:
      - name: userId
        in: query
        description: Identity technical identifier
        schema:
          type: integer
          format: int64
      - name: expand
        in: query
        description: Processes properties to expand.
        schema:
          type: string
      - name: completed
        in: query
        description: work completed property
        schema:
          type: boolean
      - name: status
        in: query
        description: Works status
        schema:
          type: string
      - name: query
        in: query
        description: Works query
        schema:
          type: string
      - name: offset
        in: query
        description: Offset of results to return
        schema:
          type: integer
          format: int32
          default: 0
      - name: limit
        in: query
        description: Limit of results to return
        schema:
          type: integer
          format: int32
          default: 10
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
    put:
      tags:
      - /v1/processes
      summary: Updates a new work
      description: Updates a new work
      operationId: updateWork
      requestBody:
        description: Work object to update
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkEntity'
        required: true
      responses:
        "204":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
    post:
      tags:
      - /v1/processes
      summary: Creates a Work
      description: Creates a Work
      operationId: createWork
      requestBody:
        description: Work object to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WorkEntity'
        required: true
      responses:
        "204":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/works/statuses:
    get:
      tags:
      - /v1/processes
      summary: Retrieves the list of workDrafts
      description: Retrieves the list of workDrafts for an authenticated user
      operationId: getAvailableWorkStatuses
      responses:
        "200":
          description: Request fulfilled
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
  /v1/processes/works/{workId}:
    get:
      tags:
      - /v1/processes
      summary: Retrieves a work by its given id
      description: Retrieves a work by its given id
      operationId: getWorkById
      parameters:
      - name: workId
        in: path
        description: Work id.
        required: true
        schema:
          type: integer
          format: int64
      - name: expand
        in: query
        description: Processes properties to expand.
        schema:
          type: string
      responses:
        "200":
          description: Request fulfilled
        "400":
          description: Invalid query input
        "404":
          description: Object not found
        "401":
          description: Unauthorized operation
        "500":
          description: Internal server error
components:
  schemas:
    Attachment:
      type: object
      properties:
        acl:
          $ref: '#/components/schemas/Permission'
        cloudDrive:
          type: boolean
        created:
          type: string
        creatorId:
          type: integer
          format: int64
        downloadUrl:
          type: string
        exoDrive:
          type: boolean
        id:
          type: string
        isPublic:
          type: boolean
        mimetype:
          type: string
        openUrl:
          type: string
        path:
          type: string
        previewBreadcrumb:
          type: object
          additionalProperties:
            type: string
        size:
          type: integer
          format: int64
        title:
          type: string
        updated:
          type: string
        updater:
          type: string
        version:
          type: string
    AvatarAttachment:
      type: object
      properties:
        attachmentType:
          type: string
        fileName:
          type: string
        id:
          type: string
        imageBytes:
          type: array
          items:
            type: string
            format: byte
        inputStream:
          type: object
          writeOnly: true
        lastModified:
          type: integer
          format: int64
        mimeType:
          type: string
        size:
          type: string
    BannerAttachment:
      type: object
      properties:
        attachmentType:
          type: string
        fileName:
          type: string
        id:
          type: string
        imageBytes:
          type: array
          items:
            type: string
            format: byte
        inputStream:
          type: object
          writeOnly: true
        lastModified:
          type: integer
          format: int64
        mimeType:
          type: string
        size:
          type: string
    ChangeLog:
      type: object
      properties:
        actionName:
          type: string
        author:
          type: string
        createdTime:
          type: string
          format: date-time
        id:
          type: integer
          format: int64
        target:
          type: string
        task:
          $ref: '#/components/schemas/Task'
    Comment:
      type: object
      properties:
        author:
          type: string
        comment:
          type: string
        createdTime:
          type: string
          format: date-time
        id:
          type: integer
          format: int64
        mentionedUsers:
          uniqueItems: true
          type: array
          items:
            type: string
        parentComment:
          $ref: '#/components/schemas/Comment'
        subComments:
          type: array
          items:
            $ref: '#/components/schemas/Comment'
        task:
          $ref: '#/components/schemas/Task'
    CreatorIdentityEntity:
      type: object
      properties:
        identity:
          $ref: '#/components/schemas/IdentityEntity'
    IdentityEntity:
      type: object
      properties:
        id:
          type: string
        profile:
          $ref: '#/components/schemas/ProfileEntity'
        providerId:
          type: string
        remoteId:
          type: string
    IllustrativeAttachment:
      type: object
      properties:
        fileBody:
          type: string
        fileInputStream:
          type: object
        fileName:
          type: string
        fileSize:
          type: integer
          format: int64
        id:
          type: integer
          format: int64
        lastUpdated:
          type: integer
          format: int64
        mimeType:
          type: string
        toDelete:
          type: boolean
    Label:
      type: object
      properties:
        children:
          type: array
          items:
            $ref: '#/components/schemas/Label'
        color:
          type: string
        hidden:
          type: boolean
        id:
          type: integer
          format: int64
        name:
          type: string
        parent:
          $ref: '#/components/schemas/Label'
        project:
          $ref: '#/components/schemas/Project'
        tasks:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/LabelTaskMapping'
        username:
          type: string
    LabelTaskMapping:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/Label'
        task:
          $ref: '#/components/schemas/Task'
    Permission:
      type: object
      properties:
        canAccess:
          type: boolean
        canDetach:
          type: boolean
        canEdit:
          type: boolean
        canView:
          type: boolean
    ProcessPermission:
      type: object
      properties:
        canAccess:
          type: boolean
        canAddRequest:
          type: boolean
        canDelete:
          type: boolean
        canEdit:
          type: boolean
    ProfileEntity:
      type: object
      properties:
        avatar:
          type: string
        fullname:
          type: string
    Project:
      type: object
      properties:
        children:
          type: array
          items:
            $ref: '#/components/schemas/Project'
        color:
          type: string
        description:
          type: string
        dueDate:
          type: string
          format: date-time
        hiddenOn:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/UserSetting'
        id:
          type: integer
          format: int64
        labels:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/Label'
        lastModifiedDate:
          type: integer
          format: int64
        manager:
          uniqueItems: true
          type: array
          items:
            type: string
        name:
          type: string
        parent:
          $ref: '#/components/schemas/Project'
        participator:
          uniqueItems: true
          type: array
          items:
            type: string
        status:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/Status'
    ProjectDto:
      type: object
      properties:
        children:
          type: array
          items:
            $ref: '#/components/schemas/ProjectDto'
        color:
          type: string
        description:
          type: string
        dueDate:
          type: string
          format: date-time
        hiddenOn:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/UserSetting'
        id:
          type: integer
          format: int64
        lastModifiedDate:
          type: integer
          format: int64
        manager:
          uniqueItems: true
          type: array
          items:
            type: string
        name:
          type: string
        parent:
          $ref: '#/components/schemas/ProjectDto'
        participator:
          uniqueItems: true
          type: array
          items:
            type: string
        spaceName:
          type: string
        status:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/StatusDto'
    Space:
      type: object
      properties:
        avatarAttachment:
          $ref: '#/components/schemas/AvatarAttachment'
        avatarLastUpdated:
          type: integer
          format: int64
        avatarUrl:
          type: string
        bannerAttachment:
          $ref: '#/components/schemas/BannerAttachment'
        bannerLastUpdated:
          type: integer
          format: int64
        bannerUrl:
          type: string
        cacheTime:
          type: integer
          format: int64
        categoryIds:
          type: array
          items:
            type: integer
            format: int64
        createdTime:
          type: integer
          format: int64
        deletePermissions:
          type: array
          items:
            type: string
        description:
          type: string
        displayName:
          type: string
        editor:
          type: string
        field:
          type: string
          enum:
          - DESCRIPTION
        groupId:
          type: string
        hasBindings:
          type: boolean
          writeOnly: true
        id:
          type: string
        invitedUsers:
          type: array
          items:
            type: string
        lastUpdatedTime:
          type: integer
          format: int64
        layoutPermissions:
          type: array
          items:
            type: string
        managers:
          type: array
          items:
            type: string
        members:
          type: array
          items:
            type: string
        parentSpaceId:
          type: integer
          format: int64
        pendingUsers:
          type: array
          items:
            type: string
        prettyName:
          type: string
        publicSiteId:
          type: integer
          format: int64
        publicSitePermissions:
          type: array
          items:
            type: string
        publicSiteVisibility:
          type: string
        publishers:
          type: array
          items:
            type: string
        redactors:
          type: array
          items:
            type: string
        registration:
          type: string
        shortName:
          type: string
        sovereign:
          type: boolean
        spaceId:
          type: integer
          format: int64
        templateId:
          type: integer
          format: int64
        url:
          type: string
        visibility:
          type: string
    Status:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        project:
          $ref: '#/components/schemas/Project'
        rank:
          type: integer
          format: int32
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/Task'
    StatusDto:
      type: object
      properties:
        id:
          type: integer
          format: int64
        name:
          type: string
        project:
          $ref: '#/components/schemas/ProjectDto'
        rank:
          type: integer
          format: int32
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/Task'
    Task:
      type: object
      properties:
        activityId:
          type: string
        assignee:
          type: string
        comments:
          type: array
          items:
            $ref: '#/components/schemas/Comment'
        completed:
          type: boolean
        context:
          type: string
        coworker:
          uniqueItems: true
          type: array
          items:
            type: string
        createdBy:
          type: string
        createdTime:
          type: string
          format: date-time
        description:
          type: string
        dueDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        id:
          type: integer
          format: int64
        labels:
          type: array
          items:
            $ref: '#/components/schemas/LabelTaskMapping'
        logs:
          type: array
          items:
            $ref: '#/components/schemas/ChangeLog'
        priority:
          type: string
          enum:
          - NONE
          - LOW
          - NORMAL
          - HIGH
        rank:
          type: integer
          format: int32
        startDate:
          type: string
          format: date-time
        status:
          $ref: '#/components/schemas/Status'
        title:
          type: string
        watcher:
          uniqueItems: true
          type: array
          items:
            type: string
    UserSetting:
      type: object
      properties:
        hiddenProjects:
          uniqueItems: true
          type: array
          items:
            $ref: '#/components/schemas/Project'
        showHiddenLabel:
          type: boolean
        showHiddenProject:
          type: boolean
        username:
          type: string
    WorkEntity:
      type: object
      properties:
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        completed:
          type: boolean
        createdBy:
          type: string
        createdTime:
          type: string
          format: date-time
        creatorId:
          type: integer
          format: int64
        description:
          type: string
        draftId:
          type: integer
          format: int64
        dueDate:
          type: string
          format: date-time
        endDate:
          type: string
          format: date-time
        id:
          type: integer
          format: int64
        isDraft:
          type: boolean
        modifiedTime:
          type: string
          format: date-time
        projectId:
          type: integer
          format: int64
        startDate:
          type: string
          format: date-time
        status:
          type: string
        taskId:
          type: integer
          format: int64
        title:
          type: string
        workFlow:
          $ref: '#/components/schemas/WorkFlowEntity'
    WorkFlowEntity:
      type: object
      properties:
        acl:
          $ref: '#/components/schemas/ProcessPermission'
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/Attachment'
        canShowPending:
          type: boolean
        createdDate:
          type: string
          format: date-time
        creatorId:
          type: integer
          format: int64
        description:
          type: string
        enabled:
          type: boolean
        helpLink:
          type: string
        id:
          type: integer
          format: int64
        illustrativeAttachment:
          $ref: '#/components/schemas/IllustrativeAttachment'
        image:
          type: string
        modifiedDate:
          type: string
          format: date-time
        modifierId:
          type: integer
          format: int64
        parentSpace:
          $ref: '#/components/schemas/Space'
        projectId:
          type: integer
          format: int64
        requestsCreators:
          type: array
          items:
            $ref: '#/components/schemas/CreatorIdentityEntity'
        statuses:
          type: array
          items:
            $ref: '#/components/schemas/StatusDto'
        summary:
          type: string
        title:
          type: string
