---
openapi: 3.1.0
components:
  schemas:
    ErrorDto:
      type: object
      properties:
        errorCode:
          type: string
        message:
          type: string
        timestamp:
          $ref: "#/components/schemas/ZonedDateTime"
    Transformation:
      type: string
      enum:
      - IDENTITY
      - BASE64
      - ZIP
      - IMAGE_ZIP
      - FAKE_JPEG
      description: |-
        The possible transformations for a downloaded stream.

        * `IDENTITY`: returns the original stream without transformation.
        * `BASE64`: returns the original stream encoded in base64.
        * `ZIP`: returns the original stream zipped.
    ZonedDateTime:
      type: string
      format: date-time
      examples:
      - 2022-03-10T12:15:50-04:00
    HealthResponse:
      type: object
      properties:
        status:
          type: string
          enum:
          - UP
          - DOWN
        checks:
          type: array
          items:
            $ref: "#/components/schemas/HealthCheck"
    HealthCheck:
      type: object
      properties:
        name:
          type: string
        data:
          type:
          - object
          - "null"
        status:
          type: string
          enum:
          - UP
          - DOWN
tags:
- name: File download
  description: Resources to allow for the download of files and optionally apply transformations
    to it.
paths:
  /dl:
    get:
      summary: Downloads a file while applying the requested transformation.
      description: |-
        This method calls the supplied URL and streams the response to the caller.

        If a transformation has been specified, it will be applied to the stream before being returned. A reverse transformation will then be required to use the file as expected.
      operationId: download
      tags:
      - File download
      parameters:
      - description: The transformation to apply to the downloaded file.
        name: transformation
        in: query
        schema:
          $ref: "#/components/schemas/Transformation"
      - description: The URL of the file to download. Both http and https are supported.
        required: true
        name: url
        in: query
        schema:
          type: string
      responses:
        "200":
          description: The requested file transformed as requested.
        "400":
          description: The supplied URL could not be open (eg. missing or invalid).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
        "500":
          description: An internal error happened and the server failed to proxy the
            download.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorDto"
  /q/health:
    description: MicroProfile Health Endpoint
    summary: MicroProfile Health provides a way for your application to distribute
      information about its healthiness state to state whether or not it is able to
      function properly
    get:
      operationId: microprofile_health_root
      description: Check the health of the application
      tags:
      - MicroProfile Health
      summary: "An aggregated view of the Liveness, Readiness and Startup of this\
        \ application"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
  /q/health/live:
    description: MicroProfile Health - Liveness Endpoint
    summary: Liveness checks are utilized to tell whether the application should be
      restarted
    get:
      operationId: microprofile_health_liveness
      description: Check the liveness of the application
      tags:
      - MicroProfile Health
      summary: The Liveness check of this application
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
  /q/health/ready:
    description: MicroProfile Health - Readiness Endpoint
    summary: Readiness checks are used to tell whether the application is able to
      process requests
    get:
      operationId: microprofile_health_readiness
      description: Check the readiness of the application
      tags:
      - MicroProfile Health
      summary: The Readiness check of this application
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
  /q/health/started:
    description: MicroProfile Health - Startup Endpoint
    summary: Startup checks are an used to tell when the application has started
    get:
      operationId: microprofile_health_startup
      description: Check the startup of the application
      tags:
      - MicroProfile Health
      summary: The Startup check of this application
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "503":
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
        "500":
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HealthResponse"
info:
  title: KeyboardPlaying download proxy
  version: 2.5.1
  description: A project to prevent corporate proxies from hindering motivated software
    creators to work properly because of rules that weren't designed with their specific
    needs in mind.
  contact:
    name: KeyboardPlaying
    email: contact@keyboardplaying.org
    url: https://keyboardplaying.org/tools/download-proxy/
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
