openapi: 3.0.3
info:
  title: payment-payin-work-redriver API
  version: 1.0.0
servers:
  - url: /api/payment-payin-work-redriver/v1
paths:
  /dlq:
    get:
      summary: SPA
      responses:
        "200":
          description: SPA main screen
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
  /dlq/info:
    get:
      summary: List visible queues
      operationId: dlq_info
      parameters: [ ]
      responses:
        "200":
          description: Information about the visible queues
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/QueueInfo'
                x-content-type: application/json
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
      security:
        - OAuth2:
            - lbc.payment.payment.read
  /dlq/ui/{asset}:
    get:
      summary: UI assets
      parameters:
        - name: asset
          in: path
          description: the relative path of the asset
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: favicon.ico
      responses:
        "200":
          description: Asset
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
  /dlq/{name}/delete:
    post:
      summary: Delete the items
      operationId: dlq_delete
      parameters:
        - name: name
          in: path
          description: the name of the queue from which to delete messages
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        description: a list of message ReceiptHandle values
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
      responses:
        "205":
          description: "Items deleted, reset view"
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
  /dlq/{name}/redrive:
    post:
      summary: Redrive the selected items
      operationId: dlq_redrive
      parameters:
        - name: name
          in: path
          description: the name of the DLQ from which to redrive messages
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        description: "a list of message ID/ReceiptHandle pairs. ID is needed to republish,\
          \ ReceiptHandle to remove from DLQ. Process starts by ChangingVisility to\
          \ protect messages, then SendMessage on original source queue, and on success,\
          \ DeleteMessage for the original messages."
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/name_redrive_body'
      responses:
        "205":
          description: "Items deleted, reset view"
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
  /dlq/{name}/purge:
    post:
      summary: purge the whole queue
      operationId: dlq_purge
      parameters:
        - name: name
          in: path
          description: the name of the queue to purge
          required: true
          style: simple
          explode: false
          schema:
            type: string
      responses:
        "205":
          description: "Success, reset views"
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
  /dlq/{name}/release:
    post:
      summary: Release the items for reception by resetting their VisibilityTimeout
        to 0
      operationId: dlq_release
      parameters:
        - name: name
          in: path
          description: the name of the queue to poll
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        description: a list of message ReceiptHandle values
        content:
          application/json:
            schema:
              type: array
              items:
                type: string
      responses:
        "200":
          description: Asset
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
  /dlq/{name}/items:
    get:
      summary: Get the first items ready to be received in a queue
      operationId: dlq_items
      parameters:
        - name: name
          in: path
          description: the name of the queue to poll
          required: true
          style: simple
          explode: false
          schema:
            type: string
        - name: limit
          in: query
          description: the maximum number of items to return
          required: false
          style: form
          explode: true
          schema:
            maximum: 10
            type: integer
            default: 10
      responses:
        "200":
          description: A list of messages
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/Message'
                x-content-type: application/json
        "500":
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SPAError'
      security:
        - OAuth2:
            - lbc.payment.payment.read
