openapi: 3.0.0
info:
  description: Aura configuration routing filters API definition.
  version: 10.11.0
  title: Aura configuration routing filters API Swagger
  contact:
    email: auradev@tid.es
servers:
  - url: https://localhost:8999
paths:
  /aura-services/v2/configuration/routing-filters/{filterId}:
    get:
      tags:
        - Routing Filters
      summary: Gets all the info associated to one routing filter
      description: Returns info by filterId
      operationId: getRoutingFilterById
      security:
        - apiKeyHeader: []
      parameters:
        - name: filterId
          in: path
          description: Unique Aura routing filter identifier
          required: true
          schema:
            type: string
        - name: excludeFields
          description: Filters to exclude some keys from the returned object. Only root values of routingFilterConfiguration can be filtered
          in: query
          required: false
          schema:
            type: string
        - name: includeFields
          description: Set all the keys returned in the result object. Only root values of routingFilterConfiguration can be filtered
          in: query
          required: false
          schema:
            type: string
        - name: correlator
          in: header
          description:
            Unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Successfully retrieved
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RoutingFilterConfiguration"
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: "modules"
    put:
      tags:
        - Routing Filters
      summary: Updates all the info associated to one routing filter
      description: Updates all routing filter info
      operationId: updateRoutingFilter
      security:
        - apiKeyHeader: []
      parameters:
        - name: filterId
          in: path
          description: Unique Aura routing filter identifier
          required: true
          schema:
            type: string
        - name: correlator
          in: header
          description: Unique identifier of a request to be used as correlator in all systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        description: Input routingFilterData to update
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RoutingFilterConfiguration"
      responses:
        "204":
          description: Successfully updated
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: "modules"
    patch:
      tags:
        - Routing Filters
      summary: Updates some info associated to one routing filter
      description: Updates some fields of routing filter info
      operationId: modifyRoutingFilter
      security:
        - apiKeyHeader: []
      parameters:
        - name: filterId
          in: path
          description: Unique Aura routing filter identifier
          required: true
          schema:
            type: string
        - name: correlator
          in: header
          description:
            Unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        description: Input channelData to add
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RoutingFilterConfigurationPartial"
      responses:
        "204":
          description: Successfully updated
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: "modules"
    delete:
      tags:
        - Routing Filters
      summary: Delete one routing filter
      description: Delete routing filter info by id
      operationId: deleteRoutingFilterById
      security:
        - apiKeyHeader: []
      parameters:
        - name: filterId
          in: path
          description: Unique Aura routing filter identifier
          required: true
          schema:
            type: string
        - name: correlator
          in: header
          description:
            Unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        "204":
          description: Successfully updated
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "404":
          $ref: "#/components/responses/NotFound"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: "modules"
  /aura-services/v2/configuration/routing-filters:
    get:
      tags:
        - Routing Filters
      summary: Gets all routing filters info
      description: Returns routing filters info
      operationId: getAllRoutingFilters
      security:
        - apiKeyHeader: []
      parameters:
        - name: excludeFields
          description: Filters to exclude some keys from the returned object. Only root values of routingFilterConfiguration can be filtered
          in: query
          required: false
          schema:
            type: string
        - name: includeFields
          description: Set all the keys returned in the result object. Properties of private properties can't be filtered
          in: query
          required: false
          schema:
            type: string
        - name: correlator
          in: header
          description:
            Unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Successfully retrieved
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/RoutingFilterConfiguration"
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: "modules"
    post:
      tags:
        - Routing Filters
      summary: Adds a new routing filter
      description: Adds a new complete routing filter
      operationId: addRoutingFilter
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description:
            Unique identifier of a request to be used as correlator in all
            systems
          required: false
          schema:
            type: string
            format: uuid
      requestBody:
        description: Input routingFilterData to add
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/RoutingFilterConfiguration"
      responses:
        "201":
          description: Successfully gathered
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
            location:
              description: URI to access this channel configuration
              schema:
                type: string
                format: url
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "409":
          $ref: "#/components/responses/Conflict"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: "modules"
  /aura-services/v2/configuration/routing-filters/entities:
    get:
      tags:
        - Routing Filters
      summary: Gets entities for all routing filters
      description: Returns entities for routing filters
      operationId: getEntitiesForRoutingFilters
      security:
        - apiKeyHeader: []
      parameters:
        - name: correlator
          in: header
          description: Unique identifier of a request to be used as correlator in all systems
          required: false
          schema:
            type: string
            format: uuid
      responses:
        "200":
          description: Successfully retrieved
          headers:
            correlator:
              description: Correlation id for the different services
              schema:
                type: string
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        "400":
          $ref: "#/components/responses/InvalidRequest"
        "401":
          $ref: "#/components/responses/Unauthorized"
        "500":
          $ref: "#/components/responses/InternalError"
      x-swagger-router-controller: modules
