openapi: 3.0.1
info:
  title: To-do Service
  description: |
    This page describes how to integrate with the **To-do Service** on a technical level.
    If you need a conceptual overview first, see the [**Foundation API Guide
    **](../../../docs/api-guides/platform/foundation).

    -----

    ## REST Resources

    The To‑do Service lets you:

    - Manage and retrieve **to-do items** within a space.
    - Validate and normalize **to-do types** that contributors register by themselves.
    - Summarize to-do items by type for display purposes.

    ### To-do

    To-do items are lightweight, actionable tasks stored by the BTX platform. They are typically managed by contributors,
    but any authorized client can view them.
    Each item:

    - belongs to a **space** (`spaceId`)
    - has a **type** (e.g. `paymentDue`, `reviewPurchaseDocument`)
    - may carry **type-specific data** (e.g. `documentId`)

    **Example to-do item**:

    ```json
    {
      "todoItemId": "bf514229-fa39-4bca-b8d9-b96607e9954a",
      "spaceId": "1b34de13-4063-41e6-8b68-237f0c391550",
      "type": "reviewPurchaseDocument",
      "data": {
        "spaceId": "1b34de13-4063-41e6-8b68-237f0c391550",
        "todoItemId": "bf514229-fa39-4bca-b8d9-b96607e9954a"
      },
      "reference": "bf514229-fa39-4bca-b8d9-b96607e9961e",
      "requiredPermission": {
        "resourceId": "1b34de13-4063-41e6-8b68-237f0c391550",
        "scope": "space_read"
      }
    }
    ```

    ### Todo Type

    A **Todo Type** defines how a category of to-dos should be interpreted and displayed:
                 - unique identifier (`type`)
                 - localized labels (referenced from the Asset Service via `labels` URI)
                 - a client action (`action`) to perform (typically a redirect)
                 - display options like `priority`, `displayCount`, and optional fields

                 Types are registered via the Plugin Service and validated by the To-do Service.

                 #### Required fields
                 - `type` (string) — unique identifier of the type, must not be blank
                 - `labels` (string) — URL of an i18n asset JSON, e.g. `static/ux/todo/todopurchasereview/reviewPurchaseDocument`
                 - `action` (string) — URL of the todo action endpoint(internal url to avoid apigee limit no more then 200 records in the body)
                 , e.g. `http://btx-ux-todo-review-contributor.ns-gcpbe-btxux-dev.svc.cluster.local:8080/ux/todoreview/v1/todoActions`
                 - `displayCount` (boolean) — whether to show the numeric count
                 - `priority` (integer) — higher = more important

                 #### Optional fields
                 - `classification` (string) — categorization such as `daily`, `weekly`, …
                 - `dynamicLabels` (boolean) — whether labels should be resolved dynamically etc.

                 #### Example Todo Type definition (Plugin Provision Hook payload)

                 ```json
                 {
                   "pluginInterface": {
                     "namespace": "com.unifiedpost.btx.todo",
                     "name": "todoTypes",
                     "version": "1.0"
                   },
                   "data": {
                     "type": "reviewPurchaseDocument",
                     "labels": "static/ux/todo/todopurchasereview/reviewPurchaseDocument",
                     "action": "http://btx-ux-todo-review-contributor.ns-gcpbe-btxux-dev.svc.cluster.local:8080/ux/todoreview/v1/todoActions",
                     "displayCount": true,
                     "priority": 50,
                     "classification": "daily",
                     "dynamicLabels": true
                   }
                 }
                 ```

                 #### Example resolved labels (from Asset Service)

                 ```json
                 {
                   "description_one": "Purchase invoice review",
                   "description_other": "Purchase invoices review",
                   "mobile": {
                     "description": "Review purchase"
                   }
                 }
                 ```
                 #### Example resolved action(todo action endpoint response, endpoint is implemented by contributor)

                 ```json
                  {
                    "actionType": "REDIRECT",
                    "uri": "https://app.dev.btx.banqup.com/purchase-invoices?tab=REVIEW&pageIndex=1&pageSize=50"
                  }
                 ```

    ## Working with to-do

    ### Retrieving to-do items

    List all to‑do items in a space:
    **GET** `/core/todo/v1/spaces/{spaceId}/todoItems`
    (see: ../../../docs/foundation/todo/list-todo-items)

    Optional query parameters:

    - `type` — filter by the type value stored on the item. (`paymentDue`, `reviewPurchaseDocument`, …)
    - `reference` — filter by the reference value stored on the item.

    Both parameters can be combined.

    ```http
    GET /v1/spaces/1b34de13-4063-41e6-8b68-237f0c391550/todoItems?type=paymentDue&reference=bf514229-fa39-4bca-b8d9-b96607e9961e
    Accept: application/json, application/x-ndjson
    ```

    Retrieve a single to‑do by its `todoItemId`:

    ```http
    GET /v1/spaces/1b34de13-4063-41e6-8b68-237f0c391550/todoItems/bf514229-fa39-4bca-b8d9-b96607e9954a
    Accept: application/json
    ```

    Summarize to-do items by type:

    **GET** `/core/todo/v1/spaces/{spaceId}/todoItems:summarize`

    This endpoint aggregates to-do items by type, providing a count for each, along with a localized label and a client
    action.

    Optional localization parameters can be provided for the summary's label:

    - `l` (query parameter) — the primary locale (e.g. `en-GB`).
    - `Accept-Language` (header) — a list of fallback locales (e.g. `en-GB,en`).

    ```http
    GET /v1/spaces/1b34de13-4063-41e6-8b68-237f0c391550/todoItems:summarize?l=en
    Accept: application/x-ndjson
    Accept-Language: en,fr
    ```

    Example line from the NDJSON response stream:

    ```json
    {
      "type": "reviewPurchaseDocument",
      "count": 1,
      "displayCount": true,
               "priority": 50,
      "labels": {
        "description_one": "Purchase invoice review",
        "description_other": "Purchase invoices review",
        "mobile": {
          "description": "Review purchase"
        }
      },
      "action": {
        "actionType": "REDIRECT",
        "uri": "https://app.dev.btx.banqup.com/purchase-invoices?tab=REVIEW&pageIndex=1&pageSize=50"
      }
    }
    ```

    ### Creating to-do items

    Create a to‑do item with **POST**
    `/core/todo/v1/spaces/{spaceId}/todoItems`
    (see: ../../../docs/foundation/todo/create-todo-item)

    ```http
    POST /v1/spaces/1b34de13-4063-41e6-8b68-237f0c391550/todoItems
    Content-Type: application/json
    ```

    ```json
    {
      "type": "reviewPurchaseDocument",
      "data": {
        "spaceId": "1b34de13-4063-41e6-8b68-237f0c391550",
        "todoItemId": "bf514229-fa39-4bca-b8d9-b96607e9954a"
      },
      "reference": "bf514229-fa39-4bca-b8d9-b96607e9961e"
    }
    ```

    A successful creation returns **HTTP 201** and the created item.

    ### Updating to-do items

    Update an existing to‑do item with **PUT**
    `/core/todo/v1/spaces/{spaceId}/todoItems/{todoItemId}`
    (see: ../../../docs/foundation/todo/update-todo-item)

    ```http
    PUT /v1/spaces/1b34de13-4063-41e6-8b68-237f0c391550/todoItems/bf514229-fa39-4bca-b8d9-b96607e9954a
    Content-Type: application/json
    ```

    ```json
    {
      "data": {
        "spaceId": "1b34de13-4063-41e6-8b68-237f0c391550",
        "todoItemId": "bf514229-fa39-4bca-b8d9-b96607e9954a"
      },
      "reference": "bf514229-fa39-4bca-b8d9-b96607e9961e"
    }
    ```

    A successful update returns **HTTP 200** and the updated item.

    ### Deleting to-do items

    Delete a to‑do item with **DELETE** on the same path.
    A successful deletion returns **HTTP 204 No Content**.

    -----

    ## Security

    To interact with the To‑do Service you must hold the right UMA permissions and OAuth scopes.

    ### 1. Create / Update / Delete to-do items

    **You need both of these:**

    - **Todo type management permission** on the specific type
      `(subject, <todoType>, todo_type_manage)` — granted in UMA bootstrap.
      *Example:* `(subject, reviewPurchaseDocument, todo_type_manage)`

    - **Write permission on the space**
      `(subject, <spaceId>, space_foundation_todo_write)` — granted via the Access Management permissions manifest when your
      service is registered in the Service Store.
      *Example manifest snippet:*

    ```json
    {
      "resource": "space",
      "scope": "space_foundation_todo_write"
    }
    ```

    ### 2. Get / List / Summarize to-do items

    **Every to‑do item carries its own permission**

    ```json
    "requiredPermission": {
    "resourceId": "1b34de13-4063-41e6-8b68-237f0c391550",
    "scope": "space_read"
    }
    ```

    Your token must always grant space-level read permission: (subject, <spaceId>, space_read) in the default UMA audience (
    uma-authz).
    If the to-do item also specifies a requiredPermission, your token must additionally grant: (
    subject, <resourceId>, <scope>) in the default UMA audience (uma-authz).
    If either resourceId or scope is missing at requiredPermission of to-do item, the item is treated as public within the
    space and only the space-level check applies.

    For the list and summarize endpoints, only items for which the caller has the required permission will be returned or
    included in the count.

    **Typical read permission on a space**
    `(subject, <resourceId>, space_read)` — granted via the Access Management permissions manifest when your service is
    registered in the Service Store.
    *Example manifest snippet:*

    ```json
    {
      "resource": "space",
      "scope": "space_read"
    }
    ```

    ### 3. Register / Update a Todo Type

    Again, **todo_type_manage** is required on that type:
    `(subject, <todoType>, todo_type_manage)` — checked by the Todo Type Authorizer endpoint.
  version: 1.0.54
