// This file was generated by the Opapi Generator
/* eslint-disable */
/* prettier-ignore */
import * as opapi from '@bpinternal/opapi'
export type State = opapi.State<'Table' | 'Column' | 'Row', never, 'tables'>
export const state = {
  "operations": {
    "listTables": {
      "name": "listTables",
      "path": "/v1/tables",
      "description": "Retrieves a list of all tables associated with your bot.",
      "method": "get",
      "parameters": {
        "tags": {
          "in": "query",
          "type": "object",
          "schema": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            }
          },
          "description": "Optional filters to narrow down the list by tags associated with tables."
        }
      },
      "section": "tables",
      "response": {
        "description": "Returns a list of tables.",
        "schema": {
          "type": "object",
          "properties": {
            "tables": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Table"
              }
            }
          },
          "required": [
            "tables"
          ],
          "title": "listTablesResponse",
          "additionalProperties": false
        }
      }
    },
    "getTable": {
      "name": "getTable",
      "path": "/v1/tables/{table}",
      "description": "Retrieves detailed information about a specific table, identified by its name or unique identifier.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "method": "get",
      "section": "tables",
      "response": {
        "description": "Details of the requested table, including row count and indexing status.",
        "schema": {
          "type": "object",
          "properties": {
            "table": {
              "$ref": "#/components/schemas/Table"
            },
            "rows": {
              "type": "number",
              "description": "The total number of rows present in the table."
            },
            "stale": {
              "type": "number",
              "description": "The number of stale rows that are waiting to be processed"
            },
            "indexing": {
              "type": "number",
              "description": "The number of rows that are waiting to be indexed (for search)"
            }
          },
          "required": [
            "table",
            "rows",
            "stale",
            "indexing"
          ],
          "title": "getTableResponse",
          "additionalProperties": false
        }
      }
    },
    "getOrCreateTable": {
      "name": "getOrCreateTable",
      "path": "/v1/tables/{table}",
      "description": "Retrieves information about a specific table if it exists; otherwise, creates a new table based on the provided schema.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "method": "post",
      "requestBody": {
        "description": "Schema defining the structure of the table",
        "schema": {
          "type": "object",
          "properties": {
            "factor": {
              "default": 1,
              "type": "number",
              "minimum": 1,
              "maximum": 30,
              "description": "The 'factor' multiplies the row's data storage limit by 4KB and its quota count, but can only be set at table creation and not modified later. For instance, a factor of 2 increases storage to 8KB but counts as 2 rows in your quota. The default factor is 1."
            },
            "frozen": {
              "type": "boolean",
              "description": "A table designated as \"frozen\" is immutable in terms of its name and schema structure; modifications to its schema or a renaming operation are not permitted. The only action that can be taken on such a table is deletion. The schema established at the time of creation is locked in as the final structure. To implement any changes, the table must be duplicated with the desired alterations."
            },
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "description": "Provide an object or a JSON schema to define the columns of the table. A maximum of 20 keys in the object/schema is allowed."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "description": "Optional tags to help organize your tables. These should be passed here as an object representing key/value pairs."
            },
            "isComputeEnabled": {
              "type": "boolean",
              "description": "Indicates if the table is enabled for computation."
            }
          },
          "required": [
            "schema"
          ],
          "title": "getOrCreateTableBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "The retrieved or created table object.",
        "schema": {
          "type": "object",
          "properties": {
            "table": {
              "$ref": "#/components/schemas/Table"
            },
            "created": {
              "type": "boolean",
              "description": "Flag indicating if the table was newly created."
            },
            "rows": {
              "type": "number",
              "description": "The total number of rows present in the table."
            },
            "stale": {
              "type": "number",
              "description": "The number of stale rows that are waiting to be processed"
            },
            "indexing": {
              "type": "number",
              "description": "The number of rows that are waiting to be indexed (for search)"
            }
          },
          "required": [
            "table",
            "created",
            "rows",
            "stale",
            "indexing"
          ],
          "title": "getOrCreateTableResponse",
          "additionalProperties": false
        }
      }
    },
    "createTable": {
      "name": "createTable",
      "path": "/v1/tables",
      "description": "Initiates the creation of a new table based on the provided schema, excluding system-managed fields like IDs and timestamps.",
      "method": "post",
      "requestBody": {
        "description": "Schema defining the structure of the new table",
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "description": "Required. This name is used to identify your table.",
              "type": "string",
              "minLength": 1
            },
            "factor": {
              "default": 1,
              "type": "number",
              "minimum": 1,
              "maximum": 30,
              "description": "The 'factor' multiplies the row's data storage limit by 4KB and its quota count, but can only be set at table creation and not modified later. For instance, a factor of 2 increases storage to 8KB but counts as 2 rows in your quota. The default factor is 1."
            },
            "frozen": {
              "type": "boolean",
              "description": "A table designated as \"frozen\" is immutable in terms of its name and schema structure; modifications to its schema or a renaming operation are not permitted. The only action that can be taken on such a table is deletion. The schema established at the time of creation is locked in as the final structure. To implement any changes, the table must be duplicated with the desired alterations."
            },
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "description": "Provide an object or a JSON schema to define the columns of the table. A maximum of 20 keys in the object/schema is allowed."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "description": "Optional tags to help organize your tables. These should be passed here as an object representing key/value pairs."
            },
            "isComputeEnabled": {
              "type": "boolean",
              "description": "Indicates if the table is enabled for computation."
            }
          },
          "required": [
            "name",
            "schema"
          ],
          "title": "createTableBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "The created table object.",
        "schema": {
          "type": "object",
          "properties": {
            "table": {
              "$ref": "#/components/schemas/Table"
            }
          },
          "required": [
            "table"
          ],
          "title": "createTableResponse",
          "additionalProperties": false
        }
      },
      "parameters": {}
    },
    "duplicateTable": {
      "name": "duplicateTable",
      "path": "/v1/tables/{sourceTableId}/duplicate",
      "description": "Duplicates the table schema & content",
      "parameters": {
        "sourceTableId": {
          "type": "string",
          "description": "The table's unique identifier",
          "in": "path"
        }
      },
      "method": "post",
      "requestBody": {
        "description": "Parameters for the duplication operation.",
        "schema": {
          "type": "object",
          "properties": {
            "tableName": {
              "type": "string"
            },
            "schemaOnly": {
              "type": "boolean",
              "description": "Only duplicate the schema, not the content"
            },
            "factor": {
              "type": "number",
              "description": "Use a different factor for the table. Leave empty to use the same as the duplicated table."
            }
          },
          "title": "duplicateTableBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "The created table object.",
        "schema": {
          "type": "object",
          "properties": {
            "table": {
              "$ref": "#/components/schemas/Table"
            },
            "rows": {
              "type": "number",
              "description": "The total number of rows present in the table."
            }
          },
          "required": [
            "table",
            "rows"
          ],
          "title": "duplicateTableResponse",
          "additionalProperties": false
        }
      }
    },
    "exportTable": {
      "name": "exportTable",
      "path": "/v1/tables/{table}/export",
      "description": "Starts an export job for the table",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's unique identifier",
          "in": "path"
        },
        "format": {
          "in": "query",
          "type": "object",
          "description": "The format of the exported file. CSV includes only the data while JSON includes the schema.",
          "schema": {
            "type": "string",
            "enum": [
              "csv",
              "json"
            ]
          }
        },
        "compress": {
          "in": "query",
          "type": "object",
          "description": "Whether or not the export is compressed (gzipped).",
          "schema": {
            "default": true,
            "type": "boolean"
          }
        }
      },
      "method": "get",
      "section": "tables",
      "response": {
        "description": "The export job",
        "schema": {
          "type": "object",
          "properties": {
            "job": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "botId": {
                  "type": "string"
                },
                "tableId": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "export",
                    "import"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "in_progress",
                    "finalizing",
                    "completed",
                    "failed"
                  ]
                },
                "progress": {
                  "default": 0,
                  "type": "number"
                },
                "inputFileId": {
                  "type": "string",
                  "nullable": true
                },
                "outputFileId": {
                  "type": "string",
                  "nullable": true
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "botId",
                "tableId",
                "type",
                "status",
                "inputFileId",
                "outputFileId",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "job"
          ],
          "title": "exportTableResponse",
          "additionalProperties": false
        }
      }
    },
    "getTableJobs": {
      "name": "getTableJobs",
      "path": "/v1/tables/{table}/jobs",
      "description": "Returns a list of recent jobs for the table (export/import operations)",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's unique identifier",
          "in": "path"
        }
      },
      "method": "get",
      "section": "tables",
      "response": {
        "description": "The most recent jobs",
        "schema": {
          "type": "object",
          "properties": {
            "jobs": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "botId": {
                    "type": "string"
                  },
                  "tableId": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "export",
                      "import"
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "pending",
                      "in_progress",
                      "finalizing",
                      "completed",
                      "failed"
                    ]
                  },
                  "progress": {
                    "default": 0,
                    "type": "number"
                  },
                  "inputFileId": {
                    "type": "string",
                    "nullable": true
                  },
                  "outputFileId": {
                    "type": "string",
                    "nullable": true
                  },
                  "createdAt": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "updatedAt": {
                    "type": "string",
                    "format": "date-time"
                  }
                },
                "required": [
                  "id",
                  "botId",
                  "tableId",
                  "type",
                  "status",
                  "inputFileId",
                  "outputFileId",
                  "createdAt",
                  "updatedAt"
                ]
              }
            }
          },
          "required": [
            "jobs"
          ],
          "title": "getTableJobsResponse",
          "additionalProperties": false
        }
      }
    },
    "importTable": {
      "name": "importTable",
      "path": "/v1/tables/{table}/import",
      "description": "Import the content of a file into a table. The table must already have been created with the correct schema. Data already in the table will be kept.",
      "method": "post",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "Content to import",
        "schema": {
          "type": "object",
          "properties": {
            "fileId": {
              "type": "string",
              "description": "The file ID to import. It must have been uploaded to the Files API before. Supported formats: CSV, JSON (gzipped or not)"
            }
          },
          "required": [
            "fileId"
          ],
          "title": "importTableBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "The import job",
        "schema": {
          "type": "object",
          "properties": {
            "job": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "botId": {
                  "type": "string"
                },
                "tableId": {
                  "type": "string"
                },
                "type": {
                  "type": "string",
                  "enum": [
                    "export",
                    "import"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "pending",
                    "in_progress",
                    "finalizing",
                    "completed",
                    "failed"
                  ]
                },
                "progress": {
                  "default": 0,
                  "type": "number"
                },
                "inputFileId": {
                  "type": "string",
                  "nullable": true
                },
                "outputFileId": {
                  "type": "string",
                  "nullable": true
                },
                "createdAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "updatedAt": {
                  "type": "string",
                  "format": "date-time"
                }
              },
              "required": [
                "id",
                "botId",
                "tableId",
                "type",
                "status",
                "inputFileId",
                "outputFileId",
                "createdAt",
                "updatedAt"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "job"
          ],
          "title": "importTableResponse",
          "additionalProperties": false
        }
      }
    },
    "updateTable": {
      "name": "updateTable",
      "path": "/v1/tables/{table}",
      "description": "Updates the schema or the name of an existing table.",
      "method": "put",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "The updated schema/name of the table.",
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "description": "Required. This name is used to identify your table.",
              "type": "string",
              "minLength": 1
            },
            "frozen": {
              "type": "boolean",
              "description": "A table designated as \"frozen\" is immutable in terms of its name and schema structure; modifications to its schema or a renaming operation are not permitted. The only action that can be taken on such a table is deletion. The schema established at the time of creation is locked in as the final structure. To implement any changes, the table must be duplicated with the desired alterations."
            },
            "schema": {
              "type": "object",
              "additionalProperties": true,
              "description": "Provide an object or a JSON schema to define the columns of the table. A maximum of 20 keys in the object/schema is allowed."
            },
            "tags": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              },
              "description": "Optional tags to help organize your tables. These should be passed here as an object representing key/value pairs."
            },
            "isComputeEnabled": {
              "type": "boolean",
              "description": "Indicates if the table is enabled for computation."
            }
          },
          "title": "updateTableBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "The updated table",
        "schema": {
          "type": "object",
          "properties": {
            "table": {
              "$ref": "#/components/schemas/Table"
            },
            "staleColumns": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "List of columns that have become stale following the modification."
            }
          },
          "required": [
            "table"
          ],
          "title": "updateTableResponse",
          "additionalProperties": false
        }
      }
    },
    "renameTableColumn": {
      "name": "renameTableColumn",
      "path": "/v1/tables/{table}/column",
      "description": "Renames an existing column within a table to better reflect its content or usage. The operation targets a specific table and requires the current and new column names.",
      "method": "put",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "Details of the column to be renamed, including its current name and the desired new name.",
        "schema": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The existing name of the column."
            },
            "newName": {
              "description": "The new name to assign to the column.",
              "type": "string",
              "minLength": 1,
              "maxLength": 30
            }
          },
          "required": [
            "name",
            "newName"
          ],
          "title": "renameTableColumnBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "Confirmation of the column rename operation, including the updated table schema.",
        "schema": {
          "type": "object",
          "properties": {
            "table": {
              "$ref": "#/components/schemas/Table"
            }
          },
          "required": [
            "table"
          ],
          "title": "renameTableColumnResponse",
          "additionalProperties": false
        }
      }
    },
    "deleteTable": {
      "name": "deleteTable",
      "path": "/v1/tables/{table}",
      "description": "Permanently deletes a table and all its associated data from the system. Use with caution, as this action cannot be undone.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "method": "delete",
      "section": "tables",
      "response": {
        "description": "Confirmation that the table has been deleted.",
        "schema": {
          "type": "object",
          "title": "deleteTableResponse",
          "additionalProperties": false
        }
      }
    },
    "getTableRow": {
      "name": "getTableRow",
      "path": "/v1/tables/{table}/row",
      "description": "Fetches a specific row from a table using the row's unique identifier.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        },
        "id": {
          "type": "object",
          "description": "Identifier of the row within the table.",
          "in": "query",
          "required": true,
          "schema": {
            "type": "integer"
          }
        }
      },
      "method": "get",
      "section": "tables",
      "response": {
        "description": "The requested row object.",
        "schema": {
          "type": "object",
          "properties": {
            "row": {
              "$ref": "#/components/schemas/Row"
            }
          },
          "required": [
            "row"
          ],
          "title": "getTableRowResponse",
          "additionalProperties": false
        }
      }
    },
    "findTableRows": {
      "name": "findTableRows",
      "path": "/v1/tables/{table}/rows/find",
      "description": "Enables the search and filtering of rows within a table based on specific criteria. This operation supports complex queries for advanced data manipulation and retrieval.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "The search criteria and filters to apply when searching for rows. This includes conditions, search terms, and pagination options.",
        "schema": {
          "type": "object",
          "properties": {
            "limit": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "description": "Limit for pagination, specifying the maximum number of rows to return."
            },
            "offset": {
              "default": 0,
              "type": "integer",
              "minimum": 0,
              "description": "Offset for pagination, specifying where to start returning rows from."
            },
            "filter": {
              "type": "object",
              "additionalProperties": true,
              "description": "Provide a mongodb-like filter to apply to the query. Example: \\{ \"name\": \\{ \"$eq\": \"John\" \\} \\}"
            },
            "group": {
              "type": "object",
              "additionalProperties": true,
              "description": "Group the rows by a specific column and apply aggregations to them. Allowed values: key, avg, max, min, sum, count. Example: \\{ \"someId\": \"key\", \"orders\": [\"sum\", \"avg\"] \\}"
            },
            "search": {
              "type": "string",
              "maxLength": 1024,
              "description": "Search term to apply to the row search. When using this parameter, some rows which doesn't match the search term will be returned, use the similarity field to know how much the row matches the search term. "
            },
            "select": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Specify which columns to return in the response. Supports both top-level columns (e.g., \"name\") and nested attributes using dot notation (e.g., \"attributes.price\"). System columns (id, createdAt, updatedAt, etc.) are always included. If omitted, all columns are returned."
            },
            "orderBy": {
              "default": "id",
              "type": "string",
              "description": "Specifies the column by which to order the results. By default it is ordered by id. Build-in columns: id, createdAt, updatedAt"
            },
            "orderDirection": {
              "default": "asc",
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "description": "Specifies the direction of sorting, either ascending or descending."
            }
          },
          "title": "findTableRowsBody",
          "additionalProperties": false
        }
      },
      "method": "post",
      "section": "tables",
      "response": {
        "description": "A collection of rows that match the search criteria, along with metadata such as total count and pagination details.",
        "schema": {
          "type": "object",
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Row"
              }
            },
            "hasMore": {
              "type": "boolean",
              "description": "Flag indicating if there are more rows to fetch."
            },
            "offset": {
              "type": "integer"
            },
            "limit": {
              "type": "integer"
            },
            "warnings": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Alerts for minor issues that don't block the operation but suggest possible improvements."
            }
          },
          "required": [
            "rows",
            "hasMore",
            "offset",
            "limit"
          ],
          "title": "findTableRowsResponse",
          "additionalProperties": false
        }
      }
    },
    "createTableRows": {
      "name": "createTableRows",
      "path": "/v1/tables/{table}/rows",
      "description": "Inserts one or multiple new rows into the specified table.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "A batch of new rows to insert into the table. Each row must adhere to the table’s schema. A maximum of 1000 rows can be inserted in a single request.",
        "schema": {
          "type": "object",
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {},
                "additionalProperties": true
              },
              "minItems": 1,
              "maxItems": 1000
            },
            "waitComputed": {
              "type": "boolean",
              "description": "Ensure computed columns are fully processed before returning the result. This is applicable only when the number of rows involved is fewer than 1."
            }
          },
          "required": [
            "rows"
          ],
          "title": "createTableRowsBody",
          "additionalProperties": false
        }
      },
      "method": "post",
      "section": "tables",
      "response": {
        "description": "A summary of the insertion operation, including any warnings or errors encountered, and the inserted row data.",
        "schema": {
          "type": "object",
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Row"
              }
            },
            "warnings": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Alerts for minor issues that don't block the operation but suggest possible improvements."
            },
            "errors": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Critical issues in specific elements that prevent their successful processing, allowing partial operation success."
            }
          },
          "required": [
            "rows"
          ],
          "title": "createTableRowsResponse",
          "additionalProperties": false
        }
      }
    },
    "deleteTableRows": {
      "name": "deleteTableRows",
      "path": "/v1/tables/{table}/rows/delete",
      "description": "Allows selective deletion of rows or complete clearance of a table.",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "Identifiers of the rows to be deleted.",
        "schema": {
          "type": "object",
          "properties": {
            "ids": {
              "type": "array",
              "items": {
                "type": "number",
                "maximum": 2147483647
              },
              "maxItems": 1000
            },
            "filter": {
              "type": "object",
              "additionalProperties": true,
              "description": "Filter to apply when deleting rows. Example: \\{ \"name\": \\{ \"$eq\": \"John\" \\} \\}"
            },
            "deleteAllRows": {
              "type": "boolean",
              "description": "Flag to delete all rows. Use with caution as this action is irreversible."
            }
          },
          "title": "deleteTableRowsBody",
          "additionalProperties": false
        }
      },
      "method": "post",
      "section": "tables",
      "response": {
        "description": "Confirms the number of rows successfully deleted.",
        "schema": {
          "type": "object",
          "properties": {
            "deletedRows": {
              "type": "number"
            }
          },
          "required": [
            "deletedRows"
          ],
          "title": "deleteTableRowsResponse",
          "additionalProperties": false
        }
      }
    },
    "updateTableRows": {
      "name": "updateTableRows",
      "path": "/v1/tables/{table}/rows",
      "description": "Updates specified rows in a table, allowing partial success with detailed feedback on errors.",
      "method": "put",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "Data for rows to update, including IDs. Errors affect only specific rows, not the entire batch.",
        "schema": {
          "type": "object",
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "number",
                    "maximum": 2147483647
                  }
                },
                "required": [
                  "id"
                ],
                "additionalProperties": true
              },
              "minItems": 1,
              "maxItems": 1000,
              "description": "Rows with updated data, identified by ID."
            },
            "waitComputed": {
              "type": "boolean",
              "description": "Ensure computed columns are fully processed before returning the result. This is applicable only when the number of rows involved is fewer than 1."
            }
          },
          "required": [
            "rows"
          ],
          "title": "updateTableRowsBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "Returns updated rows, including warnings for minor issues and errors for failed updates.",
        "schema": {
          "type": "object",
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Row"
              }
            },
            "warnings": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Alerts for minor issues that don't block the operation but suggest possible improvements."
            },
            "errors": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Critical issues in specific elements that prevent their successful processing, allowing partial operation success."
            }
          },
          "required": [
            "rows"
          ],
          "title": "updateTableRowsResponse",
          "additionalProperties": false
        }
      }
    },
    "upsertTableRows": {
      "name": "upsertTableRows",
      "path": "/v1/tables/{table}/rows/upsert",
      "description": "Inserts or updates rows based on a key. If a row exists, it is updated; otherwise, a new row is created.",
      "method": "post",
      "parameters": {
        "table": {
          "type": "string",
          "description": "The table's name or unique identifier for targeting specific table operations.",
          "in": "path"
        }
      },
      "requestBody": {
        "description": "Rows for insertion or update, with a key column to determine action. Supports partial successes.",
        "schema": {
          "type": "object",
          "properties": {
            "rows": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "number",
                    "maximum": 2147483647
                  }
                },
                "additionalProperties": true
              },
              "minItems": 1,
              "maxItems": 1000
            },
            "keyColumn": {
              "default": "id",
              "type": "string",
              "minLength": 1,
              "maxLength": 30,
              "description": "Determines if a row is inserted or updated. Defaults to \"id\"."
            },
            "waitComputed": {
              "type": "boolean",
              "description": "Ensure computed columns are fully processed before returning the result. This is applicable only when the number of rows involved is fewer than 1."
            }
          },
          "required": [
            "rows"
          ],
          "title": "upsertTableRowsBody",
          "additionalProperties": false
        }
      },
      "section": "tables",
      "response": {
        "description": "Summary of insertions and updates, including any warnings or errors.",
        "schema": {
          "type": "object",
          "properties": {
            "inserted": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Row"
              }
            },
            "updated": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/Row"
              }
            },
            "warnings": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Alerts for minor issues that don't block the operation but suggest possible improvements."
            },
            "errors": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "Critical issues in specific elements that prevent their successful processing, allowing partial operation success."
            }
          },
          "required": [
            "inserted",
            "updated"
          ],
          "title": "upsertTableRowsResponse",
          "additionalProperties": false
        }
      }
    }
  },
  "metadata": {
    "title": "Botpress Tables API",
    "description": "API for Botpress Tables",
    "server": "https://api.botpress.cloud",
    "version": "1.48.2",
    "prefix": "v1"
  },
  "errors": [
    {
      "status": 500,
      "type": "Unknown",
      "description": "An unknown error occurred"
    },
    {
      "status": 500,
      "type": "Internal",
      "description": "An internal error occurred"
    },
    {
      "status": 401,
      "type": "Unauthorized",
      "description": "The request requires to be authenticated."
    },
    {
      "status": 403,
      "type": "Forbidden",
      "description": "The requested action can't be peform by this resource."
    },
    {
      "status": 413,
      "type": "PayloadTooLarge",
      "description": "The request payload is too large."
    },
    {
      "status": 400,
      "type": "InvalidPayload",
      "description": "The request payload is invalid."
    },
    {
      "status": 415,
      "type": "UnsupportedMediaType",
      "description": "The request is invalid because the content-type is not supported."
    },
    {
      "status": 405,
      "type": "MethodNotFound",
      "description": "The requested method does not exist."
    },
    {
      "status": 404,
      "type": "ResourceNotFound",
      "description": "The requested resource does not exist."
    },
    {
      "status": 400,
      "type": "InvalidJsonSchema",
      "description": "The provided JSON schema is invalid."
    },
    {
      "status": 400,
      "type": "InvalidDataFormat",
      "description": "The provided data doesn't respect the provided JSON schema."
    },
    {
      "status": 400,
      "type": "InvalidIdentifier",
      "description": "The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters."
    },
    {
      "status": 409,
      "type": "RelationConflict",
      "description": "The resource is related with a different resource that the one referenced in the request. This is usually caused when providing two resource identifiers that aren't linked together."
    },
    {
      "status": 409,
      "type": "ReferenceConstraint",
      "description": "The resource cannot be deleted because it's referenced by another resource"
    },
    {
      "status": 409,
      "type": "ResourceLockedConflict",
      "description": "The resource is current locked and cannot be operated on until the lock is released."
    },
    {
      "status": 410,
      "type": "ResourceGone",
      "description": "The requested resource is no longer available."
    },
    {
      "status": 400,
      "type": "ReferenceNotFound",
      "description": "The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request."
    },
    {
      "status": 400,
      "type": "InvalidQuery",
      "description": "The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource."
    },
    {
      "status": 400,
      "type": "Runtime",
      "description": "An error happened during the execution of a runtime (bot or integration)."
    },
    {
      "status": 409,
      "type": "AlreadyExists",
      "description": "The record attempted to be created already exists."
    },
    {
      "status": 429,
      "type": "RateLimited",
      "description": "The request has been rate limited."
    },
    {
      "status": 402,
      "type": "PaymentRequired",
      "description": "A payment is required to perform this request."
    },
    {
      "status": 403,
      "type": "QuotaExceeded",
      "description": "The request exceeds the allowed quota. Quotas are a soft limit that can be increased."
    },
    {
      "status": 413,
      "type": "LimitExceeded",
      "description": "The request exceeds the allowed limit. Limits are a hard limit that cannot be increased."
    },
    {
      "status": 400,
      "type": "BreakingChanges",
      "description": "Request payload contains breaking changes which is not allowed for this resource without a version increment."
    }
  ],
  "refs": {
    "parameters": {},
    "requestBodies": {
      "getOrCreateTableBody": true,
      "createTableBody": true,
      "duplicateTableBody": true,
      "importTableBody": true,
      "updateTableBody": true,
      "renameTableColumnBody": true,
      "findTableRowsBody": true,
      "createTableRowsBody": true,
      "deleteTableRowsBody": true,
      "updateTableRowsBody": true,
      "upsertTableRowsBody": true
    },
    "responses": {
      "listTablesResponse": true,
      "getTableResponse": true,
      "getOrCreateTableResponse": true,
      "createTableResponse": true,
      "duplicateTableResponse": true,
      "exportTableResponse": true,
      "getTableJobsResponse": true,
      "importTableResponse": true,
      "updateTableResponse": true,
      "renameTableColumnResponse": true,
      "deleteTableResponse": true,
      "getTableRowResponse": true,
      "findTableRowsResponse": true,
      "createTableRowsResponse": true,
      "deleteTableRowsResponse": true,
      "updateTableRowsResponse": true,
      "upsertTableRowsResponse": true
    },
    "schemas": {
      "Table": true,
      "Column": true,
      "Row": true
    }
  },
  "schemas": {
    "Table": {
      "section": "tables",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the table"
          },
          "name": {
            "description": "Required. This name is used to identify your table.",
            "type": "string",
            "minLength": 1
          },
          "factor": {
            "default": 1,
            "type": "number",
            "minimum": 1,
            "maximum": 30,
            "description": "The 'factor' multiplies the row's data storage limit by 4KB and its quota count, but can only be set at table creation and not modified later. For instance, a factor of 2 increases storage to 8KB but counts as 2 rows in your quota. The default factor is 1."
          },
          "frozen": {
            "type": "boolean",
            "description": "A table designated as \"frozen\" is immutable in terms of its name and schema structure; modifications to its schema or a renaming operation are not permitted. The only action that can be taken on such a table is deletion. The schema established at the time of creation is locked in as the final structure. To implement any changes, the table must be duplicated with the desired alterations."
          },
          "schema": {
            "type": "object",
            "properties": {
              "$schema": {
                "type": "string"
              },
              "properties": {
                "type": "object",
                "additionalProperties": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string",
                      "enum": [
                        "string",
                        "number",
                        "boolean",
                        "object",
                        "array",
                        "null"
                      ]
                    },
                    "format": {
                      "type": "string",
                      "enum": [
                        "date-time"
                      ]
                    },
                    "description": {
                      "type": "string"
                    },
                    "pattern": {
                      "type": "string",
                      "description": "String properties must match this pattern"
                    },
                    "enum": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "String properties must be one of these values"
                    },
                    "items": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "string",
                            "number",
                            "boolean",
                            "object",
                            "array",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": true,
                      "description": "Defines the shape of items in an array"
                    },
                    "nullable": {
                      "default": true,
                      "type": "boolean"
                    },
                    "properties": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean",
                              "object",
                              "array",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "additionalProperties": true
                      }
                    },
                    "x-zui": {
                      "type": "object",
                      "properties": {
                        "index": {
                          "type": "integer"
                        },
                        "id": {
                          "type": "string",
                          "description": "[deprecated] ID of the column."
                        },
                        "searchable": {
                          "type": "boolean",
                          "description": "Indicates if the column is vectorized and searchable."
                        },
                        "hidden": {
                          "type": "boolean",
                          "description": "Indicates if the field is hidden in the UI"
                        },
                        "order": {
                          "type": "number",
                          "description": "Order of the column in the UI"
                        },
                        "width": {
                          "type": "number",
                          "description": "Width of the column in the UI"
                        },
                        "schemaId": {
                          "type": "string",
                          "description": "ID of the schema"
                        },
                        "computed": {
                          "type": "object",
                          "properties": {
                            "action": {
                              "type": "string",
                              "enum": [
                                "ai",
                                "code",
                                "workflow"
                              ]
                            },
                            "dependencies": {
                              "default": [],
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "prompt": {
                              "type": "string",
                              "description": "Prompt when action is \"ai\""
                            },
                            "code": {
                              "type": "string",
                              "description": "Code to execute when action is \"code\""
                            },
                            "model": {
                              "default": "gpt-4o",
                              "type": "string",
                              "maxLength": 80,
                              "description": "Model to use when action is \"ai\""
                            },
                            "workflowId": {
                              "type": "string",
                              "maxLength": 20,
                              "description": "ID of Workflow to execute when action is \"workflow\""
                            },
                            "enabled": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "action"
                          ],
                          "additionalProperties": false
                        },
                        "typings": {
                          "type": "string",
                          "description": "TypeScript typings for the column. Recommended if the type is \"object\", ex: \"\\{ foo: string; bar: number \\}\""
                        }
                      },
                      "required": [
                        "index"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "type",
                    "x-zui"
                  ],
                  "additionalProperties": false
                },
                "description": "List of keys/columns in the table."
              },
              "additionalProperties": {
                "type": "boolean",
                "enum": [
                  true
                ],
                "description": "Additional properties can be provided, but they will be ignored if no column matches."
              },
              "required": {
                "type": "array",
                "items": {
                  "type": "string"
                },
                "description": "Array of required properties."
              },
              "type": {
                "type": "string",
                "enum": [
                  "object"
                ]
              }
            },
            "required": [
              "properties",
              "additionalProperties",
              "type"
            ],
            "additionalProperties": false
          },
          "tags": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Optional tags to help organize your tables. These should be passed here as an object representing key/value pairs."
          },
          "isComputeEnabled": {
            "type": "boolean",
            "description": "Indicates if the table is enabled for computation."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of table creation."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the last table update."
          }
        },
        "required": [
          "id",
          "name",
          "schema"
        ],
        "additionalProperties": false
      }
    },
    "Column": {
      "section": "tables",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique identifier for the column."
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 30,
            "description": "Name of the column, must be within length limits."
          },
          "description": {
            "type": "string",
            "description": "Optional descriptive text about the column."
          },
          "searchable": {
            "type": "boolean",
            "description": "Indicates if the column is vectorized and searchable."
          },
          "type": {
            "type": "string",
            "enum": [
              "string",
              "number",
              "boolean",
              "date",
              "object"
            ],
            "description": "Specifies the data type of the column. Use \"object\" for complex data structures."
          },
          "typings": {
            "type": "string",
            "description": "TypeScript typings for the column. Recommended if the type is \"object\", ex: \"\\{ foo: string; bar: number \\}\""
          },
          "computed": {
            "type": "object",
            "properties": {
              "action": {
                "type": "string",
                "enum": [
                  "ai",
                  "code",
                  "workflow"
                ]
              },
              "dependencies": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "prompt": {
                "type": "string",
                "description": "Prompt when action is \"ai\""
              },
              "code": {
                "type": "string",
                "description": "Code to execute when action is \"code\""
              },
              "model": {
                "default": "gpt-4o",
                "type": "string",
                "maxLength": 80,
                "description": "Model to use when action is \"ai\""
              },
              "workflowId": {
                "type": "string",
                "maxLength": 20,
                "description": "ID of Workflow to execute when action is \"workflow\""
              },
              "enabled": {
                "type": "boolean"
              }
            },
            "required": [
              "action"
            ],
            "additionalProperties": false
          },
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        },
        "required": [
          "name",
          "type"
        ],
        "additionalProperties": false
      }
    },
    "Row": {
      "section": "tables",
      "schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number",
            "description": "Unique identifier for the row."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of row creation."
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "description": "Timestamp of the last row update."
          },
          "computed": {
            "type": "object",
            "additionalProperties": {
              "type": "object",
              "properties": {
                "status": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                },
                "updatedBy": {
                  "type": "string"
                },
                "updatedAt": {
                  "type": "string"
                }
              },
              "required": [
                "status"
              ],
              "additionalProperties": false
            }
          },
          "stale": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "[Read-only] List of stale values that are waiting to be recomputed."
          },
          "similarity": {
            "type": "number",
            "description": "Optional numeric value indicating similarity, when using findTableRows."
          }
        },
        "required": [
          "id",
          "computed"
        ],
        "additionalProperties": true
      }
    }
  },
  "sections": [
    {
      "title": "Tables",
      "description": "Manage and interact with table structures, including creation, updates, and querying of tables and their rows.",
      "name": "tables",
      "operations": [
        "listTables",
        "getTable",
        "getOrCreateTable",
        "createTable",
        "duplicateTable",
        "exportTable",
        "getTableJobs",
        "importTable",
        "updateTable",
        "renameTableColumn",
        "deleteTable",
        "getTableRow",
        "findTableRows",
        "createTableRows",
        "deleteTableRows",
        "updateTableRows",
        "upsertTableRows"
      ],
      "schema": "Table"
    }
  ],
  "options": {
    "allowUnions": false
  }
} satisfies State