components:
  responses:
    InvalidRequest:
      description: Incoming HTTP request format is not valid
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AuraError"
    Unauthorized:
      description: Incoming HTTP request authorization is not valid
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AuraError"
    Conflict:
      description:
        The request could not be completed due to a conflict with the current
        state of the target resource.
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AuraError"
    TooManyRequests:
      description: The user has sent too many requests in a given amount of time
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AuraError"
    InternalError:
      description: Unexpected internal error
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AuraError"
    NotFound:
      description: Request resource not found
      headers:
        correlator:
          description: Correlation id for the different services
          schema:
            type: string
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/AuraError"
  securitySchemes:
    apiKeyHeader:
      type: apiKey
      name: Authorization
      in: header
  schemas:
    RoutingFilterConfiguration:
      type: object
      description: Filter object
      required:
        - id
        - type
        - name
        - entities
        - dataBase
        - vars
        - fields
        - match
        - summary
        - summaryFilter
        - actions
      additionalProperties: false
      properties:
        name:
          type: string
          description: Name of the filter
        id:
          type: string
          description: Unique identifier of the filter
        type:
          type: string
          description: Type of the filter (e.g., userId)
        description:
          type: string
          description: Description of the filter
        entities:
          type: array
          items:
            type: string
          description: List of entities associated with the filter
        dataBase:
          type: object
          required:
            - dataFilterCollection
            - dataSummaryCollection
          properties:
            dataFilterCollection:
              $ref: "#/components/schemas/FilterCollection"
            dataSummaryCollection:
              $ref: "#/components/schemas/FilterCollection"
        sourceFilters:
          type: array
          items:
            $ref: "#/components/schemas/SourceFilter"
        vars:
          type: object
          description: Variables to filter on
        fields:
          type: object
          description: Fields to filter on
          properties:
            forTime:
              type: string
              description: Description of field with time data
            forId:
              type: string
              description: Description of field with user ID data
            forMatchingField:
              type: string
              description: Description of field with matching criteria
            MatchingValue:
              type: string
              description: Description of field with matching value
          additionalProperties: false
        match:
          type: array
          description: Aggregate function to apply to the filter
          items:
            type: object
        summary:
          type: object
          description: Summary of the filter
        summaryFilter:
          type: object
          description: Summary filter to apply to the filter
        applyFilter:
          type: object
          description: Whether to apply the filter or not
        actions:
          type: array
          description: Actions to execute
          items:
            type: object            
        metadata:
          $ref: "#/components/schemas/DocumentMetadata"
    RoutingFilterConfigurationPartial:
      type: object
      description: Filter object
      required:
        - id
      additionalProperties: false
      properties:
        name:
          type: string
          description: Name of the filter
        id:
          type: string
          description: Unique identifier of the filter
        type:
          type: string
          description: Type of the filter (e.g., userId)
        description:
          type: string
          description: Description of the filter
        entities:
          type: array
          items:
            type: string
          description: List of entities associated with the filter
        dataBase:
          type: object
          required:
            - dataFilterCollection
            - dataSummaryCollection
          properties:
            dataFilterCollection:
              $ref: "#/components/schemas/FilterCollection"
            dataSummaryCollection:
              $ref: "#/components/schemas/FilterCollection"
        sourceFilters:
          type: array
          items:
            $ref: "#/components/schemas/SourceFilter"
        vars:
          type: object
          description: Variables to filter on
        fields:
          type: object
          description: Fields to filter on
          properties:
            forTime:
              type: string
              description: Description of field with time data
            forId:
              type: string
              description: Description of field with user ID data
            forMatchingField:
              type: string
              description: Description of field with matching criteria
            MatchingValue:
              type: string
              description: Description of field with matching value
          additionalProperties: false
        match:
          type: array
          description: Aggregate function to apply to the filter
          items:
            type: object
        summary:
          type: object
          description: Summary of the filter
        summaryFilter:
          type: object
          description: Summary filter to apply to the filter
        applyFilter:
          type: object
          description: Whether to apply the filter or not
        action:
          type: object
          description: Action to execute
        metadata:
          $ref: "#/components/schemas/DocumentMetadata"
    SourceFilter:
      type: object
      description: Source filter object
      required:
        - field
        - val
        - op
      properties:
        field:
          type: string
          description: Field to filter on
        val:
          type: string
          description: Value to filter on
        op:
          type: string
          enum: [equal, minor, major]
          description: Comparison operator (e.g., equal, not equal)
        cast:
          type: string
          enum: [number, date]
          description: Cast type (e.g., number, date)
    FilterCollection:
      type: object
      description: Filter collection object
      required:
        - collectionName
      properties:
        collectionName:
          type: string
        expiration:
          type: integer
          description: Expiration time in seconds
    DocumentMetadata:
      type: object
      description: Metadata for configuration-api docs
      properties:
        version:
          type: string
          description: configuration-api version when document was created
        createdAt:
          type: string
          description: creation date
          format: date-time
        updatedAt:
          type: string
          description: Date when the content was updated
          format: date-time
      additionalProperties: true
    AuraError:
      type: object
      description: Error response
      properties:
        code:
          type: string
          description: Unique id of the error
        message:
          type: string
          description: Specific and descriptive text of the error
        errors:
          description: With validation error. Swagger error information
          type: array
          items:
            type: object
