{
  "swagger": "2.0",
  "info": {
    "title": "Teamwork Connect API V1",
    "version": "1.0"
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "tags": [
    {
      "name": "Data"
    },
    {
      "name": "Schema"
    }
  ],
  "paths": {
    "/twconnect/api/v1/data/{entity}": {
      "get": {
        "operationId": "GET_twconnect_api_v1_data_{entity}",
        "tags": [
          "Data"
        ],
        "summary": "Retrieve data for a specific entity.",
        "description": "Return the schema of all entities in the underlying storage.",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "orderMode",
            "in": "query",
            "description": "Set if the ordering is ascending or descending.",
            "type": "string",
            "default": "asc"
          },
          {
            "name": "orderBy",
            "in": "query",
            "description": "Allow ordering the result set using a specific field.",
            "type": "string"
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "Allow navigating through the result set using a cursor.",
            "type": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Limit the maximum number of records to return.",
            "type": "integer",
            "default": "1000"
          },
          {
            "name": "entity",
            "in": "path",
            "type": "integer",
            "required": true
          },
          {
            "name": "fields",
            "in": "query",
            "description": "Allow selecting specific fields to return.",
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "200 OK",
            "schema": {
              "$ref": "#/definitions/v1.ClickHouseDataResponse"
            }
          },
          "400": {
            "description": "400 Bad Request",
            "schema": {
              "$ref": "#/definitions/v1.ErrorResponse"
            }
          }
        }
      }
    },
    "/twconnect/api/v1/schema": {
      "get": {
        "operationId": "GET_twconnect_api_v1_schema",
        "tags": [
          "Schema"
        ],
        "summary": "Retrieve schema from all entities.",
        "description": "Return the schema of all entities in the underlying storage.",
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "200 OK",
            "schema": {
              "$ref": "#/definitions/v1.ClickHouseSchemaResponse"
            }
          },
          "400": {
            "description": "400 Bad Request",
            "schema": {
              "$ref": "#/definitions/v1.ErrorResponse"
            }
          }
        }
      }
    },
    "/twconnect/api/v1/schema/{entity}": {
      "get": {
        "operationId": "GET_twconnect_api_v1_schema_{entity}",
        "tags": [
          "Schema"
        ],
        "summary": "Retrieve schema for a specific entity.",
        "description": "Return the schema of a specific entity from the underlying storage.",
        "produces": [
          "application/json"
        ],
        "parameters": [
          {
            "name": "entity",
            "in": "path",
            "type": "integer",
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "200 OK",
            "schema": {
              "$ref": "#/definitions/v1.ClickHouseSchemaResponse"
            }
          },
          "400": {
            "description": "400 Bad Request",
            "schema": {
              "$ref": "#/definitions/v1.ErrorResponse"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "v1.ClickHouseDataResponse": {
      "title": "ClickHouseDataResponse",
      "description": "ClickHouseDataResponse contains the data returned from ClickHouse.",
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "meta": {
          "$ref": "#/definitions/v1.Metadata"
        }
      }
    },
    "v1.ClickHouseSchemaColumn": {
      "title": "ClickHouseSchemaColumn",
      "description": "ClickHouseSchemaColumn contains the schema for a ClickHouse column.",
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "primaryKey": {
          "type": "boolean"
        },
        "type": {
          "type": "string"
        }
      }
    },
    "v1.ClickHouseSchemaResponse": {
      "title": "ClickHouseSchemaResponse",
      "description": "ClickHouseSchemaResponse contains the schema for ClickHouse.",
      "type": "object",
      "properties": {
        "tables": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/v1.ClickHouseSchemaTable"
          }
        }
      }
    },
    "v1.ClickHouseSchemaTable": {
      "title": "ClickHouseSchemaTable",
      "description": "ClickHouseSchemaTable contains the schema for a ClickHouse table.",
      "type": "object",
      "properties": {
        "columns": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/v1.ClickHouseSchemaColumn"
          }
        },
        "name": {
          "type": "string"
        }
      }
    },
    "v1.Error": {
      "title": "Error",
      "description": "Error contains information about an error that occurred while processing a\nrequest.",
      "type": "object",
      "properties": {
        "code": {
          "description": "Application-specific error code. This can be used by consumers to decide\nhow to deal with certain types of errors, etc.",
          "type": "string"
        },
        "detail": {
          "description": "Human-readable explanation specific to this occurrence of the problem. This\nwill not be localized either.",
          "type": "string"
        },
        "id": {
          "description": "Reference for this exact instance of the error, which can help with\ndebugging.",
          "type": "string"
        },
        "meta": {
          "description": "Contains tags with extra information about the specific error. The same\nerror code should always return the same tags.",
          "type": "object"
        },
        "title": {
          "description": "Short, human-readable summary of the problem. This will not be localized. A\nconsumer can use the code property to show a localized string if they like.",
          "type": "string"
        }
      }
    },
    "v1.ErrorResponse": {
      "title": "ErrorResponse",
      "description": "ErrorResponse is the response for one or more errors.",
      "type": "object",
      "properties": {
        "errors": {
          "description": "Collection of errors that occurred while processing a request.",
          "type": "array",
          "items": {
            "$ref": "#/definitions/v1.Error"
          }
        }
      }
    },
    "v1.Metadata": {
      "title": "Metadata",
      "description": "Metadata contains the metadata for a paginated response.",
      "type": "object",
      "properties": {
        "limit": {
          "type": "integer"
        },
        "nextCursor": {
          "type": "string"
        }
      }
    }
  }
}