openapi: 3.0.1
info:
  description: The Email Connector API
  title: Email Connector API
  version: 0.0.244
servers:
- description: Generated server url
  url: https://api.btx.fr.banqup.com/connectors/email
- description: Generated server url
  url: https://api.btx.eu.banqup.com/connectors/email
security:
- email-connector-shared-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
        spaceId:
          type: string
          format: uuid
      required:
      - entityId
      - extensionId
      - name
      - namespace
      - spaceId
    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
  securitySchemes:
    email-connector-shared-oauth2:
      scheme: bearer
      type: http
