openapi: 3.1.0
info:
  title: Beacontower Core
  description: >-
    Use this API to interact with core features of Beacon Tower. I.e. Asset
    Management, Provider Management etc.
  termsOfService: https://beacontower.io/api-terms/
  contact:
    email: apiteam@beacontower.io
  version: 1.0.11
externalDocs:
  description: Find out more about Swagger
  url: https://swagger.io
tags:
  - name: Authentication
    description: Login/Request token
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/authentication
  - name: Provider
    description: Manage Providers
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/providers
  - name: ProviderClient
    description: Manage Provider Clients
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/providers/clients
  - name: ProviderTemplate
    description: Manage Provider Templates
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/providers/providertemplates
  - name: Alarms
    description: Manage Alarms
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/alarms
  - name: Asset
    description: Manage Assets
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/assets
  - name: Dashboard
    description: Manage Dashboards
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/assets
  - name: Model
    description: Manage Models
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/models
  - name: Model draft
    description: Manage Model drafts
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/models
  - name: Binding description
    description: Manage binding descriptions
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/models
  - name: Binding description draft
    description: Manage binding description drafts
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/models
  - name: Tenant
    description: Manage tenants (PREVIEW)
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/tenants
  - name: Organization
    description: Manage organizations
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/organizations
  - name: User
    description: Manage users
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/users
  - name: Group
    description: Manage user groups
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/groups
  - name: Auth-Relation
    description: Manage relations for authorization
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/relations
  - name: Permission
    description: Work with permissions
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/permissions
  - name: Privilege
    description: Work with privileges
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/privileges
  - name: Graph
    description: Graph management
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/graph
  - name: Notification
    description: Manage Notifications
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/notifications
  - name: Timeseries
    description: Query Timeseries
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/timeseries
  - name: Contact Group
    description: Manage Contact Groups
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/contactgroups
  - name: Push
    description: Manage SignalR Streams
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/push
  - name: Firmware
    description: Manage Firmware
    externalDocs:
      description: More information
      url: https://beacontower.io/docs/firmware
