openapi: 3.0.3
info:
  title: PolyScale API
  version: 0.0.140
  termsOfService: https://www.polyscale.ai/terms-of-use/
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
  schemas: {}
paths:
  "/v1/caches/{cacheId}/cache-ttls":
    get:
      summary: Get cache ttls
      tags:
        - cacheTtl
      description: Get cache ttls of a cache in the workspace associated with the
        provided api key.
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
      responses:
        "200":
          description: Default Response
    post:
      summary: Create a cache ttl
      tags:
        - cacheTtl
      description: Craete a cache ttl for a cache in the workspace associated with the
        provided api key.
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - type: object
                  required:
                    - key
                    - type
                  properties:
                    type:
                      type: string
                      enum:
                        - MANUAL
                        - AUTO
                    key:
                      type: string
                - type: object
                  required:
                    - key
                    - type
                    - value
                  properties:
                    type:
                      type: string
                      enum:
                        - QUERY
                        - TEMPLATE
                        - TABLE
                    key:
                      type: string
                    value:
                      type: number
                    name:
                      type: string
                    sql:
                      type: string
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
      responses:
        "200":
          description: Default Response
  "/v1/caches/{cacheId}/cache-ttls/{key}":
    get:
      summary: Get a cache ttl
      tags:
        - cacheTtl
      description: Retrieve a cache ttl of a cache in the workspace associated with
        the provided api key.
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
        - schema:
            type: string
          in: path
          name: key
          required: true
        - schema:
            type: string
            enum:
              - AUTO
              - MANUAL
              - QUERY
              - TEMPLATE
              - TABLE
          in: path
          name: type
          required: true
      responses:
        "200":
          description: Default Response
    patch:
      summary: Update a cache ttl
      tags:
        - cacheTtl
      description: Update a cache ttl for a cache in the workspace associated with the
        provided api key.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required: []
              properties:
                value:
                  type: number
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
        - schema:
            type: string
          in: path
          name: key
          required: true
      responses:
        "200":
          description: Default Response
  "/v1/caches/{cacheId}/cache-ttls/{type}/{key}":
    delete:
      summary: Delete a cache ttl
      tags:
        - cacheTtl
      description: Delete a cache ttl for a cache in the workspace associated with the
        provided api key.
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
        - schema:
            type: string
          in: path
          name: key
          required: true
        - schema:
            type: string
            enum:
              - AUTO
              - MANUAL
              - QUERY
              - TEMPLATE
              - TABLE
          in: path
          name: type
          required: true
      responses:
        "200":
          description: Default Response
  /v1/caches:
    get:
      summary: Get caches
      tags: &a1
        - cache
      description: Retrieves all caches in the workspace associated with the provided
        api key.
      responses:
        "200":
          description: Default Response
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: false
                  properties:
                    id:
                      type: string
                    name:
                      type: string
                    description:
                      type: string
                    host:
                      type: string
                    port:
                      type: number
                    cachingEnabled:
                      type: boolean
                    database:
                      type: string
                      enum:
                        - mysql
                        - mariadb
                        - postgres
                        - mssql
                        - graphql
                        - mongodb
                    defaultCachingBehaviour:
                      type: string
                      enum:
                        - autoCached
                        - uncached
                    createdAt:
                      type: string
                    connectionUriTemplate:
                      type: string
                    workspaceId:
                      type: string
                    connectionPool:
                      type: object
                      properties:
                        enabled:
                          type: boolean
    post:
      summary: Create a cache
      tags: *a1
      description: Creates a cache in the workspace associated with the provided api key.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - host
                - port
                - cachingEnabled
                - defaultCachingBehaviour
                - database
              properties:
                name:
                  type: string
                  minLength: 1
                description:
                  type: string
                  maxLength: 250
                host:
                  type: string
                  minLength: 1
                port:
                  type: number
                  maximum: 65535
                cachingEnabled:
                  type: boolean
                defaultCachingBehaviour:
                  type: string
                  enum:
                    - autoCached
                    - uncached
                database:
                  type: string
                  enum:
                    - mysql
                    - mariadb
                    - postgres
                    - mssql
                    - graphql
                    - mongodb
        required: true
      responses:
        "200":
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  description:
                    type: string
                  host:
                    type: string
                  port:
                    type: number
                  cachingEnabled:
                    type: boolean
                  database:
                    type: string
                    enum:
                      - mysql
                      - mariadb
                      - postgres
                      - mssql
                      - graphql
                      - mongodb
                  defaultCachingBehaviour:
                    type: string
                    enum:
                      - autoCached
                      - uncached
                  createdAt:
                    type: string
                  connectionUriTemplate:
                    type: string
                  workspaceId:
                    type: string
                  connectionPool:
                    type: object
                    properties:
                      enabled:
                        type: boolean
  "/v1/caches/{id}":
    get:
      summary: Get a cache
      tags: *a1
      description: Retrieves a specific cache in the workspace associated with the
        provided api key.
      parameters:
        - schema:
            type: string
          in: path
          name: id
          required: true
      responses:
        "200":
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  description:
                    type: string
                  host:
                    type: string
                  port:
                    type: number
                  cachingEnabled:
                    type: boolean
                  database:
                    type: string
                    enum:
                      - mysql
                      - mariadb
                      - postgres
                      - mssql
                      - graphql
                      - mongodb
                  defaultCachingBehaviour:
                    type: string
                    enum:
                      - autoCached
                      - uncached
                  createdAt:
                    type: string
                  connectionUriTemplate:
                    type: string
                  workspaceId:
                    type: string
                  connectionPool:
                    type: object
                    properties:
                      enabled:
                        type: boolean
    patch:
      summary: Update a cache
      tags: *a1
      description: Updates a cache in the workspace associated with the provided api key.
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name:
                  type: string
                description:
                  type: string
                cachingEnabled:
                  type: boolean
                host:
                  type: string
                port:
                  type: number
      parameters:
        - schema:
            type: string
          in: path
          name: id
          required: true
      responses:
        "200":
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: false
                properties:
                  id:
                    type: string
                  name:
                    type: string
                  description:
                    type: string
                  host:
                    type: string
                  port:
                    type: number
                  cachingEnabled:
                    type: boolean
                  database:
                    type: string
                    enum:
                      - mysql
                      - mariadb
                      - postgres
                      - mssql
                      - graphql
                      - mongodb
                  defaultCachingBehaviour:
                    type: string
                    enum:
                      - autoCached
                      - uncached
                  createdAt:
                    type: string
                  connectionUriTemplate:
                    type: string
                  workspaceId:
                    type: string
                  connectionPool:
                    type: object
                    properties:
                      enabled:
                        type: boolean
  "/v1/caches/{cacheId}/purge":
    put:
      summary: Purge a cache
      tags: *a1
      description: Purge a cache in the workspace associated with the provided api key.
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
      responses:
        "204":
          description: No Content
  "/v1/caches/{cacheId}":
    delete:
      summary: Delete a cache
      tags: *a1
      description: Delete a cache in the workspace associated with the provided api key.
      parameters:
        - schema:
            type: string
          in: path
          name: cacheId
          required: true
      responses:
        "204":
          description: No Content
security:
  - bearerAuth: []
tags:
  - name: cache
  - name: cacheTtl