servers:
- description: ''
  url: https://api.uat.btx.fr.banqup.com/core/todo
- description: ''
  url: https://api.uat.btx.eu.banqup.com/core/todo
tags:
- name: PluginServiceAuthorizationEndpoint
  description: the PluginServiceAuthorizationEndpoint API
paths:
  /v1/spaces/{spaceId}/todoItems/{todoItemId}:
    get:
      tags:
      - To-do Service
      summary: Retrieve a todo item
      description: 'Get details of a specific todo item.Requires **space_read** scope
        on the *spaceId* and only todo items where the caller has requiredPermission
        are returned. <br/> Scope: space_read<br/> This Endpoint is part of: todo-service'
      operationId: getTodoItem
      parameters:
      - name: spaceId
        in: path
        description: The space identifier. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: 1b34de13-4063-41e6-8b68-237f0c391550
      - name: todoItemId
        in: path
        description: Unique identifier of the todo item. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: bf514229-fa39-4bca-b8d9-b96607e9954a
      responses:
        '404':
          description: Todo item not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 404
                error: NOT_FOUND
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Not Found
                detail: The HTTP method was not allowed on this endpoint.
        '403':
          description: Forbidden Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '200':
          description: The requested todo item.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoItemResponse'
              example:
                id: bf514229-fa39-4bca-b8d9-b96607e9954a
                spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                type: reviewPurchaseDocument
                data:
                  spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
                reference: bf514229-fa39-4bca-b8d9-b96607e9961e
                requiredPermission:
                  resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  scope: space_read
        '400':
          description: Invalid Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      security:
      - oauth2:
        - space_read
    put:
      tags:
      - To-do Service
      summary: Update a todo item
      description: 'Modify an existing todo item by its ID. Requires **space_foundation_todo_write**
        scope on the *spaceId* and **todo_type_manage** scope on *type* of the todo
        item. <br/> Scope: space_foundation_todo_write, todo_type_manage<br/> This
        Endpoint is part of: todo-service'
      operationId: updateTodoItem
      parameters:
      - name: spaceId
        in: path
        description: The space identifier. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: 1b34de13-4063-41e6-8b68-237f0c391550
      - name: todoItemId
        in: path
        description: Unique identifier of the todo item. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: bf514229-fa39-4bca-b8d9-b96607e9954a
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TodoItemPatchRequest'
        required: true
      responses:
        '404':
          description: Todo item not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 404
                error: NOT_FOUND
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Not Found
                detail: The HTTP method was not allowed on this endpoint.
        '403':
          description: Forbidden Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '200':
          description: Todo item updated successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoItemResponse'
              example:
                id: bf514229-fa39-4bca-b8d9-b96607e9954a
                spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                type: reviewPurchaseDocument
                data:
                  spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
                reference: bf514229-fa39-4bca-b8d9-b96607e9961e
                requiredPermission:
                  resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  scope: space_read
        '400':
          description: Invalid Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      security:
      - oauth2:
        - space_foundation_todo_write
        - todo_type_manage
    delete:
      tags:
      - To-do Service
      summary: Delete a todo item
      description: 'Remove a specific todo item from the collection. Requires **space_foundation_todo_write**
        scope on the *spaceId* and **todo_type_manage** scope on *type* of the todo
        item. <br/> Scope: space_foundation_todo_write, todo_type_manage<br/> This
        Endpoint is part of: todo-service'
      operationId: deleteTodoItem
      parameters:
      - name: spaceId
        in: path
        description: The space identifier. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: 1b34de13-4063-41e6-8b68-237f0c391550
      - name: todoItemId
        in: path
        description: Unique identifier of the todo item. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: bf514229-fa39-4bca-b8d9-b96607e9954a
      responses:
        '204':
          description: Todo item deleted successfully.
        '404':
          description: Todo item not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 404
                error: NOT_FOUND
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Not Found
                detail: The HTTP method was not allowed on this endpoint.
        '403':
          description: Forbidden Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '400':
          description: Invalid Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      security:
      - oauth2:
        - space_foundation_todo_write
        - todo_type_manage
  /v2/plugins/todoTypes/authorize:
    post:
      tags:
      - PluginServiceAuthorizationEndpoint
      summary: Determines if the caller is allowed to register a plugin for the provided
        plugin interface.
      operationId: authorize
      parameters:
      - name: Authorization
        in: header
        required: false
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthorizationRequest'
        required: true
      responses:
        '200':
          description: The authorization data that will be saved as authorization
            info for the plugin
          content:
            application/json:
              schema:
                type: string
        '204':
          description: An empty authorizer response to allow the registration of a
            plugin without enforcing additional authorization filter
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
      description: ' <br/> Scope: []<br/> This Endpoint is part of: todo-service'
  /v1/spaces/{spaceId}/todoItems:
    get:
      tags:
      - To-do Service
      summary: List all todo items in a space.
      description: 'Retrieve a list of all todo items.Requires **space_read** scope
        on the *spaceId* and only todo items where the caller has requiredPermission
        are returned. <br/> Scope: space_read<br/> This Endpoint is part of: todo-service'
      operationId: listTodoItems_1
      parameters:
      - name: spaceId
        in: path
        description: The space identifier. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: 1b34de13-4063-41e6-8b68-237f0c391550
      - name: type
        in: query
        description: The type of the todo item.
        required: false
        schema:
          type: string
        example: reviewPurchaseDocument
      - name: reference
        in: query
        description: Optional identifier to quickly find todo items.
        required: false
        schema:
          type: string
        example: bf514229-fa39-4bca-b8d9-b96607e9961e
      responses:
        '200':
          description: A list of todo items.
          content:
            application/x-ndjson:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/TodoItemResponse'
              example:
              - id: bf514229-fa39-4bca-b8d9-b96607e9954a
                spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                type: paymentDue
                data:
                  spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
                reference: dab33574-472c-4353-8119-678d705e7f9d
                requiredPermission:
                  resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  scope: space_read
              - id: cd319a93-1782-4c3d-b4cd-ac5bb06a20c5
                spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                type: paymentDue
                data:
                  spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  todoItemId: cd319a93-1782-4c3d-b4cd-ac5bb06a20c5
                reference: dab33574-472c-4353-8119-678d705e7f9e
                requiredPermission:
                  resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  scope: space_read
            application/json:
              schema:
                $ref: '#/components/schemas/TodoItemResponseList'
        '403':
          description: Forbidden Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '400':
          description: Invalid Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      security:
      - oauth2:
        - space_read
    post:
      tags:
      - To-do Service
      summary: Create a new todo item
      description: 'Add a new todo item to the collection. Requires **space_foundation_todo_write**
        scope on the *spaceId* and **todo_type_manage** scope on *type* of the todo
        item. <br/> Scope: space_foundation_todo_write, todo_type_manage<br/> This
        Endpoint is part of: todo-service'
      operationId: addTodoItem
      parameters:
      - name: spaceId
        in: path
        description: The space identifier. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: 1b34de13-4063-41e6-8b68-237f0c391550
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TodoItemRequest'
        required: true
      responses:
        '403':
          description: Forbidden Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '201':
          description: Todo item created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TodoItemResponse'
              example:
                id: bf514229-fa39-4bca-b8d9-b96607e9954a
                spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                type: reviewPurchaseDocument
                data:
                  spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
                reference: bf514229-fa39-4bca-b8d9-b96607e9961e
                requiredPermission:
                  resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
                  scope: space_read
        '400':
          description: Invalid Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      security:
      - oauth2:
        - space_foundation_todo_write
        - todo_type_manage
  /v1/spaces/{spaceId}/todoItems:summarize:
    get:
      tags:
      - To-do Service
      summary: Summarize the todo items.
      description: 'Aggregates and describes todo items and returns this alongside
        an action to be performed when clicked.Requires **space_read** scope on the
        *spaceId* and only todo items where the caller has requiredPermission are
        returned. <br/> Scope: space_read<br/> This Endpoint is part of: todo-service'
      operationId: summarizeTodoItems_1
      parameters:
      - name: spaceId
        in: path
        description: The space identifier. (A UUID specified by RFC4122).
        required: true
        schema:
          type: string
          format: uuid
        example: 1b34de13-4063-41e6-8b68-237f0c391550
      - name: l
        in: query
        description: The locale of the todo type label
        required: false
        schema:
          type: string
        example: en-GB
      - name: Accept-Language
        in: header
        description: The fallback locale of the todo type label
        required: false
        schema:
          type: array
          items:
            type: string
        example:
        - en-GB
        - en
      responses:
        '403':
          description: Forbidden Error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 403
                error: PERMISSION_DENIED
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Forbidden
                detail: Access to the requested resource was denied.
        '200':
          description: Visualization of open Todo Types.
          content:
            application/x-ndjson:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SummarizeTodoItemsPerTypeResponse'
              example:
              - type: paymentDue
                count: 2
                displayCount: true
                priority: 70
                labels:
                  description_one: Purchase invoice to pay
                  description_other: Purchase invoices to pay
                  mobile:
                    description: Payment due
                action:
                  actionType: REDIRECT
                  uri: 
                    https://app.dev.btx.banqup.com/purchase-invoices?tab=UNPAID&pageIndex=1&pageSize=50
              - type: reviewPurchaseDocument
                count: 1
                displayCount: true
                priority: 50
                labels:
                  description_one: Purchase invoice review
                  description_other: Purchase invoices review
                  mobile:
                    description: Review purchase
                action:
                  actionType: REDIRECT
                  uri: 
                    https://app.dev.btx.banqup.com/purchase-invoices?tab=REVIEW&pageIndex=1&pageSize=50
            application/json:
              schema:
                $ref: '#/components/schemas/SummarizeTodoItemsPerTypeResponseList'
        '400':
          description: Invalid Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorProblemDetail'
              example:
                status: 400
                error: BAD_REQUEST
                requestId: a78150d2-7913-4ea6-933f-286cadac6745
                timestamp: 2018-08-27T12:34:50Z
                type: about:blank
                title: Bad Request
                detail: Bad Request message details.
      security:
      - oauth2:
        - space_read
