---
openapi: 3.0.0
info:
  title: Notification
  version: '2.0'
servers:
- url: https://wappsto.com/services/2.0
  description: Server to connect to the API
components:
  schemas:
    Deletelist:
      title: Deletelist
      type: object
      properties:
        deleted:
          type: array
          items:
            type: string
          description: List of deleted objects
        child_deleted:
          type: array
          items:
            type: string
          description: List of deleted children object related to the chosen objects
            to delete
        shared_deleted:
          type: array
          items:
            type: string
          description: List of removed objects previosly shared and accepted by the
            user
        shared_child_deleted:
          type: array
          items:
            type: string
          description: List of removed children objects previosly shared and accepted
            by the user related to the chosen objects to delete
        not_deleted:
          type: array
          items:
            type: string
          description: List of not deleted objects
        child_not_deleted:
          type: array
          items:
            type: string
          description: List of not deleted children object related to the chosen objects
            to delete
        shared_not_deleted:
          type: array
          items:
            type: string
          description: List of not removed objects previosly shared and accepted by
            the user
        shared_child_not_deleted:
          type: array
          items:
            type: string
          description: List of not removed children objects previosly shared and accepted
            by the user related to the chosen objects to delete
        pending:
          type: array
          items:
            type: string
          description: List of objects that will be deleted eventually
        child_pending:
          type: array
          items:
            type: string
          description: List of children objects that will be deleted eventually
        owned_not_deleted_because_it_has_parent:
          type: array
          items:
            type: string
          description: List of owned object not deleted since they have a parent
        shared_not_deleted_because_it_has_parent:
          type: array
          items:
            type: string
          description: List of shared object not deleted since they have a parent
        code:
          type: integer
          description: Code of the deletion
        message:
          type: string
          description: Final status of the deletion
        error:
          type: string
          description: Possible incurred errors
        meta:
          type: object
          description: Meta data of the object
        unsuccessful:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              message:
                type: string
              data:
                type: object
          description: An array that includes a more deep description about the reason
            of unsuccessful deletions
      additionalProperties: false
      description: Output obtained when one or multiple objects are deleted with a
        DELETE request
    Httpresponse:
      title: Httpresponse
      type: object
      properties:
        message:
          type: string
          description: Message of the error
        data:
          type: object
          description: More information about the error
        code:
          type: integer
          description: Identifier code of the error
        service:
          type: string
          description: Service that sent the error
        meta:
          type: object
          description: Meta data of the object
      additionalProperties: false
      description: Output obtain when a fast communication is returned (usually an
        error)
    Idlist:
      title: Idlist
      type: object
      properties:
        id:
          items:
            type: string
            pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
          type: array
          description: Ids found
        more:
          type: boolean
          description: If true, it means that using offset it is possible to retrieve
            other values
        limit:
          type: integer
          multipleOf: 1
          minimum: 1
          description: Limit used to retrieve the ids
        count:
          type: integer
          multipleOf: 1
          minimum: 0
          description: Number of ids returned
        data:
          type: object
          description: Further information in relation of the service
        child:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
              version:
                type: string
                pattern: "(\\d+)\\.(\\d+)"
          description: It is an array that gives a brief description of the type and
            the version of the retrieved objects
        meta:
          type: object
      additionalProperties: false
      description: Output obtain when a list is returned
    Fetch:
      title: Fetch
      type: object
      properties:
        filter:
          type: object
        return:
          type: string
          description: A graphQL string that describes the format it needs to be returned
        table:
          type: boolean
          description: If true, use iot table to fetch the data
        data:
          type: object
          description: The output obtained after filtering and parsing the results
            with the GraphQL request
        meta:
          type: object
          description: Meta data of the object
      additionalProperties: false
      description: Output obtained when the input is a fetch request
    Notification:
      title: Notification
      type: object
      properties:
        read:
          type: string
          enum:
          - read
          - unread
          - accepted
          - denied
          - deleted
          description: Information if the notification has been read
          example: unread
        custom:
          type: object
          description: Generic data returned with the communication
          example:
            Test: 8
            name_installation: Amcell Direct Mount
            title_installation: Trische HD Receiver
        base:
          type: object
          additionalProperties: false
          properties:
            action:
              type: string
            code:
              type: integer
            from:
              type: string
              pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            to:
              type: string
              pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
            from_type:
              type: string
            from_name:
              type: string
            to_type:
              type: string
            type_ids:
              type: string
            priority:
              type: integer
              multipleOf: 1
              minimum: 0
            ids:
              items:
                type: string
                pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
              type: array
            info:
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
                  type:
                    type: string
                  name:
                    type: string
            type:
              enum:
              - admin
              - installation
              - installation_request
              - permission
              - user_relationship
              - usergroup_permission
              - usergroup_relationship
              - shared
              - wallet
          description: Include base information as the used action, the code of the
            notification, from whom the notification is sent, to whom the notification
            is sent, the type of the source and the receiver, which ids are involved
            and their type, custom data and some order of priority
          example:
            action: Installation notification
            code: 1100011
            type: installation
            from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
            to: eb17a62b-15b2-435a-a76d-a80947045059
            from_type: installation
            from_name: Amcell Direct Mount - Trische HD Receiver
            to_type: user
            type_ids: notification
            priority: 0
            ids:
            - 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
            info:
            - type: notification
              id: 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
              name: notification
        times:
          type: integer
          multipleOf: 1
          minimum: 1
          description: How many times the notification has been sent
          example: 1
        timestamp:
          type: string
          description: Timestamp of the last time the notification has been sent
          example: '2021-03-23T11:44:15.476932Z'
        identifier:
          type: string
          description: Identifier of the notification
          example: 2bc55ec24e313b89714eced214f28b1d46eb35e4c4a220de3ad628cd44f41b89
        url:
          type: string
          description: Address used to send the notification
        meta:
          type: object
          description: Meta data of the object
          example:
            deprecated: true
            id: fba8759f-53d3-4883-bf87-b2bb8227a68b
            type: notification
            version: '2.0'
      additionalProperties: false
      description: A notification is used to send communication internally to the
        user. A notification can be only sent from an installation to its owner or
        from an administrator to another user. In case of an installation needs more
        permission, a notification is sent to the owner of the installation
  parameters:
    url_id:
      name: :id
      in: path
      required: true
      description: Id of the given object
      schema:
        type: string
        pattern: "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    url_hex:
      name: :token
      in: path
      required: true
      description: Token used for some operation
      schema:
        type: string
        pattern: "^[0-9a-fA-F]{64}$"
