---
openapi: 3.0.0
info:
  title: Firmware
  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
    Firmware:
      title: Firmware
      type: object
      properties:
        meta:
          type: object
          description: Meta data of the object
          example:
            id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
            type: firmware
            version: '2.0'
        log:
          type: array
          maxItems: 100
          items:
            type: object
            properties:
              type:
                type: string
              timestamp:
                type: string
              message:
                type: string
          description: Attribute to manage the firmware log (successes and failures)
        paths:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              path:
                type: string
              firmware:
                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}$"
              unpack:
                type: boolean
            required:
            - path
            - firmware
          description: Instruction of how to retrieve the firmware
          example:
          - name: test path 1
            path: test/path1
            firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
            unpack: false
      additionalProperties: false
      description: Service to manage firmware to real networks
  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: Firmware
  description: Service to manage firmware to real networks
paths:
  "/firmware":
    post:
      tags:
      - Firmware
      summary: Create firmware
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Firmware"
            example:
              meta:
                id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
              paths:
              - name: test path 1
                path: test/path1
                firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                unpack: false
      responses:
        '201':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Firmware"
              example:
                paths:
                - name: test path 1
                  path: test/path1
                  firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                  unpack: false
                meta:
                  id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                  type: firmware
                  version: '2.0'
    get:
      tags:
      - Firmware
      summary: Retrieve list of firmware
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Idlist"
              example:
                child:
                - type: firmware
                  version: '2.0'
                id:
                - ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                - 7379deec-331c-4d05-a19b-e41b42a30511
                - dec7109d-86cc-43b9-b99f-abdf14c9b4fa
                - 23dbce7f-b9d3-4db0-bd3a-f6828c49d95f
                more: false
                limit: 1000
                count: 4
                meta:
                  type: idlist
                  version: '2.0'
    head:
      tags:
      - Firmware
      summary: Check if list of firmware is retrievable
      parameters: []
      responses:
        '200':
          description: OK
    patch:
      tags:
      - Firmware
      summary: Update multiple firmwares
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Firmware"
            example:
              paths:
              - name: test path 1
                path: test/path1
                firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                unpack: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Firmware"
              example:
              - paths:
                - name: test path 1
                  path: test/path1
                  firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                  unpack: false
                meta:
                  id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                  type: firmware
                  version: '2.0'
              - paths:
                - name: test path 1
                  path: test/path1
                  firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                  unpack: false
                meta:
                  id: 7379deec-331c-4d05-a19b-e41b42a30511
                  type: firmware
                  version: '2.0'
    delete:
      tags:
      - Firmware
      summary: Delete all firmware
      parameters: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Deletelist"
              example:
                deleted:
                - 7379deec-331c-4d05-a19b-e41b42a30511
                - dec7109d-86cc-43b9-b99f-abdf14c9b4fa
                - 23dbce7f-b9d3-4db0-bd3a-f6828c49d95f
                code: 105000004
                message: Cleared
                internal_code: documentstore_cleared
                meta:
                  type: deletelist
                  version: '2.0'
  "/firmware/:id":
    get:
      tags:
      - Firmware
      summary: Retrieve firmware by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Firmware"
              example:
                paths:
                - name: test path 1
                  path: test/path1
                  firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                  unpack: false
                meta:
                  id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                  type: firmware
                  version: '2.0'
    head:
      tags:
      - Firmware
      summary: Check if firmware by ID is retrievable
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
    patch:
      tags:
      - Firmware
      summary: Update an firmware by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Firmware"
            example:
              paths:
              - name: test path 2
                path: test/path1
                firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                unpack: false
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Firmware"
              example:
                paths:
                - name: test path 2
                  path: test/path1
                  firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                  unpack: false
                meta:
                  id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                  type: firmware
                  version: '2.0'
    put:
      tags:
      - Firmware
      summary: Replace an firmware by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      requestBody:
        content:
          application/json:
            schema:
              "$ref": "#/components/schemas/Firmware"
            example:
              paths:
              - name: test path 2
                path: test/path1
                firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                unpack: false
              meta:
                id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                type: firmware
                version: '2.0'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Firmware"
              example:
                paths:
                - name: test path 2
                  path: test/path1
                  firmware: 17d68673-dad9-42a8-97bd-bb58082fb817
                  unpack: false
                meta:
                  id: ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                  type: firmware
                  version: '2.0'
    delete:
      tags:
      - Firmware
      summary: Delete an firmware by ID
      parameters:
      - "$ref": "#/components/parameters/url_id"
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                "$ref": "#/components/schemas/Deletelist"
              example:
                deleted:
                - ff89289f-86b7-425d-bd12-0cdaaa6e1f75
                code: 105000003
                message: Deleted
                internal_code: documentstore_deleted
                meta:
                  type: deletelist
                  version: '2.0'
