openapi: 3.0.1
info:
  title: Message Channel Service API
  version: 1.0.0
servers:
- description: The Message Channel Service API REST endpoint
  url: https://api.btx.fr.banqup.com/core/channel
- description: The Message Channel Service API REST endpoint
  url: https://api.btx.eu.banqup.com/core/channel
paths:
  /v1/sessions/{sessionId}/subscriptions:
    post:
      tags:
      - channel-service
      summary: Subscribes to events
      description: Create a subscription for events that honor a given set of filters.
        Deprecated due to rename. Use /v1/eventSources/{sourceId}/subscriptions instead.
      operationId: subscribeToSession
      parameters:
      - name: sessionId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscribeRequest'
        required: true
      responses:
        '201':
          description: The subscription has been created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscribeResponse'
        '404':
          description: The session ID could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscribeResponse'
        '403':
          description: You do not have access to this session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscribeResponse'
      deprecated: true
  /v1/sessions:
    post:
      tags:
      - channel-service
      summary: Creates a session
      description: Creates an SSE session and subscribes to messages. Deprecated due
        to rename. Use /v1/eventSources instead.
      operationId: createSession
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscribeRequest'
      responses:
        '201':
          description: The session has been created. You can now start receiving events.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
      deprecated: true
  /v1/eventSources/{sourceId}/subscriptions:
    post:
      tags:
      - channel-service
      summary: Subscribes to events
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Create a subscription for events that honor a given set of filters.
        <br/> Scope: []"
      operationId: subscribe
      parameters:
      - name: sourceId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SubscribeRequest'
        required: true
      responses:
        '201':
          description: The subscription has been created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscribeResponse'
        '404':
          description: The sourceId ID could not be found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscribeResponse'
        '403':
          description: You do not have access to this source.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SubscribeResponse'
  /v1/eventSources:
    post:
      tags:
      - channel-service
      summary: Creates an event source
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Creates an SSE event source and subscribes to it. <br/> Scope: []"
      operationId: createEventSource
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MessageEventSourceRequest'
      responses:
        '201':
          description: The event source has been created. You can now start receiving
            events.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageEventSourceResponse'
  /v1/sessions/{sessionId}/events:
    get:
      tags:
      - channel-service
      summary: Retrieves events
      description: Opens an SSE stream to start receiving events. Deprecated due to
        rename. Use /v1/eventSources/{sourceId}:receiveEvents instead.
      operationId: getEvents
      parameters:
      - name: sessionId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      - name: Last-Event-ID
        in: header
        required: false
        schema:
          type: string
      responses:
        '404':
          description: The session ID is not found.
          content:
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ServerSentEventEvent'
        '200':
          description: The Server Sent Event stream has been opened. You will now
            receive events.
          content:
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ServerSentEventEvent'
      deprecated: true
  /v1/eventSources/{sourceId}:receiveEvents:
    get:
      tags:
      - channel-service
      summary: Retrieves events
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Opens an SSE stream to start receiving events from an event source.
        <br/> Scope: []"
      operationId: receiveEvents
      parameters:
      - name: sourceId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      - name: Last-Event-ID
        in: header
        required: false
        schema:
          type: string
      responses:
        '404':
          description: The sourceId is not found.
          content:
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ServerSentEventEvent'
        '200':
          description: The Server Sent Event stream has been opened. You will now
            receive events.
          content:
            text/event-stream:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ServerSentEventEvent'
  /v1/sessions/{sessionId}/subscriptions/{subscriptionId}:
    delete:
      tags:
      - channel-service
      summary: Unsubscribe from events
      description: Cancel an existing subscription. After this operation, the event
        stream will no longer contain events for this subscription. Deprecated due
        to rename. Use /eventSources/{sourceId}/subscriptions/{subscriptionId} instead.
      operationId: unsubscribeFromSession
      parameters:
      - name: sessionId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      responses:
        '404':
          description: The session ID could not be found.
        '403':
          description: You do not have access to this session.
        '204':
          description: The subscription has been removed.
      deprecated: true
  /v1/eventSources/{sourceId}/subscriptions/{subscriptionId}:
    delete:
      tags:
      - channel-service
      summary: Unsubscribe from events
      description: "<div class='my-preview'><span>Preview: The API is in development
        or testing phases and the interface could still change slightly.</span></div>
        <br/> Cancel an existing subscription. After this operation, the event stream
        will no longer contain events for this subscription. <br/> Scope: []"
      operationId: unsubscribe
      parameters:
      - name: sourceId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      - name: subscriptionId
        in: path
        required: true
        schema:
          pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
          type: string
      responses:
        '404':
          description: The event source ID could not be found.
        '403':
          description: You do not have access to this event source.
        '204':
          description: The subscription has been removed.
components:
  schemas:
    MessageListenerFilter:
      required:
      - type
      type: object
      properties:
        type:
          type: string
          enum:
          - CATEGORY
          - TYPE
          - PERMISSION
          - NEVER
          - SUBJECT
          - CHANNEL
        test:
          maxItems: 1024
          minItems: 0
          type: array
          items:
            type: string
        subject:
          maxLength: 256
          minLength: 0
          type: string
    SubscribeRequest:
      type: object
      properties:
        subscriptions:
          maxItems: 128
          minItems: 0
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
    Subscription:
      type: object
      properties:
        filters:
          maxItems: 1024
          minItems: 0
          type: array
          items:
            $ref: '#/components/schemas/MessageListenerFilter'
    SubscribeResponse:
      required:
      - subscriptionIds
      type: object
      properties:
        subscriptionIds:
          type: array
          items:
            type: string
    SessionResponse:
      required:
      - sessionId
      type: object
      properties:
        sessionId:
          type: string
        subscriptionIds:
          type: array
          items:
            type: string
    MessageEventSourceRequest:
      type: object
      properties:
        subscriptions:
          maxItems: 128
          minItems: 0
          type: array
          items:
            $ref: '#/components/schemas/Subscription'
    MessageEventSourceResponse:
      required:
      - eventSourceId
      type: object
      properties:
        eventSourceId:
          type: string
        subscriptionIds:
          type: array
          items:
            type: string
    ServerSentEventEvent:
      type: object
  securitySchemes:
    channel:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.btx.fr.banqup.com/v1/oauth20/authorization
          tokenUrl: https://api.btx.fr.banqup.com/v1/oauth20/token_kc
          scopes: {}