components:
  schemas:
    QueueURL:
      type: string
      description: The absolute URL to the queue
      example: https://sqs.amazonaws.com/eu-west-3/12345678901234/some-queue
    QueueARN:
      type: string
      description: the Amazon resource name (ARN) of the queue.
      example: arn:sqs:eu-west-3:12345678901234:some_queue
    Message:
      type: object
      properties:
        attributes:
          $ref: '#/components/schemas/Message_attributes'
        body:
          type: string
          description: not url-encoded
        md5_of_body:
          type: string
          description: An MD5 digest of the non-URL-encoded message body string.
        md5_of_message_attributes:
          type: string
          description: "An MD5 digest of the non-URL-encoded message attribute string.\
            \ You can use this attribute to verify that Amazon SQS received the message\
            \ correctly. Amazon SQS URL-decodes the message before creating the MD5\
            \ digest. For information about MD5, see RFC1321 (https://www.ietf.org/rfc/rfc1321.txt)."
        message_id:
          type: string
        receipt_handle:
          type: string
          description: "An identifier associated with the act of receiving the message.\
            \ A new receipt handle is returned every time you receive a message. When\
            \ deleting a message, you provide the last received receipt handle to\
            \ delete the message."
      example:
        md5_of_message_attributes: md5_of_message_attributes
        receipt_handle: receipt_handle
        attributes:
          sequence_number: 5
          approximate_first_receive_timestamp: 0
          approximate_receive_count: 1
          sent_timestamp: 1
          sender_id: ABCDE1F2GH3I4JK5LMNOP:i-a123b456
        message_id: message_id
        body: body
        md5_of_body: md5_of_body
    SPAError:
      type: object
      properties:
        message:
          type: string
          description: Free string describing the error
      example:
        message: an error message
    QueueInfo:
      type: object
      properties:
        name:
          type: string
          description: "The queue name, for both human and machine use"
        url:
          $ref: '#/components/schemas/QueueURL'
        attributes:
          $ref: '#/components/schemas/QueueInfo_attributes'
      example:
        name: name
        attributes:
          visibility_timeout: 2
          last_modified_timestamp: 2
          approximate_number_of_messages_delayed: 6
          created_timestamp: 5
          delay_seconds: 5
          redrive_policy:
            maxReceiveCount: 4
            deadLetterTargetArn: arn:sqs:eu-west-3:12345678901234:some_queue
          redrive_allow_policy:
            source_queue_arns:
              - null
              - null
            redrive_permission: ""
          message_retention_period: 9
          maximum_message_size: 7
          queue_arn: arn:sqs:eu-west-3:12345678901234:some_queue
          approximate_number_of_messages_not_visible: 1
          approximate_number_of_messages: 0
          receive_message_wait_time_seconds: 3
        url: https://sqs.amazonaws.com/eu-west-3/12345678901234/some-queue
    name_redrive_body:
      type: object
      properties:
        id:
          type: string
        receipt_handle:
          type: string
    Message_attributes:
      type: object
      properties:
        # AWSTraceHeader
        approximate_first_receive_timestamp:
          type: integer
        approximate_receive_count:
          minimum: 1
          type: integer
        # MessageDeduplicationId
        # MessageGroupId
        sender_id:
          type: string
          description: IAM user or role
          example: ABCDE1F2GH3I4JK5LMNOP:i-a123b456
        sent_timestamp:
          type: integer
        sequence_number:
          type: integer
      example:
        sequence_number: 5
        approximate_first_receive_timestamp: 0
        approximate_receive_count: 1
        sent_timestamp: 1
        sender_id: ABCDE1F2GH3I4JK5LMNOP:i-a123b456
    QueueInfo_attributes_redrive_policy:
      type: object
      properties:
        deadLetterTargetArn:
          type: string
          description: The Amazon Resource Name (ARN) of the dead-letter queue to
            which Amazon SQS moves messages after the value of maxReceiveCount is
            exceeded.
        maxReceiveCount:
          type: integer
          description: "The number of times a message is delivered to the source queue\
            \ before being moved to the dead-letter queue. Default 10. When the ReceiveCount\
            \ for a message exceeds the maxReceiveCount for a queue, Amazon SQS moves\
            \ the message to the dead-letter-queue."
      description: the parameters for the dead-letter queue functionality of the source
        queue
      example:
        maxReceiveCount: 4
        deadLetterTargetArn: arn:sqs:eu-west-3:12345678901234:some_queue_dlq
    QueueInfo_attributes_redrive_allow_policy:
      type: object
      properties:
        redrive_permission:
          type: string
          description: The permission type that defines which source queues can specify
            the current queue as the dead-letter queue.
          enum:
            - allowAll
            - denyAll
            - byQueue
        source_queue_arns:
          type: array
          items:
            $ref: '#/components/schemas/QueueARN'
      description: the permissions for the dead-letter queue redrive permission and
        which source queues can specify dead-letter queues.
      example:
        source_queue_arns:
          - null
          - null
        redrive_permission: ""
    QueueInfo_attributes:
      type: object
      properties:
        approximate_number_of_messages:
          type: integer
          description: he approximate number of messages available for retrieval from
            the queue.
        approximate_number_of_messages_delayed:
          type: integer
          description: the approximate number of messages in the queue that are delayed
            and not available for reading immediately. This can happen when the queue
            is configured as a delay queue or when a message has been sent with a
            delay parameter.
        approximate_number_of_messages_not_visible:
          type: integer
          description: the approximate number of messages that are in flight. Messages
            are considered to be in flight if they have been sent to a client but
            have not yet been deleted or have not yet reached the end of their visibility
            window.
        created_timestamp:
          type: integer
          description: the time when the queue was created in seconds (epoch time).
        delay_seconds:
          type: integer
          description: the default delay on the queue in seconds.
        last_modified_timestamp:
          type: integer
          description: the time when the queue was last changed in seconds (epoch
            time).
        maximum_message_size:
          type: integer
          description: the limit of how many bytes a message can contain before Amazon
            SQS rejects it.
        message_retention_period:
          type: integer
          description: "the length of time, in seconds, for which Amazon SQS retains\
            \ a message. When you change a queue's attributes, the change can take\
            \ up to 60 seconds for most of the attributes to propagate throughout\
            \ the Amazon SQS system. Changes made to the MessageRetentionPeriod attribute\
            \ can take up to 15 minutes and will impact existing messages in the queue\
            \ potentially causing them to be expired and deleted if the MessageRetentionPeriod\
            \ is reduced below the age of existing messages."
        # policy:
        queue_arn:
          $ref: '#/components/schemas/QueueARN'
        receive_message_wait_time_seconds:
          type: integer
          description: "the length of time, in seconds, for which the ReceiveMessage\
            \ action waits for a message to arrive."
        visibility_timeout:
          type: integer
          description: seconds a message remains hidden after being received. Max
            43200.
        redrive_policy:
          $ref: '#/components/schemas/QueueInfo_attributes_redrive_policy'
        redrive_allow_policy:
          $ref: '#/components/schemas/QueueInfo_attributes_redrive_allow_policy'
      example:
        visibility_timeout: 2
        last_modified_timestamp: 2
        approximate_number_of_messages_delayed: 6
        created_timestamp: 5
        delay_seconds: 5
        redrive_policy:
          maxReceiveCount: 4
          deadLetterTargetArn: arn:sqs:eu-west-3:12345678901234:some_queue_dlq
        redrive_allow_policy:
          source_queue_arns:
            - null
            - null
          redrive_permission: ""
        message_retention_period: 9
        maximum_message_size: 7
        queue_arn: arn:sqs:eu-west-3:12345678901234:some_queue
        approximate_number_of_messages_not_visible: 1
        approximate_number_of_messages: 0
        receive_message_wait_time_seconds: 3
        # KmsMesterKeyID:
        # KmsDataKeyReusePeriodSeconds:
        # SqsManagerSseEnabled:
        # FifoQueue:
        # DeduplicationScope
        # FifoThroughputLimit

  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://api.leboncoin.fr/api/oauth/v1/authorize
          tokenUrl: https://api.leboncoin.fr/api/oauth/v1/token
          scopes:
            user: Get user rights