paths:
  /push/negotiate:
    post:
      operationId: negotiate-stream
      summary: Negotiate a signalr connection for the authenticated user
      description: >-
        Negotiates a signalr connection for the user. Returns a url and access
        token that can be used to configure the signalr client. The signalR
        client will need this endpoint.
      tags:
        - Push
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostNegotiateStreamResponse'
  /push/subscription:
    post:
      operationId: post-subscription
      summary: Add signalR subscription
      description: >-
        Adds a subscription for a topic (telemetry , alarm). With an active
        subscription, updates for the specified assets will be pushed to the
        signalr service. Subscriptions have a TTL of 600 seconds.
      tags:
        - Push
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostPutSubscriptionRequestBody'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostPutSubscriptionResponse'
  /push/subscription/{subscriptionId}:
    put:
      operationId: put-subscription
      summary: Update signalR subscription
      tags:
        - Push
      parameters:
        - name: subscriptionId
          in: path
          required: true
          schema:
            type: string
            description: Subscription Identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostPutSubscriptionRequestBody'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostPutSubscriptionResponse'
    get:
      operationId: get-subscription
      summary: Get subscription
      tags:
        - Push
      parameters:
        - name: subscriptionId
          in: path
          required: true
          schema:
            type: string
            description: Subscription Identifier
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSubscriptionResponse'
        '204':
          description: No content
        '404':
          description: Not found
    delete:
      operationId: delete-subscription
      summary: Delete subscription
      description: >-
        Manually delete a subscription for a topic. Note that subscriptions are
        automatically deleted after 600 seconds from creation.
      tags:
        - Push
      parameters:
        - name: subscriptionId
          in: path
          required: true
          schema:
            type: string
            description: Subscription Identifier
      responses:
        '204':
          description: No content
        '404':
          description: Not found
  /tenants:
    get:
      operationId: get-tenants
      summary: Get tenants
      description: Fetches all tenants
      tags:
        - Tenant
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTenantsResponse'
  /tenants/{tenantId}:
    get:
      operationId: get-tenant
      summary: Get a specific tenant
      tags:
        - Tenant
      parameters:
        - name: tenantId
          in: path
          required: true
          schema:
            type: string
            description: Tenant identifier
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTenantResponse'
        '404':
          description: Not found
  /users:
    get:
      operationId: get-users
      summary: Get users
      description: Fetches all users
      tags:
        - User
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUsersResponse'
    post:
      operationId: create-user
      summary: Create user
      tags:
        - User
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostUserRequestBody'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostUserResponse'
        '400':
          description: Bad request
        '409':
          description: Conflict (Duplicate id)
  /users/{userId}:
    get:
      operationId: get-user
      summary: Get a specific user
      tags:
        - User
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            description: User identifier
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUserResponse'
        '404':
          description: Not found
    patch:
      operationId: patch-user
      summary: Change a users properties
      tags:
        - User
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            description: User identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserPatchRequestBody'
      responses:
        '204':
          description: No content
        '404':
          description: Not found
        '412':
          description: Conflict when updating. Please try again.
    delete:
      operationId: delete-user
      summary: Delete User
      tags:
        - User
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            description: User Identifier
      responses:
        '204':
          description: No content
        '404':
          description: Not found
  /users/{userId}/settings:
    get:
      operationId: get-user-settings
      summary: Get a specific user's settings
      tags:
        - User
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            description: User identifier
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Bad request
        '404':
          description: Not found
    put:
      operationId: put-user-settings
      summary: Set a specific user's settings
      tags:
        - User
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
            description: User identifier
      requestBody:
        description: The user's new settings
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '404':
          description: Not found
  /groups:
    get:
      operationId: get-groups
      summary: Get groups
      tags:
        - Group
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetGroupsResponse'
    post:
      operationId: create-group
      summary: Create group
      tags:
        - Group
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostGroupRequestBody'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostGroupResponse'
        '400':
          description: Bad request
  /groups/{groupId}:
    get:
      operationId: get-group
      summary: Get a specific group
      tags:
        - Group
      parameters:
        - name: groupId
          in: path
          required: true
          schema:
            type: string
            description: Group identifier
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetGroupResponse'
        '404':
          description: Not found
    patch:
      operationId: patch-group
      summary: Change a groups properties
      tags:
        - Group
      parameters:
        - name: groupId
          in: path
          required: true
          schema:
            type: string
            description: Group identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GroupPatchRequestBody'
      responses:
        '204':
          description: No content
        '404':
          description: Not found
        '412':
          description: Conflict when updating. Please try again.
    delete:
      operationId: delete-group
      summary: Delete group
      tags:
        - Group
      parameters:
        - name: groupId
          in: path
          required: true
          schema:
            type: string
            description: Group Identifier
      responses:
        '204':
          description: No content
        '404':
          description: Not found
  /organizations:
    get:
      operationId: get-orgs
      summary: Get organizations
      description: Fetches all organizations that the user has read access to
      tags:
        - Organization
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOrganizationsResponse'
    post:
      operationId: create-org
      summary: Create organization
      tags:
        - Organization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostOrganizationRequestBody'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostOrganizationResponse'
        '400':
          description: Bad request
  /organizations/{organizationId}:
    get:
      operationId: get-org
      summary: Get a specific organization
      tags:
        - Organization
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
            description: Organization identifier
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetOrganizationResponse'
        '404':
          description: Not found
    patch:
      operationId: patch-org
      summary: Change an organizations properties
      tags:
        - Organization
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
            description: Organization identifier
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationPatchRequestBody'
      responses:
        '204':
          description: No content
        '404':
          description: Not found
    delete:
      operationId: delete-org
      summary: Delete Organization
      tags:
        - Organization
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
            description: Organization Identifier
      responses:
        '204':
          description: No content
        '404':
          description: Not found
  /organizations/{organizationId}/settings:
    get:
      tags:
        - Organization
      operationId: get-org-settings
      summary: Get an organization's settings
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
    put:
      tags:
        - Organization
      operationId: put-org-settings
      summary: Set an organization's settings
      parameters:
        - name: organizationId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        description: The organization's new settings
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '404':
          description: Not found
  /permissions/check:
    post:
      tags:
        - Permission
      summary: Make a permissions check
      operationId: check-permissions
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostPermissionCheckRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PostPermissionCheckResponse'
  /permissions/lookup-resources:
    post:
      tags:
        - Permission
      summary: >-
        Looks up resources of a specified type that a subject has a specified
        permission on
      operationId: lookup-resoures
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostLookupResourcesRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostLookupResourcesResponse'
  /permissions/lookup-subjects:
    post:
      tags:
        - Permission
      summary: Looks up wich subjects have permissions on a resource.
      operationId: lookup-subjects
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostLookupSubjectsRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PostLookupSubjectsResponse'
  /privileges/check:
    post:
      tags:
        - Privilege
      summary: Make a Privilege check
      operationId: check-privileges
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostPrivilegeCheckRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PostPrivilegeCheckResponse'
  /relations:
    post:
      tags:
        - Auth-Relation
      summary: Create a relation between a subject and a resource
      operationId: post-relation
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostRelationRequest'
      responses:
        '200':
          description: OK
  /relations/find:
    post:
      tags:
        - Auth-Relation
      summary: Find relations
      operationId: find-relations
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostFindRelationsRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PostFindRelationsResponse'
  /relations/{subjectType}/{subjectId}/{resourceType}/{resourceId}/{relation}:
    delete:
      tags:
        - Auth-Relation
      summary: Remove a relation between a subject and a resource
      operationId: delete-relation
      parameters:
        - name: subjectType
          in: path
          required: true
          schema:
            type: string
            description: Subject type
        - name: subjectId
          in: path
          required: true
          schema:
            type: string
            description: Subject Id
        - name: resourceType
          in: path
          required: true
          schema:
            type: string
            description: Resource type
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
            description: Resource Id
        - name: relation
          in: path
          required: true
          schema:
            type: string
            description: relation
      responses:
        '204':
          description: No content
  /auth/ropc:
    post:
      tags:
        - Authentication
      summary: Get a Access Token (JWT)
      operationId: get-token
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetTokenByRopcRequest'
      responses:
        '200':
          description: Successfully retrieved a token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetTokenByRopcRequestResponse'
        '400':
          description: Username and password was not provided
        '401':
          description: The user with username and password could not be authenticated
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /dashboards:
    get:
      operationId: get-dashboards
      summary: Get dashboards
      description: >-
        Get dashboards that the current user has the  ***view*** resource
        permission on.
      tags:
        - Dashboard
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetDashboardsResponse'
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    post:
      operationId: create-dashboard
      summary: Create dashboard
      description: Create dashboard requires the  ***dashboard_management*** privilege.
      tags:
        - Dashboard
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardPost'
      responses:
        '201':
          description: Created
          headers:
            location:
              schema:
                type: string
                format: uri
              description: Url to created dashboard
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dashboard'
          links:
            GetDashboardByDashboardId:
              operationId: getDashboard
              parameters:
                dashboardId: $response.body#/id
              description: >
                The `id` value returned in the response can be used as the
                `dashboardId` parameter in `GET /dashboards/{dashboardId}`.
        '400':
          description: Request validation failed
        '403':
          description: >-
            Unauthorized. User, Org or Tenant does not have the required
            Privilege
        '404':
          description: No match for gateway route
        '409':
          description: Duplicate dashboardId
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /dashboards/{dashboardId}:
    get:
      operationId: get-dashboard
      summary: Get dashboard
      description: >-
        Get dashboard details. The current user must have the  ***view***
        resource permission on the dashboard.
      tags:
        - Dashboard
      parameters:
        - name: dashboardId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Dashboard'
        '400':
          description: Request validation failed
        '404':
          description: No match for gateway route / Dashboard not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    patch:
      operationId: patch-dashboard
      summary: Update dashboard
      description: >-
        Patch the Dashboard with new **displayName**, **description** or
        **data**. The current user must have the  ***manage*** resource
        permission on the Dashboard.
      tags:
        - Dashboard
      parameters:
        - name: dashboardId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DashboardPatch'
      responses:
        '200':
          description: OK
        '403':
          description: Permission denied
        '404':
          description: Not found
    delete:
      operationId: delete-dashboard
      summary: Delete dashboard
      tags:
        - Dashboard
      parameters:
        - name: dashboardId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '404':
          description: Not found
  /contactgroups:
    post:
      operationId: create-contact-group
      summary: Create contact group
      description: >-
        Create contact group requires the  ***contact_group_management***
        privilege.
      tags:
        - Contact Group
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactGroupPost'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactGroup'
        '400':
          description: Resource can not be created / Display name is not provided
        '403':
          description: The user or organization does not have the required privilege.
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to create contact group
    get:
      operationId: get-contact-groups
      summary: Get contact groups
      description: >-
        Get all contact groups that the current user has the  ***view***
        resource permission on.
      tags:
        - Contact Group
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetContactGroupsResponse'
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get contact groups
  /contactgroups/{contactGroupId}:
    patch:
      operationId: patch-contact-group
      summary: Change a contact group
      description: >-
        Patch the Contact Group with new **displayName** or **description** or
        **userGroups** or **users**. The current user must have the 
        ***manage*** resource permission on the Contact Group.
      tags:
        - Contact Group
      parameters:
        - name: contactGroupId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContactGroupPatch'
      responses:
        '204':
          description: Created
        '400':
          description: Contact group ID is not provided
        '403':
          description: The user does not have permission to manage the contact group.
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    get:
      operationId: get-contact-group
      summary: Get a contact group
      tags:
        - Contact Group
      parameters:
        - name: contactGroupId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactGroup'
        '403':
          description: The user does not have permission to view the contact group.
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    delete:
      operationId: delete-contact-group
      summary: Delete contact group
      tags:
        - Contact Group
      parameters:
        - name: contactGroupId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '403':
          description: The user does not have permission to delete the contact group.
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /releases/upload:
    post:
      operationId: upload-firmware
      summary: Upload firmware
      description: >-
        Upload firmware file. Upload firmware requires the
        ***firmware_management*** privilege.
      tags:
        - Firmware
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ReleaseUploadPost'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: File is not provided
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /releases:
    post:
      operationId: create-release
      summary: Create release
      description: >-
        Сreate release item. Create release requires the
        ***firmware_management*** privilege.
      tags:
        - Firmware
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReleasePost'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '400':
          description: Display name is not provided
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Unexpected error occurred
    get:
      operationId: get-releases
      summary: Get releases
      description: >-
        Get all releases that the current user has the  ***view*** resource
        permission on.
      tags:
        - Firmware
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Release'
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Unexpected error occurred
  /releases/{releaseId}:
    put:
      operationId: put-release
      summary: Update release
      description: >-
        Put the release with new **displayName** or **description** or
        **startingModels** or **propertyValues**. The current user must have
        the  ***manage*** resource permission on the Release.
      tags:
        - Firmware
      parameters:
        - name: releaseId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ReleasePut'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '400':
          description: >-
            There are active deployments connected to this release. Please
            remove them first.
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs
    get:
      operationId: get-release
      summary: Retrieve a release by its unique id
      description: >-
        Get Release. The current user must have the ***view*** resource
        permission on the Release.
      tags:
        - Firmware
      parameters:
        - name: releaseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Release'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    delete:
      operationId: delete-release
      summary: Delete release by its unique id
      description: >-
        Delete release by its unique id. The current user must have the
        ***delete*** resource permission on the Release.
      tags:
        - Firmware
      parameters:
        - name: releaseId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '400':
          description: >-
            There are active deployments connected to this release. Please
            remove them first.
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/templates:
    post:
      operationId: create-deployment-template
      summary: Create deployment method template
      description: >-
        Сreate Deployment method Template. Create deployment template requires
        the ***firmware_management*** privilege.
      tags:
        - Firmware
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeploymentTemplatePost'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentTemplate'
        '400':
          description: Display name is not provided / Template document is not provided
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    get:
      operationId: get-deployment-templates
      summary: Get deployment method templates
      description: >-
        Get all Deployment method Templates that the current user has the 
        ***view*** resource permission on.
      tags:
        - Firmware
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeploymentTemplate'
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Unexpected error occurred
  /deployments/templates/{deploymentTemplateId}:
    get:
      operationId: get-deployment-template
      summary: Retrieve a deployment method template by its unique id
      description: >-
        Get Deployment method Template. The current user has the  ***view***
        resource permission on Deployment method Template.
      tags:
        - Firmware
      parameters:
        - name: deploymentTemplateId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentTemplate'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    delete:
      operationId: delete-deployment-template
      summary: Delete deployment method template by its unique id
      description: >-
        Delete Deployment method Template by its unique id. The current user
        must have the ***delete*** resource permission on the Deployment method
        Template.
      tags:
        - Firmware
      parameters:
        - name: deploymentTemplateId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /firmware/provider-client/{providerClientId}:
    delete:
      operationId: delete-pc-fwu
      summary: Delete provider client FWU instance
      tags:
        - Firmware
      parameters:
        - name: providerClientId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderClientFwuStatus'
        '400':
          description: Not found
  /firmware/provider-client/{providerClientId}/status:
    get:
      operationId: get-pc-fwu-status
      summary: Provider client FWU status
      description: Get provider client FWU status
      tags:
        - Firmware
      parameters:
        - name: providerClientId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderClientFwuStatus'
        '400':
          description: Not found
  /firmware/provider-client/{providerClientId}/cancel:
    post:
      operationId: cancel-pc-fwu
      summary: Cancel provider client FWU
      tags:
        - Firmware
      parameters:
        - name: providerClientId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '404':
          description: Not found
  /deployments:
    post:
      operationId: create-deployment
      summary: Create deployment
      description: >-
        Сreate Deployment. Create deployment requires the
        ***firmware_management*** privilege.
      tags:
        - Firmware
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeploymentPost'
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Deployment'
        '400':
          description: >-
            Display name is not provided / Device IDs are not provided /
            Deployment Template ID is not provided / Release ID is not provided
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    get:
      operationId: get-deployments
      summary: Get deployments
      description: >-
        Get all Deployments that the current user has the  ***view*** resource
        permission on.
      tags:
        - Firmware
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Deployment'
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}:
    get:
      operationId: get-deployment
      summary: Retrieve a deployment by its unique id
      description: >-
        Get Deployment. The current user must have the ***view*** resource
        permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Deployment'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    patch:
      operationId: patch-deployment
      summary: Update specific fields of a deployment
      description: >-
        Patch the deployment with new **displayName** or **description** or
        **deploymentTemplateId** or **releaseId** or **deviceIds**. The current
        user must have the  ***manage*** resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeploymentPatch'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Deployment'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    delete:
      operationId: delete-deployment
      summary: Delete deployment by its unique id
      description: >-
        Delete deployment by its unique id. The current user must have the
        ***delete*** resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/status:
    get:
      operationId: get-deployment-status
      summary: Retrieve a deployment status by its unique id
      description: >-
        Get Deployment status. The current user must have the ***view***
        resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeploymentStatus'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/devices/{deviceId}/status:
    get:
      operationId: get-deployment-device-status
      summary: Retrieve a deployment device status by deployment id and device id
      description: >-
        Get Deployment device status. The current user must have the ***view***
        resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProviderClientFwuStatus'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/devices/{deviceId}/cancel:
    post:
      operationId: cancel-deployment-device
      summary: Cancel a deployment device processing by deployment id and device id
      description: >-
        Cancel Deployment device run. The current user must have the ***view***
        resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/FirmwareStatus'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/cancel:
    post:
      operationId: cancel-deployment
      summary: Cancel a deployment processing by deployment id
      description: >-
        Cancel Deployment run. The current user must have the ***view***
        resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/FirmwareStatus'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/devices/{deviceId}/restart:
    post:
      operationId: restart-deployment-device
      summary: Restart a deployment device processing by deployment id and device id
      description: >-
        Restart Deployment device run. The current user must have the ***view***
        resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
        - name: deviceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/FirmwareStatus'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/restart:
    post:
      operationId: restart-deployment
      summary: Restart a deployment processing by deployment id
      description: >-
        Restart Deployment run. The current user must have the ***view***
        resource permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/FirmwareStatus'
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/batch-statuses:
    post:
      operationId: get-deployments-statuses
      summary: Get statuses of the list of deployments
      description: Get Deployments statuses
      tags:
        - Firmware
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeploymentsStatusesPost'
      responses:
        '200':
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/DeploymentStatus'
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /deployments/{deploymentId}/start:
    post:
      operationId: start-deployment
      summary: Start deployment process by unique id of the Deployment
      description: >-
        Start Deployment. The current user must have the ***view*** resource
        permission on the Deployment.
      tags:
        - Firmware
      parameters:
        - name: deploymentId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    $ref: '#/components/schemas/FirmwareStatus'
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /orgTemplates:
    get:
      operationId: get-orgtemplates
      summary: Retrieve a list of all organization templates
      description: >-
        Get all organization templates that the current user has the  ***view***
        resource permission on (Supports filtering by tags).
      parameters:
        - name: limit
          in: query
          description: >-
            Number of items to retrieve (max: appsetting
            {ResponseEntitiesLimit})
          schema:
            type: integer
        - name: tag
          in: query
          description: >-
            Filter by tags (possible to filter by single tag or multiple using
            AND and OR conditions)
          schema:
            type: array
            items:
              type: string
          style: form
          explode: true
          examples:
            withoutTag:
              summary: Example without tag (route /orgTemplates)
              value: []
            singleTag:
              summary: >-
                Example with a single tag (route
                /orgTemplates?tag=department:sales)
              value: department:sales
            multipleAndConditions:
              summary: >-
                Example with multiple tags and 'AND' conditions (route
                /orgTemplates?tag=department:sales&tag=status:active)
              value: department:sales,status:active
            multipleOrConditions:
              summary: >-
                Example with multiple 'OR' conditions for tag values (route
                /orgTemplates?tag=department:sales|marketing)
              value: department:sales|marketing
            multipleOrAndConditions:
              summary: >-
                Example with 'OR' and 'AND' conditions (route
                /orgTemplates?tag=department:sales|marketing&tag=status:active|draft)
              value: department:sales|marketing,status:active|draft
      tags:
        - OrgTemplate
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/ResourceListItem'
                  responseEntitiesLimitReached:
                    type: object
                    nullable: true
                    description: Reports that the maximum result has been exceeded
                    properties:
                      resultLimit:
                        type: number
        '400':
          description: >-
            Tag should be in format 'key:value' / Tag key should not be empty
            string / Tag value should not be empty string
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get organization templates
    post:
      operationId: create-orgtemplate
      summary: Create a new organization template
      description: >-
        Create resource with JSON document requires the 
        ***organization_management*** privilege.
      tags:
        - OrgTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrgTemplatePost'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: >-
            Display name is not provided / Document is not provided / Tag key
            should not be empty string / Tag value should not be empty string
        '401':
          description: Unauthorized
        '403':
          description: >-
            The user or organization does not have permission to manage the
            resource.
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to create organization template
  /orgTemplates/{orgTemplateId}:
    patch:
      operationId: patch-orgtemplate
      summary: Update specific fields of a organization template
      description: >-
        Patch the organization template with new **displayName** or
        **description** or **tags** or **document**. The current user must have
        the  ***manage*** resource permission on the OrgTemplate.
      tags:
        - OrgTemplate
      parameters:
        - name: orgTemplateId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourcePatch'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: >-
            Resource ID is not provided / Could not save document for file type
            resource / Tag key should not be empty string / Tag value should not
            be empty string
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to patch organization template
    get:
      operationId: get-orgtemplate
      summary: Retrieve a organization template by its unique id
      description: >-
        Get Organization Template. The current user must have the ***view***
        resource permission on the OrgTemplate.
      tags:
        - OrgTemplate
      parameters:
        - name: orgTemplateId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: Resource ID is not provided.
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get organization template with id
            {orgTemplateId}
    delete:
      operationId: delete-orgtemplate
      summary: Delete organization template by its unique id
      description: >-
        Delete organization template by its unique id. The current user must
        have the ***delete*** resource permission on the OrgTemplate.
      tags:
        - OrgTemplate
      parameters:
        - name: orgTemplateId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '400':
          description: Resource ID is not provided.
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to delete organization template with
            id {orgTemplateId}
  /resources:
    get:
      operationId: get-resources
      summary: Retrieve a list of all resources
      description: >-
        Get all resources that the current user has the  ***view*** resource
        permission on (Supports filtering by resource_type and tags).
      parameters:
        - name: limit
          in: query
          description: >-
            Number of items to retrieve (max: appsetting
            {ResponseEntitiesLimit})
          schema:
            type: integer
        - name: resource_type
          in: query
          description: 'Filter by resource type. Valid resource types: [''user-resource'']'
          schema:
            type: string
        - name: tag
          in: query
          description: >-
            Filter by tags (possible to filter by single tag or multiple using
            AND and OR conditions)
          schema:
            type: array
            items:
              type: string
          style: form
          explode: true
          examples:
            withoutTag:
              summary: Example without tag (route /resources)
              value: []
            singleTag:
              summary: >-
                Example with a single tag (route
                /resources?tag=department:sales)
              value: department:sales
            multipleAndConditions:
              summary: >-
                Example with multiple tags and 'AND' conditions (route
                /resources?tag=department:sales&tag=status:active)
              value: department:sales,status:active
            multipleOrConditions:
              summary: >-
                Example with multiple 'OR' conditions for tag values (route
                /resources?tag=department:sales|marketing)
              value: department:sales|marketing
            multipleOrAndConditions:
              summary: >-
                Example with 'OR' and 'AND' conditions (route
                /resources?tag=department:sales|marketing&tag=status:active|draft)
              value: department:sales|marketing,status:active|draft
      tags:
        - Resource
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/ResourceListItem'
                  responseEntitiesLimitReached:
                    type: object
                    nullable: true
                    description: Reports that the maximum result has been exceeded
                    properties:
                      resultLimit:
                        type: number
        '400':
          description: >-
            Tag should be in format 'key:value' / Tag key should not be empty
            string / Tag value should not be empty string / Resource type is not
            allowed. Valid resource types: ['user-resource']
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get resources
    post:
      operationId: create-resource
      summary: Create a new resource
      description: >-
        Create resource with JSON document requires the 
        ***resource_item_management*** privilege.
      tags:
        - Resource
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourcePost'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: >-
            Display name is not provided / Resource type is not provided /
            Document is not provided / Tag key should not be empty string / Tag
            value should not be empty string / Resource type is not allowed.
            Valid resource types: ['user-resource']
        '401':
          description: Unauthorized
        '403':
          description: >-
            The user or organization does not have permission to manage the
            resource.
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to create resource
  /resources/{resourceId}:
    patch:
      operationId: patch-resource
      summary: Update specific fields of a resource
      description: >-
        Patch the resource with new **displayName** or **description** or
        **tags** or **document**. The current user must have the  ***manage***
        resource permission on the Resource.
      tags:
        - Resource
      parameters:
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourcePatch'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: >-
            Resource ID is not provided / Could not save document for file type
            resource / Tag key should not be empty string / Tag value should not
            be empty string / Resource type is not allowed. Valid resource
            types: ['user-resource']
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to patch resource
    get:
      operationId: get-resource
      summary: Retrieve a resource by its unique id
      description: >-
        Get Resource metadata. The current user must have the ***view***
        resource permission on the Resource.
      tags:
        - Resource
      parameters:
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: Resource ID is not provided.
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get resource with id {resourceId}
    delete:
      operationId: delete-resource
      summary: Delete resource by its unique id
      description: >-
        Delete resource by its unique id. The current user must have the
        ***delete*** resource permission on the Resource.
      tags:
        - Resource
      parameters:
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '400':
          description: Resource ID is not provided.
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to delete resource with id
            {resourceId}
  /resources/upload:
    post:
      operationId: upload-resource
      summary: Create a new resource
      description: >-
        Create resource with binary file data requires the 
        ***resource_item_management*** privilege.
      tags:
        - Resource
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ResourceUpload'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: >-
            Display name is not provided / File is not provided / Resource type
            is not provided / Resource type is not allowed. Valid resource
            types: ['user-resource']
        '403':
          description: >-
            The user or organization does not have permission to manage the
            resource.
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to create resource / File was not
            uploaded successfully. Item was not saved
  /resources/upload/{resourceId}:
    put:
      operationId: reupload-resource
      summary: Reupload a resource file
      description: >-
        Reupload a resource file. The current user must have the ***manage***
        resource permission on the Resource.
      tags:
        - Resource
      parameters:
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ResourceReupload'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Resource'
        '400':
          description: >-
            Resource ID is not provided / File cannot be updated for not file
            type resource / File is not provided / File was not uploaded
            successfully. Item was not saved
        '401':
          description: Unauthorized
        '403':
          description: Permission denied
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to reupload file
  /resources/download/{resourceId}:
    get:
      operationId: download-resource
      summary: Download a resource file
      description: >-
        Download a Resource file. The current user must have the ***view***
        resource permission on the Resource.
      tags:
        - Resource
      parameters:
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
        '400':
          description: Resource ID is not provided
        '403':
          description: Permission denied
        '404':
          description: Resource not found.
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get resource with id {resourceId}
  /resources/tags:
    get:
      operationId: get-resources-tags
      summary: >-
        Retrieve a list of all resources tags or tags related to specific
        resource types
      description: >-
        Get resources tags that the current user has the  ***view*** resource
        permission on (Supports filtering by resource_type).
      parameters:
        - name: resource_type
          in: query
          description: 'Filter by resource type. Valid resource types: [''user-resource'']'
          schema:
            type: array
            items:
              type: string
          style: form
          explode: true
      tags:
        - Resource
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  tags:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                        value:
                          type: string
        '400':
          description: >-
            Resource type is not allowed. Valid resource types:
            ['user-resource']
        '401':
          description: Unauthorized
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get tags
  /resources/{resourceId}/tags:
    put:
      operationId: update-resource-tags
      summary: Add/Modify/Delete tags in a resource identified by {resourceId}
      description: >-
        Add/Modify/Delete tags. The current user must have the  ***manage***
        resource permission on the Resource.
      tags:
        - Resource
      parameters:
        - name: resourceId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                tags:
                  type: object
                  additionalProperties:
                    type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceTagsResponse'
        '400':
          description: >-
            Resource ID is not provided. / Tags are not provided / Tag key
            should not be empty string / Tag value should not be empty string
        '403':
          description: Permission denied
        '404':
          description: Resource not found.
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to update tags
  /notifications:
    get:
      operationId: get-notifications
      summary: Get notifications
      description: >-
        Get notifications that the current user has the  ***view*** resource
        permission on.
      tags:
        - Notification
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetNotificationsResponse'
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get notifications
    post:
      operationId: create-notification
      summary: Create notification
      description: >-
        Create notification requires the  ***notification_management***
        privilege.
      tags:
        - Notification
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationPost'
      responses:
        '201':
          description: Created
          headers:
            location:
              schema:
                type: string
                format: uri
              description: Url to created notification
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Notification'
          links:
            GetNotificationByNotificationId:
              operationId: getNotification
              parameters:
                notificationId: $response.body#/id
              description: >
                The `id` value returned in the response can be used as the
                `notificationId` parameter in `GET
                /notifications/{notificationId}`.
        '400':
          description: >-
            Invalid message providers data / Resource can not be created / Sms
            text is not provided / Email text is not provided / Alarm triggers
            are not provided / Display name is not provided
        '403':
          description: The user or organization does not have the required privilege.
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to create notification
  /timeseries/get:
    post:
      operationId: get-timeseries
      summary: Get time series
      description: >-
        Get time series data. The current user must have the **view** resource
        permission on the Assets.
      tags:
        - Timeseries
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimeseriesGet'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Timeseries'
        '400':
          description: AssetId is not provided / TimeseriesName is not provided
        '403':
          description: The user does not have permission to query time series
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get timeseries
  /timeseries/get/last:
    post:
      operationId: get-last-timeseries
      summary: Get last value of specific signal or property
      description: >-
        Get last value of specific signal or property. The current user must
        have the **view** resource permission on the Assets.
      tags:
        - Timeseries
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TimeseriesGetLast'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TimeseriesLast'
        '400':
          description: >-
            Items are not provided / Item should include one of these fields not
            empty: assetId, componentId, timeseries
        '403':
          description: The user does not have permission to query time series
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get last timeseries
  /notifications/{notificationId}:
    get:
      operationId: get-notification
      summary: Get notification
      description: >-
        Get notification details. The current user must have the  ***view***
        resource permission on the notification.
      tags:
        - Notification
      parameters:
        - name: notificationId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Notification'
        '404':
          description: No match for gateway route / Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Failed to get notification with id {0}
    patch:
      operationId: patch-notification
      summary: Change notification
      description: >-
        Change a Notification. The current user must have the  ***manage***
        resource permission on the Notification.
      tags:
        - Notification
      parameters:
        - name: notificationId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationPatch'
      responses:
        '204':
          description: NoContent
        '400':
          description: >-
            Notification ID is not provided / DisplayName is not provided /
            Alarm triggers are not provided / Workflow has no active steps /
            Subscribers are not provided
        '403':
          description: The user does not have permission to manage the notification.
        '404':
          description: No match for gateway route / Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs. / Workflow does not exist in Novu platform /
            Failed to update notification
    delete:
      operationId: delete-notification
      summary: Delete notification
      tags:
        - Notification
      parameters:
        - name: notificationId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: NoContent
        '403':
          description: The user does not have permission to delete the notification.
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /notifications/{notificationId}/subscribers:
    post:
      operationId: subscribe-notification
      summary: Add a subscriber to a notification
      description: >-
        Any user who has **view** access on the notification and contact group
        can add a subscribing contact group.
      tags:
        - Notification
      parameters:
        - name: notificationId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NotificationSubscribe'
      responses:
        '204':
          description: NoContent
        '400':
          description: Organization ID is not provided / Contact group ID is not provided
        '403':
          description: The user does not have permission to subscribe to the notification.
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /notifications/{notificationId}/subscribers/{contactGroupId}:
    delete:
      operationId: delete-subscribe-notification
      summary: Delete a notification subscriber
      tags:
        - Notification
      parameters:
        - name: notificationId
          in: path
          required: true
          schema:
            type: string
        - name: contactGroupId
          in: path
          required: true
          schema:
            type: string
            description: Notification id
      responses:
        '204':
          description: NoContent
        '400':
          description: Contact group ID is not provided / Notification ID is not provided
        '403':
          description: The user does not have permission to subscribe to the notification.
        '404':
          description: Resource not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.)
  /assets:
    get:
      operationId: get-assets
      summary: Get assets
      description: >-
        Get Assets that the current user has the  ***view*** resource permission
        on.
      tags:
        - Asset
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetAssetsResponse'
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    post:
      operationId: create-asset
      summary: Create asset
      description: >-
        Create Asset requires the  ***asset_management*** privilege. the current
        user must also have the ***view*** resource permission on the model.
      tags:
        - Asset
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssetPost'
      responses:
        '201':
          description: Created
          headers:
            location:
              schema:
                type: string
                format: uri
              description: Url to created Asset
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedAsset'
          links:
            GetAssetByAssetId:
              operationId: getAsset
              parameters:
                assetId: $response.body#/id
              description: >
                The `id` value returned in the response can be used as the
                `assetId` parameter in `GET /assets/{assetId}`.
        '400':
          description: Request validation failed
        '403':
          description: >-
            Unauthorized. User, Org or Tenant does not have the required
            Privilege
        '404':
          description: No match for gateway route / Model does not exist
        '409':
          description: Duplicate AssetId
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /assets/{assetId}:
    get:
      operationId: get-asset
      summary: Get asset
      description: >-
        Get Asset details. The current user must have the  ***view*** resource
        permission on the Asset.
      tags:
        - Asset
      parameters:
        - name: assetId
          in: path
          required: true
          schema:
            type: string
            description: Instance BTI
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '400':
          description: Request validation failed
        '404':
          description: No match for gateway route / Asset not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    patch:
      operationId: patch-asset
      summary: Update asset
      description: >-
        Patch the Asset with new **displayName** or **description**. The current
        user must have the  ***manage*** resource permission on the Asset.
      tags:
        - Asset
      parameters:
        - name: assetId
          in: path
          required: true
          schema:
            type: string
            description: Instance BTI
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssetPatch'
      responses:
        '200':
          description: OK
        '403':
          description: Permission denied
        '404':
          description: Not found
    delete:
      operationId: delete-asset
      summary: Delete asset
      tags:
        - Asset
      parameters:
        - name: assetId
          in: path
          required: true
          schema:
            type: string
            description: Instance BTI
      responses:
        '200':
          description: OK
        '404':
          description: Not found
  /assets/model/{modelId}:
    get:
      operationId: get-assets-of-model
      summary: Get assets of model
      tags:
        - Asset
      parameters:
        - name: modelId
          in: path
          required: true
          schema:
            type: string
            description: Instance BTI
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Asset'
        '404':
          description: Model not found, Route not found
  /assets/{assetId}/bind:
    post:
      operationId: bind-asset
      summary: Bind asset
      description: >-
        **The most common case is to just use autobind with a default binding
        description.**


        The bind endpoint constructs a set of content bindings by doing the
        following steps:


        1. Add `contentBindings`, if any.

        2. Run autobind to create content bindings for the remaining unbound
        contents.


        So it is possible to specify some content bindings directly and run
        autobind on the remaining contents.


        ## Autobind


        This functionality takes an endpoint instance ID and a binding
        description ID and creates a set of content bindings. These content
        bindings do not overwrite other content bindings binding to the same
        content.


        If `autobindBindingDescriptionId` is omitted it will assume a default
        binding description will be used. This binding description ID is
        constructed from the model or the provider type of the endpoint instance
        that `autobindEndpointInstanceId` refers to. The default binding
        description will be generated if it does not exist.


        **NOTE:** Using autobind with an implicit binding description ID is
        currently only supported when binding to a provider client.
      tags:
        - Asset
      parameters:
        - name: assetId
          in: path
          required: true
          schema:
            type: string
            description: Instance BTI
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssetBindRequest'
            examples:
              simple:
                summary: Autobind with default binding description
                description: >-
                  The common and simplest case of binding an asset to a provider
                  client through autobind with a default binding description.
                value:
                  autobindRemoteInstanceIds:
                    - defaultIotHubProvider::device1
              simpleCustomBindingDesc:
                summary: Autobind with specific binding description
                description: >-
                  Bind an asset or provider client through autobind with a
                  specific binding description.
                value:
                  autobindEndpointInstanceId: defaultIotHubProvider::device1
                  autobindBindingDescriptionId: btbi:dtmi:myModel;1:myCustomBindingDesc;1
              contentBindings:
                summary: Content bindings directly
                description: Bind an asset by specifying the content bindings directly
                value:
                  contentBindings:
                    - contentBindingDescriptionId: btbi:dtmi:myModel;1:myCustomBindingDesc:_c:temp;1
                      endpoints:
                        - endpointId: temp
                          instanceId: defaultIotHubProvider::device1
              mixed:
                summary: Mixed autobind and content bindings
                description: >-
                  Bind an asset by specifying some content bindings directly and
                  run autobind on the remaining contents
                value:
                  contentBindings:
                    - contentBindingDescriptionId: btbi:dtmi:myModel;1:myCustomBindingDesc:_c:temp;1
                      endpoints:
                        - endpointId: temp
                          instanceId: defaultIotHubProvider::device1
                  autobindEndpointInstanceId: defaultIotHubProvider::device1
                  autobindBindingDescriptionId: btbi:dtmi:myModel;1:myCustomBindingDesc;1
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetBindResponse'
        '400':
          description: Bad request
        '404':
          description: Not found
  /assets/{assetId}/commands/{commandName}:
    post:
      tags:
        - Asset
      summary: Execute command
      description: >-
        Send a command to an Asset to be executed. If the command endpoint of
        the Asset is bound, the command will be forwarded to the bound endpoint.
        The request returns the current status of the executed command.


        This operation requires the ***manage*** resource permission on the
        Asset.
      operationId: sendAssetCommand
      parameters:
        - name: assetId
          in: path
          description: AssetId
          required: true
          schema:
            type: string
        - name: commandName
          in: path
          description: CommandName
          required: true
          schema:
            type: string
      requestBody:
        description: Asset command payload
        content:
          application/json:
            schema: {}
        required: false
      responses:
        '200':
          description: Command sent
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getAssetCommandStatus'
        '400':
          description: Request validation failed
        '403':
          description: >-
            Unauthorized. The current user does not have ***manage*** permission
            on the Asset
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    get:
      tags:
        - Asset
      summary: Get command status
      description: Get the status of the last executed command.
      operationId: getAssetCommandStatus
      parameters:
        - name: assetId
          in: path
          description: AssetId
          required: true
          schema:
            type: string
        - name: commandName
          in: path
          description: CommandName
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Command status
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getAssetCommandStatus'
        '403':
          description: >-
            Unauthorized. The current user does not have ***manage*** permission
            on the Asset.
        '404':
          description: No command found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /assets/{assetId}/properties/desired:
    put:
      tags:
        - Asset
      summary: Update desired properties
      description: Update desired properties of an Asset
      operationId: updateAssetDesiredProperties
      parameters:
        - name: assetId
          in: path
          description: AssetId
          required: true
          schema:
            type: string
      requestBody:
        description: Asset desired properties body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/assetProperties'
        required: true
      responses:
        '200':
          description: Successful operation
        '404':
          description: Asset not found
    get:
      tags:
        - Asset
      summary: Get desired properties
      description: Get desired properties of an Asset
      operationId: getAssetDesiredProperties
      parameters:
        - name: assetId
          in: path
          description: AssetId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/assetProperties'
        '404':
          description: Asset not found
  /assets/{assetId}/properties/reported:
    get:
      tags:
        - Asset
      summary: Get reported properties
      description: Get reported properties of an Asset
      operationId: getAssetReportedProperties
      parameters:
        - name: assetId
          in: path
          description: AssetId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/assetProperties'
        '404':
          description: Asset not found
  /providers:
    get:
      tags:
        - Provider
      summary: Get Providers
      description: Get all Providers or filter by type
      operationId: getAllProviders
      parameters:
        - name: type
          in: query
          description: Filter by type. Examples are "iothub" and "import"
          required: false
          explode: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/provider'
    post:
      tags:
        - Provider
      summary: Create Provider
      description: Create a new provider
      operationId: createProvider
      responses:
        '200':
          description: Successful operation
      requestBody:
        description: Provider
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postProvider'
        required: true
  /providers/{providerId}:
    put:
      tags:
        - Provider
      summary: Create or update an existing Provider
      description: Create or update Provider by Id
      operationId: createUpdateProvider
      parameters:
        - name: providerId
          in: path
          description: Provider id
          required: true
          schema:
            type: string
      requestBody:
        description: Create or update a Provider
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/putProvider'
        required: true
      responses:
        '200':
          description: Successful operation
    get:
      tags:
        - Provider
      summary: Get provider by ID
      description: Returns a single Provider
      operationId: getByProviderId
      parameters:
        - name: providerId
          in: path
          description: ID of Provider to return
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/provider'
        '404':
          description: Provider not found
    delete:
      tags:
        - Provider
      summary: Deletes a provider
      description: Delete a provider
      operationId: deleteProvider
      parameters:
        - name: providerId
          in: path
          description: Provider id to delete
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
  /providers/{providerId}/clients:
    get:
      tags:
        - ProviderClient
      summary: Get Clients
      description: Get all clients from a Provider
      operationId: getAllProviderClients
      parameters:
        - name: providerId
          in: path
          description: Requests a list of clients from a Provider
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/getProviderClients'
    post:
      tags:
        - ProviderClient
      summary: Create Client
      description: Create a new client
      operationId: createProviderClient
      parameters:
        - name: providerId
          in: path
          description: Creates a new Provider Client
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
        '409':
          description: Non unique id or bad template
      requestBody:
        description: Provider Client
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postProviderClient'
        required: true
  /providers/{providerId}/clients/{clientId}:
    get:
      tags:
        - ProviderClient
      summary: Get Client
      description: Get a client from Provider including Provider Data
      operationId: getProviderClient
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
        - name: componentId
          in: query
          description: Component identifier (module)
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getProviderClient'
    delete:
      tags:
        - ProviderClient
      summary: Delete Client
      description: Delete a client
      operationId: deleteProviderClient
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
        '404':
          description: Client not found on Provider
    patch:
      tags:
        - ProviderClient
      summary: Update Client properties
      description: Update properties on a Provider Client
      operationId: patchProviderClient
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
      requestBody:
        description: Update a subset of properties on a Provider Client
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/patchProviderClient'
        required: true
      responses:
        '200':
          description: Successful operation
        '404':
          description: Client not found on Provider
  /providers/{providerId}/clients/{clientId}/provision:
    post:
      tags:
        - ProviderClient
      summary: Provisions a provider client onto it's provider infrastructure
      description: >-
        If a template is used, include a refrence to the template using
        templateId
      operationId: provision
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
      requestBody:
        required: true
        description: >-
          Provision request body. Defaults: Iot-device, Sas authentication,
          enabled
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProvisionRequestBody'
            examples:
              IotDevice1:
                summary: Provision an iot-device onto iot-hub provider (Minimal))
                value:
                  Options:
                    hub: someHubName
              IotDevice2:
                summary: Provision an iot-device onto iot-hub provider
                value:
                  Options:
                    hub: someHubName
                    isEdge: false
                    deviceEnabled: true
                    authenticationType: sas
                    IoTDeviceProvisioningOptions:
                      DesiredProperties:
                        UpdateInterval: 10
              IotDeviceCACertificate:
                summary: >-
                  Provision an iot-device with CA Cert Authentication onto
                  iot-hub provider
                value:
                  Options:
                    hub: someHubName
                    authenticationType: certificateAuthority
              EdgeDevice:
                summary: Provision an edge-device on to iot-hub provider
                value:
                  Options:
                    hub: someHubName
                    isEdge: true
                    deviceEnabled: true
                    EdgeDeviceProvisioningOptions:
                      Manifest: {}
                      DeviceDesiredProperties:
                        UpdateInterval: 10
                      ModulesDesiredProperties:
                        module1Name:
                          UpdateInterval: 10
                        module2Name:
                          UpdateInterval: 20
              ImportEntity:
                summary: Provision an entity onto Import provider)
                value:
                  options:
                    Signals:
                      - Id: telemetry1
                      - Id: telemetry2
      responses:
        '200':
          description: Successful operation
        '400':
          description: Unsuccessful operation
        '409':
          description: Unsuccessful operation
  /providers/{providerId}/clients/{clientId}/unprovision:
    post:
      tags:
        - ProviderClient
      summary: Unprovisions a provider client from it's provider infrastructure
      operationId: unprovision
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
        '404':
          description: Client not found on Provider
  /providers/{providerId}/clients/{clientId}/directMethod:
    post:
      tags:
        - ProviderClient
      summary: Run direct method command
      description: Synchronously execute a remote mehod on the Client
      operationId: runDirectMethod
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
      requestBody:
        description: Direct mehod request with optional payload
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postDirectMethod'
        required: true
      responses:
        '200':
          description: Successful operation
        '404':
          description: >-
            Provider client not found | Component not found | Provider client
            offline
        '409':
          description: Unprovisioned Provider client
        '504':
          description: Unsuccessful remote method call | Timeout.
  /providers/{providerId}/clients/{clientId}/reportedProperties:
    get:
      tags:
        - ProviderClient
      summary: Get reported properties
      description: Get reported properties for a Provider Client
      operationId: getReportedProperties
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
        - name: componentId
          in: query
          description: Component identifier (module)
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                example:
                  tempsettings:
                    hightemp: 20
                    lowtem: 10
                  updatefreq: 20
  /providers/{providerId}/clients/{clientId}/desiredProperties:
    get:
      tags:
        - ProviderClient
      summary: Get desired properties
      description: Get desired properties for a Provider Client
      operationId: getDesiredProperties
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
        - name: componentId
          in: query
          description: Component identifier (module)
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: object
                example:
                  tempsettings:
                    hightemp: 20
                    lowtemp: 10
                  updatefreq: 20
    post:
      tags:
        - ProviderClient
      summary: Set desired properties
      description: Set desired properties on a Provider Client
      operationId: setDesiredProperties
      parameters:
        - name: providerId
          in: path
          description: ProviderId
          required: true
          schema:
            type: string
        - name: clientId
          in: path
          description: ClientId
          required: true
          schema:
            type: string
      requestBody:
        description: Desired properties body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updateDesiredPropertiesRequestBody'
        required: true
      responses:
        '200':
          description: Successful operation
        '400':
          description: Template not found
        '409':
          description: Template disabled
  /providertemplates:
    get:
      tags:
        - ProviderTemplate
      summary: Get Templates
      description: Get all templates for a Provider
      operationId: getAllProviderTemplates
      parameters:
        - name: tagFilter
          required: false
          in: query
          description: Only fetch templates with the matching tags.
          example: AssetModel=myModel
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/getProviderTemplate'
    post:
      tags:
        - ProviderTemplate
      summary: Create a Template
      description: Create a new Provider Template
      operationId: postProviderTemplate
      requestBody:
        description: Create Template body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postProviderTemplate'
            examples:
              iotDevice:
                summary: IotHub - Iot device
                value:
                  tags:
                    AssetModel:
                      - model1
                      - model2
                    PublishingStatus:
                      - Draft
                  displayName: Default iot-hub device template
                  description: This template is used to provision iot-devices onto iot-hub
                  enabled: false
                  options:
                    hub: iothub-name
                    isEdge: false
                    iotDeviceTemplateOptions:
                      desiredProperties:
                        test: 1
                  organizationId: org1
              edgeDevice:
                summary: IotHub - Edge device
                value:
                  tags:
                    AssetModel:
                      - model1
                      - model2
                    PublishingStatus:
                      - Draft
                  displayName: Default iot-hub edge device template
                  description: This template is used to provision edge-devices onto iot-hub
                  options:
                    hub: iothub-name
                    isEdge: true
                    edgeDeviceTemplateOptions:
                      manifest:
                        $edgeAgent: {}
                        $edgeHub: {}
                        myModule: {}
                      deviceDesiredProperties:
                        test: 1
                      modulesDesiredProperties:
                        myModule:
                          test: 1
                  organizationId: org1
        required: true
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getProviderTemplate'
  /providertemplates/{templateId}:
    get:
      tags:
        - ProviderTemplate
      summary: Get Template
      description: Get a provider template
      operationId: getProviderTemplate
      parameters:
        - name: templateId
          in: path
          description: TemplateId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getProviderTemplate'
    put:
      tags:
        - ProviderTemplate
      summary: Update Provider Template
      description: Update an exising Provider Template
      operationId: putProviderTemplate
      parameters:
        - name: templateId
          in: path
          description: TemplateId
          required: true
          schema:
            type: string
      requestBody:
        description: Update Template body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/providerTemplate'
        required: true
      responses:
        '200':
          description: Successful operation
    delete:
      tags:
        - ProviderTemplate
      summary: Delete Template
      description: Delete a Provider Template
      operationId: deleteProviderTemplate
      parameters:
        - name: templateId
          in: path
          description: TemplateId
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful operation
        '404':
          description: Provider Template not found
  /graph/nodes:
    post:
      tags:
        - Graph
      summary: Create a new node
      description: Create a new node that can be part of a tree or the start node of a tree
      operationId: postNode
      requestBody:
        description: Create node body
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNodeBody'
        required: true
      responses:
        '201':
          description: Created
          headers:
            location:
              schema:
                type: string
                format: uri
              description: Url to created node
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Node'
          links:
            GetNodeById:
              operationId: getNode
              parameters:
                id: $response.body#/id
              description: >
                The `id` value returned in the response can be used as the `id`
                parameter in `GET /nodes/{id}`.
        '400':
          description: Request validation failed
        '403':
          description: >-
            Unauthorized. User, Org or Tenant does not have the required
            Privilege
        '404':
          description: No match for gateway route
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /graph/nodes/{id}:
    get:
      operationId: getNode
      summary: Get a node
      tags:
        - Graph
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Node'
        '400':
          description: Request validation failed
        '403':
          description: >-
            Unauthorized. User, Org or Tenant does not have the required
            Privilege or Permission
        '404':
          description: No match for gateway route, Node not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
    patch:
      operationId: patch-node
      summary: Update a node
      description: Patch the Node with new **displayName** or **description**
      tags:
        - Graph
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NodePatch'
      responses:
        '200':
          description: OK
        '403':
          description: Permission denied
        '404':
          description: Not found
    delete:
      operationId: deleteNode
      summary: >-
        Delete a node. Any child nodes will be deleted. Any linked resources
        will be unlinked.
      tags:
        - Graph
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '400':
          description: Request validation failed
        '403':
          description: >-
            Unauthorized. User, Org or Tenant does not have the required
            Privilege or Permission
        '404':
          description: No match for gateway route, Node not found
        '500':
          description: >-
            Unforeseen error in Gateway or App server. (Including downstream
            services.) Check logs.
  /graph/edges:
    post:
      tags:
        - Graph
      summary: Link graph items by creating an edge in the graph
      operationId: post-edge
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostEdge'
      responses:
        '200':
          description: OK
  /graph/edges/find:
    post:
      tags:
        - Graph
      summary: Find relations
      operationId: find-resource-relations
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostFindEdgesRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Edge'
  /graph/edges/{edgeId}:
    delete:
      tags:
        - Graph
      summary: Remove a relation between a subject and a resource
      operationId: delete-resource-relation
      parameters:
        - name: edgeId
          in: path
          required: true
          schema:
            type: string
            description: Edge Id
      responses:
        '204':
          description: No content
  /graph/trees:
    get:
      tags:
        - Graph
      summary: Get list of trees (Nodes that are unparented)
      description: Get a list of start nodes (trees) available for the user.
      operationId: getTrees
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Node'
  /graph/trees/{startNodeId}:
    get:
      tags:
        - Graph
      summary: Get a tree based on a start node
      description: Get a specific tree
      operationId: getTree
      parameters:
        - name: startNodeId
          in: path
          description: Optional start node Id
          required: true
          schema:
            type: string
        - name: depth
          in: query
          description: Optional search depth in the graph
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TreeHierarchyNode'
        '404':
          description: Not found
  /models:
    get:
      tags:
        - Model
      summary: Get all models
      operationId: get-models
      responses:
        '200':
          description: OK
        '401':
          description: Unauthorized
    post:
      tags:
        - Model
      summary: Create a new model
      operationId: post-model
      requestBody:
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '401':
          description: Unauthorized
        '409':
          description: Conflict
  /models/{modelId}:
    get:
      tags:
        - Model
      summary: Get model
      operationId: get-model
      parameters:
        - name: modelId
          in: path
          description: ID of model
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not found
    delete:
      tags:
        - Model
      summary: Delete model
      operationId: delete-model
      parameters:
        - name: modelId
          in: path
          description: ID of model
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
        '400':
          description: Bad Request
        '403':
          description: Forbidden
        '404':
          description: Not found
  /models/{modelId}/dtdl:
    get:
      tags:
        - Model
      summary: Get DTDL model
      operationId: get-dtdl-model
      parameters:
        - name: modelId
          in: path
          description: ID of model
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad Request
        '404':
          description: Not found
  /models/dtdl/validate:
    post:
      tags:
        - Model
      summary: Validate a DTDL model
      operationId: validate-dtdl-model
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
  /bindings:
    get:
      tags:
        - Binding description
      summary: Get binding descriptions
      operationId: get-binding-descriptions
      responses:
        '200':
          description: OK
    post:
      tags:
        - Binding description
      summary: Create binding description
      operationId: post-binding-description
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
  /bindings/{bindingDescriptionId}:
    get:
      tags:
        - Binding description
      summary: Get binding description
      operationId: get-binding-description
      parameters:
        - name: bindingDescriptionId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
    delete:
      tags:
        - Binding description
      summary: Delete binding description
      operationId: delete-binding-description
      parameters:
        - name: bindingDescriptionId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Forbidden
        '404':
          description: Not found
    patch:
      tags:
        - Binding description
      summary: Update binding description
      operationId: patch-binding-description
      parameters:
        - name: bindingDescriptionId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Forbidden
        '404':
          description: Not found
  /bindings/model/{modelId}:
    get:
      tags:
        - Binding description
      summary: Get binding descriptions for asset model
      operationId: get-binding-descriptions-for-model
      parameters:
        - name: modelId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
  /bindings/generate/{modelId}/{endpointId}:
    post:
      tags:
        - Binding description
      summary: Generate a binding description from a model ID and an endpoint ID
      operationId: generate-binding-description
      parameters:
        - name: modelId
          in: path
          required: true
          schema:
            type: string
        - name: endpointId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
  /models/drafts:
    get:
      tags:
        - Model draft
      summary: Get model drafts
      operationId: get-model-drafts
      responses:
        '200':
          description: OK
    post:
      tags:
        - Model draft
      summary: Create model draft
      operationId: post-model-draft
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Forbidden
        '409':
          description: Conflict
  /models/drafts/{modelDraftId}:
    get:
      tags:
        - Model draft
      summary: Get model draft
      operationId: get-model-draft
      parameters:
        - name: modelDraftId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
    put:
      tags:
        - Model draft
      summary: Update model draft
      operationId: put-model-draft
      parameters:
        - name: modelDraftId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Not found
    delete:
      tags:
        - Model draft
      summary: Delete model draft
      operationId: delete-model-draft
      parameters:
        - name: modelDraftId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Forbidden
        '404':
          description: Not found
  /models/drafts/{modelDraftId}/promote:
    post:
      tags:
        - Model draft
      summary: Promote model draft
      operationId: promote-model-draft
      parameters:
        - name: modelDraftId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
  /bindings/drafts:
    get:
      tags:
        - Binding description draft
      summary: Get binding description drafts
      operationId: get-binding-description-drafts
      responses:
        '200':
          description: OK
    post:
      tags:
        - Binding description draft
      summary: Create binding description draft
      operationId: post-binding-description-draft
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Forbidden
  /bindings/drafts/{bindingDescriptionDraftId}:
    get:
      tags:
        - Binding description draft
      summary: Get binding description draft
      operationId: get-binding-description-draft
      parameters:
        - name: bindingDescriptionDraftId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
    delete:
      tags:
        - Binding description draft
      summary: Delete binding description draft
      operationId: delete-binding-description-draft
      parameters:
        - name: bindingDescriptionDraftId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '404':
          description: Not found
    put:
      tags:
        - Binding description draft
      summary: Update binding description draft
      operationId: put-binding-description-draft
      parameters:
        - name: bindingDescriptionDraftId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '403':
          description: Forbidden
  /bindings/drafts/model/{modelId}:
    get:
      tags:
        - Binding description draft
      summary: Get binding description drafts for model
      operationId: get-binding-description-drafts-for-model
      parameters:
        - name: modelId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '404':
          description: Not found
  /bindings/drafts/{bindingDescriptionId}/promote:
    post:
      tags:
        - Binding description draft
      summary: Promote binding description draft
      operationId: promote-binding-description-draft
      parameters:
        - name: bindingDescriptionId
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
        '400':
          description: Bad request
        '404':
          description: Not found
  /alarms:
    get:
      tags:
        - Alarms
      description: Fetch alarms or alarm if alarmId is provided
      parameters:
        - name: alarmId
          in: query
          description: Alarm id
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
        '400':
          description: Bad request
        '401':
          description: Unauthorized
        '403':
          description: Forbidden
        '404':
          description: Not found
    post:
      tags:
        - Alarms
      description: Create a new alarm
      parameters: []
      requestBody:
        description: Alarm object
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Alarm'
        required: true
      responses:
        '200':
          description: OK
    delete:
      tags:
        - Alarms
      description: Delete an alarm
      parameters:
        - name: alarmId
          in: query
          description: Alarm id
          required: true
          schema:
            type: string
      responses:
        '204':
          description: No content
    put:
      tags:
        - Alarms
      description: Update an alarm
      parameters:
        - name: alarmId
          in: query
          description: Alarm id
          required: true
          schema:
            type: string
      requestBody:
        description: Alarm object
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Alarm'
        required: true
      responses:
        '200':
          description: OK
  /alarms/status:
    get:
      tags:
        - Alarms
      description: >-
        returns all alarms that are active for the alarms accessible for the
        user
      parameters: []
      responses:
        '200':
          description: OK
  /alarms/status/entity/{entityId}:
    get:
      tags:
        - Alarms
      description: get alarm status for a specific entity
      parameters:
        - name: entityId
          in: path
          description: Entity id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
  /alarms/status/acknowledge/{alarmStatusId}:
    put:
      tags:
        - Alarms
      description: alarm status id to acknowledge
      parameters:
        - name: alarmStatusId
          in: path
          description: Alarm status id
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
  /assets/migrate:
    post:
      tags:
        - Asset
      description: Migrate an asset to a new model
      parameters: []
      requestBody:
        description: Migration object
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssetMigration'
        required: true
      responses:
        '200':
          description: OK
