openapi: 3.0.1
info:
  description: The Email Connector API
  title: Email Connector API
  version: 1.6.0-CR3
servers:
- description: Generated server url
  url: https://api.uat.btx.fr.banqup.com/connectors/email
- description: Generated server url
  url: https://api.uat.btx.eu.banqup.com/connectors/email
security:
- oauth2: []
paths:
  /v1/spaces/connectors/email/documents:add:
    post:
      description: 'Receive incoming webhooks from Mailgun when an email event occurs.  <br/>
        Scope: []'
      operationId: receiveInboundEmail
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/MailgunWebhookRequestSchema'
      responses:
        '200':
          description: Webhook received successfully
        '406':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Bad request, Invalid Mailgun signature
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: Internal server error
      summary: Receive Mailgun webhook
      tags:
      - Email Connector API
  /v1/spaces/connectors/email/documents:send:
    post:
      description: 'Accepts a request containing a space ID and a list of document
        IDs for processing. Processes <br/> Scope: []'
      operationId: sendDocument
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmailDocumentSendRequest'
        required: true
      responses:
        '202':
          description: Sent to subscriber
        '400':
          content:
            application/json: {}
          description: Bad Request - Invalid input data.
      summary: 'Send '
      tags:
      - Email Connector API
components:
  schemas:
    ConfigureExtensionRequest:
      type: object
      properties:
        entityId:
          type: string
          format: uuid
        extensionId:
          type: string
          format: uuid
        name:
          type: string
        namespace:
          type: string
        settings:
          $ref: '#/components/schemas/EmailConfigurationSettings'
        spaceId:
          type: string
          format: uuid
      required:
      - entityId
      - extensionId
      - name
      - namespace
      - spaceId
    Email:
      type: object
      properties:
        replyTo:
          type: string
    EmailConfigurationSettings:
      type: object
      properties:
        quotes:
          $ref: '#/components/schemas/Quotes'
        replyTo:
          type: string
    EmailDirectorySearchRequest:
      type: object
      properties:
        connectionId:
          type: string
          format: uuid
        spaceId:
          type: string
          format: uuid
      required:
      - connectionId
      - spaceId
    EmailDirectorySearchResult:
      type: object
      properties:
        name:
          type: string
        settings:
          type: object
          additionalProperties:
            type: object
    EmailDocumentSendRequest:
      type: object
      properties:
        documentIds:
          type: array
          items:
            type: string
            format: uuid
        spaceId:
          type: string
          format: uuid
      required:
      - documentIds
      - spaceId
    ExtensionAddRequest:
      type: object
      properties:
        entityId:
          type: string
          format: uuid
        spaceId:
          type: string
          format: uuid
      required:
      - entityId
      - spaceId
    ExtensionRequest:
      type: object
      properties:
        entityId:
          type: string
          format: uuid
        extensionId:
          type: string
          format: uuid
        name:
          type: string
        namespace:
          type: string
        spaceId:
          type: string
          format: uuid
      required:
      - entityId
      - extensionId
      - name
      - namespace
      - spaceId
    MailgunWebhookRequestSchema:
      type: object
      properties:
        Cc:
          type: string
        From:
          type: string
          example: test@mail.com
        To:
          type: string
          example: BE0786452046@mail.dev.btx.eu.banqup.com
        message-url:
          type: string
        recipient:
          type: string
          example: BE0786452046@mail.dev.btx.eu.banqup.com
        signature:
          type: string
        subject:
          type: string
        timestamp:
          type: string
        token:
          type: string
      required:
      - From
      - To
      - recipient
    ProblemDetail:
      type: object
      properties:
        detail:
          type: string
        instance:
          type: string
          format: uri
        properties:
          type: object
          additionalProperties:
            type: object
        status:
          type: integer
          format: int32
        title:
          type: string
        type:
          type: string
          format: uri
    Quotes:
      type: object
      properties:
        sales:
          $ref: '#/components/schemas/Sales'
    Sales:
      type: object
      properties:
        email:
          $ref: '#/components/schemas/Email'
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://api.uat.btx.fr.banqup.com/oauth2/client_credential/gettoken
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
        authorizationCode:
          authorizationUrl: https://api.uat.btx.fr.banqup.com/oauth2/auth
          tokenUrl: https://api.uat.btx.fr.banqup.com/oauth2/token
          scopes:
            info: Scopes are endpoint-specific, see each endpoint for required scope.