components:
  schemas:
    TodoItemPatchRequest:
      type: object
      properties:
        data:
          type: object
        reference:
          type: string
          description: Optional identifier to quickly find todo items.
          example: bf514229-fa39-4bca-b8d9-b96607e9961e
      description: Body of todo item patch request.
      example:
        data:
          spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
          todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
        reference: bf514229-fa39-4bca-b8d9-b96607e9961e
    ApiErrorProblemDetail:
      required:
      - error
      - requestId
      - timestamp
      type: object
      properties:
        status:
          type: integer
          format: int32
        error:
          type: string
        requestId:
          type: string
        timestamp:
          type: string
          format: date-time
        type:
          type: string
          format: uri
        title:
          type: string
        detail:
          type: string
        instance:
          type: string
          format: uri
        problems:
          type: array
          items:
            $ref: '#/components/schemas/NestedProblem'
        properties:
          type: object
          additionalProperties:
            type: object
    NestedProblem:
      required:
      - detail
      - error
      - title
      type: object
      properties:
        error:
          type: string
        title:
          type: string
        detail:
          type: string
        type:
          type: string
          format: uri
    RequiredPermission:
      type: object
      properties:
        resourceId:
          type: string
          description: The resource part of the permission needed to view this item.
          example: 1b34de13-4063-41e6-8b68-237f0c391550
        scope:
          type: string
          description: The scope part needed on the specified resource.
          example: space_read
      description: The permission needed to view this item
    TodoItemResponse:
      required:
      - data
      - id
      - spaceId
      - type
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of created todo item. (A UUID specified by
            RFC4122).
          format: uuid
          example: bf514229-fa39-4bca-b8d9-b96607e9954a
        spaceId:
          type: string
          description: The space identifier. (A UUID specified by RFC4122).
          format: uuid
          example: 1b34de13-4063-41e6-8b68-237f0c391550
        type:
          type: string
          description: The type of created todo item.
          example: reviewPurchaseDocument
        data:
          type: object
        reference:
          type: string
          description: Optional identifier to quickly find created todo item.
          example: bf514229-fa39-4bca-b8d9-b96607e9961e
        requiredPermission:
          $ref: '#/components/schemas/RequiredPermission'
      example:
        id: bf514229-fa39-4bca-b8d9-b96607e9954a
        spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
        type: reviewPurchaseDocument
        data:
          spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
          todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
        reference: bf514229-fa39-4bca-b8d9-b96607e9961e
        requiredPermission:
          resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
          scope: space_read
    AuthorizationRequest:
      required:
      - name
      - namespace
      - operation
      - subject
      - version
      type: object
      properties:
        subject:
          maxLength: 256
          minLength: 1
          type: string
        operation:
          maxLength: 256
          minLength: 1
          type: string
        namespace:
          maxLength: 256
          minLength: 1
          type: string
        name:
          maxLength: 256
          minLength: 1
          type: string
        version:
          pattern: \d+(.\d+){0,2}
          type: string
        pluginId:
          type: string
        data:
          type: object
    TodoItemRequest:
      required:
      - data
      - type
      type: object
      properties:
        type:
          type: string
          description: The type of the todo item.
          example: reviewPurchaseDocument
        data:
          type: object
        reference:
          type: string
          description: Optional identifier to quickly find todo items.
          example: bf514229-fa39-4bca-b8d9-b96607e9961e
        requiredPermission:
          $ref: '#/components/schemas/RequiredPermission'
      description: Body of todo item request.
      example:
        type: reviewPurchaseDocument
        data:
          spaceId: 1b34de13-4063-41e6-8b68-237f0c391550
          todoItemId: bf514229-fa39-4bca-b8d9-b96607e9954a
        reference: bf514229-fa39-4bca-b8d9-b96607e9961e
        requiredPermission:
          resourceId: 1b34de13-4063-41e6-8b68-237f0c391550
          scope: space_read
    SummarizeTodoItemsPerTypeResponse:
      type: object
      properties:
        type:
          type: string
          description: The type of the todo item.
          example: reviewPurchaseDocument
        count:
          type: integer
          description: The number of todo items of this type.
          format: int64
          example: 2
        displayCount:
          type: boolean
          description: Whether the count of todoItems should be shown on the right.
          example: true
        priority:
          type: integer
          description: Determines the order in which these items are displayed. 100
            is higher priority than 1.
          format: int32
          example: 100
        labels:
          type: object
        action:
          $ref: '#/components/schemas/TodoAction'
      example:
        type: reviewPurchaseDocument
        count: 1
        displayCount: true
        priority: 50
        labels:
          description_one: Purchase invoice review
          description_other: Purchase invoices review
          mobile:
            description: Review purchase
        action:
          actionType: REDIRECT
          uri: 
            https://app.dev.btx.banqup.com/purchase-invoices?tab=REVIEW&pageIndex=1&pageSize=50
    TodoAction:
      type: object
      properties:
        actionType:
          type: string
          description: The type of action to be performed.
          example: REDIRECT
          enum:
          - REDIRECT
        uri:
          type: string
          description: The URI for the action.
          example: 
            https://app.dev.btx.banqup.com/purchase-invoices?tab=REVIEW&pageIndex=1&pageSize=50
      description: Defines a navigational action, typically a redirect to a specific
        URI.
      example:
        actionType: REDIRECT
        uri: 
          https://app.dev.btx.banqup.com/purchase-invoices?tab=REVIEW&pageIndex=1&pageSize=50
    SummarizeTodoItemsPerTypeResponseList:
      type: object
      properties:
        summarizedTodoItems:
          type: array
          items:
            $ref: '#/components/schemas/SummarizeTodoItemsPerTypeResponse'
    TodoItemResponseList:
      type: object
      properties:
        todoItems:
          type: array
          items:
            $ref: '#/components/schemas/TodoItemResponse'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.uat.btx.fr.banqup.com/oauth2/client_credential/gettoken
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
        authorizationCode:
          authorizationUrl: https://api.uat.btx.fr.banqup.com/oauth2/auth
          tokenUrl: https://api.uat.btx.fr.banqup.com/oauth2/token
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