security:
  - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    provider:
      type: object
      properties:
        id:
          type: string
          example: myProviderId
        type:
          type: string
          example: iothub
        displayName:
          type: string
          example: My Provider
        description:
          type: string
          example: Description of My Provider
    postProvider:
      type: object
      required:
        - displayName
        - organizationId
        - type
      properties:
        id:
          type: string
          example: myProviderId
        type:
          type: string
          example: iothub
        displayName:
          type: string
          example: My Provider
        description:
          type: string
          example: Description of My Provider
        organizationId:
          type: string
          example: org1
    putProvider:
      type: object
      required:
        - displayName
      properties:
        type:
          type: string
          example: iothub
        displayName:
          type: string
          example: My Provider
        description:
          type: string
          example: Description of My Provider
    patchProviderClient:
      type: object
      properties:
        displayName:
          type: string
          example: My Provider Client Display name
          nullable: true
        description:
          type: string
          example: My Provider Client Description
          nullable: true
        enabled:
          type: boolean
          example: true
          default: true
          nullable: true
    postDirectMethod:
      type: object
      properties:
        componentId:
          type: string
          nullable: true
          example: sensehat
        method:
          type: string
          example: lightsOn
        payload:
          type: object
          example:
            theme: christmas01
          nullable: true
    postAssetCommand:
      type: object
      properties:
        commandName:
          type: string
          nullable: false
          example: print_text
        payload:
          type: object
          example:
            text: hello
          nullable: true
        correlationId:
          type: string
          example: 19b69bd2-4194-4fea-b59d-7682fd1b36d3
          nullable: true
    getAssetCommandStatus:
      type: object
      properties:
        commandId:
          type: string
          example: myDevice1.start
        requestTimestamp:
          type: string
          format: date-time
          example: '2024-04-04T04:04:04.000Z'
        responseTimestamp:
          type: string
          format: date-time
          example: '2024-04-04T04:04:06.000Z'
        status:
          type: string
          example: running
        statusMessage:
          type: string
          example: Command is running
        requestPayload:
          type: object
          example: null
        responsePayload:
          type: object
          example: null
        correlationId:
          type: string
          example: CB2886DC-6CFE-4AB3-B3BC-76B51DFE4B1B
    assetProperties:
      type: object
      example:
        assetComponent:
          reportInterval: 10
          connectionConfigObject:
            connectionString: >-
              HostName=iothub-somethingsomething-1234567-1234567-1234567-1234567.azure-devices.net;DeviceId=MyDevice;SharedAccessKey=1234567890123456789012345678901234567890123456789012345678901234=
        maxFlowThreshold: 230
        location: somewhere
        meterType: Meter3000
    updateDesiredPropertiesRequestBody:
      type: object
      properties:
        componentId:
          type: string
          nullable: true
          example: sensehat
        properties:
          type: object
          additionalProperties:
            type: object
      example:
        componentId: sensehat
        tempsettings:
          hightemp: 20
          lowtemp: 10
          updatefreq: 20
    postProviderClient:
      type: object
      required:
        - id
        - displayName
        - organizationId
      properties:
        id:
          type: string
          example: myClientId
        displayName:
          type: string
          example: My Client
        description:
          type: string
          example: My Provider Client description
        enabled:
          type: boolean
          example: true
        organizationId:
          type: string
    getProviderClient:
      type: object
      properties:
        id:
          type: string
          example: myClientId
        displayName:
          type: string
          example: My Client
        description:
          type: string
          example: My Provider Client description
        templateId:
          type: string
          example: fc006ddc-e939-4d66-bf6d-4b53b10d812b
          nullable: true
        templateApplied:
          type: string
          format: date
          nullable: true
          example: '2020-02-08 09:30:26.123Z'
        enabled:
          type: string
          example: true
        providerData:
          type: object
          example:
            someProviderDataPropertyName: someProviderDataPropertyValue
    getProviderClients:
      type: object
      properties:
        id:
          type: string
          example: myClientId
        displayName:
          type: string
          example: My Client
        description:
          type: string
          example: My Provider Client description
        templateid:
          type: string
          example: fc006ddc-e939-4d66-bf6d-4b53b10d812b
        enabled:
          type: boolean
          example: true
    postProviderTemplate:
      type: object
      properties:
        tags:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        displayName:
          type: string
          example: Default iot-hub edge device template
        description:
          type: string
          example: This template is used to provision generic edge-devices onto iot-hub
        enabled:
          type: string
          example: true
          default: true
          description: If disabled, no new clients can be created using this template
        options:
          type: object
          description: Provider specific options
          example:
            hub: iothub-name
            isEdge: true
            edgeDeviceTemplateOptions:
              manifest: {}
              deviceDesiredProperties:
                test: 1
              modulesDesiredProperties:
                sensehat:
                  test: 1
        organizationId:
          type: string
          example: org1
      required:
        - displayName
        - organizationId
    providerTemplate:
      type: object
      properties:
        tags:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
        displayName:
          type: string
          example: Default iot-hub edge device template
        description:
          type: string
          example: This template is used to provision generic edge-devices onto iot-hub
        enabled:
          type: string
          example: true
          description: If disabled, no new clients can be created using this template
        options:
          type: object
          description: Provider specific options
          example:
            hub: iothub-name
            isEdge: true
            edgeDeviceTemplateOptions:
              manifest: {}
              deviceDesiredProperties:
                test: 1
              modulesDesiredProperties:
                sensehat:
                  test: 1
    getProviderTemplate:
      type: object
      properties:
        id:
          type: string
          example: e6c27027-6c25-4e81-b6a0-a9bd9af184eb
        displayName:
          type: string
          example: Default iot-hub edge device template
        description:
          type: string
          example: This template is used to provision edge-devices onto iot-hub
        enabled:
          type: string
          example: true
          description: If disabled, no new clients can be created using this template
        options:
          type: object
          description: Provider specific options
          example:
            hub: iothub-name
            isEdge: true
            edgeDeviceTemplateOptions:
              manifest: {}
              deviceDesiredProperties:
                test: 1
              modulesDesiredProperties:
                sensehat:
                  test: 1
    NamedEndpointId:
      type: object
      properties:
        name:
          type: string
          description: The name of the endpoint ID
        endpointId:
          type: string
          description: The endpoint ID
    EndpointBinding:
      type: object
      properties:
        localEndpointId:
          type: string
          description: The local endpoint ID
        remoteEndpointIds:
          type: array
          items:
            $ref: '#/components/schemas/NamedEndpointId'
          description: The remote endpoint IDs
        bindingType:
          type: string
          description: The binding operation type deciding this result
          enum:
            - default
            - input
            - output
        transform:
          type: object
        inverseTransform:
          type: object
    BindingDescriptionBinding:
      type: object
      properties:
        bindingDescriptionId:
          type: string
        instances:
          type: array
          items:
            type: object
            properties:
              instanceName:
                type: string
              instanceId:
                type: string
        localComponentEndpointId:
          type: string
          nullable: true
    AssetBindingData:
      type: object
      description: Asset binding data
      properties:
        endpointBindings:
          type: array
          items:
            $ref: '#/components/schemas/EndpointBinding'
    BindingDescriptionBindDefinition:
      type: object
      description: A definition of the usage of a binding description
      properties:
        bindingDescriptionId:
          type: string
          description: The ID of the binding description
    GetDashboardsResponse:
      type: array
      items:
        $ref: '#/components/schemas/Dashboard'
    Dashboard:
      type: object
      description: Dashboard
      properties:
        id:
          type: string
        data:
          type: object
          description: Dashboard data
        displayName:
          type: string
        description:
          type: string
          nullable: true
        authorizationContext:
          $ref: '#/components/schemas/AuthorizationContext'
      required:
        - id
        - displayName
      example:
        id: dashboard1
        data:
          someDashboardSpecificData: data
        displayName: Temperature Dashboard1
        description: Shows temperatures over time for Assets of model x
        authorizationContext:
          viewableByOrganizations:
            - org1
            - org2
    DashboardPatch:
      type: object
      description: Dashboard patch
      properties:
        displayName:
          type: string
        description:
          type: string
        data:
          type: object
      example:
        displayName: Temperature Dashboard1
        description: Shows temperatures over time for Assets of model x
    DashboardPost:
      type: object
      description: Dashboard post
      properties:
        data:
          type: object
        displayName:
          type: string
        description:
          type: string
        organizationId:
          type: string
      required:
        - id
        - displayName
        - organizationId
      example:
        displayName: Temperature Dashboard1
        description: Shows temperatures over time for Assets of model x
        organizationId: myOrg
        data:
          someDashboardSpecificData: data
    GetAssetsResponse:
      type: array
      items:
        $ref: '#/components/schemas/Asset'
    GetContactGroupsResponse:
      type: array
      items:
        $ref: '#/components/schemas/ContactGroup'
    ContactGroup:
      type: object
      description: ContactGroup
      properties:
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
        users:
          type: array
          description: List of users IDs
          items:
            type: string
        userGroups:
          type: array
          description: List of groups IDs
          items:
            type: string
      required:
        - id
        - displayName
      example:
        id: contactgroup1
        displayName: ContactGroup1
        description: Description
        users:
          - user1
          - user2
        userGroups:
          - group1
          - group2
    ContactGroupPost:
      type: object
      description: Contact Group post
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        users:
          type: array
          items:
            type: string
        userGroups:
          type: array
          items:
            type: string
      required:
        - displayName
      example:
        displayName: ContactGroup1
        description: Description
        users:
          - user1
          - user2
        userGroups:
          - group1
          - group2
        organizationId: organization-1
    ContactGroupPatch:
      type: object
      description: Contact Group patch
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        users:
          type: array
          items:
            type: string
        userGroups:
          type: array
          items:
            type: string
      example:
        displayName: ContactGroup1
        description: Description
        users:
          - user1
          - user2
        userGroups:
          - group1
          - group2
    Release:
      type: object
      description: Release
      properties:
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
          nullable: true
        startingModels:
          type: array
          items:
            $ref: '#/components/schemas/StartingModel'
        propertyValues:
          type: array
          items:
            $ref: '#/components/schemas/PropertyValue'
        fileResourceId:
          type: string
      example:
        id: release1
        displayName: Release1
        description: Description
        startingModels:
          - id: model1
            displayName: Model1
        propertyValues:
          - key: key1
            value: value1
        fileResourceId: resource1
    ReleasePut:
      type: object
      description: Release put
      properties:
        displayName:
          type: string
          nullable: false
        description:
          type: string
        startingModels:
          type: array
          items:
            $ref: '#/components/schemas/StartingModel'
        propertyValues:
          type: array
          items:
            $ref: '#/components/schemas/PropertyValue'
        fileResourceId:
          type: string
        fileName:
          type: string
      example:
        displayName: Release1
        description: Description
        startingModels:
          - id: model1
            displayName: Model1
        propertyValues:
          - key: key1
            value: value1
        fileResourceId: resource1
        fileName: firmware.txt
    ReleasePost:
      type: object
      description: Release post
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        startingModels:
          type: array
          items:
            $ref: '#/components/schemas/StartingModel'
        propertyValues:
          type: array
          items:
            $ref: '#/components/schemas/PropertyValue'
        organizationId:
          type: string
        fileResourceId:
          type: string
          nullable: true
        fileName:
          type: string
      required:
        - displayName
        - organizationId
      example:
        displayName: Release1
        description: Description
        startingModels:
          - id: model1
            displayName: Model1
        propertyValues:
          - key: key1
            value: value1
        fileResourceId: resource1
        organizationId: organization-1
        fileName: firmware.txt
    ReleaseUploadPost:
      type: object
      description: Release upload post
      properties:
        organizationId:
          type: string
        file:
          type: string
          format: binary
      example:
        file: IFormFile
        organizationId: organization1
    StartingModel:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
    PropertyValue:
      type: object
      properties:
        key:
          type: string
        value:
          type: string
    DeploymentPost:
      type: object
      description: Deployment post
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        deploymentTemplateId:
          type: string
        releaseId:
          type: string
        deviceIds:
          type: array
          items:
            type: string
        organizationId:
          type: string
      required:
        - displayName
        - deploymentTemplateId
        - releaseId
        - deviceIds
        - organizationId
      example:
        displayName: Deployment 1
        description: Description
        deploymentTemplateId: deployment-template-1
        releaseId: release-1
        deviceIds:
          - device-1
          - device-2
        organizationId: organization-1
    DeploymentPatch:
      type: object
      description: Deployment patch
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        deploymentTemplateId:
          type: string
        releaseId:
          type: string
        deviceIds:
          type: array
          items:
            type: string
      example:
        displayName: Deployment 1
        description: Description
        deploymentTemplateId: deployment-template-1
        releaseId: release-1
        deviceIds:
          - device-1
          - device-2
    Deployment:
      type: object
      description: Deployment
      properties:
        deploymentId:
          type: string
        displayName:
          type: string
        description:
          type: string
        deploymentTemplateId:
          type: string
        releaseId:
          type: string
        deviceIds:
          type: array
          items:
            type: string
      example:
        deploymentId: deployment-1
        displayName: Deployment 1
        description: Description
        deploymentTemplateId: deployment-template-1
        releaseId: release-1
        deviceIds:
          - device-1
          - device-2
    DeploymentTemplatePost:
      type: object
      description: Deployment method template post
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        version:
          type: string
        steps:
          type: array
          items:
            $ref: '#/components/schemas/TemplateStep'
        status:
          type: object
          properties:
            statusType:
              type: string
            statusPropertyName:
              type: string
            statusMap:
              type: object
              properties:
                successStatuses:
                  type: array
                  items:
                    type: object
                failureStatuses:
                  type: array
                  items:
                    type: object
                rejectStatuses:
                  type: array
                  items:
                    type: object
                cancelStatuses:
                  type: array
                  items:
                    type: object
        organizationId:
          type: string
      example:
        displayName: Deployment Template 1
        description: Description
        version: 0.0.1
        steps:
          - name: FirmwareVersion
            displayName: Update Firmware
            type: SetProperty
            value: 1.0.5
          - тame: RebootRequired
            displayName: Reboot Device
            type: SetProperty
            value: '234'
        status:
          statusPropertyName: DeploymentStatus
          statusMap:
            successStatuses:
              - value: Success
            failureStatuses:
              - value: Failure
            rejectStatuses:
              - value: Rejected
            cancelStatuses:
              - value: Canceled
          statusType: ReportedProperty
        organizationId: organization-1
    TemplateStep:
      type: object
      description: Deployment method template step
      properties:
        type:
          type: string
        name:
          type: string
        value:
          type: string
        displayName:
          type: string
    DeploymentStartPost:
      type: object
      description: Start Deployment post
      properties:
        deploymentId:
          type: string
        steps:
          type: array
          items:
            type: object
            properties:
              propertyValue:
                type: object
                nullable: true
              propertyName:
                type: string
              displayName:
                type: string
              type:
                type: string
                enum:
                  - SetProperty
        status:
          type: object
          properties:
            statusPropertyName:
              type: string
            statusMap:
              type: object
              properties:
                successStatusValues:
                  type: array
                  items:
                    type: object
                failureStatusValues:
                  type: array
                  items:
                    type: object
                rejectStatusValues:
                  type: array
                  items:
                    type: object
                cancelStatusValues:
                  type: array
                  items:
                    type: object
            statusType:
              type: string
              enum:
                - ReportedProperty
        providerClientIds:
          type: array
          items:
            type: string
      required:
        - status
        - steps
        - id
        - providerClientIds
      example:
        deploymentId: deploy-12345
        steps:
          - propertyName: FirmwareVersion
            displayName: Update Firmware
            type: SetProperty
            propertyValue:
              value: 1.0.5
          - propertyName: RebootRequired
            displayName: Reboot Device
            type: SetProperty
            propertyValue:
              value: true
        status:
          statusPropertyName: DeploymentStatus
          statusMap:
            successStatusValues:
              - value: Success
            failureStatusValues:
              - value: Failure
            rejectStatusValues:
              - value: Rejected
            cancelStatusValues:
              - value: Canceled
          statusType: ReportedProperty
        providerClientIds:
          - device1
          - device2
    DeploymentTemplate:
      type: object
      description: Deployment method template
      properties:
        name:
          type: string
        description:
          type: string
          nullable: true
        version:
          type: string
        steps:
          type: array
          items:
            $ref: '#/components/schemas/TemplateStep'
        status:
          type: object
          properties:
            statusType:
              type: string
            statusPropertyName:
              type: string
            statusMap:
              type: object
              properties:
                successStatusValues:
                  type: array
                  items:
                    type: object
                failureStatusValues:
                  type: array
                  items:
                    type: object
                rejectStatusValues:
                  type: array
                  items:
                    type: object
                cancelStatusValues:
                  type: array
                  items:
                    type: object
        templateId:
          type: string
      example:
        displayName: Deployment Template 1
        description: Description
        version: 0.0.1
        steps:
          - name: FirmwareVersion
            displayName: Update Firmware
            type: SetProperty
            value: 1.0.5
          - тame: RebootRequired
            displayName: Reboot Device
            type: SetProperty
            value: '234'
        status:
          statusPropertyName: DeploymentStatus
          statusMap:
            successStatuses:
              - value: Success
            failureStatuses:
              - value: Failure
            rejectStatuses:
              - value: Rejected
            cancelStatuses:
              - value: Canceled
          statusType: ReportedProperty
        templateId: template1
    DeploymentsStatusesPost:
      type: object
      description: Deployment statuses post
      properties:
        ids:
          type: array
          items:
            type: string
      required:
        - ids
    DeploymentStatus:
      type: object
      description: DeploymentStatus
      properties:
        id:
          type: string
        aggregateStatus:
          $ref: '#/components/schemas/FirmwareStatus'
        fwuStatusCounts:
          type: object
          $ref: '#/components/schemas/DeploymentStatusCounts'
        startTimestamp:
          type: string
        endTimestamp:
          type: string
        providerClientStatuses:
          type: array
          items:
            $ref: '#/components/schemas/DeploymentDeviceStatus'
      example:
        id: deployment-12345
        aggregateStatus: Succeeded
        fwuStatusCounts:
          succeeded: 10
          failed: 2
          running: 3
          rejected: 1
          canceled: 0
          ready: 5
        startTimestamp: '2025-06-12T09:36:34.7493006+00:00'
        endTimestamp: '2025-06-12T09:36:34.7941229+00:00'
        providerClientStatuses:
          - providerClientId: client-001
            status: Succeeded
            statusValue:
              details: Firmware updated successfully
            currentStep: 5
            currentStepTimestamp: '2025-05-19T08:30:00Z'
    FirmwareStatus:
      type: string
      enum:
        - Ready
        - Running
        - Failed
        - Success
        - Canceled
        - Rejected
    ProviderClientFwuStatus:
      type: object
      description: Device Status
      properties:
        deploymentId:
          type: string
        status:
          $ref: '#/components/schemas/FirmwareStatus'
        statusValue:
          type: object
        currentStep:
          type: number
        logs:
          type: array
          items:
            type: object
            properties:
              timestamp:
                type: string
              message:
                type: string
              level:
                type: string
                enum:
                  - Error
                  - Information
                  - Trace
              step:
                type: number
    DeploymentStatusCounts:
      type: object
      description: Deployment Status Counts
      properties:
        succeded:
          type: number
        failed:
          type: number
        running:
          type: number
        rejected:
          type: number
        canceled:
          type: number
        ready:
          type: number
    DeploymentDeviceStatus:
      type: object
      description: Deployment Device Status
      properties:
        providerClientId:
          type: string
        status:
          $ref: '#/components/schemas/FirmwareStatus'
        statusValue:
          type: string
        currentStep:
          type: number
        currentStepTimestamp:
          type: string
    Resource:
      type: object
      description: Resource metadata
      properties:
        resource_type:
          type: string
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
        tags:
          type: object
          additionalProperties:
            type: string
        document:
          type: object
        originalFileName:
          type: string
        fileUrl:
          type: string
        metadata:
          type: object
          nullable: true
        history:
          type: object
          nullable: true
      exampleOfResourceWithDocumentContent:
        id: resource1
        resource_type: user-resource
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document:
          sections:
            - title: Introduction
              content: This is the introduction section of the project plan.
            - title: Objectives
              content: The objectives of this project are...
        originalFileName: null
        fileUrl: https://blobstorage/m2vm2b4234nm234g34j23g
        metadata:
          category: documentation
          version: '1.0'
        history:
          - timestamp: '2025-10-01T10:00:00Z'
            action: created
            user: user@example.com
      exampleOfResourceWithFileContent:
        id: resource1
        resource_type: file
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document: null
        originalFileName: Test_File.jpg
        metadata: null
        history: null
    ResourceListItem:
      type: object
      description: >-
        Resource metadata for list responses (excludes history field for
        performance)
      properties:
        resource_type:
          type: string
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
        tags:
          type: object
          additionalProperties:
            type: string
        document:
          type: object
        originalFileName:
          type: string
        fileUrl:
          type: string
        metadata:
          type: object
          nullable: true
      exampleOfResourceWithDocumentContent:
        id: resource1
        resource_type: user-resource
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document:
          sections:
            - title: Introduction
              content: This is the introduction section of the project plan.
            - title: Objectives
              content: The objectives of this project are...
        originalFileName: null
        fileUrl: https://blobstorage/m2vm2b4234nm234g34j23g
        metadata:
          category: documentation
          version: '1.0'
      exampleOfResourceWithFileContent:
        id: resource1
        resource_type: file
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document: null
        originalFileName: Test_File.jpg
        metadata: null
    ResourcePost:
      type: object
      description: Create Resource request body
      properties:
        resource_type:
          type: string
          example: user-resource
          enum:
            - user-resource
        displayName:
          type: string
        description:
          type: string
          nullable: true
        tags:
          type: object
          additionalProperties:
            type: string
        document:
          type: object
        organizationId:
          type: string
        metadata:
          type: object
          nullable: true
        history:
          type: object
          nullable: true
      required:
        - resource_type
        - displayName
        - document
        - organizationId
      example:
        resource_type: user-resource
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document:
          sections:
            - title: Introduction
              content: This is the introduction section of the project plan.
            - title: Objectives
              content: The objectives of this project are...
        organizationId: organization1
        metadata:
          category: documentation
          version: '1.0'
        history:
          - timestamp: '2025-10-01T10:00:00Z'
            action: created
            user: user@example.com
    OrgTemplatePost:
      type: object
      description: Create OrgTemplate request body
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        tags:
          type: object
          additionalProperties:
            type: string
        document:
          type: object
        organizationId:
          type: string
        metadata:
          type: object
          nullable: true
        history:
          type: object
          nullable: true
      required:
        - displayName
        - document
        - organizationId
      example:
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document:
          sections:
            - title: Introduction
              content: This is the introduction section of the project plan.
            - title: Objectives
              content: The objectives of this project are...
        organizationId: organization1
        metadata:
          category: template
          version: '1.0'
        history:
          - timestamp: '2025-11-01T10:00:00Z'
            action: created
            user: admin@example.com
    ResourceUpload:
      type: object
      description: Upload Resource request body
      properties:
        resource_type:
          type: string
          example: user-resource
          enum:
            - user-resource
        displayName:
          type: string
        description:
          type: string
          nullable: true
        file:
          type: string
          format: binary
        organizationId:
          type: string
        tags:
          type: object
          additionalProperties:
            type: string
          nullable: true
        metadata:
          type: object
          nullable: true
        history:
          type: object
          nullable: true
      required:
        - resource_type
        - displayName
        - file
        - organizationId
      example:
        resource_type: user-resource
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        file: IFormFile
        organizationId: organization1
        metadata:
          category: firmware
          version: 2.1.0
        history:
          - timestamp: '2025-10-01T10:00:00Z'
            action: uploaded
            user: user@example.com
    ResourceReupload:
      type: object
      description: Reupload Resource request body
      properties:
        file:
          type: string
          format: binary
        organizationId:
          type: string
        tags:
          type: object
          additionalProperties:
            type: string
          nullable: true
        metadata:
          type: object
          nullable: true
        history:
          type: object
          nullable: true
      required:
        - file
        - organizationId
      example:
        file: IFormFile
        organizationId: organization1
        tags:
          environment: production
          device_type: sensor
        metadata:
          version: 2.2.0
          checksum: abc123
        history:
          - timestamp: '2025-10-05T09:00:00Z'
            action: reuploaded
            user: admin@example.com
    ResourcePatch:
      type: object
      description: Update Resource request body
      properties:
        displayName:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        tags:
          type: object
          additionalProperties:
            type: string
          nullable: true
        document:
          type: object
          nullable: true
        metadata:
          type: object
          nullable: true
        history:
          type: object
          nullable: true
      example:
        displayName: Project Plan
        description: Detailed project plan for Q4.
        tags:
          department: sales
          status: draft
        document:
          sections:
            - title: Introduction
              content: This is the introduction section of the project plan.
            - title: Objectives
              content: The objectives of this project are...
        metadata:
          category: documentation
          version: '1.1'
        history:
          - timestamp: '2025-10-01T10:00:00Z'
            action: created
            user: user@example.com
          - timestamp: '2025-10-02T14:30:00Z'
            action: updated
            user: admin@example.com
    ResourceTagsResponse:
      type: object
      properties:
        resource_id:
          type: string
        tags:
          type: array
          items:
            type: object
            properties:
              key:
                type: string
              value:
                type: string
      updateTagsExample:
        resource_id: id
        tags:
          - key: new_tag1
            value: value1
          - key: updated_tag2
            value: value2
      deleteTagsExample:
        resource_id: id
        tags: []
    Notification:
      type: object
      description: Notification
      properties:
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
        broadcast:
          type: boolean
          description: >-
            If the notification should be broadcasted to all organizations that
            have view access on the notification. Broadcast uses the
            organizations' notification contacts. Not contact groups.
            (Default=false)
        trigger:
          type: object
          description: List of alarm IDs
        channels:
          type: object
          description: Email/SMS active property and template
        triggerIdentifier:
          type: string
        workflowId:
          type: string
        subscribers:
          type: object
          description: List of Contact Groups
      required:
        - id
        - displayName
        - trigger
        - channels
        - workflowId
      example:
        id: notification1
        displayName: Notification1
        description: Description
        broadcast: false
        trigger:
          alarmTrigger:
            - alarmId1
            - alarmId2
        channels:
          email:
            active: true
            template: >-
              {{alarmName}} triggered on Asset: {{assetName}}. Click here to
              acknowledge: {{ackUrl}}
            from: Sender1
            subject: Any subject
          sms:
            active: false
            template: >-
              {{alarmName}} triggered on Asset: {{assetName}}. Click here to
              acknowledge: {{ackUrl}}
            from: Sender2
        workflowId: workflowID
        triggerIdentifier: trigger-identifier
        subscribers:
          contactGroups:
            - contactGroupId: contact-group-1
    NotificationPost:
      type: object
      description: Notification post
      properties:
        displayName:
          type: string
        description:
          type: string
          nullable: true
        trigger:
          type: object
        broadcast:
          type: boolean
        channels:
          type: object
        organizationId:
          type: string
      required:
        - displayName
        - trigger
        - broadcast
        - channels
        - organizationId
      example:
        trigger:
          alarmTrigger:
            - alarmId1
        displayName: Notification1
        description: Description
        broadcast: true
        channels:
          email:
            active: true
            template: >-
              {{alarmName}} triggered on Asset: {{assetName}}. Click here to
              acknowledge: {{ackUrl}}
            from: Sender1
            subject: Any subject
          sms:
            active: true
            template: >-
              {{alarmName}} triggered on Asset: {{assetName}}. Click here to
              acknowledge: {{ackUrl}}
            from: Sender2
        organizationId: organization-1
    NotificationPatch:
      type: object
      description: Notification Patch
      properties:
        displayName:
          type: string
        description:
          type: string
        trigger:
          type: object
        broadcast:
          type: boolean
        channels:
          type: object
        subscribers:
          type: object
      example:
        trigger:
          alarmTrigger:
            - alarmId1
        displayName: Notification1
        description: Description
        broadcast: true
        channels:
          email:
            active: true
            template: >-
              {{alarmName}} triggered on Asset: {{assetName}}. Click here to
              acknowledge: {{ackUrl}}
            from: Sender1
            subject: Any subject
          sms:
            active: true
            template: >-
              {{alarmName}} triggered on Asset: {{assetName}}. Click here to
              acknowledge: {{ackUrl}}
            from: Sender2
        organizationId: organization-1
        subscribers:
          contactGroups:
            - contactGroupId: string
    GetNotificationsResponse:
      type: array
      items:
        $ref: '#/components/schemas/Notification'
    NotificationSubscribe:
      type: object
      description: Notification subscribe
      properties:
        contactGroupId:
          type: string
      required:
        - contactGroupId
      example:
        contactGroupId: contact-group1
    Timeseries:
      type: object
      description: Timeseries
      properties:
        items:
          type: array
          description: List of AssetTimeseries entities
          items:
            $ref: '#/components/schemas/AssetTimeseries'
        aggregation:
          type: string
        timeBucket:
          type: string
      example:
        items:
          - name: batterylevel--agg--max
            signalId: batterylevel
            items:
              - value: 244.97301926642587
                timestamp: '2024-04-01T19:00:00Z'
              - value: 21.97301926642587
                timestamp: '2024-05-01T19:00:00Z'
            queryResultLimitReached: null
          - name: temperature--agg--max
            signalId: temperature
            items:
              - value: 2.97301926642587
                timestamp: '2024-04-01T19:00:00Z'
              - value: 21.97301926642587
                timestamp: '2024-06-01T19:00:00Z'
            queryResultLimitReached:
              resultLimit: 10000
        aggregation: max
        time_bucket: 7 minutes
    TimeseriesGet:
      type: object
      description: Timeseries Get
      properties:
        assetId:
          type: string
        timeseriesName:
          type: array
          items:
            type: string
        whereClause:
          type: string
          description: >-
            The following column names are allowed: 'time', 'assetid',
            'componentid', 'timeseries_name', 'timeseries_type', 'modelid',
            'messageid', 'value'.
        searchSpanFrom:
          type: string
          description: From timestamp in the ISO 8601 format
        searchSpanTo:
          type: string
          description: To timestamp in the ISO 8601 format
        aggregationType:
          type: string
          description: Type of the aggregation operation
          enum:
            - avg
            - min
            - max
            - first
            - last
            - sum
            - median
        aggregationInterval:
          type: string
          description: >-
            Aggregation will be calculated based on time interval ('PT1M' = '1
            minute'). Also endpoint supports custom time intervals e.g. '12
            minutes'
          enum:
            - PT1M
            - PT5M
            - PT15M
            - PT1H
            - PT12H
            - P1M
            - P1Y
      required:
        - assetId
        - timeseriesName
        - searchSpanFrom
        - searchSpanTo
      example:
        assetId: asset1
        timeseriesName:
          - signal1
          - signal2
        whereClause: timeseries_type = 'telemetry' AND value > 7
        searchSpanFrom: '2024-03-04 19:03:00.39+00'
        searchSpanTo: '2024-03-10 19:03:00+00'
        aggregationType: median
        aggregationInterval: PT5M
    TimeseriesGetLast:
      type: object
      description: Timeseries Get Last
      properties:
        items:
          type: array
          description: List of TimeseriesGetLastItem entities
          items:
            $ref: '#/components/schemas/TimeseriesGetLastItem'
      required:
        - items
      example:
        items:
          - assetId: asset1
            componentId: component1
            timeseries: []
          - assetId: null
            componentId: null
            timeseries:
              - name: temperature
                type: telemetry
              - name: batterylevel
                type: telemetry
    TimeseriesLast:
      type: object
      description: Timeseries Last
      properties:
        items:
          type: array
          description: List of AssetTimeseriesLast entities
          items:
            $ref: '#/components/schemas/AssetTimeseriesLast'
      example:
        items:
          - time: '2024-03-14 10:37:31.614+00'
            assetId: asset1
            componentId: component1
            timeseriesName: reportinterval
            timeseriesType: propertyReported
            value: 7
          - time: '2024-03-14 10:38:31.614+00'
            assetId: asset2
            componentId: component2
            timeseriesName: batterylevel
            timeseriesType: telemetry
            value: 5.37
    AssetTimeseries:
      type: object
      description: Asset Timeseries
      properties:
        name:
          type: string
        signalId:
          type: string
        items:
          type: array
          description: List of AssetTimeseriesItem entities
          items:
            $ref: '#/components/schemas/AssetTimeseriesItem'
        queryResultLimitReached:
          type: object
          description: Reports that the maximum result of a sql query has been exceeded
          properties:
            resultLimit:
              type: number
    AssetTimeseriesLast:
      type: object
      description: Asset Timeseries Last Item
      properties:
        timestamp:
          type: string
        assetId:
          type: string
        componentId:
          type: string
        timeseriesName:
          type: string
        timeseriesType:
          type: string
        value:
          type: object
    AssetTimeseriesItem:
      type: object
      description: Asset Timeseries Item
      properties:
        timestamp:
          type: string
        value:
          type: object
    TimeseriesGetLastItem:
      type: object
      description: Asset Timeseries Last Item
      properties:
        assetId:
          type: string
        componentId:
          type: string
          nullable: true
        timeseries:
          type: array
          description: List of TimeseriesGetLastItemSignal entities
          items:
            $ref: '#/components/schemas/TimeseriesGetLastItemSignal'
          nullable: true
      required:
        - assetId
    TimeseriesGetLastItemSignal:
      type: object
      description: >-
        Asset Timeseries Last Item Signal. At least one of object properties
        shouldn't be null or empty
      properties:
        name:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
    Asset:
      type: object
      description: Asset including its bindings
      properties:
        id:
          type: string
          description: Instance BTI
        modelId:
          type: string
          description: Model BTI
        displayName:
          type: string
        description:
          type: string
          nullable: true
        bindingData:
          allOf:
            - $ref: '#/components/schemas/AssetBindingData'
          nullable: true
        authorizationContext:
          $ref: '#/components/schemas/AuthorizationContext'
      required:
        - id
        - modelId
        - displayName
      example:
        id: temperatureDevice1
        modelId: dtmi:series200:tempSensor;1
        displayName: Temperature Sensor 1
        description: Measures temperature in °C at 2 Hz.
        contentBindings:
          - endpointId: temp
            instanceId: device1
          - endpoint: pressure
            instanceId: device1
        authorizationContext:
          viewableByOrganizations:
            - org1
            - org2
    CreatedAsset:
      type: object
      description: Asset
      properties:
        id:
          type: string
          description: Instance BTI
        modelId:
          type: string
          description: Model BTI
        displayName:
          type: string
        description:
          type: string
      example:
        id: temperatureDevice1
        modelId: dtmi:series200:tempSensor;1
        displayName: Temperature Sensor 1
        description: Measures temperature in °C at 2 Hz.
    AssetPatch:
      type: object
      description: Asset patch
      properties:
        displayName:
          type: string
        description:
          type: string
      example:
        displayName: Smart fridge
        description: Detects and notifies when you are running out of food.
    AssetPost:
      type: object
      description: Asset post
      properties:
        id:
          type: string
          description: Instance BTI
        modelId:
          type: string
          description: Model BTI
        displayName:
          type: string
        description:
          type: string
        organizationId:
          type: string
      required:
        - id
        - modelId
        - displayName
        - organizationId
      example:
        id: temperatureDevice1
        modelId: dtmi:series200:tempSensor;1
        displayName: Temperature Sensor 1
        description: Measures temperature in °C at 2 Hz.
        organizationId: myOrg
    AssetBindRequest:
      type: object
      description: Asset bind request
      properties:
        endpointBindings:
          type: array
          description: Manually defined endpoint bindings.
          items:
            $ref: '#/components/schemas/EndpointBinding'
        ignoreEndpointsIds:
          type: array
          description: >-
            Local endpoint IDs to not bind with autobind nor binding
            descriptions.
          items:
            type: string
        bindingDescriptions:
          type: array
          description: >-
            Binding descriptions and their remote instance definitions, bound in
            order specified in this array.
          items:
            $ref: '#/components/schemas/BindingDescriptionBindDefinition'
        autobindRemoteInstanceIds:
          type: array
          description: >-
            Instance IDs used for the autobind function, bound in order
            specified in this array.
          items:
            type: string
    AssetBindResponse:
      type: object
      properties:
        endpointBindings:
          type: array
          items:
            $ref: '#/components/schemas/EndpointBinding'
        ignoreEndpointIds:
          type: array
          items:
            type: string
        bindingDescriptions:
          type: array
          items:
            $ref: '#/components/schemas/BindingDescriptionBinding'
        autobindRemoteInstanceIds:
          type: array
          items:
            type: string
    ProvisionRequestBody:
      type: object
      required:
        - options
      properties:
        templateId:
          type: string
          description: Template Id
        options:
          type: object
          description: Controls behaviour for the provision operation. See examples.
    CreateNodeBody:
      type: object
      properties:
        displayName:
          type: string
        description:
          type: string
        parentNodeId:
          type: string
        organizationId:
          type: string
      required:
        - displayName
        - organizationId
    Node:
      type: object
      properties:
        id:
          type: string
          example: '2342345'
        displayName:
          type: string
          example: Node1
        description:
          type: string
          example: My Node 1
    NodePatch:
      type: object
      description: Node patch
      properties:
        displayName:
          type: string
        description:
          type: string
      example:
        displayName: NewDisplayName1
    TreeHierarchyNode:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
        type:
          type: string
          enum:
            - NODE
            - ASSET
            - DASHBOARD
          example: NODE
        edge:
          $ref: '#/components/schemas/Edge'
        details:
          type: object
          nullable: true
          items: {}
        children:
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/TreeHierarchyNode'
      example:
        id: '345335'
        displayName: Node1
        description: My Node 1
        type: NODE
        edge:
          id: '2342341'
          fromType: NODE
          fromId: '2343254'
          toType: NODE
          toId: '653522'
          relation: CONTAINS
        children:
          - id: '345335'
            displayName: Asset1
            description: Asset1 Description
            type: ASSET
            edge:
              id: '4332543'
              fromType: NODE
              fromId: '2342341'
              toType: ASSET
              toId: '345335'
              relation: CONTAINS
            details:
              modelId: dtmi:myModel;1
    GetOrganizationResponse:
      type: object
      properties:
        id:
          type: string
          example: org1
        parentOrganizationId:
          type: string
          description: Will be null if the organization is a root organization
          example: null
          nullable: true
        displayName:
          type: string
          example: My Org. name
        description:
          type: string
          example: My root Org. (Privilege restrictions from Tenant)
        contacts:
          $ref: '#/components/schemas/OrgContacts'
        privileges:
          type: array
          description: Privileges for this organization.
          items:
            $ref: '#/components/schemas/Privilege'
    PostOrganizationRequestBody:
      type: object
      properties:
        parentOrganizationId:
          type: string
          example: null
          description: >-
            A sub-organization's privileges are limited to a subset of the
            parent organization's privileges or if this is a root organization,
            to the tenant's privileges. Set to null if this is a root
            organization.
        displayName:
          type: string
          example: myOrg
        description:
          type: string
          example: My root Org. (Privilege restrictions from Tenant)
        privileges:
          type: array
          description: >-
            List of privileges that the organization should have. These must be
            a subset of any parent organization's or the tenant's privileges.
          items:
            $ref: '#/components/schemas/Privilege'
        contacts:
          $ref: '#/components/schemas/OrgContacts'
        relations:
          $ref: '#/components/schemas/OrgRelations'
      required:
        - displayName
    OrganizationPatchRequestBody:
      type: object
      properties:
        displayName:
          type: string
          example: My new display name
        description:
          type: string
          example: My new description
        contacts:
          $ref: '#/components/schemas/OrgContacts'
        privileges:
          type: array
          items:
            $ref: '#/components/schemas/Privilege'
      minProperties: 1
    GetTenantResponse:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
        permissions:
          type: array
          items:
            type: string
            minItems: 1
    GetTenantsResponse:
      type: array
      items:
        $ref: '#/components/schemas/GetTenantResponse'
    GetOrganizationsResponse:
      type: array
      items:
        $ref: '#/components/schemas/GetOrganizationResponse'
    PostOrganizationResponse:
      $ref: '#/components/schemas/GetOrganizationResponse'
    GetUserResponse:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
        email:
          type: string
        phoneNumber:
          type: string
    PostUserRequestBody:
      type: object
      properties:
        displayName:
          type: string
        email:
          type: string
        password:
          type: string
      required:
        - displayName
        - email
        - password
    UserPatchRequestBody:
      type: object
      properties:
        displayName:
          type: string
        phoneNumber:
          type: string
    GetUsersResponse:
      type: array
      items:
        $ref: '#/components/schemas/GetUserResponse'
    PostUserResponse:
      $ref: '#/components/schemas/GetUserResponse'
    GetGroupResponse:
      type: object
      properties:
        id:
          type: string
        displayName:
          type: string
        description:
          type: string
    PostGroupRequestBody:
      type: object
      properties:
        displayName:
          type: string
        description:
          type: string
      required:
        - displayName
    GroupPatchRequestBody:
      type: object
      properties:
        displayName:
          type: string
        description:
          type: string
    GetGroupsResponse:
      type: array
      items:
        $ref: '#/components/schemas/GetGroupResponse'
    PostGroupResponse:
      $ref: '#/components/schemas/GetGroupResponse'
    OrgContacts:
      type: object
      properties:
        notifications:
          type: object
          properties:
            userGroups:
              type: array
              items:
                type: string
            users:
              type: array
              items:
                type: string
    OrgRelations:
      type: object
      description: >-
        Describes the relationships that should be set up for this organization.
        Relationships are used to manage permissions. I.e the permissions to
        features the organization it self has, who can access the organization
        and in what capacity, as well as what resources the organization
        controls and in what capacity.
      properties:
        GroupToOrgRelations:
          type: array
          description: List of Group relations
          items:
            $ref: '#/components/schemas/GroupToOrgRelations'
          minItems: 0
        UserToOrgRelations:
          type: array
          description: List of User relations
          items:
            $ref: '#/components/schemas/UserToOrgRelations'
          minItems: 0
        OrgToResourceRelations:
          type: array
          description: List of Resource relations
          items:
            $ref: '#/components/schemas/OrgToResourceRelations'
          minItems: 0
    PostRelationRequest:
      type: array
      items:
        $ref: '#/components/schemas/PostRelation'
    PostRelation:
      type: object
      properties:
        subjectType:
          type: string
          enum:
            - user
            - group
            - organization
            - tenant
            - node
        subjectId:
          type: string
          example: user1
        resourceType:
          type: string
          enum:
            - environment
            - tenant
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
          example: asset
        resourceId:
          type: string
          example: asset1
        relation:
          type: string
          enum:
            - owner
            - member
            - manager
            - viewer
            - user_manager
            - asset_manager
            - model_manager
            - notification_manager
            - contact_group_manager
            - alarm_manager
            - provider_manager
            - provider_client_manager
            - tree_manager
            - organization_manager
            - dashboard_manager
            - resource_item_manager
            - parent
          example: manager
      required:
        - subjectType
        - subjectId
        - resourceType
        - resourceId
        - relation
    GroupToOrgRelations:
      type: object
      properties:
        groupId:
          type: string
          description: Group Id
          example: group1
        relation:
          type: string
          enum:
            - owner
            - member
            - manager
            - viewer
            - user_manager
            - asset_manager
            - model_manager
            - notification_manager
            - contact_group_manager
            - alarm_manager
            - provider_manager
            - provider_client_manager
            - tree_manager
            - organization_manager
            - dashboard_manager
            - resource_item_manager
    UserToOrgRelations:
      type: object
      properties:
        userId:
          type: string
          description: User Id
          example: user1
        relation:
          type: string
          enum:
            - owner
            - member
            - manager
            - viewer
            - user_manager
            - asset_manager
            - model_manager
            - notification_manager
            - contact_group_manager
            - alarm_manager
            - provider_manager
            - provider_client_manager
            - tree_manager
            - organization_manager
            - dashboard_manager
            - resource_item_manager
    OrgToResourceRelations:
      type: object
      properties:
        resourceId:
          type: string
          description: Resource Id
          example: model1
        resourceType:
          type: string
          enum:
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        relation:
          type: string
          enum:
            - owner
            - manager
            - viewer
    PermissionCheck:
      type: object
      properties:
        subjectType:
          type: string
          example: user
          enum:
            - user
            - group
            - organization
            - tenant
            - node
        subjectId:
          type: string
          example: user1
        resourceType:
          type: string
          example: asset
          enum:
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        resourceId:
          type: string
          example: asset1
        permission:
          type: string
          example: manage
          enum:
            - view
            - manage
            - delete
            - share
      required:
        - subjectType
        - subject
        - resourceType
        - resourceId
        - permission
    PostPermissionCheckResponse:
      type: object
      properties:
        subjectType:
          type: string
          example: user
          enum:
            - user
            - group
            - organization
            - tenant
            - node
        subject:
          type: string
          example: user1
        resourceType:
          type: string
          example: asset
          enum:
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        resourceId:
          type: string
          example: user1
        permission:
          type: string
          example: manage
          enum:
            - view
            - manage
            - delete
            - share
        result:
          type: boolean
          example: false
    PostPermissionCheckRequest:
      type: array
      items:
        $ref: '#/components/schemas/PermissionCheck'
    PostLookupResourcesRequest:
      type: object
      properties:
        subjectType:
          type: string
          example: user
          enum:
            - user
            - group
            - organization
            - tenant
            - node
        subjectId:
          type: string
        resourceType:
          type: string
          example: asset
          enum:
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        permission:
          type: string
          example: manage
          enum:
            - view
            - manage
            - delete
            - share
      required:
        - subjectType
        - subjectId
        - resourceType
        - permission
    PostLookupSubjectsRequest:
      type: object
      properties:
        resourceType:
          type: string
          example: asset
          enum:
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        resourceId:
          type: string
          example: asset1
        subjectType:
          type: string
          example: user
          enum:
            - user
            - group
            - organization
            - tenant
            - node
        permission:
          type: string
          example: manage
          enum:
            - view
            - manage
            - delete
            - share
      required:
        - resourceType
        - resourceId
        - subjectType
        - permission
    PostLookupSubjectsResponse:
      type: array
      items:
        type: string
      example:
        - user1
        - user2
        - user3
    PostLookupResourcesResponse:
      type: array
      items:
        type: string
      example:
        - asset1
        - asset2
        - asset3
    PostFindRelationsRequest:
      type: object
      properties:
        resourceType:
          type: string
          enum:
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        optionalResourceId:
          type: string
          example: assetModel1
        optionalRelation:
          type: string
          enum:
            - owner
            - member
            - manager
            - viewer
            - user_manager
            - asset_manager
            - model_manager
            - notification_manager
            - contact_group_manager
            - alarm_manager
            - provider_manager
            - provider_client_manager
            - tree_manager
            - organization_manager
            - dashboard_manager
            - resource_item_manager
            - parent
        optionalSubjectFilter:
          type: object
          properties:
            subjectType:
              type: string
              enum:
                - user
                - group
                - organization
                - tenant
                - node
              example: organization
            optionalSubjectId:
              type: string
              example: org1
          required:
            - subjectType
      required:
        - resourceType
    PostFindRelationsResponse:
      type: object
      properties:
        subjectType:
          type: string
          enum:
            - user
            - group
            - organization
            - tenant
            - node
          example: organization
        subjectId:
          type: string
          example: org1
        resourceType:
          type: string
          enum:
            - environment
            - tenant
            - organization
            - group
            - user
            - node
            - asset
            - model
            - binding_description
            - alarm
            - provider
            - provider_client
            - provider_template
            - dashboard
            - notification
            - contact_group
            - resource_item
        resourceId:
          type: string
          example: assetModel1
        relation:
          type: string
          enum:
            - owner
            - member
            - manager
            - viewer
            - user_manager
            - asset_manager
            - model_manager
            - notification_manager
            - contact_group_manager
            - alarm_manager
            - provider_manager
            - provider_client_manager
            - tree_manager
            - organization_manager
            - dashboard_manager
            - resource_item_manager
            - parent
          example: owner
    PostPrivilegeCheckRequest:
      type: array
      items:
        $ref: '#/components/schemas/PrivilegeCheck'
    PrivilegeCheck:
      type: object
      properties:
        subjectType:
          type: string
          enum:
            - user
            - group
            - organization
            - tenant
        subjectId:
          type: string
          example: user1
        privilege:
          $ref: '#/components/schemas/Privilege'
        organizationId:
          type: string
          example: org1
          description: Used when subjectType is group or user
      required:
        - subjectType
        - subjectId
        - privilege
    PostPrivilegeCheckResponse:
      type: object
      properties:
        subjectType:
          type: string
          example: user
          enum:
            - user
            - group
            - organization
            - tenant
        subjectId:
          type: string
          example: user1
        organizationId:
          type: string
          nullable: true
          example: org1
        privilege:
          $ref: '#/components/schemas/Privilege'
        result:
          type: boolean
          example: false
    Privilege:
      type: string
      enum:
        - asset_management
        - dashboard_management
        - user_management
        - tree_management
        - model_management
        - alarm_management
        - organization_management
        - provider_management
        - provider_client_management
        - notification_management
        - contact_group_management
        - resource_item_management
      example: asset_management
    AuthorizationContext:
      type: object
      properties:
        viewableByOrganizations:
          type: array
          items:
            type: string
    PostFindEdgesRequest:
      type: object
      properties:
        fromId:
          type: string
          example: 474334
        fromType:
          type: string
          enum:
            - node
            - asset
            - dashboard
      required:
        - fromId
        - fromType
    PostEdge:
      type: object
      properties:
        fromType:
          type: string
          enum:
            - node
            - asset
        fromId:
          type: string
          example: 2342352
        toType:
          type: string
          enum:
            - node
            - asset
            - dashboard
          example: asset
        toId:
          type: string
          example: 3453453
        relation:
          type: string
          enum:
            - CONTAINS
          example: CONTAINS
      required:
        - fromType
        - fromId
        - toType
        - toId
        - relation
    Edge:
      type: object
      properties:
        id:
          type: string
          example: 3245342
        fromType:
          type: string
          enum:
            - node
            - asset
            - dashboard
          example: node
        fromId:
          type: string
          example: 4743564
        toType:
          type: string
          enum:
            - node
            - asset
            - dashboard
          example: node
        toId:
          type: string
          example: 3453435
        relation:
          type: string
          enum:
            - CONTAINS
          example: CONTAINS
    Alarm:
      type: object
      properties:
        name:
          type: string
          example: alarm1
          description: Name of the alarm
        description:
          type: string
          example: My alarm
          description: Description of the alarm
        severity:
          type: integer
          example: 0
          description: Severity of the alarm
        id:
          type: string
          example: alarm1
          description: Id of the alarm
        entityTypeId:
          type: string
          example: dtmi:com:example:TemperatureController;1
          description: Id of the entity type
        entityIds:
          type: array
          items:
            type: string
            example: device1
            description: Id of the entity
        type:
          type: string
          example: dtmi:com:example:TemperatureController;1
          description: Type of the alarm
        condition:
          type: string
          description: JSONLogic condition of the alarm
      required:
        - name
    AssetMigration:
      type: object
      properties:
        targetAssetModelId:
          title: Target Asset Model Id
          type: string
        assetIds:
          title: Array of Asset Ids
          type: array
          items:
            type: string
      required:
        - targetAssetModelId
        - assetIds
    GetTokenByRopcRequest:
      type: object
      properties:
        username:
          title: User Name
          type: string
        password:
          title: Password
          type: string
    GetTokenByRopcRequestResponse:
      type: object
      properties:
        accessToken:
          title: Access token
          type: string
    PostNegotiateStreamResponse:
      type: object
      properties:
        url:
          type: string
        accessToken:
          type: string
    PostPutSubscriptionRequestBody:
      type: object
      properties:
        connectionId:
          type: string
          description: signalr connection id
        topic:
          type: string
          enum:
            - telemetry
            - alarm
        assets:
          type: array
          items:
            type: string
            description: List of asset id's
        samplingType:
          type: string
          enum:
            - none
            - first
          description: |
            Sort order:
             * `none` - No sampling
             * `first` - First signal in sampleIntervalSeconds time bucket
        sampleIntervalSeconds:
          type: integer
    PostPutSubscriptionResponse:
      $ref: '#/components/schemas/PushSubscription'
    PushSubscription:
      type: object
      properties:
        id:
          type: string
        connectionId:
          type: string
          description: signalr connection id
        user:
          type: string
        topic:
          type: string
        startTimestamp:
          type: string
        assets:
          type: array
          items:
            type: string
            description: List of asset id's
        samplingType:
          type: string
          enum:
            - none
            - first
          description: |
            Sort order:
             * `none` - No sampling
             * `first` - First update in sampleIntervalSeconds time bucket
        sampleIntervalSeconds:
          type: integer
    GetSubscriptionResponse:
      $ref: '#/components/schemas/PushSubscription'