tags:
- name: Notification
  description: A notification is used to send communication internally to the user.
    A notification can be only sent from an installation to its owner or from an administrator
    to another user. In case of an installation needs more permission, a notification
    is sent to the owner of the installation
paths:
  "/notification":
    post:
      tags:
      - Notification
      summary: Fetch request of notification
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Notification"
            example:
              filter:
                id:
                - 88f7c1b1-a952-4324-a504-aeafd9c44f58
                - fba8759f-53d3-4883-bf87-b2bb8227a68b
              return: "{ notification {meta {id}}}"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Fetch"
              example:
                meta:
                  type: fetch
                  version: '2.0'
                data:
                  notification:
                  - meta:
                      id: 88f7c1b1-a952-4324-a504-aeafd9c44f58
                  - meta:
                      id: fba8759f-53d3-4883-bf87-b2bb8227a68b
    get:
      tags:
      - Notification
      summary: Retrieve list of notification
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Idlist"
              example:
                child:
                - type: notification
                  version: '2.0'
                id:
                - 88f7c1b1-a952-4324-a504-aeafd9c44f58
                - fba8759f-53d3-4883-bf87-b2bb8227a68b
                - 541c9db5-3b1b-46ae-b8d7-5db21ae840af
                - 71e415b5-6de9-40ca-aae9-1188b89f1743
                more: false
                limit: 1000
                count: 4
                meta:
                  type: idlist
                  version: '2.0'
    head:
      tags:
      - Notification
      summary: Check if list of notification is retrievable
      parameters: []
      responses:
        '200':
          description: OK
    patch:
      tags:
      - Notification
      summary: Update multiple notifications
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Notification"
            example:
              read: unread
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Notification"
              example:
              - read: unread
                custom:
                  method:
                  - add
                  type: installation
                  collection: notification
                  data:
                  - meta:
                      type: notification
                      id: 570cc393-0d0d-4b45-94ff-000f6843d2aa
                  name_installation: Amcell Direct Mount
                  title_installation: Trische HD Receiver
                base:
                  action: Request precise permission
                  code: 1100003
                  type: installation_request
                  from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                  to: eb17a62b-15b2-435a-a76d-a80947045059
                  from_type: installation
                  from_name: Amcell Direct Mount - Trische HD Receiver
                  to_type: user
                  type_ids: installation
                  priority: 0
                  ids:
                  - c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                  info:
                  - type: installation
                    id: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                    name: Trische HD Receiver
                times: 1
                timestamp: '2021-03-23T11:44:15.422155Z'
                identifier: c4571f55ce18e3f36628f64daed2bf79094f3655c5cb9abd3a4409547ecb1f70
                meta:
                  deprecated: true
                  id: 88f7c1b1-a952-4324-a504-aeafd9c44f58
                  type: notification
                  version: '2.0'
              - read: unread
                custom:
                  Test: 8
                  name_installation: Amcell Direct Mount
                  title_installation: Trische HD Receiver
                base:
                  action: Installation notification
                  code: 1100011
                  type: installation
                  from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                  to: eb17a62b-15b2-435a-a76d-a80947045059
                  from_type: installation
                  from_name: Amcell Direct Mount - Trische HD Receiver
                  to_type: user
                  type_ids: notification
                  priority: 0
                  ids:
                  - 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                  info:
                  - type: notification
                    id: 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                    name: notification
                times: 1
                timestamp: '2021-03-23T11:44:15.476932Z'
                identifier: 2bc55ec24e313b89714eced214f28b1d46eb35e4c4a220de3ad628cd44f41b89
                meta:
                  deprecated: true
                  id: fba8759f-53d3-4883-bf87-b2bb8227a68b
                  type: notification
                  version: '2.0'
    delete:
      tags:
      - Notification
      summary: Delete all notification
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Deletelist"
              example:
                deleted:
                - 88f7c1b1-a952-4324-a504-aeafd9c44f58
                - 541c9db5-3b1b-46ae-b8d7-5db21ae840af
                - 71e415b5-6de9-40ca-aae9-1188b89f1743
                code: 105000004
                message: Cleared
                internal_code: documentstore_cleared
                meta:
                  type: deletelist
                  version: '2.0'
  "/notification/:id":
    get:
      tags:
      - Notification
      summary: Retrieve notification by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Notification"
              example:
                read: unread
                custom:
                  Test: 8
                  name_installation: Amcell Direct Mount
                  title_installation: Trische HD Receiver
                base:
                  action: Installation notification
                  code: 1100011
                  type: installation
                  from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                  to: eb17a62b-15b2-435a-a76d-a80947045059
                  from_type: installation
                  from_name: Amcell Direct Mount - Trische HD Receiver
                  to_type: user
                  type_ids: notification
                  priority: 0
                  ids:
                  - 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                  info:
                  - type: notification
                    id: 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                    name: notification
                times: 1
                timestamp: '2021-03-23T11:44:15.476932Z'
                identifier: 2bc55ec24e313b89714eced214f28b1d46eb35e4c4a220de3ad628cd44f41b89
                meta:
                  deprecated: true
                  id: fba8759f-53d3-4883-bf87-b2bb8227a68b
                  type: notification
                  version: '2.0'
    head:
      tags:
      - Notification
      summary: Check if notification by ID is retrievable
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
    post:
      tags:
      - Notification
      summary: Fetch request of notification
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Notification"
            example:
              return: "{ object: notification {meta {id} read}}"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Fetch"
              example:
                meta:
                  type: fetch
                  version: '2.0'
                data:
                  object:
                  - meta:
                      id: fba8759f-53d3-4883-bf87-b2bb8227a68b
                    read: unread
    patch:
      tags:
      - Notification
      summary: Update an notification by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Notification"
            example:
              read: read
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Notification"
              example:
                read: read
                custom:
                  Test: 8
                  name_installation: Amcell Direct Mount
                  title_installation: Trische HD Receiver
                base:
                  action: Installation notification
                  code: 1100011
                  type: installation
                  from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                  to: eb17a62b-15b2-435a-a76d-a80947045059
                  from_type: installation
                  from_name: Amcell Direct Mount - Trische HD Receiver
                  to_type: user
                  type_ids: notification
                  priority: 0
                  ids:
                  - 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                  info:
                  - type: notification
                    id: 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                    name: notification
                times: 1
                timestamp: '2021-03-23T11:44:15.476932Z'
                identifier: 2bc55ec24e313b89714eced214f28b1d46eb35e4c4a220de3ad628cd44f41b89
                meta:
                  deprecated: true
                  id: fba8759f-53d3-4883-bf87-b2bb8227a68b
                  type: notification
                  version: '2.0'
    put:
      tags:
      - Notification
      summary: Replace an notification by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Notification"
            example:
              read: read
              custom:
                Test: 8
                name_installation: Amcell Direct Mount
                title_installation: Trische HD Receiver
              base:
                action: Installation notification
                code: 1100011
                type: installation
                from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                to: eb17a62b-15b2-435a-a76d-a80947045059
                from_type: installation
                from_name: Amcell Direct Mount - Trische HD Receiver
                to_type: user
                type_ids: notification
                priority: 0
                ids:
                - 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                info:
                - type: notification
                  id: 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                  name: notification
              times: 1
              timestamp: '2021-03-23T11:44:15.476932Z'
              identifier: 2bc55ec24e313b89714eced214f28b1d46eb35e4c4a220de3ad628cd44f41b89
              meta:
                deprecated: true
                id: fba8759f-53d3-4883-bf87-b2bb8227a68b
                type: notification
                version: '2.0'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Notification"
              example:
                read: read
                custom:
                  Test: 8
                  name_installation: Amcell Direct Mount
                  title_installation: Trische HD Receiver
                base:
                  action: Installation notification
                  code: 1100011
                  type: installation
                  from: c6be3a3d-ea6e-4ee5-9ba9-d2a48633046e
                  to: eb17a62b-15b2-435a-a76d-a80947045059
                  from_type: installation
                  from_name: Amcell Direct Mount - Trische HD Receiver
                  to_type: user
                  type_ids: notification
                  priority: 0
                  ids:
                  - 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                  info:
                  - type: notification
                    id: 7dcfb829-0ef2-4f18-8644-d0d50fd4fc1e
                    name: notification
                times: 1
                timestamp: '2021-03-23T11:44:15.476932Z'
                identifier: 2bc55ec24e313b89714eced214f28b1d46eb35e4c4a220de3ad628cd44f41b89
                meta:
                  deprecated: true
                  id: fba8759f-53d3-4883-bf87-b2bb8227a68b
                  type: notification
                  version: '2.0'
    delete:
      tags:
      - Notification
      summary: Delete an notification by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Deletelist"
              example:
                deleted:
                - fba8759f-53d3-4883-bf87-b2bb8227a68b
                code: 105000003
                message: Deleted
                internal_code: documentstore_deleted
                meta:
                  type: deletelist
                  version: '2.0'
