openapi: 3.0.3
servers:
  - url: https://apache.local
info:
  contact:
    x-twitter: TheASF
  description: API for Qakka Queue System
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  title: Qakka
  version: v1
  x-apisguru-categories:
    - messaging
  x-logo:
    url: https://twitter.com/TheASF/profile_image?size=original
  x-origin:
    - format: openapi
      url: https://raw.githubusercontent.com/apache/usergrid-qakka/master/docs/swagger.json
      version: "2.0"
  x-providerName: apache.org
  x-serviceName: qakka
tags:
  - description: Queue management, send, get and ack.
    name: queues
  - description: Status end-point.
    name: status
paths:
  /queues:
    get:
      description: ""
      operationId: getListOfQueues
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
      summary: Get list of all Queues.
      tags:
        - queues
    post:
      description: ""
      operationId: createQueue
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: No Queue object posted, or name field is missing
      summary: Create new queue.
      tags:
        - queues
  "/queues/{queueName}":
    delete:
      description: ""
      operationId: deleteQueue
      parameters:
        - in: path
          name: queueName
          required: true
          schema:
            type: string
        - in: query
          name: confirm
          required: false
          schema:
            default: false
            type: boolean
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: Queue name or confirm flag missing.
      summary: Delete Queue.
      tags:
        - queues
  "/queues/{queueName}/config":
    get:
      description: ""
      operationId: getQueueConfig
      parameters:
        - description: Name of Queue
          in: path
          name: queueName
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: Queue name or confirm flag missing.
      summary: Get Queue config.
      tags:
        - queues
    put:
      description: ""
      operationId: updateQueueConfig
      parameters:
        - in: path
          name: queueName
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: No Queue object posted, or name field is missing
      summary: Update Queue configuration.
      tags:
        - queues
  "/queues/{queueName}/data/{queueMessageId}":
    get:
      description: ""
      operationId: getMessageData
      parameters:
        - description: Name of Queue
          in: path
          name: queueName
          required: true
          schema:
            type: string
        - description: ID of Queue Message for which data is to be returned
          in: path
          name: queueMessageId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            "*/*":
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: Message ID invalid
        "404":
          description: Queue Message or data not found
      summary: Get data associated with a Queue Message.
      tags:
        - queues
  "/queues/{queueName}/messages":
    get:
      description: ""
      operationId: getNextMessages
      parameters:
        - description: Name of Queue
          in: path
          name: queueName
          required: true
          schema:
            type: string
        - description: Number of messages to get
          in: query
          name: count
          required: false
          schema:
            default: "1"
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: Invalid count parameter
      summary: Get next Queue Messages from a Queue
      tags:
        - queues
    post:
      description: ""
      operationId: sendMessageBinary
      parameters:
        - description: Name of Queue
          in: path
          name: queueName
          required: true
          schema:
            type: string
        - description: Regions to which message is to be sent
          in: query
          name: regions
          required: false
          schema:
            type: string
        - in: query
          name: delay
          required: false
          schema:
            type: string
        - in: query
          name: expiration
          required: false
          schema:
            type: string
        - description: Content type of the data to be sent with Queue Message
          in: query
          name: contentType
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/octet-stream:
            schema:
              items:
                format: byte
                type: string
              type: array
        description: Data to be send with Queue Message
        required: true
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
      summary: Send Queue Message with a binary data (blob) payload.
      tags:
        - queues
  "/queues/{queueName}/messages/{queueMessageId}":
    delete:
      description: ""
      operationId: ackMessage
      parameters:
        - description: Name of Queue
          in: path
          name: queueName
          required: true
          schema:
            type: string
        - description: ID of Queue Message to be acknowledged
          in: path
          name: queueMessageId
          required: true
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiResponse"
          description: successful operation
        "400":
          description: Queue Message ID invalid, or message not in-flight
      summary: Acknowledge that Queue Message has been processed.
      tags:
        - queues
  /status:
    get:
      description: ""
      operationId: status
      responses:
        "200":
          content:
            application/json:
              schema:
                type: object
          description: successful operation
      summary: Status of webapp.
      tags:
        - status
components:
  schemas:
    ApiResponse:
      description: Response returned by most Queue API calls.
      properties:
        count:
          description: Count of Queues or QueueMessages returned by the call.
          format: int32
          type: integer
        message:
          description: Informative message intended for client.
          type: string
        queueMessages:
          description: Queues Messages returned by the call, or empty if not applicable.
          items:
            $ref: "#/components/schemas/QueueMessage"
          type: array
        queues:
          description: Queues returned but the call, or empty if not applicable.
          items:
            $ref: "#/components/schemas/Queue"
          type: array
      type: object
    Queue:
      description: Specifies the configuration for a Queue.
      properties:
        name:
          description: Name of queue, must be unique.
          type: string
      required:
        - name
      type: object
    QueueMessage:
      description: A Queue Message
      properties:
        contentType:
          description: Content-type of data associated with QueueMessage.
          type: string
        createDate:
          description: Date that message was received by system.
          format: int64
          type: integer
        data:
          description: Embedded JSON to be sent with Queue Message.
          type: string
        href:
          description: URL of data associated with Queue Message (if not embedded JSON)
          type: string
        messageId:
          description: UUID of Message Data associated with this Queue Message
          format: uuid
          type: string
        queueMessageId:
          description: UUID of Queue Message in local region.
          format: uuid
          type: string
        queueName:
          description: Name of Queue for message.
          type: string
        receivingRegion:
          description: Regions to which message will be sent
          type: string
        sendingRegion:
          description: Region from which was sent
          type: string
      required:
        - queueName
      type: object
