diff --git a/.gitignore b/.gitignore index 3c5f752..98b81e0 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ go.work .env .idea **/.xatarc +**/fern.config.json # ignore license header checker bin/license-header-checker \ No newline at end of file diff --git a/Makefile b/Makefile index da6b4b9..1f98b05 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ smoke-test: ## smoke tests @echo "Running test app for sanity check" @cd internal/smoke-tests && go run . && cd ../.. -test: ## run all tests +test: ## run unit tests @echo "Running unit tests" @go test -v -count=1 -cover -race ./xata @@ -33,3 +33,11 @@ check-license-header: ## Check if all *.py files have a license header help: ## Display help @awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) #------------- -------------- + +.PHONY: generate-core-code +generate-core-code: + go run xata/internal/code-gen/code_gen.go -scope=core + +.PHONY: generate-workspace-code +generate-workspace-code: + go run xata/internal/code-gen/code_gen.go -scope=workspace \ No newline at end of file diff --git a/go.mod b/go.mod index 37cd501..1d0ea62 100644 --- a/go.mod +++ b/go.mod @@ -7,11 +7,12 @@ require ( github.com/hashicorp/go-retryablehttp v0.7.4 github.com/joho/godotenv v1.5.1 github.com/stretchr/testify v1.8.4 + gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index d32c50c..ab30266 100644 --- a/go.sum +++ b/go.sum @@ -17,5 +17,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/internal/docs/sql-openapi.json b/internal/docs/sql-openapi.json index 9193a6c..a5c02bb 100644 --- a/internal/docs/sql-openapi.json +++ b/internal/docs/sql-openapi.json @@ -1 +1 @@ -{"openapi":"3.0.0","info":{"title":"xata-auth","description":"Xata.io Auth API","version":"1.0","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"contact":{"name":"support@xata.io"}},"servers":[{"url":"/","description":""}],"paths":{"/user":{"summary":"User info","description":"This endpoint allows retrieving or updating a given user by their user ID.","get":{"operationId":"getUser","summary":"Get user details","description":"Return details of the user making the request","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithID"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]},"put":{"operationId":"updateUser","summary":"Update user info","description":"Update user info","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithID"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]},"delete":{"operationId":"deleteUser","summary":"Delete user","description":"Delete the user making the request","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]}},"/user/keys":{"summary":"User API Keys","description":"This endpoint allows interacting with the API keys for a given user.","get":{"operationId":"getUserAPIKeys","summary":"Get the list of user API keys","description":"Retrieve a list of existing user API keys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"required":["name","createdAt"]}}},"required":["keys"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]}},"/user/keys/{key_name}":{"summary":"Single User API Key","description":"This endpoint allows operations on a single API key for a given user.","parameters":[{"$ref":"#/components/parameters/APIKeyNameParam"}],"post":{"operationId":"createUserAPIKey","summary":"Create and return new API key","description":"Create and return new API key","responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"key":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"required":["name","key","createdAt"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]},"delete":{"operationId":"deleteUserAPIKey","summary":"Delete an existing API key","description":"Delete an existing API key","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]}},"/user/oauth/clients":{"summary":"User OAuth Clients","description":"this endpoint allows listing the clients the current user has authorized","get":{"operationId":"getUserOAuthClients","summary":"Get the list of user OAuth Clients","description":"Retrieve the list of OAuth Clients that a user has authorized","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"clients":{"type":"array","items":{"$ref":"#/components/schemas/OAuthClientPublicDetails"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/clients/{client_id}":{"parameters":[{"$ref":"#/components/parameters/OAuthClientIDParam"}],"delete":{"operationId":"deleteUserOAuthClient","summary":"Delete the oauth client for the user","description":"Delete the oauth client for the user and revoke all access","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/tokens":{"summary":"User OAuth Access Tokens","description":"this endpoint allows listing the valid access tokens on the current user's account","get":{"operationId":"getUserOAuthAccessTokens","summary":"Get the list of user OAuth Access Tokens","description":"Retrieve the list of valid OAuth Access Tokens on the current user's account","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"accessTokens":{"type":"array","items":{"$ref":"#/components/schemas/OAuthAccessToken"}}},"required":["accessTokens"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/tokens/{token}":{"parameters":[{"$ref":"#/components/parameters/OAuthAccessTokenParam"}],"delete":{"operationId":"deleteOAuthAccessToken","summary":"delete an access token for a third party app","description":"Expires the access token for a third party app","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]},"patch":{"operationId":"updateOAuthAccessToken","summary":"updates an access token for a third party app","description":"Updates partially the access token for a third party app","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expires":{"description":"expiration time of the token as a unix timestamp","type":"integer"}},"required":["expires"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthAccessToken"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/workspaces":{"summary":"Workspaces","description":"This endpoint enables interacting with specific workspaces within Xata. For more information about workspaces, see the [docs](/concepts/workspaces).","get":{"operationId":"getWorkspacesList","summary":"Get list of workspaces","description":"Retrieve the list of workspaces the user belongs to","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"workspaces":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceID"},"name":{"type":"string"},"slug":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}},"required":["name","role","slug","id"]}}},"required":["workspaces"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"post":{"operationId":"createWorkspace","summary":"Create a new workspace","description":"Creates a new workspace with the user requesting it as its single owner.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMeta"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}":{"summary":"Workspace by ID","description":"This endpoint contains operations for a specific workspace, referenced by ID.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getWorkspace","summary":"Get an existing workspace","description":"Retrieve workspace info from a workspace ID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"put":{"operationId":"updateWorkspace","summary":"Update an existing workspace","description":"Update workspace info","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMeta"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"delete":{"operationId":"deleteWorkspace","summary":"Delete an existing workspace","description":"Delete the workspace with the provided ID","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/members":{"summary":"Workspace Members","description":"This endpoint allows operations concerning the members of a given workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getWorkspaceMembersList","summary":"Get the list members of a workspace","description":"Retrieve the list of members of the given workspace","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMembers"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/members/{user_id}":{"summary":"Specific Workspace Member","description":"This endpoint enables operations on a specific member of a workspace, referenced by their user ID.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/UserIDParam"}],"put":{"operationId":"updateWorkspaceMemberRole","summary":"Update workspace member role","description":"Update a workspace member role. Workspaces must always have at least one owner, so this operation will fail if trying to remove owner role from the last owner in the workspace.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"delete":{"operationId":"removeWorkspaceMember","summary":"Remove a member from the workspace","description":"Remove the member from the workspace","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/invites":{"summary":"Workspace Invites","description":"This endpoint enables working with invites for a given workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"post":{"operationId":"inviteWorkspaceMember","summary":"Invite a user to join the workspace","description":"Invite some user to join the workspace with the given role","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/Role"}},"required":["email","role"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceInvite"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_id}":{"summary":"A specific invite within a given workspace","description":"This endpoint enables working with a given invite.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteIDParam"}],"patch":{"operationId":"updateWorkspaceMemberInvite","summary":"Updates an existing invite","description":"This operation provides a way to update an existing invite. Updates are performed in-place; they do not change the invite link, the expiry time, nor do they re-notify the recipient of the invite.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"200":{"description":"Updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceInvite"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]},"delete":{"operationId":"cancelWorkspaceMemberInvite","summary":"Deletes an invite","description":"This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_key}/accept":{"summary":"Accept an Invite","description":"This [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call)-style endpoint accepts a given invite to join a workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteKeyParam"}],"post":{"operationId":"acceptWorkspaceMemberInvite","summary":"Accept the invitation to join a workspace","description":"Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace\n","responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_id}/resend":{"summary":"Resend Invite notification","description":"Resend the notification for a previously generated Invite.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteIDParam"}],"post":{"operationId":"resendWorkspaceMemberInvite","summary":"Resend Invite notification","description":"This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.","responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/dbs":{"summary":"Databases","description":"This path contains operations that can be performed on databases within Xata.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getDatabaseList","summary":"List databases","description":"List all databases available in your Workspace.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDatabasesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/DBNameParam"}],"put":{"operationId":"createDatabase","summary":"Create Database","description":"Create Database with identifier name","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string","minLength":1},"region":{"type":"string","minLength":1},"ui":{"type":"object","properties":{"color":{"type":"string"}}},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}},"example":{"branchName":"main","region":"us-east-1","metadata":{"repository":"github.com/my/repository","branch":"github repository","stage":"testing","labels":["development"]}},"required":["region"]}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"}}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"New Database","status":"completed"},"required":["databaseName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"422":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"delete":{"operationId":"deleteDatabase","summary":"Delete Database","description":"Delete a database and all of its branches and tables permanently.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"get":{"operationId":"getDatabaseMetadata","summary":"Get Database metadata","description":"Retrieve metadata of the given database","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"patch":{"operationId":"updateDatabaseMetadata","summary":"Update Database metadata","description":"Update the color of the selected database","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"ui":{"type":"object","properties":{"color":{"type":"string","minLength":1}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/dbs/{db_name}/rename":{"summary":"Rename database","description":"Given a parameter `db_name`, this path allows you to rename your Xata database. When you rename a database all URLs accessing the database have to be updated.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/DBNameParam"}],"post":{"operationId":"renameDatabase","summary":"Rename Database","description":"Change the name of an existing database","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1}},"required":["newName"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"422":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/regions":{"summary":"Available regions","description":"This path allows to access the list of available database regions","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"listRegions","summary":"List available regions","description":"List regions available to create a database on","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRegionsResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getBranchList","summary":"List branches","description":"List all available Branches","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}":{"summary":"Database Branch by Name","description":"This path allows interacting with a given database branch, referenced by parameter `db_branch_name`, which is expected in the format `database_name:branch_name`.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchDetails","summary":"Get branch schema and metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DBBranch"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"put":{"operationId":"createBranch","summary":"Create Database branch","parameters":[{"name":"from","in":"query","description":"Name of source branch to branch the new schema from","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"description":"Select the branch to fork from. Defaults to 'main'","type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}}}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"mydatabase","branchName":"mybranch","status":"completed"},"required":["databaseName","branchName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"deleteBranch","summary":"Delete Database branch","description":"Delete the branch in the database and all its resources","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/metadata":{"summary":"Branch Metadata","description":"This path allows interacting with the metadata of a specific database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"put":{"operationId":"updateBranchMetadata","summary":"Update branch metadata","description":"Update the branch metadata","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"get":{"operationId":"getBranchMetadata","summary":"Get Branch Metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/stats":{"summary":"Branch Statistics","description":"This endpoint presents a number of statistics on a given database's branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchStats","summary":"Branch stats","description":"Get branch usage metrics.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"type":"string"},"interval":{"type":"string"},"resolution":{"type":"string"},"numberOfRecords":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"writesOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readsOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readLatency":{"$ref":"#/components/schemas/MetricsLatency"},"writeLatency":{"$ref":"#/components/schemas/MetricsLatency"},"warning":{"type":"string"}},"required":["timestamp","interval","resolution"]}}}},"400":{"$ref":"#/components/responses/SimpleError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/gitBranches":{"summary":"Mapping of git to Xata branches","description":"This path allows managing the mapping between git and Xata branches, which is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git branches to the associated Xata branches.\n","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getGitBranchesMapping","summary":"List git branches mapping","description":"Lists all the git branches in the mapping, and their associated Xata branches.\n\nExample response:\n\n```json\n{\n \"mappings\": [\n {\n \"gitBranch\": \"main\",\n \"xataBranch\": \"main\"\n },\n {\n \"gitBranch\": \"gitBranch1\",\n \"xataBranch\": \"xataBranch1\"\n }\n {\n \"gitBranch\": \"xataBranch2\",\n \"xataBranch\": \"xataBranch2\"\n }\n ]\n}\n```\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"post":{"operationId":"addGitBranchesEntry","summary":"Link a git branch to a Xata branch","description":"Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.\n\nIf the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.\n\nExample request:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches\n{\n \"gitBranch\": \"fix/bug123\",\n \"xataBranch\": \"fix_bug\"\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"gitBranch":{"description":"The name of the Git branch.","type":"string"},"xataBranch":{"description":"The name of the Xata branch.","$ref":"#/components/schemas/BranchName"}},"required":["gitBranch","xataBranch"]}}}},"responses":{"201":{"description":"Operation was successful with warnings","content":{"application/json":{"schema":{"type":"object","properties":{"warning":{"description":"Warning message","type":"string"}},"example":{"warning":"Git branch [fix/bug123] was already present in the mapping and was overwritten."}}}}},"204":{"description":"Operation was successful without warnings"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"removeGitBranchesEntry","summary":"Unlink a git branch to a Xata branch","description":"Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.\n\nExample request:\n\n```json\n// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch to remove from the mapping","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"The git branch was not found in the mapping"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/resolveBranch":{"summary":"Resolve the branch to use","description":"This endpoint is typically used by the Xata SDKs to resolve the correct branch to use in a particular situation. The main input is the git branch.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"resolveBranch","summary":"Resolve a Git Branch to a Xata branch","description":"In order to resolve the database branch, the following algorithm is used:\n* if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned\n* else, if a Xata branch with the exact same name as `gitBranch` exists, return it\n* else, if `fallbackBranch` is provided and a branch with that name exists, return it\n* else, return the default branch of the DB (`main` or the first branch)\n\nExample call:\n\n```json\n// GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg\n```\n\nExample response:\n\n```json\n{\n \"branch\": \"main\",\n \"reason\": {\n \"code\": \"DEFAULT_BRANCH\",\n \"message\": \"Default branch for this database (main)\"\n }\n}\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch","schema":{"type":"string"}},{"name":"fallbackBranch","in":"query","description":"Default branch to fallback to","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branch":{"type":"string"},"reason":{"type":"object","properties":{"code":{"type":"string","enum":["FOUND_IN_MAPPING","BRANCH_EXISTS","FALLBACK_BRANCH","DEFAULT_BRANCH"]},"message":{"type":"string"}},"required":["code","message"]}},"example":{"branch":"main","reason":{"code":"DEFAULT_BRANCH","message":"Default branch for this database (main)"}},"required":["branch","reason"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/migrations":{"summary":"Branch Migrations [deprecated]","description":"This path allows access to migrations on a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchMigrationHistory","summary":"Get branch migration history [deprecated]","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer"},"startFrom":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"migrations":{"type":"array","items":{"$ref":"#/components/schemas/BranchMigration"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/plan":{"summary":"Migration Plan [deprecated]","description":"This endpoint enables creating a migration plan for a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchMigrationPlan","summary":"Compute migration plan [deprecated]","description":"Compute a migration plan from a target schema the branch should be migrated too.","requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Schema"}}}},"responses":{"200":{"$ref":"#/components/responses/BranchMigrationPlan"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/execute":{"summary":"Migration Execution [deprecated]","description":"This endpoint is called in the style of an RPC (Remote Procedure Call) when a migration is to be executed against a specific database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"executeBranchMigrationPlan","summary":"Migrate branch [deprecated]","description":"Apply a migration plan to the branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/history":{"summary":"Query schema history.","description":"Query the branch its schema history.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchSchemaHistory","summary":"Query schema history.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.","type":"integer","default":20}}},"since":{"description":"Report only migrations that have been added since the given Migration ID.","type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetch","type":"boolean"}},"required":["cursor","more"]},"logs":{"type":"array","items":{"$ref":"#/components/schemas/Commit"}}},"required":["meta","logs"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare":{"summary":"Compare branch with custom schema.","description":"Compare the branch schema with a custom provided schema.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"compareBranchWithUserSchema","summary":"Compare branch with user schema.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"$ref":"#/components/schemas/Schema"},"schemaOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"branchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare/{branch_name}":{"summary":"Compare branch schemas.","description":"Compare the schema of any 2 branches.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/BranchNameParam"}],"post":{"operationId":"compareBranchSchemas","summary":"Compare branch schemas.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sourceBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"targetBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/update":{"summary":"Update Branch schema","description":"Update the branch schema with migration operations","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"updateBranchSchema","summary":"Update Branch schema","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Migration"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/preview":{"summary":"Preview branch schema edits.","description":"Preview the resulting branch schema when applying the edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"previewBranchSchemaEdit","summary":"Preview branch schema edits.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"original":{"$ref":"#/components/schemas/Schema"},"updated":{"$ref":"#/components/schemas/Schema"}},"required":["original","updated"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/apply":{"summary":"Update Branch schema with edit script.","description":"Update the branch from schema edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"applyBranchSchemaEdit","summary":"Apply edit script.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["edits"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/push":{"summary":"Push migrations.","description":"Apply a list of migrations to the current branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"pushBranchMigrations","summary":"Push migrations.","description":"The `schema/push` API accepts a list of migrations to be applied to the\ncurrent branch. A list of applicable migrations can be fetched using\nthe `schema/history` API from another branch or database.\n\nThe most recent migration must be part of the list or referenced (via\n`parentID`) by the first migration in the list of migrations to be pushed.\n\nEach migration in the list has an `id`, `parentID`, and `checksum`. The\nchecksum for migrations are generated and verified by xata. The\noperation fails if any migration in the list has an invalid checksum.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"migrations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationObject"}}},"required":["migrations"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/tables/{table_name}":{"summary":"Database Table by Name","description":"This endpoint provides a way to mutate a specific table on a database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"put":{"operationId":"createTable","summary":"Create table","description":"Creates a new table with the given name. Returns 422 if a table with the same name already exists.","responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}/tables/{table_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string"},"tableName":{"type":"string","minLength":1},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"branchName":"mydb_main","tableName":"mytable","status":"completed"},"required":["branchName","tableName","status"]}}}},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteTable","summary":"Delete table","description":"Deletes the table with the given name.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"Not Found"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateTable","summary":"Update table","description":"Update table. Currently there is only one update operation supported: renaming the table by providing a new name.\n\nIn the example below, we rename a table from “users” to “people”:\n\n```json\n// PATCH /db/test:main/tables/users\n\n{\n \"name\": \"people\"\n}\n```","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/schema":{"summary":"Table Schema","description":"This endpoint enables reading or updating the schema of a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableSchema","summary":"Get table schema","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"put":{"operationId":"setTableSchema","summary":"Update table schema","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns":{"summary":"Table Columns","description":"This endpoint allows working with a table's columns.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableColumns","summary":"List table columns","description":"Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their\nfull dot-separated path (flattened).\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"example":{"columns":[{"name":"name","type":"string"},{"name":"email","type":"email"},{"name":"settings.plan","type":"string"},{"name":"settings.dark","type":"bool"}]},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"post":{"operationId":"addTableColumn","summary":"Create new column","description":"Adds a new column to the table. The body of the request should contain the column definition.","requestBody":{"description":"The column definition.","content":{"application/json":{"schema":{"example":{"name":"columnName","type":"string"},"$ref":"#/components/schemas/Column"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns/{column_name}":{"summary":"Single Table Column","description":"This endpoint allows working with a single column from a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getColumn","summary":"Get column information","description":"Get the definition of a single column.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"example":{"value":{"name":"settings.labels","type":"multiple"}},"$ref":"#/components/schemas/Column"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateColumn","summary":"Update column","description":"Update column with partial data. Can be used for renaming the column by providing a new \"name\" field.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"example":{"name":"newName","description":"Sample new description"},"required":["name"]},"examples":{"Rename column":{"value":{"name":"new_name"}}}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteColumn","summary":"Delete column","description":"Deletes the specified column.","responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/transaction":{"summary":"Execute a transaction on a branch","description":"Executes multiple operations together as one. This allows you to run a number of \noperations that succeed as a single group; or fail with no changes to your database.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"branchTransaction","summary":"Execute a transaction on a branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"operations":{"type":"array","items":{"$ref":"#/components/schemas/TransactionOperation"}}},"required":["operations"]}}}},"responses":{"200":{"description":"Returns the results of a successful transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionSuccess"}}}},"400":{"description":"Returns errors from a failed transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionFailure"}}}},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data":{"summary":"Table Data","description":"This endpoint enables mutating data into a given database table. To query data, please see the [query endpoint](query).\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"insertRecord","summary":"Insert record","description":"Insert a new Record into the Table","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file/{file_id}":{"summary":"File array access","description":"File array access endpoint allows upload, download and remove of file items.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"},{"$ref":"#/components/parameters/FileItemIDParam"}],"get":{"operationId":"getFileItem","summary":"Download content from a file item in a file array column","description":"Retrieves file content from an array by file ID","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFileItem","summary":"Upload or update the content of a file item in a file array column","description":"Uploads the file content to an array given the file ID","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFileItem","summary":"Delete an item from a file array","description":"Deletes an item from an file array column given the file ID","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file":{"summary":"File column access","description":"File access endpoint allows upload and download of binary file content.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getFile","summary":"Download content from a file column","description":"Retrieves the file content from a file column","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"204":{"description":"no content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFile","summary":"Upload content to a file column","description":"Uploads the file content to the given file column","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFile","summary":"Remove the content from a file column","description":"Deletes a file referred in a file column","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}":{"summary":"Table Record","description":"This endpoint enables mutating a given record in a table, referenced by its ID.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"get":{"operationId":"getRecord","summary":"Get record by ID","description":"Retrieve record by ID","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"put":{"operationId":"insertRecordWithID","summary":"Insert record with ID","description":"By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.","parameters":[{"name":"createOnly","in":"query","schema":{"type":"boolean"}},{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"patch":{"operationId":"updateRecordWithID","summary":"Update record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"post":{"operationId":"upsertRecordWithID","summary":"Upsert record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"delete":{"operationId":"deleteRecord","summary":"Delete record from table","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/bulk":{"summary":"Bulk Table Operations","description":"This endpoint enables bulk operations on a given table. For now, we only allow bulk inserting.\n\nAn example bulk request looks like this:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/db/tutorial:main/tables/users/bulk\n\n{\n \"records\": [\n {\n \"email\": \"laurence@example.com\",\n \"full_name\": \"Laurence Fishburne\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"hugo@example.com\",\n \"full_name\": \"Hugo Weaving\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"joe@example.com\",\n \"full_name\": \"Joe Pantoliano\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n }\n ]\n}\n```\nFor more details, see the [this section](/web-api/records/insert#inserting-records-in-bulk) from the tutorial.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"bulkInsertTableRecords","summary":"Bulk insert records","description":"Bulk insert records","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DataInputRecord"}}},"required":["records"]}}}},"responses":{"200":{"$ref":"#/components/responses/BulkInsertResponse"},"400":{"$ref":"#/components/responses/BulkError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"],"x-experimental":true}},"/db/{db_branch_name}/tables/{table_name}/query":{"summary":"Query Table Data","description":"This endpoint serves data from a given table, inside a specific database's branch.\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"queryTable","summary":"Query table","description":"The Query Table API can be used to retrieve all records in a table.\nThe API support filtering, sorting, selecting a subset of columns, and pagination.\n\nThe overall structure of the request looks like this:\n\n```json\n// POST /db/:/tables//query\n{\n \"columns\": [...],\n \"filter\": {\n \"$all\": [...],\n \"$any\": [...]\n ...\n },\n \"sort\": {\n \"multiple\": [...]\n ...\n },\n \"page\": {\n ...\n }\n}\n```\n\nFor usage, see also the [API Guide](https://xata.io/docs/api-guide/get).\n\n### Column selection\n\nIf the `columns` array is not specified, all columns are included. For link\nfields, only the ID column of the linked records is included in the response.\n\nIf the `columns` array is specified, only the selected and internal\ncolumns `id` and `xata` are included. The `*` wildcard can be used to\nselect all columns.\n\nFor objects and link fields, if the column name of the object is specified, we\ninclude all of its sub-keys. If only some sub-keys are specified (via dotted\nnotation, e.g. `\"settings.plan\"` ), then only those sub-keys from the object\nare included.\n\nBy the way of example, assuming two tables like this:\n\n```json {\"truncate\": true}\n{\n \"tables\": [\n {\n \"name\": \"teams\",\n \"columns\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"users\"\n }\n },\n {\n \"name\": \"foundedDate\",\n \"type\": \"datetime\"\n },\n ]\n },\n {\n \"name\": \"users\",\n \"columns\": [\n {\n \"name\": \"email\",\n \"type\": \"email\"\n },\n {\n \"name\": \"full_name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"address\",\n \"type\": \"object\",\n \"columns\": [\n {\n \"name\": \"street\",\n \"type\": \"string\"\n },\n {\n \"name\": \"number\",\n \"type\": \"int\"\n },\n {\n \"name\": \"zipcode\",\n \"type\": \"int\"\n }\n ]\n },\n {\n \"name\": \"team\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"teams\"\n }\n }\n ]\n }\n ]\n}\n```\n\nA query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.*\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n }\n}\n```\n\nwhile a query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.street\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\"\n }\n}\n```\n\nIf you want to return all columns from the main table and selected columns from the linked table, you can do it like this:\n\n```json\n{\n \"columns\": [\"*\", \"team.name\"]\n}\n```\n\nThe `\"*\"` in the above means all columns, including columns of objects. This returns data like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\"\n }\n}\n```\n\nIf you want all columns of the linked table, you can do:\n\n```json\n{\n \"columns\": [\"*\", \"team.*\"]\n}\n```\n\nThis returns, for example:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\",\n \"code\": \"A1\",\n \"foundedDate\": \"2020-03-04T10:43:54.32Z\"\n }\n}\n```\n\n### Filtering\n\nThere are two types of operators:\n\n- Operators that work on a single column: `$is`, `$contains`, `$pattern`,\n `$includes`, `$gt`, etc.\n- Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,\n `$none`, etc.\n\nAll operators start with an `$` to differentiate them from column names\n(which are not allowed to start with a dollar sign).\n\n#### Exact matching and control operators\n\nFilter by one column:\n\n```json\n{\n \"filter\": {\n \"\": \"value\"\n }\n}\n```\n\nThis is equivalent to using the `$is` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$is\": \"value\"\n }\n }\n}\n```\n\nFor example:\n\n```json\n{\n \"filter\": {\n \"name\": \"r2\"\n }\n}\n```\n\nOr:\n\n```json\n{\n \"filter\": {\n \"name\": {\n \"$is\": \"r2\"\n }\n }\n}\n```\n\nFor objects, both dots and nested versions work:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": \"free\"\n }\n}\n```\n\n```json\n{\n \"filter\": {\n \"settings\": {\n \"plan\": \"free\"\n }\n }\n}\n```\n\nIf you want to OR together multiple values, you can use the `$any` operator with an array of values:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": { \"$any\": [\"free\", \"paid\"] }\n }\n}\n```\n\nIf you specify multiple columns in the same filter, they are logically AND'ed together:\n\n```json\n{\n \"filter\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n}\n```\n\nThe above matches if both conditions are met.\n\nTo be more explicit about it, you can use `$all` or `$any`:\n\n```json\n{\n \"filter\": {\n \"$any\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n }\n}\n```\n\nThe `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:\n\n```json\n{\n \"filter\": {\n \"$any\": [\n {\n \"name\": \"r1\"\n },\n {\n \"name\": \"r2\"\n }\n ]\n }\n}\n```\n\nYou can check for a value being not-null with `$exists`:\n\n```json\n{\n \"filter\": {\n \"$exists\": \"settings\"\n }\n}\n```\n\nThis can be combined with `$all` or `$any` :\n\n```json\n{\n \"filter\": {\n \"$all\": [\n {\n \"$exists\": \"settings\"\n },\n {\n \"$exists\": \"name\"\n }\n ]\n }\n}\n```\n\nOr you can use the inverse operator `$notExists`:\n\n```json\n{\n \"filter\": {\n \"$notExists\": \"settings\"\n }\n}\n```\n\n#### Partial match\n\n`$contains` is the simplest operator for partial matching. Note that `$contains` operator can\ncause performance issues at scale, because indices cannot be used.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$contains\": \"value\"\n }\n }\n}\n```\n\nWildcards are supported via the `$pattern` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$pattern\": \"v*alu?\"\n }\n }\n}\n```\n\nThe `$pattern` operator accepts two wildcard characters:\n* `*` matches zero or more characters\n* `?` matches exactly one character\n\nIf you want to match a string that contains a wildcard character, you can escape them using a backslash (`\\`). You can escape a backslash by usign another backslash.\n\nYou can also use the `$endsWith` and `$startsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$endsWith\": \".gz\"\n },\n \"\": {\n \"$startsWith\": \"tmp-\"\n }\n }\n}\n```\n\n#### Numeric or datetime ranges\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$ge\": 0,\n \"$lt\": 100\n }\n }\n}\n```\nDate ranges support the same operators, with the date using the format defined in\n[RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):\n```json\n{\n \"filter\": {\n \"\": {\n \"$gt\": \"2019-10-12T07:20:50.52Z\",\n \"$lt\": \"2021-10-12T07:20:50.52Z\"\n }\n }\n}\n```\nThe supported operators are `$gt`, `$lt`, `$ge`, `$le`.\n\n#### Negations\n\nA general `$not` operator can inverse any operation.\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nNote: in the above the two condition are AND together, so this does (NOT ( ...\nAND ...))\n\nOr more complex:\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"$any\": [\n {\n \"\": \"value1\"\n },\n {\n \"$all\": [\n {\n \"\": \"value2\"\n },\n {\n \"\": \"value3\"\n }\n ]\n }\n ]\n }\n }\n}\n```\n\nThe `$not: { $any: {}}` can be shorted using the `$none` operator:\n\n```json\n{\n \"filter\": {\n \"$none\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nIn addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$isNot\": \"2019-10-12T07:20:50.52Z\"\n }\n }\n}\n```\n\n#### Working with arrays\n\nTo test that an array contains a value, use `$includesAny`.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includesAny\": \"value\"\n }\n }\n}\n```\n\n##### `includesAny`\n\nThe `$includesAny` operator accepts a custom predicate that will check if\nany value in the array column matches the predicate. The `$includes` operator is a\nsynonym for the `$includesAny` operator.\n\nFor example a complex predicate can include\nthe `$all` , `$contains` and `$endsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includes\": {\n \"$all\": [\n { \"$contains\": \"label\" },\n { \"$not\": { \"$endsWith\": \"-debug\" } }\n ]\n }\n }\n }\n}\n```\n\n##### `includesNone`\n\nThe `$includesNone` operator succeeds if no array item matches the\npredicate.\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesNone\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\nThe above matches if none of the array values contain the string \"label\".\n\n##### `includesAll`\n\nThe `$includesAll` operator succeeds if all array items match the\npredicate.\n\nHere is an example of using the `$includesAll` operator:\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesAll\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\n\nThe above matches if all array values contain the string \"label\".\n\n### Sorting\n\nSorting by one element:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"asc\"\n }\n}\n```\n\nor descendently:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"desc\"\n }\n}\n```\n\nSorting by multiple fields:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"index\": \"desc\"\n },\n {\n \"createdAt\": \"desc\"\n }\n ]\n}\n```\n\nIt is also possible to sort results randomly:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"*\": \"random\"\n }\n}\n```\n\nNote that a random sort does not apply to a specific column, hence the special column name `\"*\"`.\n\nA random sort can be combined with an ascending or descending sort on a specific column:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"name\": \"desc\"\n },\n {\n \"*\": \"random\"\n }\n ]\n}\n```\n\nThis will sort on the `name` column, breaking ties randomly.\n\n### Pagination\n\nWe offer cursor pagination and offset pagination. The cursor pagination method can be used for sequential scrolling with unrestricted depth. The offset pagination can be used to skip pages and is limited to 1000 records.\n\nExample of cursor pagination:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"after\":\"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\nIn the above example, the value of the `page.after` parameter is the cursor returned by the previous query. A sample response is shown below:\n\n```json\n{\n \"meta\": {\n \"page\": {\n \"cursor\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\",\n \"more\": true\n }\n },\n \"records\": [...]\n}\n```\n\nThe `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:\n\n- `after`: Return the next page 'after' the current cursor\n- `before`: Return the previous page 'before' the current cursor.\n- `start`: Resets the given cursor position to the beginning of the query result set. \nWill return the first N records from the query result, where N is the `page.size` parameter. \n- `end`: Resets the give cursor position to the end for the query result set. \nReturns the last N records from the query result, where N is the `page.size` parameter.\n\nThe request will fail if an invalid cursor value is given to `page.before`,\n`page.after`, `page.start` , or `page.end`. No other cursor setting can be\nused if `page.start` or `page.end` is set in a query.\n\nIf both `page.before` and `page.after` parameters are present we treat the\nrequest as a range query. The range query will return all entries after\n`page.after`, but before `page.before`, up to `page.size` or the maximum\npage size. This query requires both cursors to use the same filters and sort\nsettings, plus we require `page.after < page.before`. The range query returns\na new cursor. If the range encompass multiple pages the next page in the range\ncan be queried by update `page.after` to the returned cursor while keeping the\n`page.before` cursor from the first range query.\n\nThe `filter` , `columns`, `sort` , and `page.size` configuration will be\nencoded with the cursor. The pagination request will be invalid if\n`filter` or `sort` is set. The columns returned and page size can be changed\nanytime by passing the `columns` or `page.size` settings to the next query.\n\nIn the following example of size + offset pagination we retrieve the third page of up to 100 results:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 100,\n \"offset\": 200\n }\n}\n```\n\nThe `page.size` parameter represents the maximum number of records returned by this query. It has a default value of 20 and a maximum value of 200.\nThe `page.offset` parameter represents the number of matching records to skip. It has a default value of 0 and a maximum value of 800.\n\nCursor pagination also works in combination with offset pagination. For example, starting from a specific cursor position, using a page size of 200 and an offset of 800, you can skip up to 5 pages of 200 records forwards or backwards from the cursor's position:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 200,\n \"offset\": 800,\n \"after\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\n**Special cursors:**\n\n- `page.after=end`: Result points past the last entry. The list of records\n returned is empty, but `page.meta.cursor` will include a cursor that can be\n used to \"tail\" the table from the end waiting for new data to be inserted.\n- `page.before=end`: This cursor returns the last page.\n- `page.start=$cursor`: Start at the beginning of the result set of the $cursor query. This is equivalent to querying the\n first page without a cursor but applying `filter` and `sort` . Yet the `page.start`\n cursor can be convenient at times as user code does not need to remember the\n filter, sort, columns or page size configuration. All these information are\n read from the cursor.\n- `page.end=$cursor`: Move to the end of the result set of the $cursor query. This is equivalent to querying the\n last page with `page.before=end`, `filter`, and `sort` . Yet the\n `page.end` cursor can be more convenient at times as user code does not\n need to remember the filter, sort, columns or page size configuration. All\n these information are read from the cursor.\n\nWhen using special cursors like `page.after=\"end\"` or `page.before=\"end\"`, we\nstill allow `filter` and `sort` to be set.\n\nExample of getting the last page:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 10,\n \"before\": \"end\"\n }\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"sort":{"$ref":"#/components/schemas/SortExpression"},"page":{"$ref":"#/components/schemas/PageConfig"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]}}}}}},"responses":{"200":{"$ref":"#/components/responses/QueryResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/search":{"summary":"Search Database","description":"This endpoint performs full text search across an entire database branch. You can filter down to particular\ntable by using the `tables` parameter. The `tables` parameter accepts a mixed array of strings and objects. Using a string (the table name) selects the full table. Using an object allows one to specify a filter as well. The supported filters are the same as documented for the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"searchBranch","summary":"Free text search","description":"Run a free text search operation across the database branch.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"tables":{"description":"An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table.","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"table":{"description":"The name of the table.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}},"additionalProperties":false,"required":["table"]}]}},"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"tables":["users",{"table":"articles","filter":{"author":"Abigail"}}],"query":"after a long day"},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/search":{"summary":"Search Table","description":"This endpoint performs full text search in a particular table.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"searchTable","summary":"Free text search in a table","description":"Run a free text search operation in a particular table.\n\nThe endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"query":"after a long day","filter":{"firstName":"Abigail"}},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/vectorSearch":{"summary":"Vector similarity search","description":"This endpoint can be used to perform vector-based similarity searches.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"vectorSearchTable","summary":"Vector similarity search in a table","description":"This endpoint can be used to perform vector-based similarity searches in a table. \nIt can be used for implementing semantic search and product recommendation. To use this\nendpoint, you need a column of type vector. The input vector must have the same\ndimension as the vector column.\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"queryVector":{"description":"The vector to search for similarities. Must have the same dimension as\nthe vector column used.\n","type":"array","items":{"type":"number"}},"column":{"description":"The vector column in which to search. It must be of type `vector`.","type":"string"},"similarityFunction":{"description":"The function used to measure the distance between two points. Can be one of:\n`cosineSimilarity`, `l1`, `l2`. The default is `cosineSimilarity`.\n","type":"string","default":"cosineSimilarity"},"size":{"description":"Number of results to return.","type":"integer","default":10,"maximum":100,"minimum":1},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["queryVector","column"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask":{"summary":"Ask data in your table a question","description":"Ask your table a question and have Xata answer.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"askTable","summary":"Ask your table a question","description":"Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"question":{"description":"The question you'd like to ask.","type":"string","minLength":3},"searchType":{"description":"The type of search to use. If set to `keyword` (the default), the search can be configured by passing\na `search` object with the following fields. For more details about each, see the Search endpoint documentation.\nAll fields are optional.\n * fuzziness - typo tolerance\n * target - columns to search into, and weights.\n * prefix - prefix search type.\n * filter - pre-filter before searching.\n * boosters - control relevancy.\nIf set to `vector`, a `vectorSearch` object must be passed, with the following parameters. For more details, see the Vector\nSearch endpoint documentation. The `column` and `contentColumn` parameters are required.\n * column - the vector column containing the embeddings.\n * contentColumn - the column that contains the text from which the embeddings where computed.\n * filter - pre-filter before searching.\n","type":"string","default":"keyword","enum":["keyword","vector"]},"search":{"type":"object","additionalProperties":false,"properties":{"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}}},"vectorSearch":{"type":"object","additionalProperties":false,"properties":{"column":{"description":"The column to use for vector search. It must be of type `vector`.","type":"string"},"contentColumn":{"description":"The column containing the text for vector search. Must be of type `text`.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"required":["column","contentColumn"]},"rules":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"required":["question"]}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","sessionId"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"records":{"description":"The IDs of the records that were used as context.","type":"array","items":{"type":"string"}},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","records","sessionId"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"description":"Unexpected Error"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask/{session_id}":{"summary":"Ask follow-up questions of your data","description":"Continue a conversation with your data. This endpoint lets you continue a question started via the /ask endpoint in order to dive deeper into your context or ask clarifying questions.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ChatSessionIDParam"}],"post":{"operationId":"askTableSession","summary":"Continue a conversation with your data","description":"Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"The question you'd like to ask.","type":"string","minLength":3}},"additionalProperties":false}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/summarize":{"summary":"Summarize Table Data","description":"This endpoint summarizes from your database. It comes with a range\nof functions to help perform calculations on the data you have stored\nin your tables\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"summarizeTable","summary":"Summarize table","description":"This endpoint allows you to (optionally) define groups, and then to run\ncalculations on the values in each group. This is most helpful when \nyou'd like to understand the data you have in your database.\n\nA group is a combination of unique values. If you create a group for \n`sold_by`, `product_name`, we will return one row for every combination \nof `sold_by` and `product_name` you have in your database. When you \nwant to calculate statistics, you define these groups and ask Xata to \ncalculate data on each group.\n\n**Some questions you can ask of your data:**\n\nHow many records do I have in this table?\n- Set `columns: []` as we we want data from the entire table, so we ask\nfor no groups.\n- Set `summaries: {\"total\": {\"count\": \"*\"}}` in order to see the count \nof all records. We use `count: *` here we'd like to know the total \namount of rows; ignoring whether they are `null` or not.\n\nWhat are the top total sales for each product in July 2022 and sold \nmore than 10 units?\n- Set `filter: {soldAt: {\n \"$ge\": \"2022-07-01T00:00:00.000Z\", \n \"$lt\": \"2022-08-01T00:00:00.000Z\"}\n}` \nin order to limit the result set to sales recorded in July 2022.\n- Set `columns: [product_name]` as we'd like to run calculations on \neach unique product name in our table. Setting `columns` like this will \nproduce one row per unique product name.\n- Set `summaries: {\"total_sales\": {\"count\": \"product_name\"}}` as we'd \nlike to create a field called \"total_sales\" for each group. This field \nwill count all rows in each group with non-null product names.\n- Set `sort: [{\"total_sales\": \"desc\"}]` in order to bring the rows with \nthe highest total_sales field to the top.\n- Set `summariesFilter: {\"total_sales\": {\"$ge\": 10}}` to only send back data \nwith greater than or equal to 10 units.\n\n`columns`: tells Xata how to create each group. If you add `product_id` \nwe will create a new group for every unique `product_id`.\n\n`summaries`: tells Xata which calculations to run on each group. Xata\ncurrently supports count, min, max, sum, average.\n\n`sort`: tells Xata in which order you'd like to see results. You may \nsort by fields specified in `columns` as well as the summary names \ndefined in `summaries`.\n\nnote: Sorting on summarized values can be slower on very large tables; \nthis will impact your rate limit significantly more than other queries. \nTry use `filter` to reduce the amount of data being processed in order \nto reduce impact on your limits.\n\n`summariesFilter`: tells Xata how to filter the results of a summary. \nIt has the same syntax as `filter`, however, by using `summariesFilter`\nyou may also filter on the results of a query.\n\nnote: This is a much slower to use than `filter`. We recommend using \n`filter` wherever possible and `summariesFilter` when it's not \npossible to use `filter`.\n\n`page.size`: tells Xata how many records to return. If unspecified, Xata\nwill return the default size.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"columns":{"$ref":"#/components/schemas/ColumnsProjection"},"summaries":{"$ref":"#/components/schemas/SummaryExpressionList"},"sort":{"$ref":"#/components/schemas/SortExpression"},"summariesFilter":{"$ref":"#/components/schemas/FilterExpression"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]},"page":{"type":"object","properties":{"size":{"description":"The number of records returned by summarize. If the amount of data you have exceeds this, or you have\nmore complex reporting requirements, we recommend that you use the aggregate endpoint instead.\n","type":"integer","default":20,"maximum":1000,"minimum":1}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/SummarizeResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/aggregate":{"summary":"Aggregate Table","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"aggregateTable","summary":"Run aggregations over a table","description":"This endpoint allows you to run aggregations (analytics) on the data from one table.\nWhile the summary endpoint is served from a transactional store and the results are strongly \nconsistent, the aggregate endpoint is served from our columnar store and the results are \nonly eventually consistent. On the other hand, the aggregate endpoint uses a \nstore that is more appropiate for analytics, makes use of approximative algorithms \n(e.g for cardinality), and is generally faster and can do more complex aggregations.\n\nFor usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate).\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}}}}}},"responses":{"200":{"$ref":"#/components/responses/AggResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}}},"components":{"parameters":{"APIKeyNameParam":{"name":"key_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/APIKeyName"},"description":"API Key name"},"BranchNameParam":{"name":"branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BranchName"},"description":"The Database Name"},"ChatSessionIDParam":{"name":"session_id","in":"path","required":true,"schema":{"type":"string","maxLength":36,"minLength":36,"title":"SessionID"}},"ColumnNameParam":{"name":"column_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ColumnName"},"description":"The Column name"},"ColumnsProjectionParam":{"name":"columns","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/ColumnsProjection"},"description":"Column filters"},"DBBranchNameParam":{"name":"db_branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBBranchName"},"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n"},"DBNameParam":{"name":"db_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBName"},"description":"The Database Name"},"FileAccessIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileAccessID"},"description":"The File Access Identifier"},"FileItemIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileItemID"},"description":"The File Identifier"},"FileSignatureParam":{"name":"verify","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/FileSignature"},"description":"File access signature"},"InviteIDParam":{"name":"invite_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/InviteID"},"description":"Invite identifier"},"InviteKeyParam":{"name":"invite_key","in":"path","required":true,"schema":{"$ref":"#/components/schemas/InviteKey"},"description":"Invite Key (secret) for the invited user"},"OAuthAccessTokenParam":{"name":"token","in":"path","required":true,"schema":{"$ref":"#/components/schemas/AccessToken"}},"OAuthClientIDParam":{"name":"client_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/OAuthClientID"}},"RecordIDParam":{"name":"record_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/RecordID"},"description":"The Record name"},"TableNameParam":{"name":"table_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/TableName"},"description":"The Table name"},"UserIDParam":{"name":"user_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserID"},"description":"UserID"},"WorkspaceIDParam":{"name":"workspace_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceID"},"description":"Workspace ID"}},"schemas":{"APIKeyName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~]*","title":"APIKeyName"},"AccessToken":{"type":"string","title":"AccessToken"},"AggExpression":{"description":"The description of a single aggregation operation. It is an object with only one key-value pair.\nThe key represents the aggregation type, while the value is an object with the configuration of\nthe aggregation.\n","oneOf":[{"type":"object","additionalProperties":false,"properties":{"count":{"$ref":"#/components/schemas/CountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"sum":{"$ref":"#/components/schemas/SumAgg"}}},{"type":"object","additionalProperties":false,"properties":{"max":{"$ref":"#/components/schemas/MaxAgg"}}},{"type":"object","additionalProperties":false,"properties":{"min":{"$ref":"#/components/schemas/MinAgg"}}},{"type":"object","additionalProperties":false,"properties":{"average":{"$ref":"#/components/schemas/AverageAgg"}}},{"type":"object","additionalProperties":false,"properties":{"uniqueCount":{"$ref":"#/components/schemas/UniqueCountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"dateHistogram":{"$ref":"#/components/schemas/DateHistogramAgg"}}},{"type":"object","additionalProperties":false,"properties":{"topValues":{"$ref":"#/components/schemas/TopValuesAgg"}}},{"type":"object","additionalProperties":false,"properties":{"numericHistogram":{"$ref":"#/components/schemas/NumericHistogramAgg"}}}]},"AggExpressionMap":{"description":"The description of the aggregations you wish to receive.\n","type":"object","example":{"totalCount":{"count":"*"},"dailyActiveUsers":{"dateHistogram":{"column":"date","interval":"1d","aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}}}}},"additionalProperties":{"$ref":"#/components/schemas/AggExpression"}},"AggResponse":{"oneOf":[{"type":"number","nullable":true},{"type":"object","properties":{"values":{"type":"array","items":{"type":"object","properties":{"$key":{"oneOf":[{"type":"string"},{"type":"number"}]},"$count":{"type":"integer"}},"additionalProperties":{"$ref":"#/components/schemas/AggResponse"},"required":["$key","$count"]}}},"required":["values"]}]},"AuthorizationCodeRequest":{"type":"object","properties":{"state":{"type":"string"},"redirectUri":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"}},"clientId":{"type":"string"},"responseType":{"$ref":"#/components/schemas/OAuthResponseType"}},"required":["clientId","responseType"]},"AuthorizationCodeResponse":{"type":"object","properties":{"state":{"type":"string"},"redirectUri":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"}},"clientId":{"type":"string"},"expires":{"type":"string","format":"date-time","readOnly":true},"code":{"type":"string","readOnly":true}}},"AverageAgg":{"description":"The average of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"BoosterExpression":{"description":"Booster Expression","oneOf":[{"type":"object","additionalProperties":false,"properties":{"valueBooster":{"$ref":"#/components/schemas/ValueBooster"}}},{"type":"object","additionalProperties":false,"properties":{"numericBooster":{"$ref":"#/components/schemas/NumericBooster"}}},{"type":"object","additionalProperties":false,"properties":{"dateBooster":{"$ref":"#/components/schemas/DateBooster"}}}]},"Branch":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"additionalProperties":false,"required":["name","createdAt"]},"BranchMetadata":{"description":"","type":"object","properties":{"repository":{"type":"string","minLength":1},"branch":{"$ref":"#/components/schemas/BranchName"},"stage":{"type":"string","minLength":1},"labels":{"type":"array","items":{"type":"string"}}},"example":{"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}},"BranchMigration":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"},"lastGitRevision":{"type":"string"},"localChanges":{"type":"boolean"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"newTables":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Table"}},"removedTables":{"type":"array","items":{"type":"string"}},"tableMigrations":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TableMigration"}},"newTableOrder":{"type":"array","items":{"type":"string"}},"renamedTables":{"type":"array","items":{"$ref":"#/components/schemas/TableRename"}}},"required":["status","localChanges","newTableOrder"],"title":"Migration"},"BranchName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"BranchName"},"BranchOp":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"modifiedAt":{"$ref":"#/components/schemas/DateTime"},"migration":{"$ref":"#/components/schemas/Commit"}},"required":["id","status","createdAt"]},"BranchWithCopyID":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"copyID":{"type":"string"}},"required":["branchName","dbBranchID","copyID"],"title":"BranchWithCopyID"},"Column":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["bool","int","float","string","text","email","multiple","link","object","datetime","vector","file[]","file","json"]},"link":{"$ref":"#/components/schemas/ColumnLink"},"vector":{"$ref":"#/components/schemas/ColumnVector"},"file":{"$ref":"#/components/schemas/ColumnFile"},"file[]":{"$ref":"#/components/schemas/ColumnFile"},"notNull":{"type":"boolean"},"defaultValue":{"type":"string"},"unique":{"type":"boolean"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["name","type"],"title":"Column"},"ColumnFile":{"type":"object","properties":{"defaultPublicAccess":{"type":"boolean"}},"additionalProperties":false},"ColumnLink":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"ColumnMigration":{"type":"object","properties":{"old":{"$ref":"#/components/schemas/Column"},"new":{"$ref":"#/components/schemas/Column"}},"required":["old","new"],"title":"ColumnMigration"},"ColumnName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~\\.]+","title":"ColumnName"},"ColumnOpAdd":{"type":"object","properties":{"table":{"type":"string"},"column":{"$ref":"#/components/schemas/Column"}},"required":["table","column"]},"ColumnOpRemove":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"]},"ColumnOpRename":{"type":"object","properties":{"table":{"type":"string"},"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["table","oldName","newName"]},"ColumnVector":{"type":"object","properties":{"dimension":{"type":"integer","maximum":10000,"minimum":2}},"additionalProperties":false,"required":["dimension"]},"ColumnsProjection":{"type":"array","items":{"type":"string"},"example":["name","email","created_at"]},"Commit":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"mergeParentID":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","createdAt","checksum"]},"CountAgg":{"description":"Count the number of records with an optional filter.","oneOf":[{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false},{"type":"string","description":"Use this form to count all records without any filter.","enum":["*"]}]},"DBBranch":{"type":"object","properties":{"databaseName":{"$ref":"#/components/schemas/DBName"},"branchName":{"$ref":"#/components/schemas/BranchName"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"version":{"type":"number"},"lastMigrationID":{"type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"},"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"schema":{"$ref":"#/components/schemas/Schema"}},"required":["databaseName","branchName","createdAt","id","version","lastMigrationID","schema"],"title":"DBBranch"},"DBBranchName":{"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n","type":"string","maxLength":511,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+:[a-zA-Z0-9_\\-~]+","title":"Tuple of database and branch name"},"DBName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"DBName"},"DataInputRecord":{"description":"Xata input record","type":"object","additionalProperties":{"nullable":true,"anyOf":[{"$ref":"#/components/schemas/RecordID"},{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"},{"$ref":"#/components/schemas/InputFileArray"},{"$ref":"#/components/schemas/InputFile"}]}},"DatabaseGithubSettings":{"description":"Github repository settings for this database (optional)","type":"object","properties":{"owner":{"description":"Repository owner (user or organization)","type":"string"},"repo":{"description":"Repository name","type":"string"}},"additionalProperties":false,"required":["owner","repo"]},"DatabaseMetadata":{"description":"Metadata of databases","type":"object","properties":{"name":{"description":"The machine-readable name of a database","type":"string"},"region":{"description":"Region where this database is hosted","type":"string"},"createdAt":{"description":"The time this database was created","$ref":"#/components/schemas/DateTime"},"ui":{"description":"Metadata about the database for display in Xata user interfaces","type":"object","properties":{"color":{"description":"The user-selected color for this database across interfaces","type":"string"}}}},"additionalProperties":false,"required":["name","createdAt","region"]},"DateBooster":{"description":"Boost records based on the value of a datetime column. It is configured via \"origin\", \"scale\", and \"decay\". The further away from the \"origin\",\nthe more the score is decayed. The decay function uses an exponential function. For example if origin is \"now\", and scale is 10 days and decay is 0.5, it\nshould be interpreted as: a record with a date 10 days before/after origin will be boosted 2 times less than a record with the date at origin.\nThe result of the exponential function is a boost between 0 and 1. The \"factor\" allows you to control how impactful this boost is, by multiplying it with a given value.\n","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"origin":{"description":"The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time.\nIf it is not specified, the current date and time is used.\n","type":"string"},"scale":{"description":"The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"decay":{"description":"The decay factor to expect at \"scale\" distance from the \"origin\".","type":"number"},"factor":{"description":"The factor with which to multiply the added boost.","type":"number","minimum":0},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","scale","decay"]},"DateHistogramAgg":{"description":"Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.\n","type":"object","properties":{"column":{"description":"The column to use for bucketing. Must be of type datetime.","type":"string"},"interval":{"description":"The fixed interval to use when bucketing. \nIt is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"calendarInterval":{"description":"The calendar-aware interval to use when bucketing. Possible values are: `minute`,\n`hour`, `day`, `week`, `month`, `quarter`, `year`.\n","type":"string","enum":["minute","hour","day","week","month","quarter","year"]},"timezone":{"description":"The timezone to use for bucketing. By default, UTC is assumed.\nThe accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or\n`-08:00`.\n","type":"string","pattern":"^[+-][01]\\d:[0-5]\\d$"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column"]},"DateTime":{"type":"string","format":"date-time","title":"DateTime"},"FileAccessID":{"description":"File identifier in access URLs","type":"string","maxLength":296,"minLength":88,"pattern":"[a-v0-9=]+","title":"FileID"},"FileItemID":{"description":"Unique file identifier","type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"FileID"},"FileName":{"description":"File name","type":"string","maxLength":1024,"minLength":0,"pattern":"[0-9a-zA-Z!\\-_\\.\\*'\\(\\)]*"},"FileResponse":{"description":"File metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"size":{"type":"integer","format":"int64"},"version":{"type":"integer","format":"int64"},"attributes":{"type":"object"}},"required":["name","mediaType","size","version"]},"FileSignature":{"description":"File signature","type":"string"},"FilterColumn":{"anyOf":[{"$ref":"#/components/schemas/FilterColumnIncludes"},{"$ref":"#/components/schemas/FilterPredicate"},{"$ref":"#/components/schemas/FilterList"}]},"FilterColumnIncludes":{"type":"object","properties":{"$includes":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAny":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAll":{"$ref":"#/components/schemas/FilterPredicate"},"$includesNone":{"$ref":"#/components/schemas/FilterPredicate"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterExpression":{"type":"object","properties":{"$exists":{"type":"string"},"$existsNot":{"type":"string"},"$any":{"$ref":"#/components/schemas/FilterList"},"$all":{"$ref":"#/components/schemas/FilterList"},"$none":{"$ref":"#/components/schemas/FilterList"},"$not":{"$ref":"#/components/schemas/FilterList"}},"additionalProperties":{"$ref":"#/components/schemas/FilterColumn"},"minProperties":1},"FilterList":{"oneOf":[{"$ref":"#/components/schemas/FilterExpression"},{"type":"array","items":{"$ref":"#/components/schemas/FilterExpression"}}]},"FilterPredicate":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"},"minLength":1},{"$ref":"#/components/schemas/FilterPredicateOp"},{"$ref":"#/components/schemas/FilterPredicateRangeOp"}]},"FilterPredicateOp":{"type":"object","properties":{"$any":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$all":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$none":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$not":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$is":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$isNot":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"},"$contains":{"type":"string"},"$startsWith":{"type":"string"},"$endsWith":{"type":"string"},"$pattern":{"type":"string"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterPredicateRangeOp":{"type":"object","properties":{"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"}},"additionalProperties":false,"maxProperties":2,"minProperties":2},"FilterRangeValue":{"oneOf":[{"type":"number"},{"type":"string"}]},"FilterValue":{"oneOf":[{"type":"number"},{"type":"string"},{"type":"boolean"}]},"FuzzinessExpression":{"description":"Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein\ndistance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single\ncharacter typos per word are tolerated by search. You can set it to 0 to remove the typo tolerance or set it to 2\nto allow two typos in a word.\n","type":"integer","default":1,"maximum":2,"minimum":0},"HighlightExpression":{"type":"object","properties":{"enabled":{"description":"Set to `false` to disable highlighting. By default it is `true`.\n","type":"boolean"},"encodeHTML":{"description":"Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.\n","type":"boolean"}},"additionalProperties":false},"InputFile":{"description":"Object representing a file","type":"object","properties":{"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false,"required":["name"]},"InputFileArray":{"description":"Array of file entries","type":"array","items":{"$ref":"#/components/schemas/InputFileEntry"},"maxItems":50},"InputFileEntry":{"description":"Object representing a file in an array","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false},"InviteID":{"type":"string","pattern":"[a-zA-Z0-9]+","title":"InviteID"},"InviteKey":{"type":"string","pattern":"^ik_[a-zA-Z0-9]+","title":"InviteKey"},"ListBranchesResponse":{"type":"object","properties":{"databaseName":{"type":"string"},"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}},"additionalProperties":false,"required":["databaseName","branches"]},"ListDatabasesResponse":{"type":"object","properties":{"databases":{"description":"A list of databases in a Xata workspace","type":"array","items":{"$ref":"#/components/schemas/DatabaseMetadata"}}},"required":["databases"]},"ListGitBranchesResponse":{"type":"object","properties":{"mapping":{"type":"array","items":{"type":"object","properties":{"gitBranch":{"type":"string"},"xataBranch":{"type":"string"}},"required":["gitBranch","xataBranch"]}}},"required":["mapping"]},"ListRegionsResponse":{"type":"object","properties":{"regions":{"description":"A list of regions where databases can be created","type":"array","items":{"$ref":"#/components/schemas/Region"}}},"required":["regions"]},"MaxAgg":{"description":"The max of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the max. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"MediaType":{"description":"Media type","type":"string","maxLength":255,"minLength":3,"pattern":"^\\w+/[-+.\\w]+$"},"MetricsDatapoint":{"type":"object","properties":{"timestamp":{"type":"string"},"value":{"type":"integer"}},"required":["timestamp","value"],"title":"Datapoint"},"MetricsLatency":{"type":"object","properties":{"p50":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"p90":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}}},"title":"MetricsLatency"},"Migration":{"description":"Branch schema migration.","type":"object","properties":{"parentID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"]},"MigrationColumnOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addColumn":{"$ref":"#/components/schemas/ColumnOpAdd"}},"required":["addColumn"]},{"type":"object","additionalProperties":false,"properties":{"removeColumn":{"$ref":"#/components/schemas/ColumnOpRemove"}},"required":["removeColumn"]},{"type":"object","additionalProperties":false,"properties":{"renameColumn":{"$ref":"#/components/schemas/ColumnOpRename"}},"required":["renameColumn"]}]},"MigrationObject":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","checksum"]},"MigrationOp":{"description":"Branch schema migration operations.","oneOf":[{"$ref":"#/components/schemas/MigrationTableOp"},{"$ref":"#/components/schemas/MigrationColumnOp"}]},"MigrationRequest":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/MigrationRequestNumber"},"createdAt":{"description":"Migration request creation timestamp.","$ref":"#/components/schemas/DateTime"},"modifiedAt":{"description":"Last modified timestamp.","$ref":"#/components/schemas/DateTime"},"closedAt":{"description":"Timestamp when the migration request was closed.","$ref":"#/components/schemas/DateTime"},"mergedAt":{"description":"Timestamp when the migration request was merged.","$ref":"#/components/schemas/DateTime"},"status":{"type":"string","enum":["open","closed","merging","merged","failed"]},"title":{"description":"The migration request title.","type":"string"},"body":{"description":"The migration request body with detailed description.","type":"string"},"source":{"description":"Name of the source branch.","type":"string"},"target":{"description":"Name of the target branch.","type":"string"}},"additionalProperties":false},"MigrationRequestNumber":{"description":"The migration request number.","type":"integer","minimum":0},"MigrationStatus":{"type":"string","enum":["completed","pending","failed"]},"MigrationTableOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addTable":{"$ref":"#/components/schemas/TableOpAdd"}},"required":["addTable"]},{"type":"object","additionalProperties":false,"properties":{"removeTable":{"$ref":"#/components/schemas/TableOpRemove"}},"required":["removeTable"]},{"type":"object","additionalProperties":false,"properties":{"renameTable":{"$ref":"#/components/schemas/TableOpRename"}},"required":["renameTable"]}]},"MinAgg":{"description":"The min of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the min. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"NumericBooster":{"description":"Boost records based on the value of a numeric column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"factor":{"description":"The factor with which to multiply the value of the column before adding it to the item score.","type":"number"},"modifier":{"description":"Modifier to be applied to the column value, before being multiplied with the factor. The possible values are:\n - none (default).\n - log: common logarithm (base 10)\n - log1p: add 1 then take the common logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - ln: natural logarithm (base e)\n - ln1p: add 1 then take the natural logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - square: raise the value to the power of two.\n - sqrt: take the square root of the value.\n - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`).\n","type":"string","enum":["none","log","log1p","ln","ln1p","square","sqrt","reciprocal"]},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","factor"]},"NumericHistogramAgg":{"description":"Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.\n","properties":{"column":{"description":"The column to use for bucketing. Must be of numeric type.","type":"string"},"interval":{"description":"The numeric interval to use for bucketing. The resulting buckets will be ranges \nwith this value as size.\n","type":"number","minimum":0},"offset":{"description":"By default the bucket keys start with 0 and then continue in `interval` steps. The bucket\nboundaries can be shifted by using the offset option. For example, if the `interval` is 100,\nbut you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset` \nto 50.\n","type":"number","default":0},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column","interval"]},"OAuthAccessToken":{"type":"object","properties":{"token":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"}},"required":["token","scopes","createdAt","updatedAt","expiresAt","clientId"]},"OAuthClientID":{"type":"string"},"OAuthClientPublicDetails":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"icon":{"type":"string"},"clientId":{"type":"string"}},"required":["clientId"]},"OAuthResponseType":{"type":"string","enum":["code"]},"OAuthScope":{"type":"string","enum":["admin:all"]},"ObjectValue":{"description":"Object column value","type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"}]}},"PageConfig":{"description":"Pagination settings.","type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"start":{"description":"Query the first page from the cursor.","type":"string"},"end":{"description":"Query the last page from the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.","type":"integer","default":20},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0}},"title":"PageConfig"},"PrefixExpression":{"description":"If the prefix type is set to \"disabled\" (the default), the search only matches full words. If the prefix type is set to \"phrase\", the search will return results that match prefixes of the search phrase.\n","type":"string","enum":["phrase","disabled"]},"ProjectionConfig":{"description":"A structured projection that allows for some configuration.","type":"object","properties":{"name":{"description":"The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations).","type":"string"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"as":{"description":"An alias for the projected field, this is how it will be returned in the response.","type":"string"},"sort":{"$ref":"#/components/schemas/SortExpression"},"limit":{"type":"integer","default":20},"offset":{"type":"integer","default":0}}},"QueryColumnsProjection":{"type":"array","items":{"oneOf":[{"type":"string"},{"$ref":"#/components/schemas/ProjectionConfig"}]}},"Record":{"description":"Xata Table Record","allOf":[{"$ref":"#/components/schemas/RecordMeta"},{"type":"object","additionalProperties":true}],"title":"Record"},"RecordID":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"RecordID"},"RecordMeta":{"description":"Xata Table Record Metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/RecordID"},"xata":{"type":"object","properties":{"version":{"description":"The record's version. Can be used for optimistic concurrency control.","type":"integer"},"createdAt":{"description":"The time when the record was created.","type":"string"},"updatedAt":{"description":"The time when the record was last updated.","type":"string"},"table":{"description":"The record's table name. APIs that return records from multiple tables will set this field accordingly.","type":"string"},"highlight":{"description":"Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.","type":"object","additionalProperties":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":true}]}},"score":{"description":"The record's relevancy score. This is returned by the search APIs.","type":"number"},"warnings":{"description":"Encoding/Decoding errors","type":"array","items":{"type":"string"}}},"required":["version"]}},"required":["id","xata"],"title":"RecordMeta"},"RecordsMetadata":{"description":"Records metadata","type":"object","properties":{"page":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetched","type":"boolean"},"size":{"description":"the number of records returned per page","type":"number"}},"required":["cursor","more","size"]}},"required":["page"]},"Region":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"RevLink":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"],"title":"RevLink"},"Role":{"type":"string","enum":["owner","maintainer"]},"SQLRecord":{"description":"Xata Table SQL Record","allOf":[{"type":"object","additionalProperties":true}],"title":"SQL Record"},"Schema":{"type":"object","properties":{"tables":{"type":"array","items":{"$ref":"#/components/schemas/Table"}},"tablesOrder":{"type":"array","items":{"type":"string"}}},"required":["tables"],"title":"Schema"},"SchemaEditScript":{"type":"object","properties":{"sourceMigrationID":{"type":"string"},"targetMigrationID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"],"title":"SchemaEditScript"},"SearchPageConfig":{"description":"Pagination settings for the search endpoints.","properties":{"size":{"description":"Set page size.","type":"integer","default":25,"maximum":200},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0,"maximum":800}},"title":"SearchPageConfig"},"SortExpression":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}},{"type":"array","items":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}}}],"title":"SortExpression"},"SortOrder":{"type":"string","enum":["asc","desc","random"],"title":"SortOrder"},"StartedFromMetadata":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"migrationID":{"type":"string"}},"required":["branchName","dbBranchID","migrationID"],"title":"StartedFromMetadata"},"SumAgg":{"description":"The sum of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the sum. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"SummaryExpression":{"description":"A summary expression is the description of a single summary operation. It consists of a single\nkey representing the operation, and a value representing the column to be operated on.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n\nWe currently support several aggregation functions. Not all functions can be run on all column\ntypes.\n\n - `count` is used to count the number of records in each group. Use `{\"count\": \"*\"}` to count\n all columns present, otherwise `{\"count\": \"\"}` to count the number of non-null\n values are present at column path.\n\n Count can be used on any column type, and always returns an int.\n\n - `min` calculates the minimum value in each group. `min` is compatible with most types;\n string, multiple, text, email, int, float, and datetime. It returns a value of the same\n type as operated on. This means that `{\"lowest_latency\": {\"min\": \"latency\"}}` where\n `latency` is an int, will always return an int.\n\n - `max` calculates the maximum value in each group. `max` shares the same compatibility as\n `min`.\n\n - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will\n return a value of the same type as requested.\n\n - `average` averages all values in a group. `average` can be run on `int` and `float` types, and\n always returns a float.\n","type":"object","example":{"count":"deleted_at"}},"SummaryExpressionList":{"description":"The description of the summaries you wish to receive. Set each key to be the field name\nyou'd like for the summary. These names must not collide with other columns you've\nrequested from `columns`; including implicit requests like `settings.*`.\n\nThe value for each key needs to be an object. This object should contain one key and one \nvalue only. In this object, the key should be set to the summary function you wish to use\nand the value set to the column name to be summarized.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n","type":"object","example":{"all_users":{"count":"*"},"total_created":{"count":"created_at"},"min_cost":{"min":"cost"},"max_happiness":{"max":"happiness"},"total_revenue":{"sum":"revenue"},"average_speed":{"average":"speed"}},"additionalProperties":{"$ref":"#/components/schemas/SummaryExpression"}},"Table":{"type":"object","properties":{"id":{"type":"string"},"name":{"$ref":"#/components/schemas/TableName"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"revLinks":{"type":"array","items":{"$ref":"#/components/schemas/RevLink"}}},"required":["name","columns"],"title":"Table"},"TableMigration":{"type":"object","properties":{"newColumns":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Column"}},"removedColumns":{"type":"array","items":{"type":"string"}},"modifiedColumns":{"type":"array","items":{"$ref":"#/components/schemas/ColumnMigration"}},"newColumnOrder":{"type":"array","items":{"type":"string"}}},"required":["newColumnOrder"],"title":"TableMigration"},"TableName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"TableName"},"TableOpAdd":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRemove":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRename":{"type":"object","properties":{"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["oldName","newName"]},"TableRename":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1},"oldName":{"type":"string","minLength":1}},"example":{"newName":"newName","oldName":"oldName"},"required":["newName","oldName"]},"TargetExpression":{"description":"The target expression is used to filter the search results by the target columns.\n","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"column":{"description":"The name of the column.","type":"string"},"weight":{"description":"The weight of the column.","type":"number","default":1,"maximum":10,"minimum":1}},"required":["column"],"additionalProperties":false}]}},"TopValuesAgg":{"description":"Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.\nThe top values as ordered by the number of records (`$count`) are returned.\n","properties":{"column":{"description":"The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.","type":"string"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"size":{"description":"The maximum number of unique values to return.\n","type":"integer","default":10,"maximum":1000}},"additionalProperties":false,"required":["column"]},"TransactionDeleteOp":{"description":"A delete operation. The transaction will continue if no record matches the ID by default. To override this behaviour, set failIfMissing to true.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"failIfMissing":{"description":"If true, the transaction will fail when the record doesn't exist.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionError":{"description":"An error message from a failing transaction operation","type":"object","properties":{"index":{"description":"The index of the failing operation","type":"integer"},"message":{"description":"The error message","type":"string"}},"required":["index","message"]},"TransactionFailure":{"description":"An array of errors, with indices, from the transaction.","type":"object","properties":{"id":{"description":"The request ID.","type":"string"},"errors":{"description":"An array of errors from the submitted operations.","type":"array","items":{"$ref":"#/components/schemas/TransactionError"}}},"required":["id","errors"]},"TransactionGetOp":{"description":"Get by id operation.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionInsertOp":{"description":"Insert operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"record":{"description":"The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.\n","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be overwriting. Only valid with an\nexplicit ID is also set in the `record` key.\n","type":"integer"},"createOnly":{"description":"createOnly is used to change how Xata acts when an explicit ID is set in the `record` key. \n\nIf `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata \nwill cancel the transaction. \n\nIf `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no\nconflict, the record is inserted. If there is a conflict, Xata will replace the record.\n","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","record"]},"TransactionOperation":{"description":"A transaction operation","type":"object","oneOf":[{"type":"object","properties":{"insert":{"$ref":"#/components/schemas/TransactionInsertOp"}},"required":["insert"]},{"type":"object","properties":{"update":{"$ref":"#/components/schemas/TransactionUpdateOp"}},"required":["update"]},{"type":"object","properties":{"delete":{"$ref":"#/components/schemas/TransactionDeleteOp"}},"required":["delete"]},{"type":"object","properties":{"get":{"$ref":"#/components/schemas/TransactionGetOp"}},"required":["get"]}]},"TransactionResultColumns":{"description":"Fields to return in the transaction result.","type":"object","additionalProperties":true},"TransactionResultDelete":{"description":"A result from a delete operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["delete"]},"rows":{"description":"The number of deleted rows","type":"integer"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows"]},"TransactionResultGet":{"description":"A result from a get operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["get"]},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation"]},"TransactionResultInsert":{"description":"A result from an insert operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["insert"]},"rows":{"description":"The number of affected rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionResultUpdate":{"description":"A result from an update operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["update"]},"rows":{"description":"The number of updated rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionSuccess":{"description":"An ordered array of results from the submitted operations.","type":"object","properties":{"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/TransactionResultInsert"},{"$ref":"#/components/schemas/TransactionResultUpdate"},{"$ref":"#/components/schemas/TransactionResultDelete"},{"$ref":"#/components/schemas/TransactionResultGet"}]}}},"required":["results"]},"TransactionUpdateOp":{"description":"Update operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"fields":{"description":"The fields of the record you'd like to update","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be updating","type":"integer"},"upsert":{"description":"Xata will insert this record if it cannot be found.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id","fields"]},"UniqueCountAgg":{"description":"Count the number of distinct values in a particular column.","type":"object","properties":{"column":{"description":"The column from where to count the unique values.","type":"string"},"precisionThreshold":{"description":"The threshold under which the unique count is exact. If the number of unique\nvalues in the column is higher than this threshold, the results are approximate.\nMaximum value is 40,000, default value is 3000.\n","type":"integer"}},"additionalProperties":false,"required":["column"]},"User":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullname":{"type":"string"},"image":{"type":"string"}},"required":["fullname","email","image"]},"UserID":{"type":"string","pattern":"[a-zA-Z0-9_-~:]+","title":"UserID"},"UserWithID":{"allOf":[{"$ref":"#/components/schemas/User"},{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UserID"}},"required":["id"]}]},"ValueBooster":{"description":"Boost records with a particular value for a column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"value":{"description":"The exact value to boost.","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"factor":{"description":"The factor with which to multiply the added boost.","type":"number"},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","value","factor"]},"Workspace":{"allOf":[{"$ref":"#/components/schemas/WorkspaceMeta"},{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceID"},"memberCount":{"type":"integer"},"plan":{"type":"string","enum":["free","pro"]}},"required":["id","memberCount","plan"]}]},"WorkspaceID":{"type":"string","pattern":"^([a-zA-Z0-9][a-zA-Z0-9_\\-~]+-)?[a-zA-Z0-9]{6}","title":"WorkspaceID"},"WorkspaceInvite":{"type":"object","properties":{"inviteId":{"$ref":"#/components/schemas/InviteID"},"email":{"type":"string","format":"email"},"expires":{"type":"string","format":"date-time"},"role":{"$ref":"#/components/schemas/Role"}},"required":["inviteId","email","expires","role"]},"WorkspaceMember":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserID"},"fullname":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/Role"}},"required":["userId","email","fullname","role"]},"WorkspaceMembers":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceMember"}},"invites":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceInvite"}}},"required":["members","invites"]},"WorkspaceMeta":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"}},"required":["name"]}},"responses":{"AggResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"aggs":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/AggResponse"}}},"example":{"aggs":{"dailyUniqueUsers":{"values":[{"$count":321,"$key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"$count":202,"$key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}}}}}},"AuthError":{"description":"Authentication Error","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"example":{"message":"invalid API key"},"required":["message"]}}}},"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"BranchMigrationPlan":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"BulkError":{"description":"Response with multiple errors of the bulk execution","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer"}}}}},"required":["errors"]}}}},"BulkInsertResponse":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"recordIDs":{"type":"array","items":{"type":"string"}}},"required":["recordIDs"]},{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}}},"required":["records"]}]}}}},"PutFileResponse":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"QueryResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"meta":{"$ref":"#/components/schemas/RecordsMetadata"}},"required":["records","meta"]}}}},"RateLimitError":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"RecordResponse":{"description":"Table Record Reponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"RecordUpdateResponse":{"description":"Record ID and metadata","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Record"},{"type":"object","properties":{"id":{"type":"string"},"xata":{"type":"object","properties":{"version":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["version","createdAt","updatedAt"]}},"required":["id","xata"]}]}}}},"SQLResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/SQLRecord"}},"warning":{"type":"string"}}}}}},"SchemaCompareResponse":{"description":"Schema comparison response.","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/Schema"},"target":{"$ref":"#/components/schemas/Schema"},"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["source","target","edits"]}}}},"SchemaUpdateResponse":{"description":"Schema migration response with ID and migration status.","content":{"application/json":{"schema":{"type":"object","properties":{"migrationID":{"type":"string","minLength":1},"parentMigrationID":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["migrationID","parentMigrationID","status"]},"examples":{"example-1":{"value":{"migrationID":"mig_c7m19ilcefoebpqj12p0","parentMigrationID":"mig_c7m19ilcefoebpqj4312","status":"completed"}}}}}},"SearchResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"warning":{"type":"string"},"totalCount":{"description":"The total count of records matched. It will be accurately returned up to 10000 records.","type":"integer"}},"required":["records","totalCount"]}}}},"ServiceUnavailableError":{"description":"ServiceUnavailable","headers":{"Retry-After":{"schema":{"description":"Number of seconds to wait after retrying the operation","type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SimpleError":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SummarizeResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"summaries":{"type":"array","items":{"type":"object"}}},"required":["summaries"]}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Workspaces","description":"Workspaces management","x-displayName":"Workspaces"},{"name":"Users","description":"Users management","x-displayName":"Users"},{"name":"Invites","description":"Manage user invites.","x-displayName":"Invites"},{"name":"Authentication","description":"Authentication and API Key management.","x-displayName":"Authentication"},{"name":"OAuth","x-displayName":"OAuth"},{"name":"auth_other","x-displayName":"other"},{"name":"Databases","description":"Workspace databases management.","x-displayName":"Databases"},{"name":"xbcontrol_other","x-displayName":"other"},{"name":"Database","description":"Database management.","x-displayName":"Database"},{"name":"Branch","description":"Branch management.","x-displayName":"Branch"},{"name":"Migrations","description":"Branch schema migrations and history.","x-displayName":"Migrations"},{"name":"Table","description":"Table management.","x-displayName":"Table"},{"name":"xbregion_other","x-displayName":"other"},{"name":"Records","description":"Record access API.","x-displayName":"Records"},{"name":"Search and Filter","description":"APIs for searching, querying, filtering, and aggregating records.","x-displayName":"Search and Filter"},{"name":"Files","description":"CRUD API for operating on binary content in file and file[] columns.","x-displayName":"Files"},{"name":"xbcell_other","x-displayName":"other"},{"name":"SQL","description":"SQL service access","x-displayName":"SQL"},{"name":"sql_other","x-displayName":"other"}],"x-tagGroups":[{"name":"auth","tags":["Workspaces","Users","Invites","Authentication","OAuth","auth_other"],"description":"Xata.io Auth API"},{"name":"xbcontrol","tags":["Databases","xbcontrol_other"],"description":"Xata.io Xatabases API"},{"name":"xbregion","tags":["Database","Branch","Migrations","Table","Migration Requests","xbregion_other"],"description":"Xata.io Xatabases API"},{"name":"xbcell","tags":["Records","Search and Filter","Files","xbcell_other"],"description":"Xata.io Xatabases API"},{"name":"sql","tags":["SQL","sql_other"],"description":"Xata.io SQL API"}]} \ No newline at end of file +{"openapi":"3.0.0","info":{"title":"xata-auth","description":"Xata.io Auth API","version":"1.0","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"contact":{"name":"support@xata.io"}},"servers":[{"url":"/","description":""}],"paths":{"/user":{"summary":"User info","description":"This endpoint allows retrieving or updating a given user by their user ID.","get":{"operationId":"getUser","summary":"Get user details","description":"Return details of the user making the request","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithID"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]},"put":{"operationId":"updateUser","summary":"Update user info","description":"Update user info","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithID"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]},"delete":{"operationId":"deleteUser","summary":"Delete user","description":"Delete the user making the request","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]}},"/user/keys":{"summary":"User API Keys","description":"This endpoint allows interacting with the API keys for a given user.","get":{"operationId":"getUserAPIKeys","summary":"Get the list of user API keys","description":"Retrieve a list of existing user API keys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"required":["name","createdAt"]}}},"required":["keys"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]}},"/user/keys/{key_name}":{"summary":"Single User API Key","description":"This endpoint allows operations on a single API key for a given user.","parameters":[{"$ref":"#/components/parameters/APIKeyNameParam"}],"post":{"operationId":"createUserAPIKey","summary":"Create and return new API key","description":"Create and return new API key","responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"key":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"required":["name","key","createdAt"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]},"delete":{"operationId":"deleteUserAPIKey","summary":"Delete an existing API key","description":"Delete an existing API key","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]}},"/user/oauth/clients":{"summary":"User OAuth Clients","description":"this endpoint allows listing the clients the current user has authorized","get":{"operationId":"getUserOAuthClients","summary":"Get the list of user OAuth Clients","description":"Retrieve the list of OAuth Clients that a user has authorized","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"clients":{"type":"array","items":{"$ref":"#/components/schemas/OAuthClientPublicDetails"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/clients/{client_id}":{"parameters":[{"$ref":"#/components/parameters/OAuthClientIDParam"}],"delete":{"operationId":"deleteUserOAuthClient","summary":"Delete the oauth client for the user","description":"Delete the oauth client for the user and revoke all access","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/tokens":{"summary":"User OAuth Access Tokens","description":"this endpoint allows listing the valid access tokens on the current user's account","get":{"operationId":"getUserOAuthAccessTokens","summary":"Get the list of user OAuth Access Tokens","description":"Retrieve the list of valid OAuth Access Tokens on the current user's account","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"accessTokens":{"type":"array","items":{"$ref":"#/components/schemas/OAuthAccessToken"}}},"required":["accessTokens"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/tokens/{token}":{"parameters":[{"$ref":"#/components/parameters/OAuthAccessTokenParam"}],"delete":{"operationId":"deleteOAuthAccessToken","summary":"delete an access token for a third party app","description":"Expires the access token for a third party app","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]},"patch":{"operationId":"updateOAuthAccessToken","summary":"updates an access token for a third party app","description":"Updates partially the access token for a third party app","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expires":{"description":"expiration time of the token as a unix timestamp","type":"integer"}},"required":["expires"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthAccessToken"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/workspaces":{"summary":"Workspaces","description":"This endpoint enables interacting with specific workspaces within Xata. For more information about workspaces, see the [docs](/concepts/workspaces).","get":{"operationId":"getWorkspacesList","summary":"Get list of workspaces","description":"Retrieve the list of workspaces the user belongs to","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"workspaces":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceID"},"name":{"type":"string"},"slug":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}},"required":["name","role","slug","id"]}}},"required":["workspaces"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"post":{"operationId":"createWorkspace","summary":"Create a new workspace","description":"Creates a new workspace with the user requesting it as its single owner.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMeta"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}":{"summary":"Workspace by ID","description":"This endpoint contains operations for a specific workspace, referenced by ID.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getWorkspace","summary":"Get an existing workspace","description":"Retrieve workspace info from a workspace ID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"put":{"operationId":"updateWorkspace","summary":"Update an existing workspace","description":"Update workspace info","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMeta"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"delete":{"operationId":"deleteWorkspace","summary":"Delete an existing workspace","description":"Delete the workspace with the provided ID","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/members":{"summary":"Workspace Members","description":"This endpoint allows operations concerning the members of a given workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getWorkspaceMembersList","summary":"Get the list members of a workspace","description":"Retrieve the list of members of the given workspace","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMembers"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/members/{user_id}":{"summary":"Specific Workspace Member","description":"This endpoint enables operations on a specific member of a workspace, referenced by their user ID.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/UserIDParam"}],"put":{"operationId":"updateWorkspaceMemberRole","summary":"Update workspace member role","description":"Update a workspace member role. Workspaces must always have at least one owner, so this operation will fail if trying to remove owner role from the last owner in the workspace.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"delete":{"operationId":"removeWorkspaceMember","summary":"Remove a member from the workspace","description":"Remove the member from the workspace","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/invites":{"summary":"Workspace Invites","description":"This endpoint enables working with invites for a given workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"post":{"operationId":"inviteWorkspaceMember","summary":"Invite a user to join the workspace","description":"Invite some user to join the workspace with the given role","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/Role"}},"required":["email","role"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceInvite"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_id}":{"summary":"A specific invite within a given workspace","description":"This endpoint enables working with a given invite.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteIDParam"}],"patch":{"operationId":"updateWorkspaceMemberInvite","summary":"Updates an existing invite","description":"This operation provides a way to update an existing invite. Updates are performed in-place; they do not change the invite link, the expiry time, nor do they re-notify the recipient of the invite.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"200":{"description":"Updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceInvite"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]},"delete":{"operationId":"cancelWorkspaceMemberInvite","summary":"Deletes an invite","description":"This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_key}/accept":{"summary":"Accept an Invite","description":"This [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call)-style endpoint accepts a given invite to join a workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteKeyParam"}],"post":{"operationId":"acceptWorkspaceMemberInvite","summary":"Accept the invitation to join a workspace","description":"Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace\n","responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_id}/resend":{"summary":"Resend Invite notification","description":"Resend the notification for a previously generated Invite.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteIDParam"}],"post":{"operationId":"resendWorkspaceMemberInvite","summary":"Resend Invite notification","description":"This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.","responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/dbs":{"summary":"Databases","description":"This path contains operations that can be performed on databases within Xata.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getDatabaseList","summary":"List databases","description":"List all databases available in your Workspace.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDatabasesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/DBNameParam"}],"put":{"operationId":"createDatabase","summary":"Create Database","description":"Create Database with identifier name","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string","minLength":1},"region":{"type":"string","minLength":1},"ui":{"type":"object","properties":{"color":{"type":"string"}}},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}},"example":{"branchName":"main","region":"us-east-1","metadata":{"repository":"github.com/my/repository","branch":"github repository","stage":"testing","labels":["development"]}},"required":["region"]}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"}}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"New Database","status":"completed"},"required":["databaseName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"422":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"delete":{"operationId":"deleteDatabase","summary":"Delete Database","description":"Delete a database and all of its branches and tables permanently.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"get":{"operationId":"getDatabaseMetadata","summary":"Get Database metadata","description":"Retrieve metadata of the given database","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"patch":{"operationId":"updateDatabaseMetadata","summary":"Update Database metadata","description":"Update the color of the selected database","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"ui":{"type":"object","properties":{"color":{"type":"string","minLength":1}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/dbs/{db_name}/rename":{"summary":"Rename database","description":"Given a parameter `db_name`, this path allows you to rename your Xata database. When you rename a database all URLs accessing the database have to be updated.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/DBNameParam"}],"post":{"operationId":"renameDatabase","summary":"Rename Database","description":"Change the name of an existing database","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1}},"required":["newName"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"422":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/regions":{"summary":"Available regions","description":"This path allows to access the list of available database regions","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"listRegions","summary":"List available regions","description":"List regions available to create a database on","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRegionsResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getBranchList","summary":"List branches","description":"List all available Branches","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}":{"summary":"Database Branch by Name","description":"This path allows interacting with a given database branch, referenced by parameter `db_branch_name`, which is expected in the format `database_name:branch_name`.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchDetails","summary":"Get branch schema and metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DBBranch"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"put":{"operationId":"createBranch","summary":"Create Database branch","parameters":[{"name":"from","in":"query","description":"Name of source branch to branch the new schema from","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"description":"Select the branch to fork from. Defaults to 'main'","type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}}}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"mydatabase","branchName":"mybranch","status":"completed"},"required":["databaseName","branchName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"deleteBranch","summary":"Delete Database branch","description":"Delete the branch in the database and all its resources","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/metadata":{"summary":"Branch Metadata","description":"This path allows interacting with the metadata of a specific database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"put":{"operationId":"updateBranchMetadata","summary":"Update branch metadata","description":"Update the branch metadata","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"get":{"operationId":"getBranchMetadata","summary":"Get Branch Metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/stats":{"summary":"Branch Statistics","description":"This endpoint presents a number of statistics on a given database's branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchStats","summary":"Branch stats","description":"Get branch usage metrics.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"type":"string"},"interval":{"type":"string"},"resolution":{"type":"string"},"numberOfRecords":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"writesOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readsOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readLatency":{"$ref":"#/components/schemas/MetricsLatency"},"writeLatency":{"$ref":"#/components/schemas/MetricsLatency"},"warning":{"type":"string"}},"required":["timestamp","interval","resolution"]}}}},"400":{"$ref":"#/components/responses/SimpleError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/gitBranches":{"summary":"Mapping of git to Xata branches","description":"This path allows managing the mapping between git and Xata branches, which is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git branches to the associated Xata branches.\n","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getGitBranchesMapping","summary":"List git branches mapping","description":"Lists all the git branches in the mapping, and their associated Xata branches.\n\nExample response:\n\n```json\n{\n \"mappings\": [\n {\n \"gitBranch\": \"main\",\n \"xataBranch\": \"main\"\n },\n {\n \"gitBranch\": \"gitBranch1\",\n \"xataBranch\": \"xataBranch1\"\n }\n {\n \"gitBranch\": \"xataBranch2\",\n \"xataBranch\": \"xataBranch2\"\n }\n ]\n}\n```\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"post":{"operationId":"addGitBranchesEntry","summary":"Link a git branch to a Xata branch","description":"Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.\n\nIf the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.\n\nExample request:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches\n{\n \"gitBranch\": \"fix/bug123\",\n \"xataBranch\": \"fix_bug\"\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"gitBranch":{"description":"The name of the Git branch.","type":"string"},"xataBranch":{"description":"The name of the Xata branch.","$ref":"#/components/schemas/BranchName"}},"required":["gitBranch","xataBranch"]}}}},"responses":{"201":{"description":"Operation was successful with warnings","content":{"application/json":{"schema":{"type":"object","properties":{"warning":{"description":"Warning message","type":"string"}},"example":{"warning":"Git branch [fix/bug123] was already present in the mapping and was overwritten."}}}}},"204":{"description":"Operation was successful without warnings"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"removeGitBranchesEntry","summary":"Unlink a git branch to a Xata branch","description":"Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.\n\nExample request:\n\n```json\n// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch to remove from the mapping","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"The git branch was not found in the mapping"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/resolveBranch":{"summary":"Resolve the branch to use","description":"This endpoint is typically used by the Xata SDKs to resolve the correct branch to use in a particular situation. The main input is the git branch.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"resolveBranch","summary":"Resolve a Git Branch to a Xata branch","description":"In order to resolve the database branch, the following algorithm is used:\n* if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned\n* else, if a Xata branch with the exact same name as `gitBranch` exists, return it\n* else, if `fallbackBranch` is provided and a branch with that name exists, return it\n* else, return the default branch of the DB (`main` or the first branch)\n\nExample call:\n\n```json\n// GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg\n```\n\nExample response:\n\n```json\n{\n \"branch\": \"main\",\n \"reason\": {\n \"code\": \"DEFAULT_BRANCH\",\n \"message\": \"Default branch for this database (main)\"\n }\n}\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch","schema":{"type":"string"}},{"name":"fallbackBranch","in":"query","description":"Default branch to fallback to","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branch":{"type":"string"},"reason":{"type":"object","properties":{"code":{"type":"string","enum":["FOUND_IN_MAPPING","BRANCH_EXISTS","FALLBACK_BRANCH","DEFAULT_BRANCH"]},"message":{"type":"string"}},"required":["code","message"]}},"example":{"branch":"main","reason":{"code":"DEFAULT_BRANCH","message":"Default branch for this database (main)"}},"required":["branch","reason"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/migrations":{"summary":"Branch Migrations [deprecated]","description":"This path allows access to migrations on a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchMigrationHistory","summary":"Get branch migration history [deprecated]","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer"},"startFrom":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"migrations":{"type":"array","items":{"$ref":"#/components/schemas/BranchMigration"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/plan":{"summary":"Migration Plan [deprecated]","description":"This endpoint enables creating a migration plan for a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchMigrationPlan","summary":"Compute migration plan [deprecated]","description":"Compute a migration plan from a target schema the branch should be migrated too.","requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Schema"}}}},"responses":{"200":{"$ref":"#/components/responses/BranchMigrationPlan"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/execute":{"summary":"Migration Execution [deprecated]","description":"This endpoint is called in the style of an RPC (Remote Procedure Call) when a migration is to be executed against a specific database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"executeBranchMigrationPlan","summary":"Migrate branch [deprecated]","description":"Apply a migration plan to the branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/history":{"summary":"Query schema history.","description":"Query the branch its schema history.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchSchemaHistory","summary":"Query schema history.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.","type":"integer","default":20}}},"since":{"description":"Report only migrations that have been added since the given Migration ID.","type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetch","type":"boolean"}},"required":["cursor","more"]},"logs":{"type":"array","items":{"$ref":"#/components/schemas/Commit"}}},"required":["meta","logs"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare":{"summary":"Compare branch with custom schema.","description":"Compare the branch schema with a custom provided schema.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"compareBranchWithUserSchema","summary":"Compare branch with user schema.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"$ref":"#/components/schemas/Schema"},"schemaOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"branchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare/{branch_name}":{"summary":"Compare branch schemas.","description":"Compare the schema of any 2 branches.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/BranchNameParam"}],"post":{"operationId":"compareBranchSchemas","summary":"Compare branch schemas.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sourceBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"targetBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/update":{"summary":"Update Branch schema","description":"Update the branch schema with migration operations","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"updateBranchSchema","summary":"Update Branch schema","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Migration"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/preview":{"summary":"Preview branch schema edits.","description":"Preview the resulting branch schema when applying the edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"previewBranchSchemaEdit","summary":"Preview branch schema edits.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"original":{"$ref":"#/components/schemas/Schema"},"updated":{"$ref":"#/components/schemas/Schema"}},"required":["original","updated"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/apply":{"summary":"Update Branch schema with edit script.","description":"Update the branch from schema edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"applyBranchSchemaEdit","summary":"Apply edit script.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["edits"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/push":{"summary":"Push migrations.","description":"Apply a list of migrations to the current branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"pushBranchMigrations","summary":"Push migrations.","description":"The `schema/push` API accepts a list of migrations to be applied to the\ncurrent branch. A list of applicable migrations can be fetched using\nthe `schema/history` API from another branch or database.\n\nThe most recent migration must be part of the list or referenced (via\n`parentID`) by the first migration in the list of migrations to be pushed.\n\nEach migration in the list has an `id`, `parentID`, and `checksum`. The\nchecksum for migrations are generated and verified by xata. The\noperation fails if any migration in the list has an invalid checksum.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"migrations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationObject"}}},"required":["migrations"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/tables/{table_name}":{"summary":"Database Table by Name","description":"This endpoint provides a way to mutate a specific table on a database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"put":{"operationId":"createTable","summary":"Create table","description":"Creates a new table with the given name. Returns 422 if a table with the same name already exists.","responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}/tables/{table_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string"},"tableName":{"type":"string","minLength":1},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"branchName":"mydb_main","tableName":"mytable","status":"completed"},"required":["branchName","tableName","status"]}}}},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteTable","summary":"Delete table","description":"Deletes the table with the given name.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"Not Found"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateTable","summary":"Update table","description":"Update table. Currently there is only one update operation supported: renaming the table by providing a new name.\n\nIn the example below, we rename a table from “users” to “people”:\n\n```json\n// PATCH /db/test:main/tables/users\n\n{\n \"name\": \"people\"\n}\n```","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/schema":{"summary":"Table Schema","description":"This endpoint enables reading or updating the schema of a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableSchema","summary":"Get table schema","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"put":{"operationId":"setTableSchema","summary":"Update table schema","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns":{"summary":"Table Columns","description":"This endpoint allows working with a table's columns.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableColumns","summary":"List table columns","description":"Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their\nfull dot-separated path (flattened).\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"example":{"columns":[{"name":"name","type":"string"},{"name":"email","type":"email"},{"name":"settings.plan","type":"string"},{"name":"settings.dark","type":"bool"}]},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"post":{"operationId":"addTableColumn","summary":"Create new column","description":"Adds a new column to the table. The body of the request should contain the column definition.","requestBody":{"description":"The column definition.","content":{"application/json":{"schema":{"example":{"name":"columnName","type":"string"},"$ref":"#/components/schemas/Column"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns/{column_name}":{"summary":"Single Table Column","description":"This endpoint allows working with a single column from a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getColumn","summary":"Get column information","description":"Get the definition of a single column.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"example":{"value":{"name":"settings.labels","type":"multiple"}},"$ref":"#/components/schemas/Column"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateColumn","summary":"Update column","description":"Update column with partial data. Can be used for renaming the column by providing a new \"name\" field.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"example":{"name":"newName","description":"Sample new description"},"required":["name"]},"examples":{"Rename column":{"value":{"name":"new_name"}}}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteColumn","summary":"Delete column","description":"Deletes the specified column.","responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/transaction":{"summary":"Execute a transaction on a branch","description":"Executes multiple operations together as one. This allows you to run a number of \noperations that succeed as a single group; or fail with no changes to your database.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"branchTransaction","summary":"Execute a transaction on a branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"operations":{"type":"array","items":{"$ref":"#/components/schemas/TransactionOperation"}}},"required":["operations"]}}}},"responses":{"200":{"description":"Returns the results of a successful transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionSuccess"}}}},"400":{"description":"Returns errors from a failed transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionFailure"}}}},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data":{"summary":"Table Data","description":"This endpoint enables mutating data into a given database table. To query data, please see the [query endpoint](query).\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"insertRecord","summary":"Insert record","description":"Insert a new Record into the Table","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file/{file_id}":{"summary":"File array access","description":"File array access endpoint allows upload, download and remove of file items.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"},{"$ref":"#/components/parameters/FileItemIDParam"}],"get":{"operationId":"getFileItem","summary":"Download content from a file item in a file array column","description":"Retrieves file content from an array by file ID","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFileItem","summary":"Upload or update the content of a file item in a file array column","description":"Uploads the file content to an array given the file ID","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFileItem","summary":"Delete an item from a file array","description":"Deletes an item from an file array column given the file ID","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file":{"summary":"File column access","description":"File access endpoint allows upload and download of binary file content.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getFile","summary":"Download content from a file column","description":"Retrieves the file content from a file column","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"204":{"description":"no content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFile","summary":"Upload content to a file column","description":"Uploads the file content to the given file column","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFile","summary":"Remove the content from a file column","description":"Deletes a file referred in a file column","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}":{"summary":"Table Record","description":"This endpoint enables mutating a given record in a table, referenced by its ID.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"get":{"operationId":"getRecord","summary":"Get record by ID","description":"Retrieve record by ID","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"put":{"operationId":"insertRecordWithID","summary":"Insert record with ID","description":"By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.","parameters":[{"name":"createOnly","in":"query","schema":{"type":"boolean"}},{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"patch":{"operationId":"updateRecordWithID","summary":"Update record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"post":{"operationId":"upsertRecordWithID","summary":"Upsert record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"delete":{"operationId":"deleteRecord","summary":"Delete record from table","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/bulk":{"summary":"Bulk Table Operations","description":"This endpoint enables bulk operations on a given table. For now, we only allow bulk inserting.\n\nAn example bulk request looks like this:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/db/tutorial:main/tables/users/bulk\n\n{\n \"records\": [\n {\n \"email\": \"laurence@example.com\",\n \"full_name\": \"Laurence Fishburne\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"hugo@example.com\",\n \"full_name\": \"Hugo Weaving\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"joe@example.com\",\n \"full_name\": \"Joe Pantoliano\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n }\n ]\n}\n```\nFor more details, see the [this section](/web-api/records/insert#inserting-records-in-bulk) from the tutorial.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"bulkInsertTableRecords","summary":"Bulk insert records","description":"Bulk insert records","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DataInputRecord"}}},"required":["records"]}}}},"responses":{"200":{"$ref":"#/components/responses/BulkInsertResponse"},"400":{"$ref":"#/components/responses/BulkError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"],"x-experimental":true}},"/db/{db_branch_name}/tables/{table_name}/query":{"summary":"Query Table Data","description":"This endpoint serves data from a given table, inside a specific database's branch.\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"queryTable","summary":"Query table","description":"The Query Table API can be used to retrieve all records in a table.\nThe API support filtering, sorting, selecting a subset of columns, and pagination.\n\nThe overall structure of the request looks like this:\n\n```json\n// POST /db/:/tables/
/query\n{\n \"columns\": [...],\n \"filter\": {\n \"$all\": [...],\n \"$any\": [...]\n ...\n },\n \"sort\": {\n \"multiple\": [...]\n ...\n },\n \"page\": {\n ...\n }\n}\n```\n\nFor usage, see also the [API Guide](https://xata.io/docs/api-guide/get).\n\n### Column selection\n\nIf the `columns` array is not specified, all columns are included. For link\nfields, only the ID column of the linked records is included in the response.\n\nIf the `columns` array is specified, only the selected and internal\ncolumns `id` and `xata` are included. The `*` wildcard can be used to\nselect all columns.\n\nFor objects and link fields, if the column name of the object is specified, we\ninclude all of its sub-keys. If only some sub-keys are specified (via dotted\nnotation, e.g. `\"settings.plan\"` ), then only those sub-keys from the object\nare included.\n\nBy the way of example, assuming two tables like this:\n\n```json {\"truncate\": true}\n{\n \"tables\": [\n {\n \"name\": \"teams\",\n \"columns\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"users\"\n }\n },\n {\n \"name\": \"foundedDate\",\n \"type\": \"datetime\"\n },\n ]\n },\n {\n \"name\": \"users\",\n \"columns\": [\n {\n \"name\": \"email\",\n \"type\": \"email\"\n },\n {\n \"name\": \"full_name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"address\",\n \"type\": \"object\",\n \"columns\": [\n {\n \"name\": \"street\",\n \"type\": \"string\"\n },\n {\n \"name\": \"number\",\n \"type\": \"int\"\n },\n {\n \"name\": \"zipcode\",\n \"type\": \"int\"\n }\n ]\n },\n {\n \"name\": \"team\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"teams\"\n }\n }\n ]\n }\n ]\n}\n```\n\nA query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.*\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n }\n}\n```\n\nwhile a query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.street\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\"\n }\n}\n```\n\nIf you want to return all columns from the main table and selected columns from the linked table, you can do it like this:\n\n```json\n{\n \"columns\": [\"*\", \"team.name\"]\n}\n```\n\nThe `\"*\"` in the above means all columns, including columns of objects. This returns data like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\"\n }\n}\n```\n\nIf you want all columns of the linked table, you can do:\n\n```json\n{\n \"columns\": [\"*\", \"team.*\"]\n}\n```\n\nThis returns, for example:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\",\n \"code\": \"A1\",\n \"foundedDate\": \"2020-03-04T10:43:54.32Z\"\n }\n}\n```\n\n### Filtering\n\nThere are two types of operators:\n\n- Operators that work on a single column: `$is`, `$contains`, `$pattern`,\n `$includes`, `$gt`, etc.\n- Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,\n `$none`, etc.\n\nAll operators start with an `$` to differentiate them from column names\n(which are not allowed to start with a dollar sign).\n\n#### Exact matching and control operators\n\nFilter by one column:\n\n```json\n{\n \"filter\": {\n \"\": \"value\"\n }\n}\n```\n\nThis is equivalent to using the `$is` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$is\": \"value\"\n }\n }\n}\n```\n\nFor example:\n\n```json\n{\n \"filter\": {\n \"name\": \"r2\"\n }\n}\n```\n\nOr:\n\n```json\n{\n \"filter\": {\n \"name\": {\n \"$is\": \"r2\"\n }\n }\n}\n```\n\nFor objects, both dots and nested versions work:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": \"free\"\n }\n}\n```\n\n```json\n{\n \"filter\": {\n \"settings\": {\n \"plan\": \"free\"\n }\n }\n}\n```\n\nIf you want to OR together multiple values, you can use the `$any` operator with an array of values:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": { \"$any\": [\"free\", \"paid\"] }\n }\n}\n```\n\nIf you specify multiple columns in the same filter, they are logically AND'ed together:\n\n```json\n{\n \"filter\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n}\n```\n\nThe above matches if both conditions are met.\n\nTo be more explicit about it, you can use `$all` or `$any`:\n\n```json\n{\n \"filter\": {\n \"$any\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n }\n}\n```\n\nThe `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:\n\n```json\n{\n \"filter\": {\n \"$any\": [\n {\n \"name\": \"r1\"\n },\n {\n \"name\": \"r2\"\n }\n ]\n }\n}\n```\n\nYou can check for a value being not-null with `$exists`:\n\n```json\n{\n \"filter\": {\n \"$exists\": \"settings\"\n }\n}\n```\n\nThis can be combined with `$all` or `$any` :\n\n```json\n{\n \"filter\": {\n \"$all\": [\n {\n \"$exists\": \"settings\"\n },\n {\n \"$exists\": \"name\"\n }\n ]\n }\n}\n```\n\nOr you can use the inverse operator `$notExists`:\n\n```json\n{\n \"filter\": {\n \"$notExists\": \"settings\"\n }\n}\n```\n\n#### Partial match\n\n`$contains` is the simplest operator for partial matching. Note that `$contains` operator can\ncause performance issues at scale, because indices cannot be used.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$contains\": \"value\"\n }\n }\n}\n```\n\nWildcards are supported via the `$pattern` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$pattern\": \"v*alu?\"\n }\n }\n}\n```\n\nThe `$pattern` operator accepts two wildcard characters:\n* `*` matches zero or more characters\n* `?` matches exactly one character\n\nIf you want to match a string that contains a wildcard character, you can escape them using a backslash (`\\`). You can escape a backslash by usign another backslash.\n\nYou can also use the `$endsWith` and `$startsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$endsWith\": \".gz\"\n },\n \"\": {\n \"$startsWith\": \"tmp-\"\n }\n }\n}\n```\n\n#### Numeric or datetime ranges\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$ge\": 0,\n \"$lt\": 100\n }\n }\n}\n```\nDate ranges support the same operators, with the date using the format defined in\n[RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):\n```json\n{\n \"filter\": {\n \"\": {\n \"$gt\": \"2019-10-12T07:20:50.52Z\",\n \"$lt\": \"2021-10-12T07:20:50.52Z\"\n }\n }\n}\n```\nThe supported operators are `$gt`, `$lt`, `$ge`, `$le`.\n\n#### Negations\n\nA general `$not` operator can inverse any operation.\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nNote: in the above the two condition are AND together, so this does (NOT ( ...\nAND ...))\n\nOr more complex:\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"$any\": [\n {\n \"\": \"value1\"\n },\n {\n \"$all\": [\n {\n \"\": \"value2\"\n },\n {\n \"\": \"value3\"\n }\n ]\n }\n ]\n }\n }\n}\n```\n\nThe `$not: { $any: {}}` can be shorted using the `$none` operator:\n\n```json\n{\n \"filter\": {\n \"$none\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nIn addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$isNot\": \"2019-10-12T07:20:50.52Z\"\n }\n }\n}\n```\n\n#### Working with arrays\n\nTo test that an array contains a value, use `$includesAny`.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includesAny\": \"value\"\n }\n }\n}\n```\n\n##### `includesAny`\n\nThe `$includesAny` operator accepts a custom predicate that will check if\nany value in the array column matches the predicate. The `$includes` operator is a\nsynonym for the `$includesAny` operator.\n\nFor example a complex predicate can include\nthe `$all` , `$contains` and `$endsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includes\": {\n \"$all\": [\n { \"$contains\": \"label\" },\n { \"$not\": { \"$endsWith\": \"-debug\" } }\n ]\n }\n }\n }\n}\n```\n\n##### `includesNone`\n\nThe `$includesNone` operator succeeds if no array item matches the\npredicate.\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesNone\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\nThe above matches if none of the array values contain the string \"label\".\n\n##### `includesAll`\n\nThe `$includesAll` operator succeeds if all array items match the\npredicate.\n\nHere is an example of using the `$includesAll` operator:\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesAll\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\n\nThe above matches if all array values contain the string \"label\".\n\n### Sorting\n\nSorting by one element:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"asc\"\n }\n}\n```\n\nor descendently:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"desc\"\n }\n}\n```\n\nSorting by multiple fields:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"index\": \"desc\"\n },\n {\n \"createdAt\": \"desc\"\n }\n ]\n}\n```\n\nIt is also possible to sort results randomly:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"*\": \"random\"\n }\n}\n```\n\nNote that a random sort does not apply to a specific column, hence the special column name `\"*\"`.\n\nA random sort can be combined with an ascending or descending sort on a specific column:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"name\": \"desc\"\n },\n {\n \"*\": \"random\"\n }\n ]\n}\n```\n\nThis will sort on the `name` column, breaking ties randomly.\n\n### Pagination\n\nWe offer cursor pagination and offset pagination. The cursor pagination method can be used for sequential scrolling with unrestricted depth. The offset pagination can be used to skip pages and is limited to 1000 records.\n\nExample of cursor pagination:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"after\":\"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\nIn the above example, the value of the `page.after` parameter is the cursor returned by the previous query. A sample response is shown below:\n\n```json\n{\n \"meta\": {\n \"page\": {\n \"cursor\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\",\n \"more\": true\n }\n },\n \"records\": [...]\n}\n```\n\nThe `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:\n\n- `after`: Return the next page 'after' the current cursor\n- `before`: Return the previous page 'before' the current cursor.\n- `start`: Resets the given cursor position to the beginning of the query result set. \nWill return the first N records from the query result, where N is the `page.size` parameter. \n- `end`: Resets the give cursor position to the end for the query result set. \nReturns the last N records from the query result, where N is the `page.size` parameter.\n\nThe request will fail if an invalid cursor value is given to `page.before`,\n`page.after`, `page.start` , or `page.end`. No other cursor setting can be\nused if `page.start` or `page.end` is set in a query.\n\nIf both `page.before` and `page.after` parameters are present we treat the\nrequest as a range query. The range query will return all entries after\n`page.after`, but before `page.before`, up to `page.size` or the maximum\npage size. This query requires both cursors to use the same filters and sort\nsettings, plus we require `page.after < page.before`. The range query returns\na new cursor. If the range encompass multiple pages the next page in the range\ncan be queried by update `page.after` to the returned cursor while keeping the\n`page.before` cursor from the first range query.\n\nThe `filter` , `columns`, `sort` , and `page.size` configuration will be\nencoded with the cursor. The pagination request will be invalid if\n`filter` or `sort` is set. The columns returned and page size can be changed\nanytime by passing the `columns` or `page.size` settings to the next query.\n\nIn the following example of size + offset pagination we retrieve the third page of up to 100 results:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 100,\n \"offset\": 200\n }\n}\n```\n\nThe `page.size` parameter represents the maximum number of records returned by this query. It has a default value of 20 and a maximum value of 200.\nThe `page.offset` parameter represents the number of matching records to skip. It has a default value of 0 and a maximum value of 800.\n\nCursor pagination also works in combination with offset pagination. For example, starting from a specific cursor position, using a page size of 200 and an offset of 800, you can skip up to 5 pages of 200 records forwards or backwards from the cursor's position:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 200,\n \"offset\": 800,\n \"after\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\n**Special cursors:**\n\n- `page.after=end`: Result points past the last entry. The list of records\n returned is empty, but `page.meta.cursor` will include a cursor that can be\n used to \"tail\" the table from the end waiting for new data to be inserted.\n- `page.before=end`: This cursor returns the last page.\n- `page.start=$cursor`: Start at the beginning of the result set of the $cursor query. This is equivalent to querying the\n first page without a cursor but applying `filter` and `sort` . Yet the `page.start`\n cursor can be convenient at times as user code does not need to remember the\n filter, sort, columns or page size configuration. All these information are\n read from the cursor.\n- `page.end=$cursor`: Move to the end of the result set of the $cursor query. This is equivalent to querying the\n last page with `page.before=end`, `filter`, and `sort` . Yet the\n `page.end` cursor can be more convenient at times as user code does not\n need to remember the filter, sort, columns or page size configuration. All\n these information are read from the cursor.\n\nWhen using special cursors like `page.after=\"end\"` or `page.before=\"end\"`, we\nstill allow `filter` and `sort` to be set.\n\nExample of getting the last page:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 10,\n \"before\": \"end\"\n }\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"sort":{"$ref":"#/components/schemas/SortExpression"},"page":{"$ref":"#/components/schemas/PageConfig"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]}}}}}},"responses":{"200":{"$ref":"#/components/responses/QueryResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/search":{"summary":"Search Database","description":"This endpoint performs full text search across an entire database branch. You can filter down to particular\ntable by using the `tables` parameter. The `tables` parameter accepts a mixed array of strings and objects. Using a string (the table name) selects the full table. Using an object allows one to specify a filter as well. The supported filters are the same as documented for the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"searchBranch","summary":"Free text search","description":"Run a free text search operation across the database branch.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"tables":{"description":"An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table.","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"table":{"description":"The name of the table.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}},"additionalProperties":false,"required":["table"]}]}},"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"tables":["users",{"table":"articles","filter":{"author":"Abigail"}}],"query":"after a long day"},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/search":{"summary":"Search Table","description":"This endpoint performs full text search in a particular table.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"searchTable","summary":"Free text search in a table","description":"Run a free text search operation in a particular table.\n\nThe endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"query":"after a long day","filter":{"firstName":"Abigail"}},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/vectorSearch":{"summary":"Vector similarity search","description":"This endpoint can be used to perform vector-based similarity searches.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"vectorSearchTable","summary":"Vector similarity search in a table","description":"This endpoint can be used to perform vector-based similarity searches in a table. \nIt can be used for implementing semantic search and product recommendation. To use this\nendpoint, you need a column of type vector. The input vector must have the same\ndimension as the vector column.\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"queryVector":{"description":"The vector to search for similarities. Must have the same dimension as\nthe vector column used.\n","type":"array","items":{"type":"number"}},"column":{"description":"The vector column in which to search. It must be of type `vector`.","type":"string"},"similarityFunction":{"description":"The function used to measure the distance between two points. Can be one of:\n`cosineSimilarity`, `l1`, `l2`. The default is `cosineSimilarity`.\n","type":"string","default":"cosineSimilarity"},"size":{"description":"Number of results to return.","type":"integer","default":10,"maximum":100,"minimum":1},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["queryVector","column"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask":{"summary":"Ask data in your table a question","description":"Ask your table a question and have Xata answer.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"askTable","summary":"Ask your table a question","description":"Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"question":{"description":"The question you'd like to ask.","type":"string","minLength":3},"searchType":{"description":"The type of search to use. If set to `keyword` (the default), the search can be configured by passing\na `search` object with the following fields. For more details about each, see the Search endpoint documentation.\nAll fields are optional.\n * fuzziness - typo tolerance\n * target - columns to search into, and weights.\n * prefix - prefix search type.\n * filter - pre-filter before searching.\n * boosters - control relevancy.\nIf set to `vector`, a `vectorSearch` object must be passed, with the following parameters. For more details, see the Vector\nSearch endpoint documentation. The `column` and `contentColumn` parameters are required.\n * column - the vector column containing the embeddings.\n * contentColumn - the column that contains the text from which the embeddings where computed.\n * filter - pre-filter before searching.\n","type":"string","default":"keyword","enum":["keyword","vector"]},"search":{"type":"object","additionalProperties":false,"properties":{"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}}},"vectorSearch":{"type":"object","additionalProperties":false,"properties":{"column":{"description":"The column to use for vector search. It must be of type `vector`.","type":"string"},"contentColumn":{"description":"The column containing the text for vector search. Must be of type `text`.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"required":["column","contentColumn"]},"rules":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"required":["question"]}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","sessionId"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"records":{"description":"The IDs of the records that were used as context.","type":"array","items":{"type":"string"}},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","records","sessionId"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"description":"Unexpected Error"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask/{session_id}":{"summary":"Ask follow-up questions of your data","description":"Continue a conversation with your data. This endpoint lets you continue a question started via the /ask endpoint in order to dive deeper into your context or ask clarifying questions.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ChatSessionIDParam"}],"post":{"operationId":"askTableSession","summary":"Continue a conversation with your data","description":"Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"The question you'd like to ask.","type":"string","minLength":3}},"additionalProperties":false}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/summarize":{"summary":"Summarize Table Data","description":"This endpoint summarizes from your database. It comes with a range\nof functions to help perform calculations on the data you have stored\nin your tables\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"summarizeTable","summary":"Summarize table","description":"This endpoint allows you to (optionally) define groups, and then to run\ncalculations on the values in each group. This is most helpful when \nyou'd like to understand the data you have in your database.\n\nA group is a combination of unique values. If you create a group for \n`sold_by`, `product_name`, we will return one row for every combination \nof `sold_by` and `product_name` you have in your database. When you \nwant to calculate statistics, you define these groups and ask Xata to \ncalculate data on each group.\n\n**Some questions you can ask of your data:**\n\nHow many records do I have in this table?\n- Set `columns: []` as we we want data from the entire table, so we ask\nfor no groups.\n- Set `summaries: {\"total\": {\"count\": \"*\"}}` in order to see the count \nof all records. We use `count: *` here we'd like to know the total \namount of rows; ignoring whether they are `null` or not.\n\nWhat are the top total sales for each product in July 2022 and sold \nmore than 10 units?\n- Set `filter: {soldAt: {\n \"$ge\": \"2022-07-01T00:00:00.000Z\", \n \"$lt\": \"2022-08-01T00:00:00.000Z\"}\n}` \nin order to limit the result set to sales recorded in July 2022.\n- Set `columns: [product_name]` as we'd like to run calculations on \neach unique product name in our table. Setting `columns` like this will \nproduce one row per unique product name.\n- Set `summaries: {\"total_sales\": {\"count\": \"product_name\"}}` as we'd \nlike to create a field called \"total_sales\" for each group. This field \nwill count all rows in each group with non-null product names.\n- Set `sort: [{\"total_sales\": \"desc\"}]` in order to bring the rows with \nthe highest total_sales field to the top.\n- Set `summariesFilter: {\"total_sales\": {\"$ge\": 10}}` to only send back data \nwith greater than or equal to 10 units.\n\n`columns`: tells Xata how to create each group. If you add `product_id` \nwe will create a new group for every unique `product_id`.\n\n`summaries`: tells Xata which calculations to run on each group. Xata\ncurrently supports count, min, max, sum, average.\n\n`sort`: tells Xata in which order you'd like to see results. You may \nsort by fields specified in `columns` as well as the summary names \ndefined in `summaries`.\n\nnote: Sorting on summarized values can be slower on very large tables; \nthis will impact your rate limit significantly more than other queries. \nTry use `filter` to reduce the amount of data being processed in order \nto reduce impact on your limits.\n\n`summariesFilter`: tells Xata how to filter the results of a summary. \nIt has the same syntax as `filter`, however, by using `summariesFilter`\nyou may also filter on the results of a query.\n\nnote: This is a much slower to use than `filter`. We recommend using \n`filter` wherever possible and `summariesFilter` when it's not \npossible to use `filter`.\n\n`page.size`: tells Xata how many records to return. If unspecified, Xata\nwill return the default size.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"columns":{"$ref":"#/components/schemas/ColumnsProjection"},"summaries":{"$ref":"#/components/schemas/SummaryExpressionList"},"sort":{"$ref":"#/components/schemas/SortExpression"},"summariesFilter":{"$ref":"#/components/schemas/FilterExpression"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]},"page":{"type":"object","properties":{"size":{"description":"The number of records returned by summarize. If the amount of data you have exceeds this, or you have\nmore complex reporting requirements, we recommend that you use the aggregate endpoint instead.\n","type":"integer","default":20,"maximum":1000,"minimum":1}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/SummarizeResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/aggregate":{"summary":"Aggregate Table","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"aggregateTable","summary":"Run aggregations over a table","description":"This endpoint allows you to run aggregations (analytics) on the data from one table.\nWhile the summary endpoint is served from a transactional store and the results are strongly \nconsistent, the aggregate endpoint is served from our columnar store and the results are \nonly eventually consistent. On the other hand, the aggregate endpoint uses a \nstore that is more appropiate for analytics, makes use of approximative algorithms \n(e.g for cardinality), and is generally faster and can do more complex aggregations.\n\nFor usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate).\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}}}}}},"responses":{"200":{"$ref":"#/components/responses/AggResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/sql":{"summary":"Query database using SQL","description":"This endpoint performs the SQL query across the entire database branch. Set your SQL query in the parameter `query`.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"sqlQuery","summary":"SQL query","description":"Run an SQL query across the database branch.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"statement":{"description":"The SQL statement.","type":"string","minLength":1},"params":{"description":"The query parameter list.","type":"array","nullable":true},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]}},"example":{"statement":"select * from users;"},"required":["statement"]}}}},"responses":{"200":{"$ref":"#/components/responses/SQLResponse"},"201":{"$ref":"#/components/responses/SQLResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"tags":["SQL"]}}},"components":{"parameters":{"APIKeyNameParam":{"name":"key_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/APIKeyName"},"description":"API Key name"},"BranchNameParam":{"name":"branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BranchName"},"description":"The Database Name"},"ChatSessionIDParam":{"name":"session_id","in":"path","required":true,"schema":{"type":"string","maxLength":36,"minLength":36,"title":"SessionID"}},"ColumnNameParam":{"name":"column_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ColumnName"},"description":"The Column name"},"ColumnsProjectionParam":{"name":"columns","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/ColumnsProjection"},"description":"Column filters"},"DBBranchNameParam":{"name":"db_branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBBranchName"},"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n"},"DBNameParam":{"name":"db_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBName"},"description":"The Database Name"},"FileAccessIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileAccessID"},"description":"The File Access Identifier"},"FileItemIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileItemID"},"description":"The File Identifier"},"FileSignatureParam":{"name":"verify","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/FileSignature"},"description":"File access signature"},"InviteIDParam":{"name":"invite_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/InviteID"},"description":"Invite identifier"},"InviteKeyParam":{"name":"invite_key","in":"path","required":true,"schema":{"$ref":"#/components/schemas/InviteKey"},"description":"Invite Key (secret) for the invited user"},"OAuthAccessTokenParam":{"name":"token","in":"path","required":true,"schema":{"$ref":"#/components/schemas/AccessToken"}},"OAuthClientIDParam":{"name":"client_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/OAuthClientID"}},"RecordIDParam":{"name":"record_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/RecordID"},"description":"The Record name"},"TableNameParam":{"name":"table_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/TableName"},"description":"The Table name"},"UserIDParam":{"name":"user_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserID"},"description":"UserID"},"WorkspaceIDParam":{"name":"workspace_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceID"},"description":"Workspace ID"}},"schemas":{"APIKeyName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~]*","title":"APIKeyName"},"AccessToken":{"type":"string","title":"AccessToken"},"AggExpression":{"description":"The description of a single aggregation operation. It is an object with only one key-value pair.\nThe key represents the aggregation type, while the value is an object with the configuration of\nthe aggregation.\n","oneOf":[{"type":"object","additionalProperties":false,"properties":{"count":{"$ref":"#/components/schemas/CountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"sum":{"$ref":"#/components/schemas/SumAgg"}}},{"type":"object","additionalProperties":false,"properties":{"max":{"$ref":"#/components/schemas/MaxAgg"}}},{"type":"object","additionalProperties":false,"properties":{"min":{"$ref":"#/components/schemas/MinAgg"}}},{"type":"object","additionalProperties":false,"properties":{"average":{"$ref":"#/components/schemas/AverageAgg"}}},{"type":"object","additionalProperties":false,"properties":{"percentiles":{"$ref":"#/components/schemas/PercentilesAgg"}}},{"type":"object","additionalProperties":false,"properties":{"uniqueCount":{"$ref":"#/components/schemas/UniqueCountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"dateHistogram":{"$ref":"#/components/schemas/DateHistogramAgg"}}},{"type":"object","additionalProperties":false,"properties":{"topValues":{"$ref":"#/components/schemas/TopValuesAgg"}}},{"type":"object","additionalProperties":false,"properties":{"numericHistogram":{"$ref":"#/components/schemas/NumericHistogramAgg"}}}]},"AggExpressionMap":{"description":"The description of the aggregations you wish to receive.\n","type":"object","example":{"totalCount":{"count":"*"},"dailyActiveUsers":{"dateHistogram":{"column":"date","interval":"1d","aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}}}}},"additionalProperties":{"$ref":"#/components/schemas/AggExpression"}},"AggResponse":{"oneOf":[{"type":"number","nullable":true},{"type":"object","properties":{"values":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"$key":{"oneOf":[{"type":"string"},{"type":"number"}]},"$count":{"type":"integer"}},"additionalProperties":{"$ref":"#/components/schemas/AggResponse"},"required":["$key","$count"]}},{"type":"object","additionalProperties":{"type":"number"}}]}},"required":["values"]}]},"AuthorizationCodeRequest":{"type":"object","properties":{"state":{"type":"string"},"redirectUri":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"}},"clientId":{"type":"string"},"responseType":{"$ref":"#/components/schemas/OAuthResponseType"}},"required":["clientId","responseType"]},"AuthorizationCodeResponse":{"type":"object","properties":{"state":{"type":"string"},"redirectUri":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"}},"clientId":{"type":"string"},"expires":{"type":"string","format":"date-time","readOnly":true},"code":{"type":"string","readOnly":true}}},"AverageAgg":{"description":"The average of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"BoosterExpression":{"description":"Booster Expression","oneOf":[{"type":"object","additionalProperties":false,"properties":{"valueBooster":{"$ref":"#/components/schemas/ValueBooster"}}},{"type":"object","additionalProperties":false,"properties":{"numericBooster":{"$ref":"#/components/schemas/NumericBooster"}}},{"type":"object","additionalProperties":false,"properties":{"dateBooster":{"$ref":"#/components/schemas/DateBooster"}}}]},"Branch":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"additionalProperties":false,"required":["name","createdAt"]},"BranchMetadata":{"description":"","type":"object","properties":{"repository":{"type":"string","minLength":1},"branch":{"$ref":"#/components/schemas/BranchName"},"stage":{"type":"string","minLength":1},"labels":{"type":"array","items":{"type":"string"}}},"example":{"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}},"BranchMigration":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"},"lastGitRevision":{"type":"string"},"localChanges":{"type":"boolean"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"newTables":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Table"}},"removedTables":{"type":"array","items":{"type":"string"}},"tableMigrations":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TableMigration"}},"newTableOrder":{"type":"array","items":{"type":"string"}},"renamedTables":{"type":"array","items":{"$ref":"#/components/schemas/TableRename"}}},"required":["status","localChanges","newTableOrder"],"title":"Migration"},"BranchName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"BranchName"},"BranchOp":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"modifiedAt":{"$ref":"#/components/schemas/DateTime"},"migration":{"$ref":"#/components/schemas/Commit"}},"required":["id","status","createdAt"]},"BranchWithCopyID":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"copyID":{"type":"string"}},"required":["branchName","dbBranchID","copyID"],"title":"BranchWithCopyID"},"Column":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["bool","int","float","string","text","email","multiple","link","object","datetime","vector","file[]","file","json"]},"link":{"$ref":"#/components/schemas/ColumnLink"},"vector":{"$ref":"#/components/schemas/ColumnVector"},"file":{"$ref":"#/components/schemas/ColumnFile"},"file[]":{"$ref":"#/components/schemas/ColumnFile"},"notNull":{"type":"boolean"},"defaultValue":{"type":"string"},"unique":{"type":"boolean"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["name","type"],"title":"Column"},"ColumnFile":{"type":"object","properties":{"defaultPublicAccess":{"type":"boolean"}},"additionalProperties":false},"ColumnLink":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"ColumnMigration":{"type":"object","properties":{"old":{"$ref":"#/components/schemas/Column"},"new":{"$ref":"#/components/schemas/Column"}},"required":["old","new"],"title":"ColumnMigration"},"ColumnName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~\\.]+","title":"ColumnName"},"ColumnOpAdd":{"type":"object","properties":{"table":{"type":"string"},"column":{"$ref":"#/components/schemas/Column"}},"required":["table","column"]},"ColumnOpRemove":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"]},"ColumnOpRename":{"type":"object","properties":{"table":{"type":"string"},"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["table","oldName","newName"]},"ColumnVector":{"type":"object","properties":{"dimension":{"type":"integer","maximum":10000,"minimum":2}},"additionalProperties":false,"required":["dimension"]},"ColumnsProjection":{"type":"array","items":{"type":"string"},"example":["name","email","created_at"]},"Commit":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"mergeParentID":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","createdAt","checksum"]},"CountAgg":{"description":"Count the number of records with an optional filter.","oneOf":[{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false},{"type":"string","description":"Use this form to count all records without any filter.","enum":["*"]}]},"DBBranch":{"type":"object","properties":{"databaseName":{"$ref":"#/components/schemas/DBName"},"branchName":{"$ref":"#/components/schemas/BranchName"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"version":{"type":"number"},"lastMigrationID":{"type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"},"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"schema":{"$ref":"#/components/schemas/Schema"}},"required":["databaseName","branchName","createdAt","id","version","lastMigrationID","schema"],"title":"DBBranch"},"DBBranchName":{"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n","type":"string","maxLength":511,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+:[a-zA-Z0-9_\\-~]+","title":"Tuple of database and branch name"},"DBName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"DBName"},"DataInputRecord":{"description":"Xata input record","type":"object","additionalProperties":{"nullable":true,"anyOf":[{"$ref":"#/components/schemas/RecordID"},{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"},{"$ref":"#/components/schemas/InputFileArray"},{"$ref":"#/components/schemas/InputFile"}]}},"DatabaseGithubSettings":{"description":"Github repository settings for this database (optional)","type":"object","properties":{"owner":{"description":"Repository owner (user or organization)","type":"string"},"repo":{"description":"Repository name","type":"string"}},"additionalProperties":false,"required":["owner","repo"]},"DatabaseMetadata":{"description":"Metadata of databases","type":"object","properties":{"name":{"description":"The machine-readable name of a database","type":"string"},"region":{"description":"Region where this database is hosted","type":"string"},"createdAt":{"description":"The time this database was created","$ref":"#/components/schemas/DateTime"},"ui":{"description":"Metadata about the database for display in Xata user interfaces","type":"object","properties":{"color":{"description":"The user-selected color for this database across interfaces","type":"string"}}}},"additionalProperties":false,"required":["name","createdAt","region"]},"DateBooster":{"description":"Boost records based on the value of a datetime column. It is configured via \"origin\", \"scale\", and \"decay\". The further away from the \"origin\",\nthe more the score is decayed. The decay function uses an exponential function. For example if origin is \"now\", and scale is 10 days and decay is 0.5, it\nshould be interpreted as: a record with a date 10 days before/after origin will be boosted 2 times less than a record with the date at origin.\nThe result of the exponential function is a boost between 0 and 1. The \"factor\" allows you to control how impactful this boost is, by multiplying it with a given value.\n","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"origin":{"description":"The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time.\nIf it is not specified, the current date and time is used.\n","type":"string"},"scale":{"description":"The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"decay":{"description":"The decay factor to expect at \"scale\" distance from the \"origin\".","type":"number"},"factor":{"description":"The factor with which to multiply the added boost.","type":"number","minimum":0},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","scale","decay"]},"DateHistogramAgg":{"description":"Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.\n","type":"object","properties":{"column":{"description":"The column to use for bucketing. Must be of type datetime.","type":"string"},"interval":{"description":"The fixed interval to use when bucketing. \nIt is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"calendarInterval":{"description":"The calendar-aware interval to use when bucketing. Possible values are: `minute`,\n`hour`, `day`, `week`, `month`, `quarter`, `year`.\n","type":"string","enum":["minute","hour","day","week","month","quarter","year"]},"timezone":{"description":"The timezone to use for bucketing. By default, UTC is assumed.\nThe accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or\n`-08:00`.\n","type":"string","pattern":"^[+-][01]\\d:[0-5]\\d$"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column"]},"DateTime":{"type":"string","format":"date-time","title":"DateTime"},"FileAccessID":{"description":"File identifier in access URLs","type":"string","maxLength":296,"minLength":88,"pattern":"[a-v0-9=]+","title":"FileID"},"FileItemID":{"description":"Unique file identifier","type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"FileID"},"FileName":{"description":"File name","type":"string","maxLength":1024,"minLength":0,"pattern":"[0-9a-zA-Z!\\-_\\.\\*'\\(\\)]*"},"FileResponse":{"description":"File metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"size":{"type":"integer","format":"int64"},"version":{"type":"integer","format":"int64"},"attributes":{"type":"object"}},"required":["name","mediaType","size","version"]},"FileSignature":{"description":"File signature","type":"string"},"FilterColumn":{"anyOf":[{"$ref":"#/components/schemas/FilterColumnIncludes"},{"$ref":"#/components/schemas/FilterPredicate"},{"$ref":"#/components/schemas/FilterList"}]},"FilterColumnIncludes":{"type":"object","properties":{"$includes":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAny":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAll":{"$ref":"#/components/schemas/FilterPredicate"},"$includesNone":{"$ref":"#/components/schemas/FilterPredicate"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterExpression":{"type":"object","properties":{"$exists":{"type":"string"},"$existsNot":{"type":"string"},"$any":{"$ref":"#/components/schemas/FilterList"},"$all":{"$ref":"#/components/schemas/FilterList"},"$none":{"$ref":"#/components/schemas/FilterList"},"$not":{"$ref":"#/components/schemas/FilterList"}},"additionalProperties":{"$ref":"#/components/schemas/FilterColumn"},"minProperties":1},"FilterList":{"oneOf":[{"$ref":"#/components/schemas/FilterExpression"},{"type":"array","items":{"$ref":"#/components/schemas/FilterExpression"}}]},"FilterPredicate":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"},"minLength":1},{"$ref":"#/components/schemas/FilterPredicateOp"},{"$ref":"#/components/schemas/FilterPredicateRangeOp"}]},"FilterPredicateOp":{"type":"object","properties":{"$any":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$all":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$none":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$not":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$is":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$isNot":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"},"$contains":{"type":"string"},"$iContains":{"type":"string"},"$startsWith":{"type":"string"},"$endsWith":{"type":"string"},"$pattern":{"type":"string"},"$iPattern":{"type":"string"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterPredicateRangeOp":{"type":"object","properties":{"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"}},"additionalProperties":false,"maxProperties":2,"minProperties":2},"FilterRangeValue":{"oneOf":[{"type":"number"},{"type":"string"}]},"FilterValue":{"oneOf":[{"type":"number"},{"type":"string"},{"type":"boolean"}]},"FuzzinessExpression":{"description":"Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein\ndistance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single\ncharacter typos per word are tolerated by search. You can set it to 0 to remove the typo tolerance or set it to 2\nto allow two typos in a word.\n","type":"integer","default":1,"maximum":2,"minimum":0},"HighlightExpression":{"type":"object","properties":{"enabled":{"description":"Set to `false` to disable highlighting. By default it is `true`.\n","type":"boolean"},"encodeHTML":{"description":"Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.\n","type":"boolean"}},"additionalProperties":false},"InputFile":{"description":"Object representing a file","type":"object","properties":{"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false,"required":["name"]},"InputFileArray":{"description":"Array of file entries","type":"array","items":{"$ref":"#/components/schemas/InputFileEntry"},"maxItems":50},"InputFileEntry":{"description":"Object representing a file in an array","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false},"InviteID":{"type":"string","pattern":"[a-zA-Z0-9]+","title":"InviteID"},"InviteKey":{"type":"string","pattern":"^ik_[a-zA-Z0-9]+","title":"InviteKey"},"ListBranchesResponse":{"type":"object","properties":{"databaseName":{"type":"string"},"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}},"additionalProperties":false,"required":["databaseName","branches"]},"ListDatabasesResponse":{"type":"object","properties":{"databases":{"description":"A list of databases in a Xata workspace","type":"array","items":{"$ref":"#/components/schemas/DatabaseMetadata"}}},"required":["databases"]},"ListGitBranchesResponse":{"type":"object","properties":{"mapping":{"type":"array","items":{"type":"object","properties":{"gitBranch":{"type":"string"},"xataBranch":{"type":"string"}},"required":["gitBranch","xataBranch"]}}},"required":["mapping"]},"ListRegionsResponse":{"type":"object","properties":{"regions":{"description":"A list of regions where databases can be created","type":"array","items":{"$ref":"#/components/schemas/Region"}}},"required":["regions"]},"MaxAgg":{"description":"The max of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the max. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"MediaType":{"description":"Media type","type":"string","maxLength":255,"minLength":3,"pattern":"^\\w+/[-+.\\w]+$"},"MetricsDatapoint":{"type":"object","properties":{"timestamp":{"type":"string"},"value":{"type":"integer"}},"required":["timestamp","value"],"title":"Datapoint"},"MetricsLatency":{"type":"object","properties":{"p50":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"p90":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}}},"title":"MetricsLatency"},"Migration":{"description":"Branch schema migration.","type":"object","properties":{"parentID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"]},"MigrationColumnOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addColumn":{"$ref":"#/components/schemas/ColumnOpAdd"}},"required":["addColumn"]},{"type":"object","additionalProperties":false,"properties":{"removeColumn":{"$ref":"#/components/schemas/ColumnOpRemove"}},"required":["removeColumn"]},{"type":"object","additionalProperties":false,"properties":{"renameColumn":{"$ref":"#/components/schemas/ColumnOpRename"}},"required":["renameColumn"]}]},"MigrationObject":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","checksum"]},"MigrationOp":{"description":"Branch schema migration operations.","oneOf":[{"$ref":"#/components/schemas/MigrationTableOp"},{"$ref":"#/components/schemas/MigrationColumnOp"}]},"MigrationRequest":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/MigrationRequestNumber"},"createdAt":{"description":"Migration request creation timestamp.","$ref":"#/components/schemas/DateTime"},"modifiedAt":{"description":"Last modified timestamp.","$ref":"#/components/schemas/DateTime"},"closedAt":{"description":"Timestamp when the migration request was closed.","$ref":"#/components/schemas/DateTime"},"mergedAt":{"description":"Timestamp when the migration request was merged.","$ref":"#/components/schemas/DateTime"},"status":{"type":"string","enum":["open","closed","merging","merged","failed"]},"title":{"description":"The migration request title.","type":"string"},"body":{"description":"The migration request body with detailed description.","type":"string"},"source":{"description":"Name of the source branch.","type":"string"},"target":{"description":"Name of the target branch.","type":"string"}},"additionalProperties":false},"MigrationRequestNumber":{"description":"The migration request number.","type":"integer","minimum":0},"MigrationStatus":{"type":"string","enum":["completed","pending","failed"]},"MigrationTableOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addTable":{"$ref":"#/components/schemas/TableOpAdd"}},"required":["addTable"]},{"type":"object","additionalProperties":false,"properties":{"removeTable":{"$ref":"#/components/schemas/TableOpRemove"}},"required":["removeTable"]},{"type":"object","additionalProperties":false,"properties":{"renameTable":{"$ref":"#/components/schemas/TableOpRename"}},"required":["renameTable"]}]},"MinAgg":{"description":"The min of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the min. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"NumericBooster":{"description":"Boost records based on the value of a numeric column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"factor":{"description":"The factor with which to multiply the value of the column before adding it to the item score.","type":"number"},"modifier":{"description":"Modifier to be applied to the column value, before being multiplied with the factor. The possible values are:\n - none (default).\n - log: common logarithm (base 10)\n - log1p: add 1 then take the common logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - ln: natural logarithm (base e)\n - ln1p: add 1 then take the natural logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - square: raise the value to the power of two.\n - sqrt: take the square root of the value.\n - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`).\n","type":"string","enum":["none","log","log1p","ln","ln1p","square","sqrt","reciprocal"]},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","factor"]},"NumericHistogramAgg":{"description":"Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.\n","properties":{"column":{"description":"The column to use for bucketing. Must be of numeric type.","type":"string"},"interval":{"description":"The numeric interval to use for bucketing. The resulting buckets will be ranges \nwith this value as size.\n","type":"number","minimum":0},"offset":{"description":"By default the bucket keys start with 0 and then continue in `interval` steps. The bucket\nboundaries can be shifted by using the offset option. For example, if the `interval` is 100,\nbut you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset` \nto 50.\n","type":"number","default":0},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column","interval"]},"OAuthAccessToken":{"type":"object","properties":{"token":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"}},"required":["token","scopes","createdAt","updatedAt","expiresAt","clientId"]},"OAuthClientID":{"type":"string"},"OAuthClientPublicDetails":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"icon":{"type":"string"},"clientId":{"type":"string"}},"required":["clientId"]},"OAuthResponseType":{"type":"string","enum":["code"]},"OAuthScope":{"type":"string","enum":["admin:all"]},"ObjectValue":{"description":"Object column value","type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"}]}},"PageConfig":{"description":"Pagination settings.","type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"start":{"description":"Query the first page from the cursor.","type":"string"},"end":{"description":"Query the last page from the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.","type":"integer","default":20},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0}},"title":"PageConfig"},"PercentilesAgg":{"description":"Calculate given percentiles of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"},"percentiles":{"type":"array","items":{"type":"number"}}},"additionalProperties":false,"required":["column","percentiles"]},"PrefixExpression":{"description":"If the prefix type is set to \"disabled\" (the default), the search only matches full words. If the prefix type is set to \"phrase\", the search will return results that match prefixes of the search phrase.\n","type":"string","enum":["phrase","disabled"]},"ProjectionConfig":{"description":"A structured projection that allows for some configuration.","type":"object","properties":{"name":{"description":"The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations).","type":"string"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"as":{"description":"An alias for the projected field, this is how it will be returned in the response.","type":"string"},"sort":{"$ref":"#/components/schemas/SortExpression"},"limit":{"type":"integer","default":20},"offset":{"type":"integer","default":0}}},"QueryColumnsProjection":{"type":"array","items":{"oneOf":[{"type":"string"},{"$ref":"#/components/schemas/ProjectionConfig"}]}},"Record":{"description":"Xata Table Record","allOf":[{"$ref":"#/components/schemas/RecordMeta"},{"type":"object","additionalProperties":true}],"title":"Record"},"RecordID":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"RecordID"},"RecordMeta":{"description":"Xata Table Record Metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/RecordID"},"xata":{"type":"object","properties":{"version":{"description":"The record's version. Can be used for optimistic concurrency control.","type":"integer"},"createdAt":{"description":"The time when the record was created.","type":"string"},"updatedAt":{"description":"The time when the record was last updated.","type":"string"},"table":{"description":"The record's table name. APIs that return records from multiple tables will set this field accordingly.","type":"string"},"highlight":{"description":"Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.","type":"object","additionalProperties":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":true}]}},"score":{"description":"The record's relevancy score. This is returned by the search APIs.","type":"number"},"warnings":{"description":"Encoding/Decoding errors","type":"array","items":{"type":"string"}}},"required":["version"]}},"required":["id","xata"],"title":"RecordMeta"},"RecordsMetadata":{"description":"Records metadata","type":"object","properties":{"page":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetched","type":"boolean"},"size":{"description":"the number of records returned per page","type":"number"}},"required":["cursor","more","size"]}},"required":["page"]},"Region":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"RevLink":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"],"title":"RevLink"},"Role":{"type":"string","enum":["owner","maintainer"]},"SQLRecord":{"description":"Xata Table SQL Record","allOf":[{"type":"object","additionalProperties":true}],"title":"SQL Record"},"Schema":{"type":"object","properties":{"tables":{"type":"array","items":{"$ref":"#/components/schemas/Table"}},"tablesOrder":{"type":"array","items":{"type":"string"}}},"required":["tables"],"title":"Schema"},"SchemaEditScript":{"type":"object","properties":{"sourceMigrationID":{"type":"string"},"targetMigrationID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"],"title":"SchemaEditScript"},"SearchPageConfig":{"description":"Pagination settings for the search endpoints.","properties":{"size":{"description":"Set page size.","type":"integer","default":25,"maximum":200},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0,"maximum":800}},"title":"SearchPageConfig"},"SortExpression":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}},{"type":"array","items":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}}}],"title":"SortExpression"},"SortOrder":{"type":"string","enum":["asc","desc","random"],"title":"SortOrder"},"StartedFromMetadata":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"migrationID":{"type":"string"}},"required":["branchName","dbBranchID","migrationID"],"title":"StartedFromMetadata"},"SumAgg":{"description":"The sum of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the sum. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"SummaryExpression":{"description":"A summary expression is the description of a single summary operation. It consists of a single\nkey representing the operation, and a value representing the column to be operated on.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n\nWe currently support several aggregation functions. Not all functions can be run on all column\ntypes.\n\n - `count` is used to count the number of records in each group. Use `{\"count\": \"*\"}` to count\n all columns present, otherwise `{\"count\": \"\"}` to count the number of non-null\n values are present at column path.\n\n Count can be used on any column type, and always returns an int.\n\n - `min` calculates the minimum value in each group. `min` is compatible with most types;\n string, multiple, text, email, int, float, and datetime. It returns a value of the same\n type as operated on. This means that `{\"lowest_latency\": {\"min\": \"latency\"}}` where\n `latency` is an int, will always return an int.\n\n - `max` calculates the maximum value in each group. `max` shares the same compatibility as\n `min`.\n\n - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will\n return a value of the same type as requested.\n\n - `average` averages all values in a group. `average` can be run on `int` and `float` types, and\n always returns a float.\n","type":"object","example":{"count":"deleted_at"}},"SummaryExpressionList":{"description":"The description of the summaries you wish to receive. Set each key to be the field name\nyou'd like for the summary. These names must not collide with other columns you've\nrequested from `columns`; including implicit requests like `settings.*`.\n\nThe value for each key needs to be an object. This object should contain one key and one \nvalue only. In this object, the key should be set to the summary function you wish to use\nand the value set to the column name to be summarized.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n","type":"object","example":{"all_users":{"count":"*"},"total_created":{"count":"created_at"},"min_cost":{"min":"cost"},"max_happiness":{"max":"happiness"},"total_revenue":{"sum":"revenue"},"average_speed":{"average":"speed"}},"additionalProperties":{"$ref":"#/components/schemas/SummaryExpression"}},"Table":{"type":"object","properties":{"id":{"type":"string"},"name":{"$ref":"#/components/schemas/TableName"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"revLinks":{"type":"array","items":{"$ref":"#/components/schemas/RevLink"}}},"required":["name","columns"],"title":"Table"},"TableMigration":{"type":"object","properties":{"newColumns":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Column"}},"removedColumns":{"type":"array","items":{"type":"string"}},"modifiedColumns":{"type":"array","items":{"$ref":"#/components/schemas/ColumnMigration"}},"newColumnOrder":{"type":"array","items":{"type":"string"}}},"required":["newColumnOrder"],"title":"TableMigration"},"TableName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"TableName"},"TableOpAdd":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRemove":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRename":{"type":"object","properties":{"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["oldName","newName"]},"TableRename":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1},"oldName":{"type":"string","minLength":1}},"example":{"newName":"newName","oldName":"oldName"},"required":["newName","oldName"]},"TargetExpression":{"description":"The target expression is used to filter the search results by the target columns.\n","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"column":{"description":"The name of the column.","type":"string"},"weight":{"description":"The weight of the column.","type":"number","default":1,"maximum":10,"minimum":1}},"required":["column"],"additionalProperties":false}]}},"TopValuesAgg":{"description":"Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.\nThe top values as ordered by the number of records (`$count`) are returned.\n","properties":{"column":{"description":"The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.","type":"string"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"size":{"description":"The maximum number of unique values to return.\n","type":"integer","default":10,"maximum":1000}},"additionalProperties":false,"required":["column"]},"TransactionDeleteOp":{"description":"A delete operation. The transaction will continue if no record matches the ID by default. To override this behaviour, set failIfMissing to true.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"failIfMissing":{"description":"If true, the transaction will fail when the record doesn't exist.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionError":{"description":"An error message from a failing transaction operation","type":"object","properties":{"index":{"description":"The index of the failing operation","type":"integer"},"message":{"description":"The error message","type":"string"}},"required":["index","message"]},"TransactionFailure":{"description":"An array of errors, with indices, from the transaction.","type":"object","properties":{"id":{"description":"The request ID.","type":"string"},"errors":{"description":"An array of errors from the submitted operations.","type":"array","items":{"$ref":"#/components/schemas/TransactionError"}}},"required":["id","errors"]},"TransactionGetOp":{"description":"Get by id operation.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionInsertOp":{"description":"Insert operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"record":{"description":"The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.\n","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be overwriting. Only valid with an\nexplicit ID is also set in the `record` key.\n","type":"integer"},"createOnly":{"description":"createOnly is used to change how Xata acts when an explicit ID is set in the `record` key. \n\nIf `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata \nwill cancel the transaction. \n\nIf `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no\nconflict, the record is inserted. If there is a conflict, Xata will replace the record.\n","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","record"]},"TransactionOperation":{"description":"A transaction operation","type":"object","oneOf":[{"type":"object","properties":{"insert":{"$ref":"#/components/schemas/TransactionInsertOp"}},"required":["insert"]},{"type":"object","properties":{"update":{"$ref":"#/components/schemas/TransactionUpdateOp"}},"required":["update"]},{"type":"object","properties":{"delete":{"$ref":"#/components/schemas/TransactionDeleteOp"}},"required":["delete"]},{"type":"object","properties":{"get":{"$ref":"#/components/schemas/TransactionGetOp"}},"required":["get"]}]},"TransactionResultColumns":{"description":"Fields to return in the transaction result.","type":"object","additionalProperties":true},"TransactionResultDelete":{"description":"A result from a delete operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["delete"]},"rows":{"description":"The number of deleted rows","type":"integer"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows"]},"TransactionResultGet":{"description":"A result from a get operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["get"]},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation"]},"TransactionResultInsert":{"description":"A result from an insert operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["insert"]},"rows":{"description":"The number of affected rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionResultUpdate":{"description":"A result from an update operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["update"]},"rows":{"description":"The number of updated rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionSuccess":{"description":"An ordered array of results from the submitted operations.","type":"object","properties":{"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/TransactionResultInsert"},{"$ref":"#/components/schemas/TransactionResultUpdate"},{"$ref":"#/components/schemas/TransactionResultDelete"},{"$ref":"#/components/schemas/TransactionResultGet"}]}}},"required":["results"]},"TransactionUpdateOp":{"description":"Update operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"fields":{"description":"The fields of the record you'd like to update","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be updating","type":"integer"},"upsert":{"description":"Xata will insert this record if it cannot be found.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id","fields"]},"UniqueCountAgg":{"description":"Count the number of distinct values in a particular column.","type":"object","properties":{"column":{"description":"The column from where to count the unique values.","type":"string"},"precisionThreshold":{"description":"The threshold under which the unique count is exact. If the number of unique\nvalues in the column is higher than this threshold, the results are approximate.\nMaximum value is 40,000, default value is 3000.\n","type":"integer"}},"additionalProperties":false,"required":["column"]},"User":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullname":{"type":"string"},"image":{"type":"string"}},"required":["fullname","email","image"]},"UserID":{"type":"string","pattern":"[a-zA-Z0-9_-~:]+","title":"UserID"},"UserWithID":{"allOf":[{"$ref":"#/components/schemas/User"},{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UserID"}},"required":["id"]}]},"ValueBooster":{"description":"Boost records with a particular value for a column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"value":{"description":"The exact value to boost.","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"factor":{"description":"The factor with which to multiply the added boost.","type":"number"},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","value","factor"]},"Workspace":{"allOf":[{"$ref":"#/components/schemas/WorkspaceMeta"},{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceID"},"memberCount":{"type":"integer"},"plan":{"type":"string","enum":["free","pro"]}},"required":["id","memberCount","plan"]}]},"WorkspaceID":{"type":"string","pattern":"^([a-zA-Z0-9][a-zA-Z0-9_\\-~]+-)?[a-zA-Z0-9]{6}","title":"WorkspaceID"},"WorkspaceInvite":{"type":"object","properties":{"inviteId":{"$ref":"#/components/schemas/InviteID"},"email":{"type":"string","format":"email"},"expires":{"type":"string","format":"date-time"},"role":{"$ref":"#/components/schemas/Role"}},"required":["inviteId","email","expires","role"]},"WorkspaceMember":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserID"},"fullname":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/Role"}},"required":["userId","email","fullname","role"]},"WorkspaceMembers":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceMember"}},"invites":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceInvite"}}},"required":["members","invites"]},"WorkspaceMeta":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"}},"required":["name"]}},"responses":{"AggResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"aggs":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/AggResponse"}}},"example":{"aggs":{"dailyUniqueUsers":{"values":[{"$count":321,"$key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"$count":202,"$key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}}}}}},"AuthError":{"description":"Authentication Error","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"example":{"message":"invalid API key"},"required":["message"]}}}},"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"BranchMigrationPlan":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"BulkError":{"description":"Response with multiple errors of the bulk execution","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer"}}}}},"required":["errors"]}}}},"BulkInsertResponse":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"recordIDs":{"type":"array","items":{"type":"string"}}},"required":["recordIDs"]},{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}}},"required":["records"]}]}}}},"PutFileResponse":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"QueryResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"meta":{"$ref":"#/components/schemas/RecordsMetadata"}},"required":["records","meta"]}}}},"RateLimitError":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}},"text/event-stream":{"schema":{"type":"string"}}}},"RecordResponse":{"description":"Table Record Reponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"RecordUpdateResponse":{"description":"Record ID and metadata","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Record"},{"type":"object","properties":{"id":{"type":"string"},"xata":{"type":"object","properties":{"version":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["version","createdAt","updatedAt"]}},"required":["id","xata"]}]}}}},"SQLResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/SQLRecord"}},"columns":{"description":"Name of the column and its PostgreSQL type","allOf":[{"type":"object"}]},"total":{"description":"Number of selected columns","type":"integer"},"warning":{"type":"string"}}}}}},"SchemaCompareResponse":{"description":"Schema comparison response.","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/Schema"},"target":{"$ref":"#/components/schemas/Schema"},"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["source","target","edits"]}}}},"SchemaUpdateResponse":{"description":"Schema migration response with ID and migration status.","content":{"application/json":{"schema":{"type":"object","properties":{"migrationID":{"type":"string","minLength":1},"parentMigrationID":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["migrationID","parentMigrationID","status"]},"examples":{"example-1":{"value":{"migrationID":"mig_c7m19ilcefoebpqj12p0","parentMigrationID":"mig_c7m19ilcefoebpqj4312","status":"completed"}}}}}},"SearchResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"warning":{"type":"string"},"totalCount":{"description":"The total count of records matched. It will be accurately returned up to 10000 records.","type":"integer"}},"required":["records","totalCount"]}}}},"ServiceUnavailableError":{"description":"ServiceUnavailable","headers":{"Retry-After":{"schema":{"description":"Number of seconds to wait after retrying the operation","type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SimpleError":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SummarizeResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"summaries":{"type":"array","items":{"type":"object"}}},"required":["summaries"]}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Workspaces","description":"Workspaces management","x-displayName":"Workspaces"},{"name":"Users","description":"Users management","x-displayName":"Users"},{"name":"Invites","description":"Manage user invites.","x-displayName":"Invites"},{"name":"Authentication","description":"Authentication and API Key management.","x-displayName":"Authentication"},{"name":"OAuth","x-displayName":"OAuth"},{"name":"auth_other","x-displayName":"other"},{"name":"Databases","description":"Workspace databases management.","x-displayName":"Databases"},{"name":"xbcontrol_other","x-displayName":"other"},{"name":"Database","description":"Database management.","x-displayName":"Database"},{"name":"Branch","description":"Branch management.","x-displayName":"Branch"},{"name":"Migrations","description":"Branch schema migrations and history.","x-displayName":"Migrations"},{"name":"Table","description":"Table management.","x-displayName":"Table"},{"name":"xbregion_other","x-displayName":"other"},{"name":"Records","description":"Record access API.","x-displayName":"Records"},{"name":"Search and Filter","description":"APIs for searching, querying, filtering, and aggregating records.","x-displayName":"Search and Filter"},{"name":"Files","description":"CRUD API for operating on binary content in file and file[] columns.","x-displayName":"Files"},{"name":"xbcell_other","x-displayName":"other"},{"name":"SQL","description":"SQL service access","x-displayName":"SQL"},{"name":"sql_other","x-displayName":"other"}],"x-tagGroups":[{"name":"auth","tags":["Workspaces","Users","Invites","Authentication","OAuth","auth_other"],"description":"Xata.io Auth API"},{"name":"xbcontrol","tags":["Databases","xbcontrol_other"],"description":"Xata.io Xatabases API"},{"name":"xbregion","tags":["Database","Branch","Migrations","Table","Migration Requests","xbregion_other"],"description":"Xata.io Xatabases API"},{"name":"xbcell","tags":["Records","Search and Filter","Files","xbcell_other"],"description":"Xata.io Xatabases API"},{"name":"sql","tags":["SQL","sql_other"],"description":"Xata.io SQL API"}]} \ No newline at end of file diff --git a/internal/docs/workspace-openapi.json b/internal/docs/workspace-openapi.json index 8e5fe12..c76e154 100644 --- a/internal/docs/workspace-openapi.json +++ b/internal/docs/workspace-openapi.json @@ -1 +1 @@ -{"openapi":"3.0.0","info":{"title":"xata-xb","description":"Xata.io Xatabases API","version":"1.0","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"contact":{"name":"support@xata.io"}},"servers":[{"url":"/","description":""}],"paths":{"/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getBranchList","summary":"List branches","description":"List all available Branches","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}":{"summary":"Database Branch by Name","description":"This path allows interacting with a given database branch, referenced by parameter `db_branch_name`, which is expected in the format `database_name:branch_name`.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchDetails","summary":"Get branch schema and metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DBBranch"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"put":{"operationId":"createBranch","summary":"Create Database branch","parameters":[{"name":"from","in":"query","description":"Name of source branch to branch the new schema from","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"description":"Select the branch to fork from. Defaults to 'main'","type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}}}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"mydatabase","branchName":"mybranch","status":"completed"},"required":["databaseName","branchName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"deleteBranch","summary":"Delete Database branch","description":"Delete the branch in the database and all its resources","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/metadata":{"summary":"Branch Metadata","description":"This path allows interacting with the metadata of a specific database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"put":{"operationId":"updateBranchMetadata","summary":"Update branch metadata","description":"Update the branch metadata","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"get":{"operationId":"getBranchMetadata","summary":"Get Branch Metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/stats":{"summary":"Branch Statistics","description":"This endpoint presents a number of statistics on a given database's branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchStats","summary":"Branch stats","description":"Get branch usage metrics.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"type":"string"},"interval":{"type":"string"},"resolution":{"type":"string"},"numberOfRecords":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"writesOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readsOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readLatency":{"$ref":"#/components/schemas/MetricsLatency"},"writeLatency":{"$ref":"#/components/schemas/MetricsLatency"},"warning":{"type":"string"}},"required":["timestamp","interval","resolution"]}}}},"400":{"$ref":"#/components/responses/SimpleError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/gitBranches":{"summary":"Mapping of git to Xata branches","description":"This path allows managing the mapping between git and Xata branches, which is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git branches to the associated Xata branches.\n","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getGitBranchesMapping","summary":"List git branches mapping","description":"Lists all the git branches in the mapping, and their associated Xata branches.\n\nExample response:\n\n```json\n{\n \"mappings\": [\n {\n \"gitBranch\": \"main\",\n \"xataBranch\": \"main\"\n },\n {\n \"gitBranch\": \"gitBranch1\",\n \"xataBranch\": \"xataBranch1\"\n }\n {\n \"gitBranch\": \"xataBranch2\",\n \"xataBranch\": \"xataBranch2\"\n }\n ]\n}\n```\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"post":{"operationId":"addGitBranchesEntry","summary":"Link a git branch to a Xata branch","description":"Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.\n\nIf the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.\n\nExample request:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches\n{\n \"gitBranch\": \"fix/bug123\",\n \"xataBranch\": \"fix_bug\"\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"gitBranch":{"description":"The name of the Git branch.","type":"string"},"xataBranch":{"description":"The name of the Xata branch.","$ref":"#/components/schemas/BranchName"}},"required":["gitBranch","xataBranch"]}}}},"responses":{"201":{"description":"Operation was successful with warnings","content":{"application/json":{"schema":{"type":"object","properties":{"warning":{"description":"Warning message","type":"string"}},"example":{"warning":"Git branch [fix/bug123] was already present in the mapping and was overwritten."}}}}},"204":{"description":"Operation was successful without warnings"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"removeGitBranchesEntry","summary":"Unlink a git branch to a Xata branch","description":"Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.\n\nExample request:\n\n```json\n// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch to remove from the mapping","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"The git branch was not found in the mapping"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/resolveBranch":{"summary":"Resolve the branch to use","description":"This endpoint is typically used by the Xata SDKs to resolve the correct branch to use in a particular situation. The main input is the git branch.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"resolveBranch","summary":"Resolve a Git Branch to a Xata branch","description":"In order to resolve the database branch, the following algorithm is used:\n* if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned\n* else, if a Xata branch with the exact same name as `gitBranch` exists, return it\n* else, if `fallbackBranch` is provided and a branch with that name exists, return it\n* else, return the default branch of the DB (`main` or the first branch)\n\nExample call:\n\n```json\n// GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg\n```\n\nExample response:\n\n```json\n{\n \"branch\": \"main\",\n \"reason\": {\n \"code\": \"DEFAULT_BRANCH\",\n \"message\": \"Default branch for this database (main)\"\n }\n}\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch","schema":{"type":"string"}},{"name":"fallbackBranch","in":"query","description":"Default branch to fallback to","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branch":{"type":"string"},"reason":{"type":"object","properties":{"code":{"type":"string","enum":["FOUND_IN_MAPPING","BRANCH_EXISTS","FALLBACK_BRANCH","DEFAULT_BRANCH"]},"message":{"type":"string"}},"required":["code","message"]}},"example":{"branch":"main","reason":{"code":"DEFAULT_BRANCH","message":"Default branch for this database (main)"}},"required":["branch","reason"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/migrations":{"summary":"Branch Migrations [deprecated]","description":"This path allows access to migrations on a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchMigrationHistory","summary":"Get branch migration history [deprecated]","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer"},"startFrom":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"migrations":{"type":"array","items":{"$ref":"#/components/schemas/BranchMigration"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/plan":{"summary":"Migration Plan [deprecated]","description":"This endpoint enables creating a migration plan for a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchMigrationPlan","summary":"Compute migration plan [deprecated]","description":"Compute a migration plan from a target schema the branch should be migrated too.","requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Schema"}}}},"responses":{"200":{"$ref":"#/components/responses/BranchMigrationPlan"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/execute":{"summary":"Migration Execution [deprecated]","description":"This endpoint is called in the style of an RPC (Remote Procedure Call) when a migration is to be executed against a specific database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"executeBranchMigrationPlan","summary":"Migrate branch [deprecated]","description":"Apply a migration plan to the branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/history":{"summary":"Query schema history.","description":"Query the branch its schema history.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchSchemaHistory","summary":"Query schema history.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.","type":"integer","default":20}}},"since":{"description":"Report only migrations that have been added since the given Migration ID.","type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetch","type":"boolean"}},"required":["cursor","more"]},"logs":{"type":"array","items":{"$ref":"#/components/schemas/Commit"}}},"required":["meta","logs"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare":{"summary":"Compare branch with custom schema.","description":"Compare the branch schema with a custom provided schema.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"compareBranchWithUserSchema","summary":"Compare branch with user schema.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"$ref":"#/components/schemas/Schema"},"schemaOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"branchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare/{branch_name}":{"summary":"Compare branch schemas.","description":"Compare the schema of any 2 branches.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/BranchNameParam"}],"post":{"operationId":"compareBranchSchemas","summary":"Compare branch schemas.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sourceBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"targetBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/update":{"summary":"Update Branch schema","description":"Update the branch schema with migration operations","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"updateBranchSchema","summary":"Update Branch schema","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Migration"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/preview":{"summary":"Preview branch schema edits.","description":"Preview the resulting branch schema when applying the edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"previewBranchSchemaEdit","summary":"Preview branch schema edits.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"original":{"$ref":"#/components/schemas/Schema"},"updated":{"$ref":"#/components/schemas/Schema"}},"required":["original","updated"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/apply":{"summary":"Update Branch schema with edit script.","description":"Update the branch from schema edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"applyBranchSchemaEdit","summary":"Apply edit script.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["edits"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/push":{"summary":"Push migrations.","description":"Apply a list of migrations to the current branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"pushBranchMigrations","summary":"Push migrations.","description":"The `schema/push` API accepts a list of migrations to be applied to the\ncurrent branch. A list of applicable migrations can be fetched using\nthe `schema/history` API from another branch or database.\n\nThe most recent migration must be part of the list or referenced (via\n`parentID`) by the first migration in the list of migrations to be pushed.\n\nEach migration in the list has an `id`, `parentID`, and `checksum`. The\nchecksum for migrations are generated and verified by xata. The\noperation fails if any migration in the list has an invalid checksum.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"migrations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationObject"}}},"required":["migrations"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/tables/{table_name}":{"summary":"Database Table by Name","description":"This endpoint provides a way to mutate a specific table on a database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"put":{"operationId":"createTable","summary":"Create table","description":"Creates a new table with the given name. Returns 422 if a table with the same name already exists.","responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}/tables/{table_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string"},"tableName":{"type":"string","minLength":1},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"branchName":"mydb_main","tableName":"mytable","status":"completed"},"required":["branchName","tableName","status"]}}}},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteTable","summary":"Delete table","description":"Deletes the table with the given name.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"Not Found"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateTable","summary":"Update table","description":"Update table. Currently there is only one update operation supported: renaming the table by providing a new name.\n\nIn the example below, we rename a table from “users” to “people”:\n\n```json\n// PATCH /db/test:main/tables/users\n\n{\n \"name\": \"people\"\n}\n```","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/schema":{"summary":"Table Schema","description":"This endpoint enables reading or updating the schema of a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableSchema","summary":"Get table schema","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"put":{"operationId":"setTableSchema","summary":"Update table schema","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns":{"summary":"Table Columns","description":"This endpoint allows working with a table's columns.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableColumns","summary":"List table columns","description":"Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their\nfull dot-separated path (flattened).\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"example":{"columns":[{"name":"name","type":"string"},{"name":"email","type":"email"},{"name":"settings.plan","type":"string"},{"name":"settings.dark","type":"bool"}]},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"post":{"operationId":"addTableColumn","summary":"Create new column","description":"Adds a new column to the table. The body of the request should contain the column definition.","requestBody":{"description":"The column definition.","content":{"application/json":{"schema":{"example":{"name":"columnName","type":"string"},"$ref":"#/components/schemas/Column"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns/{column_name}":{"summary":"Single Table Column","description":"This endpoint allows working with a single column from a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getColumn","summary":"Get column information","description":"Get the definition of a single column.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"example":{"value":{"name":"settings.labels","type":"multiple"}},"$ref":"#/components/schemas/Column"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateColumn","summary":"Update column","description":"Update column with partial data. Can be used for renaming the column by providing a new \"name\" field.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"example":{"name":"newName","description":"Sample new description"},"required":["name"]},"examples":{"Rename column":{"value":{"name":"new_name"}}}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteColumn","summary":"Delete column","description":"Deletes the specified column.","responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/transaction":{"summary":"Execute a transaction on a branch","description":"Executes multiple operations together as one. This allows you to run a number of \noperations that succeed as a single group; or fail with no changes to your database.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"branchTransaction","summary":"Execute a transaction on a branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"operations":{"type":"array","items":{"$ref":"#/components/schemas/TransactionOperation"}}},"required":["operations"]}}}},"responses":{"200":{"description":"Returns the results of a successful transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionSuccess"}}}},"400":{"description":"Returns errors from a failed transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionFailure"}}}},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data":{"summary":"Table Data","description":"This endpoint enables mutating data into a given database table. To query data, please see the [query endpoint](query).\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"insertRecord","summary":"Insert record","description":"Insert a new Record into the Table","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file/{file_id}":{"summary":"File array access","description":"File array access endpoint allows upload, download and remove of file items.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"},{"$ref":"#/components/parameters/FileItemIDParam"}],"get":{"operationId":"getFileItem","summary":"Download content from a file item in a file array column","description":"Retrieves file content from an array by file ID","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFileItem","summary":"Upload or update the content of a file item in a file array column","description":"Uploads the file content to an array given the file ID","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFileItem","summary":"Delete an item from a file array","description":"Deletes an item from an file array column given the file ID","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file":{"summary":"File column access","description":"File access endpoint allows upload and download of binary file content.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getFile","summary":"Download content from a file column","description":"Retrieves the file content from a file column","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"204":{"description":"no content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFile","summary":"Upload content to a file column","description":"Uploads the file content to the given file column","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFile","summary":"Remove the content from a file column","description":"Deletes a file referred in a file column","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}":{"summary":"Table Record","description":"This endpoint enables mutating a given record in a table, referenced by its ID.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"get":{"operationId":"getRecord","summary":"Get record by ID","description":"Retrieve record by ID","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"put":{"operationId":"insertRecordWithID","summary":"Insert record with ID","description":"By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.","parameters":[{"name":"createOnly","in":"query","schema":{"type":"boolean"}},{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"patch":{"operationId":"updateRecordWithID","summary":"Update record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"post":{"operationId":"upsertRecordWithID","summary":"Upsert record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"delete":{"operationId":"deleteRecord","summary":"Delete record from table","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/bulk":{"summary":"Bulk Table Operations","description":"This endpoint enables bulk operations on a given table. For now, we only allow bulk inserting.\n\nAn example bulk request looks like this:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/db/tutorial:main/tables/users/bulk\n\n{\n \"records\": [\n {\n \"email\": \"laurence@example.com\",\n \"full_name\": \"Laurence Fishburne\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"hugo@example.com\",\n \"full_name\": \"Hugo Weaving\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"joe@example.com\",\n \"full_name\": \"Joe Pantoliano\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n }\n ]\n}\n```\nFor more details, see the [this section](/web-api/records/insert#inserting-records-in-bulk) from the tutorial.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"bulkInsertTableRecords","summary":"Bulk insert records","description":"Bulk insert records","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DataInputRecord"}}},"required":["records"]}}}},"responses":{"200":{"$ref":"#/components/responses/BulkInsertResponse"},"400":{"$ref":"#/components/responses/BulkError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"],"x-experimental":true}},"/db/{db_branch_name}/tables/{table_name}/query":{"summary":"Query Table Data","description":"This endpoint serves data from a given table, inside a specific database's branch.\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"queryTable","summary":"Query table","description":"The Query Table API can be used to retrieve all records in a table.\nThe API support filtering, sorting, selecting a subset of columns, and pagination.\n\nThe overall structure of the request looks like this:\n\n```json\n// POST /db/:/tables/
/query\n{\n \"columns\": [...],\n \"filter\": {\n \"$all\": [...],\n \"$any\": [...]\n ...\n },\n \"sort\": {\n \"multiple\": [...]\n ...\n },\n \"page\": {\n ...\n }\n}\n```\n\nFor usage, see also the [API Guide](https://xata.io/docs/api-guide/get).\n\n### Column selection\n\nIf the `columns` array is not specified, all columns are included. For link\nfields, only the ID column of the linked records is included in the response.\n\nIf the `columns` array is specified, only the selected and internal\ncolumns `id` and `xata` are included. The `*` wildcard can be used to\nselect all columns.\n\nFor objects and link fields, if the column name of the object is specified, we\ninclude all of its sub-keys. If only some sub-keys are specified (via dotted\nnotation, e.g. `\"settings.plan\"` ), then only those sub-keys from the object\nare included.\n\nBy the way of example, assuming two tables like this:\n\n```json {\"truncate\": true}\n{\n \"tables\": [\n {\n \"name\": \"teams\",\n \"columns\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"users\"\n }\n },\n {\n \"name\": \"foundedDate\",\n \"type\": \"datetime\"\n },\n ]\n },\n {\n \"name\": \"users\",\n \"columns\": [\n {\n \"name\": \"email\",\n \"type\": \"email\"\n },\n {\n \"name\": \"full_name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"address\",\n \"type\": \"object\",\n \"columns\": [\n {\n \"name\": \"street\",\n \"type\": \"string\"\n },\n {\n \"name\": \"number\",\n \"type\": \"int\"\n },\n {\n \"name\": \"zipcode\",\n \"type\": \"int\"\n }\n ]\n },\n {\n \"name\": \"team\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"teams\"\n }\n }\n ]\n }\n ]\n}\n```\n\nA query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.*\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n }\n}\n```\n\nwhile a query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.street\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\"\n }\n}\n```\n\nIf you want to return all columns from the main table and selected columns from the linked table, you can do it like this:\n\n```json\n{\n \"columns\": [\"*\", \"team.name\"]\n}\n```\n\nThe `\"*\"` in the above means all columns, including columns of objects. This returns data like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\"\n }\n}\n```\n\nIf you want all columns of the linked table, you can do:\n\n```json\n{\n \"columns\": [\"*\", \"team.*\"]\n}\n```\n\nThis returns, for example:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\",\n \"code\": \"A1\",\n \"foundedDate\": \"2020-03-04T10:43:54.32Z\"\n }\n}\n```\n\n### Filtering\n\nThere are two types of operators:\n\n- Operators that work on a single column: `$is`, `$contains`, `$pattern`,\n `$includes`, `$gt`, etc.\n- Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,\n `$none`, etc.\n\nAll operators start with an `$` to differentiate them from column names\n(which are not allowed to start with a dollar sign).\n\n#### Exact matching and control operators\n\nFilter by one column:\n\n```json\n{\n \"filter\": {\n \"\": \"value\"\n }\n}\n```\n\nThis is equivalent to using the `$is` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$is\": \"value\"\n }\n }\n}\n```\n\nFor example:\n\n```json\n{\n \"filter\": {\n \"name\": \"r2\"\n }\n}\n```\n\nOr:\n\n```json\n{\n \"filter\": {\n \"name\": {\n \"$is\": \"r2\"\n }\n }\n}\n```\n\nFor objects, both dots and nested versions work:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": \"free\"\n }\n}\n```\n\n```json\n{\n \"filter\": {\n \"settings\": {\n \"plan\": \"free\"\n }\n }\n}\n```\n\nIf you want to OR together multiple values, you can use the `$any` operator with an array of values:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": { \"$any\": [\"free\", \"paid\"] }\n }\n}\n```\n\nIf you specify multiple columns in the same filter, they are logically AND'ed together:\n\n```json\n{\n \"filter\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n}\n```\n\nThe above matches if both conditions are met.\n\nTo be more explicit about it, you can use `$all` or `$any`:\n\n```json\n{\n \"filter\": {\n \"$any\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n }\n}\n```\n\nThe `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:\n\n```json\n{\n \"filter\": {\n \"$any\": [\n {\n \"name\": \"r1\"\n },\n {\n \"name\": \"r2\"\n }\n ]\n }\n}\n```\n\nYou can check for a value being not-null with `$exists`:\n\n```json\n{\n \"filter\": {\n \"$exists\": \"settings\"\n }\n}\n```\n\nThis can be combined with `$all` or `$any` :\n\n```json\n{\n \"filter\": {\n \"$all\": [\n {\n \"$exists\": \"settings\"\n },\n {\n \"$exists\": \"name\"\n }\n ]\n }\n}\n```\n\nOr you can use the inverse operator `$notExists`:\n\n```json\n{\n \"filter\": {\n \"$notExists\": \"settings\"\n }\n}\n```\n\n#### Partial match\n\n`$contains` is the simplest operator for partial matching. Note that `$contains` operator can\ncause performance issues at scale, because indices cannot be used.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$contains\": \"value\"\n }\n }\n}\n```\n\nWildcards are supported via the `$pattern` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$pattern\": \"v*alu?\"\n }\n }\n}\n```\n\nThe `$pattern` operator accepts two wildcard characters:\n* `*` matches zero or more characters\n* `?` matches exactly one character\n\nIf you want to match a string that contains a wildcard character, you can escape them using a backslash (`\\`). You can escape a backslash by usign another backslash.\n\nYou can also use the `$endsWith` and `$startsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$endsWith\": \".gz\"\n },\n \"\": {\n \"$startsWith\": \"tmp-\"\n }\n }\n}\n```\n\n#### Numeric or datetime ranges\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$ge\": 0,\n \"$lt\": 100\n }\n }\n}\n```\nDate ranges support the same operators, with the date using the format defined in\n[RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):\n```json\n{\n \"filter\": {\n \"\": {\n \"$gt\": \"2019-10-12T07:20:50.52Z\",\n \"$lt\": \"2021-10-12T07:20:50.52Z\"\n }\n }\n}\n```\nThe supported operators are `$gt`, `$lt`, `$ge`, `$le`.\n\n#### Negations\n\nA general `$not` operator can inverse any operation.\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nNote: in the above the two condition are AND together, so this does (NOT ( ...\nAND ...))\n\nOr more complex:\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"$any\": [\n {\n \"\": \"value1\"\n },\n {\n \"$all\": [\n {\n \"\": \"value2\"\n },\n {\n \"\": \"value3\"\n }\n ]\n }\n ]\n }\n }\n}\n```\n\nThe `$not: { $any: {}}` can be shorted using the `$none` operator:\n\n```json\n{\n \"filter\": {\n \"$none\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nIn addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$isNot\": \"2019-10-12T07:20:50.52Z\"\n }\n }\n}\n```\n\n#### Working with arrays\n\nTo test that an array contains a value, use `$includesAny`.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includesAny\": \"value\"\n }\n }\n}\n```\n\n##### `includesAny`\n\nThe `$includesAny` operator accepts a custom predicate that will check if\nany value in the array column matches the predicate. The `$includes` operator is a\nsynonym for the `$includesAny` operator.\n\nFor example a complex predicate can include\nthe `$all` , `$contains` and `$endsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includes\": {\n \"$all\": [\n { \"$contains\": \"label\" },\n { \"$not\": { \"$endsWith\": \"-debug\" } }\n ]\n }\n }\n }\n}\n```\n\n##### `includesNone`\n\nThe `$includesNone` operator succeeds if no array item matches the\npredicate.\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesNone\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\nThe above matches if none of the array values contain the string \"label\".\n\n##### `includesAll`\n\nThe `$includesAll` operator succeeds if all array items match the\npredicate.\n\nHere is an example of using the `$includesAll` operator:\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesAll\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\n\nThe above matches if all array values contain the string \"label\".\n\n### Sorting\n\nSorting by one element:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"asc\"\n }\n}\n```\n\nor descendently:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"desc\"\n }\n}\n```\n\nSorting by multiple fields:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"index\": \"desc\"\n },\n {\n \"createdAt\": \"desc\"\n }\n ]\n}\n```\n\nIt is also possible to sort results randomly:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"*\": \"random\"\n }\n}\n```\n\nNote that a random sort does not apply to a specific column, hence the special column name `\"*\"`.\n\nA random sort can be combined with an ascending or descending sort on a specific column:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"name\": \"desc\"\n },\n {\n \"*\": \"random\"\n }\n ]\n}\n```\n\nThis will sort on the `name` column, breaking ties randomly.\n\n### Pagination\n\nWe offer cursor pagination and offset pagination. The cursor pagination method can be used for sequential scrolling with unrestricted depth. The offset pagination can be used to skip pages and is limited to 1000 records.\n\nExample of cursor pagination:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"after\":\"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\nIn the above example, the value of the `page.after` parameter is the cursor returned by the previous query. A sample response is shown below:\n\n```json\n{\n \"meta\": {\n \"page\": {\n \"cursor\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\",\n \"more\": true\n }\n },\n \"records\": [...]\n}\n```\n\nThe `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:\n\n- `after`: Return the next page 'after' the current cursor\n- `before`: Return the previous page 'before' the current cursor.\n- `start`: Resets the given cursor position to the beginning of the query result set. \nWill return the first N records from the query result, where N is the `page.size` parameter. \n- `end`: Resets the give cursor position to the end for the query result set. \nReturns the last N records from the query result, where N is the `page.size` parameter.\n\nThe request will fail if an invalid cursor value is given to `page.before`,\n`page.after`, `page.start` , or `page.end`. No other cursor setting can be\nused if `page.start` or `page.end` is set in a query.\n\nIf both `page.before` and `page.after` parameters are present we treat the\nrequest as a range query. The range query will return all entries after\n`page.after`, but before `page.before`, up to `page.size` or the maximum\npage size. This query requires both cursors to use the same filters and sort\nsettings, plus we require `page.after < page.before`. The range query returns\na new cursor. If the range encompass multiple pages the next page in the range\ncan be queried by update `page.after` to the returned cursor while keeping the\n`page.before` cursor from the first range query.\n\nThe `filter` , `columns`, `sort` , and `page.size` configuration will be\nencoded with the cursor. The pagination request will be invalid if\n`filter` or `sort` is set. The columns returned and page size can be changed\nanytime by passing the `columns` or `page.size` settings to the next query.\n\nIn the following example of size + offset pagination we retrieve the third page of up to 100 results:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 100,\n \"offset\": 200\n }\n}\n```\n\nThe `page.size` parameter represents the maximum number of records returned by this query. It has a default value of 20 and a maximum value of 200.\nThe `page.offset` parameter represents the number of matching records to skip. It has a default value of 0 and a maximum value of 800.\n\nCursor pagination also works in combination with offset pagination. For example, starting from a specific cursor position, using a page size of 200 and an offset of 800, you can skip up to 5 pages of 200 records forwards or backwards from the cursor's position:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 200,\n \"offset\": 800,\n \"after\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\n**Special cursors:**\n\n- `page.after=end`: Result points past the last entry. The list of records\n returned is empty, but `page.meta.cursor` will include a cursor that can be\n used to \"tail\" the table from the end waiting for new data to be inserted.\n- `page.before=end`: This cursor returns the last page.\n- `page.start=$cursor`: Start at the beginning of the result set of the $cursor query. This is equivalent to querying the\n first page without a cursor but applying `filter` and `sort` . Yet the `page.start`\n cursor can be convenient at times as user code does not need to remember the\n filter, sort, columns or page size configuration. All these information are\n read from the cursor.\n- `page.end=$cursor`: Move to the end of the result set of the $cursor query. This is equivalent to querying the\n last page with `page.before=end`, `filter`, and `sort` . Yet the\n `page.end` cursor can be more convenient at times as user code does not\n need to remember the filter, sort, columns or page size configuration. All\n these information are read from the cursor.\n\nWhen using special cursors like `page.after=\"end\"` or `page.before=\"end\"`, we\nstill allow `filter` and `sort` to be set.\n\nExample of getting the last page:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 10,\n \"before\": \"end\"\n }\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"sort":{"$ref":"#/components/schemas/SortExpression"},"page":{"$ref":"#/components/schemas/PageConfig"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]}}}}}},"responses":{"200":{"$ref":"#/components/responses/QueryResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/search":{"summary":"Search Database","description":"This endpoint performs full text search across an entire database branch. You can filter down to particular\ntable by using the `tables` parameter. The `tables` parameter accepts a mixed array of strings and objects. Using a string (the table name) selects the full table. Using an object allows one to specify a filter as well. The supported filters are the same as documented for the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"searchBranch","summary":"Free text search","description":"Run a free text search operation across the database branch.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"tables":{"description":"An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table.","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"table":{"description":"The name of the table.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}},"additionalProperties":false,"required":["table"]}]}},"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"tables":["users",{"table":"articles","filter":{"author":"Abigail"}}],"query":"after a long day"},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/search":{"summary":"Search Table","description":"This endpoint performs full text search in a particular table.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"searchTable","summary":"Free text search in a table","description":"Run a free text search operation in a particular table.\n\nThe endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"query":"after a long day","filter":{"firstName":"Abigail"}},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/vectorSearch":{"summary":"Vector similarity search","description":"This endpoint can be used to perform vector-based similarity searches.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"vectorSearchTable","summary":"Vector similarity search in a table","description":"This endpoint can be used to perform vector-based similarity searches in a table. \nIt can be used for implementing semantic search and product recommendation. To use this\nendpoint, you need a column of type vector. The input vector must have the same\ndimension as the vector column.\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"queryVector":{"description":"The vector to search for similarities. Must have the same dimension as\nthe vector column used.\n","type":"array","items":{"type":"number"}},"column":{"description":"The vector column in which to search. It must be of type `vector`.","type":"string"},"similarityFunction":{"description":"The function used to measure the distance between two points. Can be one of:\n`cosineSimilarity`, `l1`, `l2`. The default is `cosineSimilarity`.\n","type":"string","default":"cosineSimilarity"},"size":{"description":"Number of results to return.","type":"integer","default":10,"maximum":100,"minimum":1},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["queryVector","column"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask":{"summary":"Ask data in your table a question","description":"Ask your table a question and have Xata answer.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"askTable","summary":"Ask your table a question","description":"Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"question":{"description":"The question you'd like to ask.","type":"string","minLength":3},"searchType":{"description":"The type of search to use. If set to `keyword` (the default), the search can be configured by passing\na `search` object with the following fields. For more details about each, see the Search endpoint documentation.\nAll fields are optional.\n * fuzziness - typo tolerance\n * target - columns to search into, and weights.\n * prefix - prefix search type.\n * filter - pre-filter before searching.\n * boosters - control relevancy.\nIf set to `vector`, a `vectorSearch` object must be passed, with the following parameters. For more details, see the Vector\nSearch endpoint documentation. The `column` and `contentColumn` parameters are required.\n * column - the vector column containing the embeddings.\n * contentColumn - the column that contains the text from which the embeddings where computed.\n * filter - pre-filter before searching.\n","type":"string","default":"keyword","enum":["keyword","vector"]},"search":{"type":"object","additionalProperties":false,"properties":{"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}}},"vectorSearch":{"type":"object","additionalProperties":false,"properties":{"column":{"description":"The column to use for vector search. It must be of type `vector`.","type":"string"},"contentColumn":{"description":"The column containing the text for vector search. Must be of type `text`.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"required":["column","contentColumn"]},"rules":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"required":["question"]}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","sessionId"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"records":{"description":"The IDs of the records that were used as context.","type":"array","items":{"type":"string"}},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","records","sessionId"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"description":"Unexpected Error"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask/{session_id}":{"summary":"Ask follow-up questions of your data","description":"Continue a conversation with your data. This endpoint lets you continue a question started via the /ask endpoint in order to dive deeper into your context or ask clarifying questions.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ChatSessionIDParam"}],"post":{"operationId":"askTableSession","summary":"Continue a conversation with your data","description":"Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"The question you'd like to ask.","type":"string","minLength":3}},"additionalProperties":false}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/summarize":{"summary":"Summarize Table Data","description":"This endpoint summarizes from your database. It comes with a range\nof functions to help perform calculations on the data you have stored\nin your tables\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"summarizeTable","summary":"Summarize table","description":"This endpoint allows you to (optionally) define groups, and then to run\ncalculations on the values in each group. This is most helpful when \nyou'd like to understand the data you have in your database.\n\nA group is a combination of unique values. If you create a group for \n`sold_by`, `product_name`, we will return one row for every combination \nof `sold_by` and `product_name` you have in your database. When you \nwant to calculate statistics, you define these groups and ask Xata to \ncalculate data on each group.\n\n**Some questions you can ask of your data:**\n\nHow many records do I have in this table?\n- Set `columns: []` as we we want data from the entire table, so we ask\nfor no groups.\n- Set `summaries: {\"total\": {\"count\": \"*\"}}` in order to see the count \nof all records. We use `count: *` here we'd like to know the total \namount of rows; ignoring whether they are `null` or not.\n\nWhat are the top total sales for each product in July 2022 and sold \nmore than 10 units?\n- Set `filter: {soldAt: {\n \"$ge\": \"2022-07-01T00:00:00.000Z\", \n \"$lt\": \"2022-08-01T00:00:00.000Z\"}\n}` \nin order to limit the result set to sales recorded in July 2022.\n- Set `columns: [product_name]` as we'd like to run calculations on \neach unique product name in our table. Setting `columns` like this will \nproduce one row per unique product name.\n- Set `summaries: {\"total_sales\": {\"count\": \"product_name\"}}` as we'd \nlike to create a field called \"total_sales\" for each group. This field \nwill count all rows in each group with non-null product names.\n- Set `sort: [{\"total_sales\": \"desc\"}]` in order to bring the rows with \nthe highest total_sales field to the top.\n- Set `summariesFilter: {\"total_sales\": {\"$ge\": 10}}` to only send back data \nwith greater than or equal to 10 units.\n\n`columns`: tells Xata how to create each group. If you add `product_id` \nwe will create a new group for every unique `product_id`.\n\n`summaries`: tells Xata which calculations to run on each group. Xata\ncurrently supports count, min, max, sum, average.\n\n`sort`: tells Xata in which order you'd like to see results. You may \nsort by fields specified in `columns` as well as the summary names \ndefined in `summaries`.\n\nnote: Sorting on summarized values can be slower on very large tables; \nthis will impact your rate limit significantly more than other queries. \nTry use `filter` to reduce the amount of data being processed in order \nto reduce impact on your limits.\n\n`summariesFilter`: tells Xata how to filter the results of a summary. \nIt has the same syntax as `filter`, however, by using `summariesFilter`\nyou may also filter on the results of a query.\n\nnote: This is a much slower to use than `filter`. We recommend using \n`filter` wherever possible and `summariesFilter` when it's not \npossible to use `filter`.\n\n`page.size`: tells Xata how many records to return. If unspecified, Xata\nwill return the default size.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"columns":{"$ref":"#/components/schemas/ColumnsProjection"},"summaries":{"$ref":"#/components/schemas/SummaryExpressionList"},"sort":{"$ref":"#/components/schemas/SortExpression"},"summariesFilter":{"$ref":"#/components/schemas/FilterExpression"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]},"page":{"type":"object","properties":{"size":{"description":"The number of records returned by summarize. If the amount of data you have exceeds this, or you have\nmore complex reporting requirements, we recommend that you use the aggregate endpoint instead.\n","type":"integer","default":20,"maximum":1000,"minimum":1}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/SummarizeResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/aggregate":{"summary":"Aggregate Table","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"aggregateTable","summary":"Run aggregations over a table","description":"This endpoint allows you to run aggregations (analytics) on the data from one table.\nWhile the summary endpoint is served from a transactional store and the results are strongly \nconsistent, the aggregate endpoint is served from our columnar store and the results are \nonly eventually consistent. On the other hand, the aggregate endpoint uses a \nstore that is more appropiate for analytics, makes use of approximative algorithms \n(e.g for cardinality), and is generally faster and can do more complex aggregations.\n\nFor usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate).\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}}}}}},"responses":{"200":{"$ref":"#/components/responses/AggResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}}},"components":{"parameters":{"BranchNameParam":{"name":"branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BranchName"},"description":"The Database Name"},"ChatSessionIDParam":{"name":"session_id","in":"path","required":true,"schema":{"type":"string","maxLength":36,"minLength":36,"title":"SessionID"}},"ColumnNameParam":{"name":"column_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ColumnName"},"description":"The Column name"},"ColumnsProjectionParam":{"name":"columns","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/ColumnsProjection"},"description":"Column filters"},"DBBranchNameParam":{"name":"db_branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBBranchName"},"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n"},"DBNameParam":{"name":"db_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBName"},"description":"The Database Name"},"FileAccessIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileAccessID"},"description":"The File Access Identifier"},"FileItemIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileItemID"},"description":"The File Identifier"},"FileSignatureParam":{"name":"verify","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/FileSignature"},"description":"File access signature"},"RecordIDParam":{"name":"record_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/RecordID"},"description":"The Record name"},"TableNameParam":{"name":"table_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/TableName"},"description":"The Table name"}},"schemas":{"AggExpression":{"description":"The description of a single aggregation operation. It is an object with only one key-value pair.\nThe key represents the aggregation type, while the value is an object with the configuration of\nthe aggregation.\n","oneOf":[{"type":"object","additionalProperties":false,"properties":{"count":{"$ref":"#/components/schemas/CountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"sum":{"$ref":"#/components/schemas/SumAgg"}}},{"type":"object","additionalProperties":false,"properties":{"max":{"$ref":"#/components/schemas/MaxAgg"}}},{"type":"object","additionalProperties":false,"properties":{"min":{"$ref":"#/components/schemas/MinAgg"}}},{"type":"object","additionalProperties":false,"properties":{"average":{"$ref":"#/components/schemas/AverageAgg"}}},{"type":"object","additionalProperties":false,"properties":{"uniqueCount":{"$ref":"#/components/schemas/UniqueCountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"dateHistogram":{"$ref":"#/components/schemas/DateHistogramAgg"}}},{"type":"object","additionalProperties":false,"properties":{"topValues":{"$ref":"#/components/schemas/TopValuesAgg"}}},{"type":"object","additionalProperties":false,"properties":{"numericHistogram":{"$ref":"#/components/schemas/NumericHistogramAgg"}}}]},"AggExpressionMap":{"description":"The description of the aggregations you wish to receive.\n","type":"object","example":{"totalCount":{"count":"*"},"dailyActiveUsers":{"dateHistogram":{"column":"date","interval":"1d","aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}}}}},"additionalProperties":{"$ref":"#/components/schemas/AggExpression"}},"AggResponse":{"oneOf":[{"type":"number","nullable":true},{"type":"object","properties":{"values":{"type":"array","items":{"type":"object","properties":{"$key":{"oneOf":[{"type":"string"},{"type":"number"}]},"$count":{"type":"integer"}},"additionalProperties":{"$ref":"#/components/schemas/AggResponse"},"required":["$key","$count"]}}},"required":["values"]}]},"AverageAgg":{"description":"The average of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"BoosterExpression":{"description":"Booster Expression","oneOf":[{"type":"object","additionalProperties":false,"properties":{"valueBooster":{"$ref":"#/components/schemas/ValueBooster"}}},{"type":"object","additionalProperties":false,"properties":{"numericBooster":{"$ref":"#/components/schemas/NumericBooster"}}},{"type":"object","additionalProperties":false,"properties":{"dateBooster":{"$ref":"#/components/schemas/DateBooster"}}}]},"Branch":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"additionalProperties":false,"required":["name","createdAt"]},"BranchMetadata":{"description":"","type":"object","properties":{"repository":{"type":"string","minLength":1},"branch":{"$ref":"#/components/schemas/BranchName"},"stage":{"type":"string","minLength":1},"labels":{"type":"array","items":{"type":"string"}}},"example":{"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}},"BranchMigration":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"},"lastGitRevision":{"type":"string"},"localChanges":{"type":"boolean"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"newTables":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Table"}},"removedTables":{"type":"array","items":{"type":"string"}},"tableMigrations":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TableMigration"}},"newTableOrder":{"type":"array","items":{"type":"string"}},"renamedTables":{"type":"array","items":{"$ref":"#/components/schemas/TableRename"}}},"required":["status","localChanges","newTableOrder"],"title":"Migration"},"BranchName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"BranchName"},"BranchOp":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"modifiedAt":{"$ref":"#/components/schemas/DateTime"},"migration":{"$ref":"#/components/schemas/Commit"}},"required":["id","status","createdAt"]},"BranchWithCopyID":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"copyID":{"type":"string"}},"required":["branchName","dbBranchID","copyID"],"title":"BranchWithCopyID"},"Column":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["bool","int","float","string","text","email","multiple","link","object","datetime","vector","file[]","file","json"]},"link":{"$ref":"#/components/schemas/ColumnLink"},"vector":{"$ref":"#/components/schemas/ColumnVector"},"file":{"$ref":"#/components/schemas/ColumnFile"},"file[]":{"$ref":"#/components/schemas/ColumnFile"},"notNull":{"type":"boolean"},"defaultValue":{"type":"string"},"unique":{"type":"boolean"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["name","type"],"title":"Column"},"ColumnFile":{"type":"object","properties":{"defaultPublicAccess":{"type":"boolean"}},"additionalProperties":false},"ColumnLink":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"ColumnMigration":{"type":"object","properties":{"old":{"$ref":"#/components/schemas/Column"},"new":{"$ref":"#/components/schemas/Column"}},"required":["old","new"],"title":"ColumnMigration"},"ColumnName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~\\.]+","title":"ColumnName"},"ColumnOpAdd":{"type":"object","properties":{"table":{"type":"string"},"column":{"$ref":"#/components/schemas/Column"}},"required":["table","column"]},"ColumnOpRemove":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"]},"ColumnOpRename":{"type":"object","properties":{"table":{"type":"string"},"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["table","oldName","newName"]},"ColumnVector":{"type":"object","properties":{"dimension":{"type":"integer","maximum":10000,"minimum":2}},"additionalProperties":false,"required":["dimension"]},"ColumnsProjection":{"type":"array","items":{"type":"string"},"example":["name","email","created_at"]},"Commit":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"mergeParentID":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","createdAt","checksum"]},"CountAgg":{"description":"Count the number of records with an optional filter.","oneOf":[{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false},{"type":"string","description":"Use this form to count all records without any filter.","enum":["*"]}]},"DBBranch":{"type":"object","properties":{"databaseName":{"$ref":"#/components/schemas/DBName"},"branchName":{"$ref":"#/components/schemas/BranchName"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"version":{"type":"number"},"lastMigrationID":{"type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"},"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"schema":{"$ref":"#/components/schemas/Schema"}},"required":["databaseName","branchName","createdAt","id","version","lastMigrationID","schema"],"title":"DBBranch"},"DBBranchName":{"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n","type":"string","maxLength":511,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+:[a-zA-Z0-9_\\-~]+","title":"Tuple of database and branch name"},"DBName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"DBName"},"DataInputRecord":{"description":"Xata input record","type":"object","additionalProperties":{"nullable":true,"anyOf":[{"$ref":"#/components/schemas/RecordID"},{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"},{"$ref":"#/components/schemas/InputFileArray"},{"$ref":"#/components/schemas/InputFile"}]}},"DateBooster":{"description":"Boost records based on the value of a datetime column. It is configured via \"origin\", \"scale\", and \"decay\". The further away from the \"origin\",\nthe more the score is decayed. The decay function uses an exponential function. For example if origin is \"now\", and scale is 10 days and decay is 0.5, it\nshould be interpreted as: a record with a date 10 days before/after origin will be boosted 2 times less than a record with the date at origin.\nThe result of the exponential function is a boost between 0 and 1. The \"factor\" allows you to control how impactful this boost is, by multiplying it with a given value.\n","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"origin":{"description":"The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time.\nIf it is not specified, the current date and time is used.\n","type":"string"},"scale":{"description":"The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"decay":{"description":"The decay factor to expect at \"scale\" distance from the \"origin\".","type":"number"},"factor":{"description":"The factor with which to multiply the added boost.","type":"number","minimum":0},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","scale","decay"]},"DateHistogramAgg":{"description":"Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.\n","type":"object","properties":{"column":{"description":"The column to use for bucketing. Must be of type datetime.","type":"string"},"interval":{"description":"The fixed interval to use when bucketing. \nIt is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"calendarInterval":{"description":"The calendar-aware interval to use when bucketing. Possible values are: `minute`,\n`hour`, `day`, `week`, `month`, `quarter`, `year`.\n","type":"string","enum":["minute","hour","day","week","month","quarter","year"]},"timezone":{"description":"The timezone to use for bucketing. By default, UTC is assumed.\nThe accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or\n`-08:00`.\n","type":"string","pattern":"^[+-][01]\\d:[0-5]\\d$"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column"]},"DateTime":{"type":"string","format":"date-time","title":"DateTime"},"FileAccessID":{"description":"File identifier in access URLs","type":"string","maxLength":296,"minLength":88,"pattern":"[a-v0-9=]+","title":"FileID"},"FileItemID":{"description":"Unique file identifier","type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"FileID"},"FileName":{"description":"File name","type":"string","maxLength":1024,"minLength":0,"pattern":"[0-9a-zA-Z!\\-_\\.\\*'\\(\\)]*"},"FileResponse":{"description":"File metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"size":{"type":"integer","format":"int64"},"version":{"type":"integer","format":"int64"},"attributes":{"type":"object"}},"required":["name","mediaType","size","version"]},"FileSignature":{"description":"File signature","type":"string"},"FilterColumn":{"anyOf":[{"$ref":"#/components/schemas/FilterColumnIncludes"},{"$ref":"#/components/schemas/FilterPredicate"},{"$ref":"#/components/schemas/FilterList"}]},"FilterColumnIncludes":{"type":"object","properties":{"$includes":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAny":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAll":{"$ref":"#/components/schemas/FilterPredicate"},"$includesNone":{"$ref":"#/components/schemas/FilterPredicate"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterExpression":{"type":"object","properties":{"$exists":{"type":"string"},"$existsNot":{"type":"string"},"$any":{"$ref":"#/components/schemas/FilterList"},"$all":{"$ref":"#/components/schemas/FilterList"},"$none":{"$ref":"#/components/schemas/FilterList"},"$not":{"$ref":"#/components/schemas/FilterList"}},"additionalProperties":{"$ref":"#/components/schemas/FilterColumn"},"minProperties":1},"FilterList":{"oneOf":[{"$ref":"#/components/schemas/FilterExpression"},{"type":"array","items":{"$ref":"#/components/schemas/FilterExpression"}}]},"FilterPredicate":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"},"minLength":1},{"$ref":"#/components/schemas/FilterPredicateOp"},{"$ref":"#/components/schemas/FilterPredicateRangeOp"}]},"FilterPredicateOp":{"type":"object","properties":{"$any":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$all":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$none":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$not":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$is":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$isNot":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"},"$contains":{"type":"string"},"$startsWith":{"type":"string"},"$endsWith":{"type":"string"},"$pattern":{"type":"string"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterPredicateRangeOp":{"type":"object","properties":{"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"}},"additionalProperties":false,"maxProperties":2,"minProperties":2},"FilterRangeValue":{"oneOf":[{"type":"number"},{"type":"string"}]},"FilterValue":{"oneOf":[{"type":"number"},{"type":"string"},{"type":"boolean"}]},"FuzzinessExpression":{"description":"Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein\ndistance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single\ncharacter typos per word are tolerated by search. You can set it to 0 to remove the typo tolerance or set it to 2\nto allow two typos in a word.\n","type":"integer","default":1,"maximum":2,"minimum":0},"HighlightExpression":{"type":"object","properties":{"enabled":{"description":"Set to `false` to disable highlighting. By default it is `true`.\n","type":"boolean"},"encodeHTML":{"description":"Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.\n","type":"boolean"}},"additionalProperties":false},"InputFile":{"description":"Object representing a file","type":"object","properties":{"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false,"required":["name"]},"InputFileArray":{"description":"Array of file entries","type":"array","items":{"$ref":"#/components/schemas/InputFileEntry"},"maxItems":50},"InputFileEntry":{"description":"Object representing a file in an array","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false},"ListBranchesResponse":{"type":"object","properties":{"databaseName":{"type":"string"},"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}},"additionalProperties":false,"required":["databaseName","branches"]},"ListGitBranchesResponse":{"type":"object","properties":{"mapping":{"type":"array","items":{"type":"object","properties":{"gitBranch":{"type":"string"},"xataBranch":{"type":"string"}},"required":["gitBranch","xataBranch"]}}},"required":["mapping"]},"MaxAgg":{"description":"The max of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the max. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"MediaType":{"description":"Media type","type":"string","maxLength":255,"minLength":3,"pattern":"^\\w+/[-+.\\w]+$"},"MetricsDatapoint":{"type":"object","properties":{"timestamp":{"type":"string"},"value":{"type":"integer"}},"required":["timestamp","value"],"title":"Datapoint"},"MetricsLatency":{"type":"object","properties":{"p50":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"p90":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}}},"title":"MetricsLatency"},"Migration":{"description":"Branch schema migration.","type":"object","properties":{"parentID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"]},"MigrationColumnOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addColumn":{"$ref":"#/components/schemas/ColumnOpAdd"}},"required":["addColumn"]},{"type":"object","additionalProperties":false,"properties":{"removeColumn":{"$ref":"#/components/schemas/ColumnOpRemove"}},"required":["removeColumn"]},{"type":"object","additionalProperties":false,"properties":{"renameColumn":{"$ref":"#/components/schemas/ColumnOpRename"}},"required":["renameColumn"]}]},"MigrationObject":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","checksum"]},"MigrationOp":{"description":"Branch schema migration operations.","oneOf":[{"$ref":"#/components/schemas/MigrationTableOp"},{"$ref":"#/components/schemas/MigrationColumnOp"}]},"MigrationRequest":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/MigrationRequestNumber"},"createdAt":{"description":"Migration request creation timestamp.","$ref":"#/components/schemas/DateTime"},"modifiedAt":{"description":"Last modified timestamp.","$ref":"#/components/schemas/DateTime"},"closedAt":{"description":"Timestamp when the migration request was closed.","$ref":"#/components/schemas/DateTime"},"mergedAt":{"description":"Timestamp when the migration request was merged.","$ref":"#/components/schemas/DateTime"},"status":{"type":"string","enum":["open","closed","merging","merged","failed"]},"title":{"description":"The migration request title.","type":"string"},"body":{"description":"The migration request body with detailed description.","type":"string"},"source":{"description":"Name of the source branch.","type":"string"},"target":{"description":"Name of the target branch.","type":"string"}},"additionalProperties":false},"MigrationRequestNumber":{"description":"The migration request number.","type":"integer","minimum":0},"MigrationStatus":{"type":"string","enum":["completed","pending","failed"]},"MigrationTableOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addTable":{"$ref":"#/components/schemas/TableOpAdd"}},"required":["addTable"]},{"type":"object","additionalProperties":false,"properties":{"removeTable":{"$ref":"#/components/schemas/TableOpRemove"}},"required":["removeTable"]},{"type":"object","additionalProperties":false,"properties":{"renameTable":{"$ref":"#/components/schemas/TableOpRename"}},"required":["renameTable"]}]},"MinAgg":{"description":"The min of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the min. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"NumericBooster":{"description":"Boost records based on the value of a numeric column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"factor":{"description":"The factor with which to multiply the value of the column before adding it to the item score.","type":"number"},"modifier":{"description":"Modifier to be applied to the column value, before being multiplied with the factor. The possible values are:\n - none (default).\n - log: common logarithm (base 10)\n - log1p: add 1 then take the common logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - ln: natural logarithm (base e)\n - ln1p: add 1 then take the natural logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - square: raise the value to the power of two.\n - sqrt: take the square root of the value.\n - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`).\n","type":"string","enum":["none","log","log1p","ln","ln1p","square","sqrt","reciprocal"]},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","factor"]},"NumericHistogramAgg":{"description":"Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.\n","properties":{"column":{"description":"The column to use for bucketing. Must be of numeric type.","type":"string"},"interval":{"description":"The numeric interval to use for bucketing. The resulting buckets will be ranges \nwith this value as size.\n","type":"number","minimum":0},"offset":{"description":"By default the bucket keys start with 0 and then continue in `interval` steps. The bucket\nboundaries can be shifted by using the offset option. For example, if the `interval` is 100,\nbut you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset` \nto 50.\n","type":"number","default":0},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column","interval"]},"ObjectValue":{"description":"Object column value","type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"}]}},"PageConfig":{"description":"Pagination settings.","type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"start":{"description":"Query the first page from the cursor.","type":"string"},"end":{"description":"Query the last page from the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.","type":"integer","default":20},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0}},"title":"PageConfig"},"PrefixExpression":{"description":"If the prefix type is set to \"disabled\" (the default), the search only matches full words. If the prefix type is set to \"phrase\", the search will return results that match prefixes of the search phrase.\n","type":"string","enum":["phrase","disabled"]},"ProjectionConfig":{"description":"A structured projection that allows for some configuration.","type":"object","properties":{"name":{"description":"The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations).","type":"string"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"as":{"description":"An alias for the projected field, this is how it will be returned in the response.","type":"string"},"sort":{"$ref":"#/components/schemas/SortExpression"},"limit":{"type":"integer","default":20},"offset":{"type":"integer","default":0}}},"QueryColumnsProjection":{"type":"array","items":{"oneOf":[{"type":"string"},{"$ref":"#/components/schemas/ProjectionConfig"}]}},"Record":{"description":"Xata Table Record","allOf":[{"$ref":"#/components/schemas/RecordMeta"},{"type":"object","additionalProperties":true}],"title":"Record"},"RecordID":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"RecordID"},"RecordMeta":{"description":"Xata Table Record Metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/RecordID"},"xata":{"type":"object","properties":{"version":{"description":"The record's version. Can be used for optimistic concurrency control.","type":"integer"},"createdAt":{"description":"The time when the record was created.","type":"string"},"updatedAt":{"description":"The time when the record was last updated.","type":"string"},"table":{"description":"The record's table name. APIs that return records from multiple tables will set this field accordingly.","type":"string"},"highlight":{"description":"Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.","type":"object","additionalProperties":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":true}]}},"score":{"description":"The record's relevancy score. This is returned by the search APIs.","type":"number"},"warnings":{"description":"Encoding/Decoding errors","type":"array","items":{"type":"string"}}},"required":["version"]}},"required":["id","xata"],"title":"RecordMeta"},"RecordsMetadata":{"description":"Records metadata","type":"object","properties":{"page":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetched","type":"boolean"},"size":{"description":"the number of records returned per page","type":"number"}},"required":["cursor","more","size"]}},"required":["page"]},"RevLink":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"],"title":"RevLink"},"SQLRecord":{"description":"Xata Table SQL Record","allOf":[{"type":"object","additionalProperties":true}],"title":"SQL Record"},"Schema":{"type":"object","properties":{"tables":{"type":"array","items":{"$ref":"#/components/schemas/Table"}},"tablesOrder":{"type":"array","items":{"type":"string"}}},"required":["tables"],"title":"Schema"},"SchemaEditScript":{"type":"object","properties":{"sourceMigrationID":{"type":"string"},"targetMigrationID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"],"title":"SchemaEditScript"},"SearchPageConfig":{"description":"Pagination settings for the search endpoints.","properties":{"size":{"description":"Set page size.","type":"integer","default":25,"maximum":200},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0,"maximum":800}},"title":"SearchPageConfig"},"SortExpression":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}},{"type":"array","items":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}}}],"title":"SortExpression"},"SortOrder":{"type":"string","enum":["asc","desc","random"],"title":"SortOrder"},"StartedFromMetadata":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"migrationID":{"type":"string"}},"required":["branchName","dbBranchID","migrationID"],"title":"StartedFromMetadata"},"SumAgg":{"description":"The sum of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the sum. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"SummaryExpression":{"description":"A summary expression is the description of a single summary operation. It consists of a single\nkey representing the operation, and a value representing the column to be operated on.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n\nWe currently support several aggregation functions. Not all functions can be run on all column\ntypes.\n\n - `count` is used to count the number of records in each group. Use `{\"count\": \"*\"}` to count\n all columns present, otherwise `{\"count\": \"\"}` to count the number of non-null\n values are present at column path.\n\n Count can be used on any column type, and always returns an int.\n\n - `min` calculates the minimum value in each group. `min` is compatible with most types;\n string, multiple, text, email, int, float, and datetime. It returns a value of the same\n type as operated on. This means that `{\"lowest_latency\": {\"min\": \"latency\"}}` where\n `latency` is an int, will always return an int.\n\n - `max` calculates the maximum value in each group. `max` shares the same compatibility as\n `min`.\n\n - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will\n return a value of the same type as requested.\n\n - `average` averages all values in a group. `average` can be run on `int` and `float` types, and\n always returns a float.\n","type":"object","example":{"count":"deleted_at"}},"SummaryExpressionList":{"description":"The description of the summaries you wish to receive. Set each key to be the field name\nyou'd like for the summary. These names must not collide with other columns you've\nrequested from `columns`; including implicit requests like `settings.*`.\n\nThe value for each key needs to be an object. This object should contain one key and one \nvalue only. In this object, the key should be set to the summary function you wish to use\nand the value set to the column name to be summarized.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n","type":"object","example":{"all_users":{"count":"*"},"total_created":{"count":"created_at"},"min_cost":{"min":"cost"},"max_happiness":{"max":"happiness"},"total_revenue":{"sum":"revenue"},"average_speed":{"average":"speed"}},"additionalProperties":{"$ref":"#/components/schemas/SummaryExpression"}},"Table":{"type":"object","properties":{"id":{"type":"string"},"name":{"$ref":"#/components/schemas/TableName"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"revLinks":{"type":"array","items":{"$ref":"#/components/schemas/RevLink"}}},"required":["name","columns"],"title":"Table"},"TableMigration":{"type":"object","properties":{"newColumns":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Column"}},"removedColumns":{"type":"array","items":{"type":"string"}},"modifiedColumns":{"type":"array","items":{"$ref":"#/components/schemas/ColumnMigration"}},"newColumnOrder":{"type":"array","items":{"type":"string"}}},"required":["newColumnOrder"],"title":"TableMigration"},"TableName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"TableName"},"TableOpAdd":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRemove":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRename":{"type":"object","properties":{"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["oldName","newName"]},"TableRename":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1},"oldName":{"type":"string","minLength":1}},"example":{"newName":"newName","oldName":"oldName"},"required":["newName","oldName"]},"TargetExpression":{"description":"The target expression is used to filter the search results by the target columns.\n","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"column":{"description":"The name of the column.","type":"string"},"weight":{"description":"The weight of the column.","type":"number","default":1,"maximum":10,"minimum":1}},"required":["column"],"additionalProperties":false}]}},"TopValuesAgg":{"description":"Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.\nThe top values as ordered by the number of records (`$count`) are returned.\n","properties":{"column":{"description":"The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.","type":"string"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"size":{"description":"The maximum number of unique values to return.\n","type":"integer","default":10,"maximum":1000}},"additionalProperties":false,"required":["column"]},"TransactionDeleteOp":{"description":"A delete operation. The transaction will continue if no record matches the ID by default. To override this behaviour, set failIfMissing to true.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"failIfMissing":{"description":"If true, the transaction will fail when the record doesn't exist.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionError":{"description":"An error message from a failing transaction operation","type":"object","properties":{"index":{"description":"The index of the failing operation","type":"integer"},"message":{"description":"The error message","type":"string"}},"required":["index","message"]},"TransactionFailure":{"description":"An array of errors, with indices, from the transaction.","type":"object","properties":{"id":{"description":"The request ID.","type":"string"},"errors":{"description":"An array of errors from the submitted operations.","type":"array","items":{"$ref":"#/components/schemas/TransactionError"}}},"required":["id","errors"]},"TransactionGetOp":{"description":"Get by id operation.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionInsertOp":{"description":"Insert operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"record":{"description":"The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.\n","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be overwriting. Only valid with an\nexplicit ID is also set in the `record` key.\n","type":"integer"},"createOnly":{"description":"createOnly is used to change how Xata acts when an explicit ID is set in the `record` key. \n\nIf `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata \nwill cancel the transaction. \n\nIf `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no\nconflict, the record is inserted. If there is a conflict, Xata will replace the record.\n","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","record"]},"TransactionOperation":{"description":"A transaction operation","type":"object","oneOf":[{"type":"object","properties":{"insert":{"$ref":"#/components/schemas/TransactionInsertOp"}},"required":["insert"]},{"type":"object","properties":{"update":{"$ref":"#/components/schemas/TransactionUpdateOp"}},"required":["update"]},{"type":"object","properties":{"delete":{"$ref":"#/components/schemas/TransactionDeleteOp"}},"required":["delete"]},{"type":"object","properties":{"get":{"$ref":"#/components/schemas/TransactionGetOp"}},"required":["get"]}]},"TransactionResultColumns":{"description":"Fields to return in the transaction result.","type":"object","additionalProperties":true},"TransactionResultDelete":{"description":"A result from a delete operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["delete"]},"rows":{"description":"The number of deleted rows","type":"integer"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows"]},"TransactionResultGet":{"description":"A result from a get operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["get"]},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation"]},"TransactionResultInsert":{"description":"A result from an insert operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["insert"]},"rows":{"description":"The number of affected rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionResultUpdate":{"description":"A result from an update operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["update"]},"rows":{"description":"The number of updated rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionSuccess":{"description":"An ordered array of results from the submitted operations.","type":"object","properties":{"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/TransactionResultInsert"},{"$ref":"#/components/schemas/TransactionResultUpdate"},{"$ref":"#/components/schemas/TransactionResultDelete"},{"$ref":"#/components/schemas/TransactionResultGet"}]}}},"required":["results"]},"TransactionUpdateOp":{"description":"Update operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"fields":{"description":"The fields of the record you'd like to update","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be updating","type":"integer"},"upsert":{"description":"Xata will insert this record if it cannot be found.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id","fields"]},"UniqueCountAgg":{"description":"Count the number of distinct values in a particular column.","type":"object","properties":{"column":{"description":"The column from where to count the unique values.","type":"string"},"precisionThreshold":{"description":"The threshold under which the unique count is exact. If the number of unique\nvalues in the column is higher than this threshold, the results are approximate.\nMaximum value is 40,000, default value is 3000.\n","type":"integer"}},"additionalProperties":false,"required":["column"]},"ValueBooster":{"description":"Boost records with a particular value for a column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"value":{"description":"The exact value to boost.","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"factor":{"description":"The factor with which to multiply the added boost.","type":"number"},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","value","factor"]}},"responses":{"AggResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"aggs":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/AggResponse"}}},"example":{"aggs":{"dailyUniqueUsers":{"values":[{"$count":321,"$key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"$count":202,"$key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}}}}}},"AuthError":{"description":"Authentication Error","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"example":{"message":"invalid API key"},"required":["message"]}}}},"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"BranchMigrationPlan":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"BulkError":{"description":"Response with multiple errors of the bulk execution","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer"}}}}},"required":["errors"]}}}},"BulkInsertResponse":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"recordIDs":{"type":"array","items":{"type":"string"}}},"required":["recordIDs"]},{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}}},"required":["records"]}]}}}},"PutFileResponse":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"QueryResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"meta":{"$ref":"#/components/schemas/RecordsMetadata"}},"required":["records","meta"]}}}},"RateLimitError":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"RecordResponse":{"description":"Table Record Reponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"RecordUpdateResponse":{"description":"Record ID and metadata","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Record"},{"type":"object","properties":{"id":{"type":"string"},"xata":{"type":"object","properties":{"version":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["version","createdAt","updatedAt"]}},"required":["id","xata"]}]}}}},"SQLResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/SQLRecord"}},"warning":{"type":"string"}}}}}},"SchemaCompareResponse":{"description":"Schema comparison response.","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/Schema"},"target":{"$ref":"#/components/schemas/Schema"},"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["source","target","edits"]}}}},"SchemaUpdateResponse":{"description":"Schema migration response with ID and migration status.","content":{"application/json":{"schema":{"type":"object","properties":{"migrationID":{"type":"string","minLength":1},"parentMigrationID":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["migrationID","parentMigrationID","status"]},"examples":{"example-1":{"value":{"migrationID":"mig_c7m19ilcefoebpqj12p0","parentMigrationID":"mig_c7m19ilcefoebpqj4312","status":"completed"}}}}}},"SearchResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"warning":{"type":"string"},"totalCount":{"description":"The total count of records matched. It will be accurately returned up to 10000 records.","type":"integer"}},"required":["records","totalCount"]}}}},"ServiceUnavailableError":{"description":"ServiceUnavailable","headers":{"Retry-After":{"schema":{"description":"Number of seconds to wait after retrying the operation","type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SimpleError":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SummarizeResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"summaries":{"type":"array","items":{"type":"object"}}},"required":["summaries"]}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Database","description":"Database management.","x-displayName":"Database"},{"name":"Branch","description":"Branch management.","x-displayName":"Branch"},{"name":"Migrations","description":"Branch schema migrations and history.","x-displayName":"Migrations"},{"name":"Table","description":"Table management.","x-displayName":"Table"},{"name":"xbregion_other","x-displayName":"other"},{"name":"Records","description":"Record access API.","x-displayName":"Records"},{"name":"Search and Filter","description":"APIs for searching, querying, filtering, and aggregating records.","x-displayName":"Search and Filter"},{"name":"Files","description":"CRUD API for operating on binary content in file and file[] columns.","x-displayName":"Files"},{"name":"xbcell_other","x-displayName":"other"},{"name":"SQL","description":"SQL service access","x-displayName":"SQL"},{"name":"sql_other","x-displayName":"other"}],"x-tagGroups":[{"name":"xbregion","tags":["Database","Branch","Migrations","Table","Migration Requests","xbregion_other"],"description":"Xata.io Xatabases API"},{"name":"xbcell","tags":["Records","Search and Filter","Files","xbcell_other"],"description":"Xata.io Xatabases API"},{"name":"sql","tags":["SQL","sql_other"],"description":"Xata.io SQL API"}]} \ No newline at end of file +{"openapi":"3.0.0","info":{"title":"xata-xb","description":"Xata.io Xatabases API","version":"1.0","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"contact":{"name":"support@xata.io"}},"servers":[{"url":"/","description":""}],"paths":{"/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getBranchList","summary":"List branches","description":"List all available Branches","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}":{"summary":"Database Branch by Name","description":"This path allows interacting with a given database branch, referenced by parameter `db_branch_name`, which is expected in the format `database_name:branch_name`.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchDetails","summary":"Get branch schema and metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DBBranch"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"put":{"operationId":"createBranch","summary":"Create Database branch","parameters":[{"name":"from","in":"query","description":"Name of source branch to branch the new schema from","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"from":{"description":"Select the branch to fork from. Defaults to 'main'","type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}}}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"mydatabase","branchName":"mybranch","status":"completed"},"required":["databaseName","branchName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"deleteBranch","summary":"Delete Database branch","description":"Delete the branch in the database and all its resources","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/metadata":{"summary":"Branch Metadata","description":"This path allows interacting with the metadata of a specific database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"put":{"operationId":"updateBranchMetadata","summary":"Update branch metadata","description":"Update the branch metadata","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"get":{"operationId":"getBranchMetadata","summary":"Get Branch Metadata","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/stats":{"summary":"Branch Statistics","description":"This endpoint presents a number of statistics on a given database's branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchStats","summary":"Branch stats","description":"Get branch usage metrics.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"timestamp":{"type":"string"},"interval":{"type":"string"},"resolution":{"type":"string"},"numberOfRecords":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"writesOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readsOverTime":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"readLatency":{"$ref":"#/components/schemas/MetricsLatency"},"writeLatency":{"$ref":"#/components/schemas/MetricsLatency"},"warning":{"type":"string"}},"required":["timestamp","interval","resolution"]}}}},"400":{"$ref":"#/components/responses/SimpleError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/gitBranches":{"summary":"Mapping of git to Xata branches","description":"This path allows managing the mapping between git and Xata branches, which is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git branches to the associated Xata branches.\n","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"getGitBranchesMapping","summary":"List git branches mapping","description":"Lists all the git branches in the mapping, and their associated Xata branches.\n\nExample response:\n\n```json\n{\n \"mappings\": [\n {\n \"gitBranch\": \"main\",\n \"xataBranch\": \"main\"\n },\n {\n \"gitBranch\": \"gitBranch1\",\n \"xataBranch\": \"xataBranch1\"\n }\n {\n \"gitBranch\": \"xataBranch2\",\n \"xataBranch\": \"xataBranch2\"\n }\n ]\n}\n```\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitBranchesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"post":{"operationId":"addGitBranchesEntry","summary":"Link a git branch to a Xata branch","description":"Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.\n\nIf the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.\n\nExample request:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches\n{\n \"gitBranch\": \"fix/bug123\",\n \"xataBranch\": \"fix_bug\"\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"gitBranch":{"description":"The name of the Git branch.","type":"string"},"xataBranch":{"description":"The name of the Xata branch.","$ref":"#/components/schemas/BranchName"}},"required":["gitBranch","xataBranch"]}}}},"responses":{"201":{"description":"Operation was successful with warnings","content":{"application/json":{"schema":{"type":"object","properties":{"warning":{"description":"Warning message","type":"string"}},"example":{"warning":"Git branch [fix/bug123] was already present in the mapping and was overwritten."}}}}},"204":{"description":"Operation was successful without warnings"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]},"delete":{"operationId":"removeGitBranchesEntry","summary":"Unlink a git branch to a Xata branch","description":"Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.\n\nExample request:\n\n```json\n// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch to remove from the mapping","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"The git branch was not found in the mapping"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/dbs/{db_name}/resolveBranch":{"summary":"Resolve the branch to use","description":"This endpoint is typically used by the Xata SDKs to resolve the correct branch to use in a particular situation. The main input is the git branch.","parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"get":{"operationId":"resolveBranch","summary":"Resolve a Git Branch to a Xata branch","description":"In order to resolve the database branch, the following algorithm is used:\n* if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned\n* else, if a Xata branch with the exact same name as `gitBranch` exists, return it\n* else, if `fallbackBranch` is provided and a branch with that name exists, return it\n* else, return the default branch of the DB (`main` or the first branch)\n\nExample call:\n\n```json\n// GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg\n```\n\nExample response:\n\n```json\n{\n \"branch\": \"main\",\n \"reason\": {\n \"code\": \"DEFAULT_BRANCH\",\n \"message\": \"Default branch for this database (main)\"\n }\n}\n```\n","parameters":[{"name":"gitBranch","in":"query","description":"The Git Branch","schema":{"type":"string"}},{"name":"fallbackBranch","in":"query","description":"Default branch to fallback to","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"branch":{"type":"string"},"reason":{"type":"object","properties":{"code":{"type":"string","enum":["FOUND_IN_MAPPING","BRANCH_EXISTS","FALLBACK_BRANCH","DEFAULT_BRANCH"]},"message":{"type":"string"}},"required":["code","message"]}},"example":{"branch":"main","reason":{"code":"DEFAULT_BRANCH","message":"Default branch for this database (main)"}},"required":["branch","reason"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Branch"]}},"/db/{db_branch_name}/migrations":{"summary":"Branch Migrations [deprecated]","description":"This path allows access to migrations on a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"get":{"operationId":"getBranchMigrationHistory","summary":"Get branch migration history [deprecated]","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"limit":{"type":"integer"},"startFrom":{"type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"migrations":{"type":"array","items":{"$ref":"#/components/schemas/BranchMigration"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/plan":{"summary":"Migration Plan [deprecated]","description":"This endpoint enables creating a migration plan for a given database branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchMigrationPlan","summary":"Compute migration plan [deprecated]","description":"Compute a migration plan from a target schema the branch should be migrated too.","requestBody":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Schema"}}}},"responses":{"200":{"$ref":"#/components/responses/BranchMigrationPlan"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/migrations/execute":{"summary":"Migration Execution [deprecated]","description":"This endpoint is called in the style of an RPC (Remote Procedure Call) when a migration is to be executed against a specific database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"executeBranchMigrationPlan","summary":"Migrate branch [deprecated]","description":"Apply a migration plan to the branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"deprecated":true,"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/history":{"summary":"Query schema history.","description":"Query the branch its schema history.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchSchemaHistory","summary":"Query schema history.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.","type":"integer","default":20}}},"since":{"description":"Report only migrations that have been added since the given Migration ID.","type":"string"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"meta":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetch","type":"boolean"}},"required":["cursor","more"]},"logs":{"type":"array","items":{"$ref":"#/components/schemas/Commit"}}},"required":["meta","logs"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare":{"summary":"Compare branch with custom schema.","description":"Compare the branch schema with a custom provided schema.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"compareBranchWithUserSchema","summary":"Compare branch with user schema.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"schema":{"$ref":"#/components/schemas/Schema"},"schemaOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"branchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/compare/{branch_name}":{"summary":"Compare branch schemas.","description":"Compare the schema of any 2 branches.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/BranchNameParam"}],"post":{"operationId":"compareBranchSchemas","summary":"Compare branch schemas.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"sourceBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}},"targetBranchOperations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["schema"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/update":{"summary":"Update Branch schema","description":"Update the branch schema with migration operations","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"updateBranchSchema","summary":"Update Branch schema","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Migration"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/preview":{"summary":"Preview branch schema edits.","description":"Preview the resulting branch schema when applying the edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"previewBranchSchemaEdit","summary":"Preview branch schema edits.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"original":{"$ref":"#/components/schemas/Schema"},"updated":{"$ref":"#/components/schemas/Schema"}},"required":["original","updated"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/apply":{"summary":"Update Branch schema with edit script.","description":"Update the branch from schema edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"applyBranchSchemaEdit","summary":"Apply edit script.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["edits"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/schema/push":{"summary":"Push migrations.","description":"Apply a list of migrations to the current branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"pushBranchMigrations","summary":"Push migrations.","description":"The `schema/push` API accepts a list of migrations to be applied to the\ncurrent branch. A list of applicable migrations can be fetched using\nthe `schema/history` API from another branch or database.\n\nThe most recent migration must be part of the list or referenced (via\n`parentID`) by the first migration in the list of migrations to be pushed.\n\nEach migration in the list has an `id`, `parentID`, and `checksum`. The\nchecksum for migrations are generated and verified by xata. The\noperation fails if any migration in the list has an invalid checksum.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"migrations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationObject"}}},"required":["migrations"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Migrations"]}},"/db/{db_branch_name}/tables/{table_name}":{"summary":"Database Table by Name","description":"This endpoint provides a way to mutate a specific table on a database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"put":{"operationId":"createTable","summary":"Create table","description":"Creates a new table with the given name. Returns 422 if a table with the same name already exists.","responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"},"description":"URI to newly created resource: /db/{db_branch_name}/tables/{table_name}"}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string"},"tableName":{"type":"string","minLength":1},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"branchName":"mydb_main","tableName":"mytable","status":"completed"},"required":["branchName","tableName","status"]}}}},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteTable","summary":"Delete table","description":"Deletes the table with the given name.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"Not Found"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateTable","summary":"Update table","description":"Update table. Currently there is only one update operation supported: renaming the table by providing a new name.\n\nIn the example below, we rename a table from “users” to “people”:\n\n```json\n// PATCH /db/test:main/tables/users\n\n{\n \"name\": \"people\"\n}\n```","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"required":["name"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/schema":{"summary":"Table Schema","description":"This endpoint enables reading or updating the schema of a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableSchema","summary":"Get table schema","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"put":{"operationId":"setTableSchema","summary":"Update table schema","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["columns"]}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns":{"summary":"Table Columns","description":"This endpoint allows working with a table's columns.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"get":{"operationId":"getTableColumns","summary":"List table columns","description":"Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their\nfull dot-separated path (flattened).\n","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"example":{"columns":[{"name":"name","type":"string"},{"name":"email","type":"email"},{"name":"settings.plan","type":"string"},{"name":"settings.dark","type":"bool"}]},"required":["columns"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"post":{"operationId":"addTableColumn","summary":"Create new column","description":"Adds a new column to the table. The body of the request should contain the column definition.","requestBody":{"description":"The column definition.","content":{"application/json":{"schema":{"example":{"name":"columnName","type":"string"},"$ref":"#/components/schemas/Column"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/tables/{table_name}/columns/{column_name}":{"summary":"Single Table Column","description":"This endpoint allows working with a single column from a given table.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getColumn","summary":"Get column information","description":"Get the definition of a single column.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"example":{"value":{"name":"settings.labels","type":"multiple"}},"$ref":"#/components/schemas/Column"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"patch":{"operationId":"updateColumn","summary":"Update column","description":"Update column with partial data. Can be used for renaming the column by providing a new \"name\" field.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"name":{"type":"string","minLength":1}},"example":{"name":"newName","description":"Sample new description"},"required":["name"]},"examples":{"Rename column":{"value":{"name":"new_name"}}}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]},"delete":{"operationId":"deleteColumn","summary":"Delete column","description":"Deletes the specified column.","responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Table"]}},"/db/{db_branch_name}/transaction":{"summary":"Execute a transaction on a branch","description":"Executes multiple operations together as one. This allows you to run a number of \noperations that succeed as a single group; or fail with no changes to your database.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"branchTransaction","summary":"Execute a transaction on a branch","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"operations":{"type":"array","items":{"$ref":"#/components/schemas/TransactionOperation"}}},"required":["operations"]}}}},"responses":{"200":{"description":"Returns the results of a successful transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionSuccess"}}}},"400":{"description":"Returns errors from a failed transaction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionFailure"}}}},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data":{"summary":"Table Data","description":"This endpoint enables mutating data into a given database table. To query data, please see the [query endpoint](query).\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"insertRecord","summary":"Insert record","description":"Insert a new Record into the Table","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file/{file_id}":{"summary":"File array access","description":"File array access endpoint allows upload, download and remove of file items.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"},{"$ref":"#/components/parameters/FileItemIDParam"}],"get":{"operationId":"getFileItem","summary":"Download content from a file item in a file array column","description":"Retrieves file content from an array by file ID","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFileItem","summary":"Upload or update the content of a file item in a file array column","description":"Uploads the file content to an array given the file ID","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFileItem","summary":"Delete an item from a file array","description":"Deletes an item from an file array column given the file ID","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file":{"summary":"File column access","description":"File access endpoint allows upload and download of binary file content.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"get":{"operationId":"getFile","summary":"Download content from a file column","description":"Retrieves the file content from a file column","responses":{"200":{"description":"OK","content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"204":{"description":"no content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"put":{"operationId":"putFile","summary":"Upload content to a file column","description":"Uploads the file content to the given file column","requestBody":{"content":{"*/*":{"schema":{"type":"string","format":"binary"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]},"delete":{"operationId":"deleteFile","summary":"Remove the content from a file column","description":"Deletes a file referred in a file column","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Files"]}},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}":{"summary":"Table Record","description":"This endpoint enables mutating a given record in a table, referenced by its ID.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"get":{"operationId":"getRecord","summary":"Get record by ID","description":"Retrieve record by ID","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"put":{"operationId":"insertRecordWithID","summary":"Insert record with ID","description":"By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.","parameters":[{"name":"createOnly","in":"query","schema":{"type":"boolean"}},{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"patch":{"operationId":"updateRecordWithID","summary":"Update record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"post":{"operationId":"upsertRecordWithID","summary":"Upsert record with ID","parameters":[{"name":"ifVersion","in":"query","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]},"delete":{"operationId":"deleteRecord","summary":"Delete record from table","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"]}},"/db/{db_branch_name}/tables/{table_name}/bulk":{"summary":"Bulk Table Operations","description":"This endpoint enables bulk operations on a given table. For now, we only allow bulk inserting.\n\nAn example bulk request looks like this:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/db/tutorial:main/tables/users/bulk\n\n{\n \"records\": [\n {\n \"email\": \"laurence@example.com\",\n \"full_name\": \"Laurence Fishburne\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"hugo@example.com\",\n \"full_name\": \"Hugo Weaving\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"joe@example.com\",\n \"full_name\": \"Joe Pantoliano\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n }\n ]\n}\n```\nFor more details, see the [this section](/web-api/records/insert#inserting-records-in-bulk) from the tutorial.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"operationId":"bulkInsertTableRecords","summary":"Bulk insert records","description":"Bulk insert records","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/DataInputRecord"}}},"required":["records"]}}}},"responses":{"200":{"$ref":"#/components/responses/BulkInsertResponse"},"400":{"$ref":"#/components/responses/BulkError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Records"],"x-experimental":true}},"/db/{db_branch_name}/tables/{table_name}/query":{"summary":"Query Table Data","description":"This endpoint serves data from a given table, inside a specific database's branch.\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"queryTable","summary":"Query table","description":"The Query Table API can be used to retrieve all records in a table.\nThe API support filtering, sorting, selecting a subset of columns, and pagination.\n\nThe overall structure of the request looks like this:\n\n```json\n// POST /db/:/tables/
/query\n{\n \"columns\": [...],\n \"filter\": {\n \"$all\": [...],\n \"$any\": [...]\n ...\n },\n \"sort\": {\n \"multiple\": [...]\n ...\n },\n \"page\": {\n ...\n }\n}\n```\n\nFor usage, see also the [API Guide](https://xata.io/docs/api-guide/get).\n\n### Column selection\n\nIf the `columns` array is not specified, all columns are included. For link\nfields, only the ID column of the linked records is included in the response.\n\nIf the `columns` array is specified, only the selected and internal\ncolumns `id` and `xata` are included. The `*` wildcard can be used to\nselect all columns.\n\nFor objects and link fields, if the column name of the object is specified, we\ninclude all of its sub-keys. If only some sub-keys are specified (via dotted\nnotation, e.g. `\"settings.plan\"` ), then only those sub-keys from the object\nare included.\n\nBy the way of example, assuming two tables like this:\n\n```json {\"truncate\": true}\n{\n \"tables\": [\n {\n \"name\": \"teams\",\n \"columns\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"users\"\n }\n },\n {\n \"name\": \"foundedDate\",\n \"type\": \"datetime\"\n },\n ]\n },\n {\n \"name\": \"users\",\n \"columns\": [\n {\n \"name\": \"email\",\n \"type\": \"email\"\n },\n {\n \"name\": \"full_name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"address\",\n \"type\": \"object\",\n \"columns\": [\n {\n \"name\": \"street\",\n \"type\": \"string\"\n },\n {\n \"name\": \"number\",\n \"type\": \"int\"\n },\n {\n \"name\": \"zipcode\",\n \"type\": \"int\"\n }\n ]\n },\n {\n \"name\": \"team\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"teams\"\n }\n }\n ]\n }\n ]\n}\n```\n\nA query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.*\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n }\n}\n```\n\nwhile a query like this:\n\n```json\nPOST /db/:/tables/
/query\n{\n \"columns\": [\n \"name\",\n \"address.street\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\"\n }\n}\n```\n\nIf you want to return all columns from the main table and selected columns from the linked table, you can do it like this:\n\n```json\n{\n \"columns\": [\"*\", \"team.name\"]\n}\n```\n\nThe `\"*\"` in the above means all columns, including columns of objects. This returns data like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\"\n }\n}\n```\n\nIf you want all columns of the linked table, you can do:\n\n```json\n{\n \"columns\": [\"*\", \"team.*\"]\n}\n```\n\nThis returns, for example:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\",\n \"code\": \"A1\",\n \"foundedDate\": \"2020-03-04T10:43:54.32Z\"\n }\n}\n```\n\n### Filtering\n\nThere are two types of operators:\n\n- Operators that work on a single column: `$is`, `$contains`, `$pattern`,\n `$includes`, `$gt`, etc.\n- Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,\n `$none`, etc.\n\nAll operators start with an `$` to differentiate them from column names\n(which are not allowed to start with a dollar sign).\n\n#### Exact matching and control operators\n\nFilter by one column:\n\n```json\n{\n \"filter\": {\n \"\": \"value\"\n }\n}\n```\n\nThis is equivalent to using the `$is` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$is\": \"value\"\n }\n }\n}\n```\n\nFor example:\n\n```json\n{\n \"filter\": {\n \"name\": \"r2\"\n }\n}\n```\n\nOr:\n\n```json\n{\n \"filter\": {\n \"name\": {\n \"$is\": \"r2\"\n }\n }\n}\n```\n\nFor objects, both dots and nested versions work:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": \"free\"\n }\n}\n```\n\n```json\n{\n \"filter\": {\n \"settings\": {\n \"plan\": \"free\"\n }\n }\n}\n```\n\nIf you want to OR together multiple values, you can use the `$any` operator with an array of values:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": { \"$any\": [\"free\", \"paid\"] }\n }\n}\n```\n\nIf you specify multiple columns in the same filter, they are logically AND'ed together:\n\n```json\n{\n \"filter\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n}\n```\n\nThe above matches if both conditions are met.\n\nTo be more explicit about it, you can use `$all` or `$any`:\n\n```json\n{\n \"filter\": {\n \"$any\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n }\n}\n```\n\nThe `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:\n\n```json\n{\n \"filter\": {\n \"$any\": [\n {\n \"name\": \"r1\"\n },\n {\n \"name\": \"r2\"\n }\n ]\n }\n}\n```\n\nYou can check for a value being not-null with `$exists`:\n\n```json\n{\n \"filter\": {\n \"$exists\": \"settings\"\n }\n}\n```\n\nThis can be combined with `$all` or `$any` :\n\n```json\n{\n \"filter\": {\n \"$all\": [\n {\n \"$exists\": \"settings\"\n },\n {\n \"$exists\": \"name\"\n }\n ]\n }\n}\n```\n\nOr you can use the inverse operator `$notExists`:\n\n```json\n{\n \"filter\": {\n \"$notExists\": \"settings\"\n }\n}\n```\n\n#### Partial match\n\n`$contains` is the simplest operator for partial matching. Note that `$contains` operator can\ncause performance issues at scale, because indices cannot be used.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$contains\": \"value\"\n }\n }\n}\n```\n\nWildcards are supported via the `$pattern` operator:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$pattern\": \"v*alu?\"\n }\n }\n}\n```\n\nThe `$pattern` operator accepts two wildcard characters:\n* `*` matches zero or more characters\n* `?` matches exactly one character\n\nIf you want to match a string that contains a wildcard character, you can escape them using a backslash (`\\`). You can escape a backslash by usign another backslash.\n\nYou can also use the `$endsWith` and `$startsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$endsWith\": \".gz\"\n },\n \"\": {\n \"$startsWith\": \"tmp-\"\n }\n }\n}\n```\n\n#### Numeric or datetime ranges\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$ge\": 0,\n \"$lt\": 100\n }\n }\n}\n```\nDate ranges support the same operators, with the date using the format defined in\n[RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):\n```json\n{\n \"filter\": {\n \"\": {\n \"$gt\": \"2019-10-12T07:20:50.52Z\",\n \"$lt\": \"2021-10-12T07:20:50.52Z\"\n }\n }\n}\n```\nThe supported operators are `$gt`, `$lt`, `$ge`, `$le`.\n\n#### Negations\n\nA general `$not` operator can inverse any operation.\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nNote: in the above the two condition are AND together, so this does (NOT ( ...\nAND ...))\n\nOr more complex:\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"$any\": [\n {\n \"\": \"value1\"\n },\n {\n \"$all\": [\n {\n \"\": \"value2\"\n },\n {\n \"\": \"value3\"\n }\n ]\n }\n ]\n }\n }\n}\n```\n\nThe `$not: { $any: {}}` can be shorted using the `$none` operator:\n\n```json\n{\n \"filter\": {\n \"$none\": {\n \"\": \"value1\",\n \"\": \"value1\"\n }\n }\n}\n```\n\nIn addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$isNot\": \"2019-10-12T07:20:50.52Z\"\n }\n }\n}\n```\n\n#### Working with arrays\n\nTo test that an array contains a value, use `$includesAny`.\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includesAny\": \"value\"\n }\n }\n}\n```\n\n##### `includesAny`\n\nThe `$includesAny` operator accepts a custom predicate that will check if\nany value in the array column matches the predicate. The `$includes` operator is a\nsynonym for the `$includesAny` operator.\n\nFor example a complex predicate can include\nthe `$all` , `$contains` and `$endsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\": {\n \"$includes\": {\n \"$all\": [\n { \"$contains\": \"label\" },\n { \"$not\": { \"$endsWith\": \"-debug\" } }\n ]\n }\n }\n }\n}\n```\n\n##### `includesNone`\n\nThe `$includesNone` operator succeeds if no array item matches the\npredicate.\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesNone\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\nThe above matches if none of the array values contain the string \"label\".\n\n##### `includesAll`\n\nThe `$includesAll` operator succeeds if all array items match the\npredicate.\n\nHere is an example of using the `$includesAll` operator:\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesAll\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\n\nThe above matches if all array values contain the string \"label\".\n\n### Sorting\n\nSorting by one element:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"asc\"\n }\n}\n```\n\nor descendently:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"desc\"\n }\n}\n```\n\nSorting by multiple fields:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"index\": \"desc\"\n },\n {\n \"createdAt\": \"desc\"\n }\n ]\n}\n```\n\nIt is also possible to sort results randomly:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"*\": \"random\"\n }\n}\n```\n\nNote that a random sort does not apply to a specific column, hence the special column name `\"*\"`.\n\nA random sort can be combined with an ascending or descending sort on a specific column:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"name\": \"desc\"\n },\n {\n \"*\": \"random\"\n }\n ]\n}\n```\n\nThis will sort on the `name` column, breaking ties randomly.\n\n### Pagination\n\nWe offer cursor pagination and offset pagination. The cursor pagination method can be used for sequential scrolling with unrestricted depth. The offset pagination can be used to skip pages and is limited to 1000 records.\n\nExample of cursor pagination:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"after\":\"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\nIn the above example, the value of the `page.after` parameter is the cursor returned by the previous query. A sample response is shown below:\n\n```json\n{\n \"meta\": {\n \"page\": {\n \"cursor\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\",\n \"more\": true\n }\n },\n \"records\": [...]\n}\n```\n\nThe `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:\n\n- `after`: Return the next page 'after' the current cursor\n- `before`: Return the previous page 'before' the current cursor.\n- `start`: Resets the given cursor position to the beginning of the query result set. \nWill return the first N records from the query result, where N is the `page.size` parameter. \n- `end`: Resets the give cursor position to the end for the query result set. \nReturns the last N records from the query result, where N is the `page.size` parameter.\n\nThe request will fail if an invalid cursor value is given to `page.before`,\n`page.after`, `page.start` , or `page.end`. No other cursor setting can be\nused if `page.start` or `page.end` is set in a query.\n\nIf both `page.before` and `page.after` parameters are present we treat the\nrequest as a range query. The range query will return all entries after\n`page.after`, but before `page.before`, up to `page.size` or the maximum\npage size. This query requires both cursors to use the same filters and sort\nsettings, plus we require `page.after < page.before`. The range query returns\na new cursor. If the range encompass multiple pages the next page in the range\ncan be queried by update `page.after` to the returned cursor while keeping the\n`page.before` cursor from the first range query.\n\nThe `filter` , `columns`, `sort` , and `page.size` configuration will be\nencoded with the cursor. The pagination request will be invalid if\n`filter` or `sort` is set. The columns returned and page size can be changed\nanytime by passing the `columns` or `page.size` settings to the next query.\n\nIn the following example of size + offset pagination we retrieve the third page of up to 100 results:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 100,\n \"offset\": 200\n }\n}\n```\n\nThe `page.size` parameter represents the maximum number of records returned by this query. It has a default value of 20 and a maximum value of 200.\nThe `page.offset` parameter represents the number of matching records to skip. It has a default value of 0 and a maximum value of 800.\n\nCursor pagination also works in combination with offset pagination. For example, starting from a specific cursor position, using a page size of 200 and an offset of 800, you can skip up to 5 pages of 200 records forwards or backwards from the cursor's position:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 200,\n \"offset\": 800,\n \"after\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\n**Special cursors:**\n\n- `page.after=end`: Result points past the last entry. The list of records\n returned is empty, but `page.meta.cursor` will include a cursor that can be\n used to \"tail\" the table from the end waiting for new data to be inserted.\n- `page.before=end`: This cursor returns the last page.\n- `page.start=$cursor`: Start at the beginning of the result set of the $cursor query. This is equivalent to querying the\n first page without a cursor but applying `filter` and `sort` . Yet the `page.start`\n cursor can be convenient at times as user code does not need to remember the\n filter, sort, columns or page size configuration. All these information are\n read from the cursor.\n- `page.end=$cursor`: Move to the end of the result set of the $cursor query. This is equivalent to querying the\n last page with `page.before=end`, `filter`, and `sort` . Yet the\n `page.end` cursor can be more convenient at times as user code does not\n need to remember the filter, sort, columns or page size configuration. All\n these information are read from the cursor.\n\nWhen using special cursors like `page.after=\"end\"` or `page.before=\"end\"`, we\nstill allow `filter` and `sort` to be set.\n\nExample of getting the last page:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 10,\n \"before\": \"end\"\n }\n}\n```\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"sort":{"$ref":"#/components/schemas/SortExpression"},"page":{"$ref":"#/components/schemas/PageConfig"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]}}}}}},"responses":{"200":{"$ref":"#/components/responses/QueryResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/search":{"summary":"Search Database","description":"This endpoint performs full text search across an entire database branch. You can filter down to particular\ntable by using the `tables` parameter. The `tables` parameter accepts a mixed array of strings and objects. Using a string (the table name) selects the full table. Using an object allows one to specify a filter as well. The supported filters are the same as documented for the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"searchBranch","summary":"Free text search","description":"Run a free text search operation across the database branch.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"tables":{"description":"An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table.","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"table":{"description":"The name of the table.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}},"additionalProperties":false,"required":["table"]}]}},"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"tables":["users",{"table":"articles","filter":{"author":"Abigail"}}],"query":"after a long day"},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/search":{"summary":"Search Table","description":"This endpoint performs full text search in a particular table.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"searchTable","summary":"Free text search in a table","description":"Run a free text search operation in a particular table.\n\nThe endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"query":{"description":"The query string.","type":"string","minLength":1},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}},"page":{"$ref":"#/components/schemas/SearchPageConfig"}},"example":{"query":"after a long day","filter":{"firstName":"Abigail"}},"required":["query"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/vectorSearch":{"summary":"Vector similarity search","description":"This endpoint can be used to perform vector-based similarity searches.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"vectorSearchTable","summary":"Vector similarity search in a table","description":"This endpoint can be used to perform vector-based similarity searches in a table. \nIt can be used for implementing semantic search and product recommendation. To use this\nendpoint, you need a column of type vector. The input vector must have the same\ndimension as the vector column.\n","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"queryVector":{"description":"The vector to search for similarities. Must have the same dimension as\nthe vector column used.\n","type":"array","items":{"type":"number"}},"column":{"description":"The vector column in which to search. It must be of type `vector`.","type":"string"},"similarityFunction":{"description":"The function used to measure the distance between two points. Can be one of:\n`cosineSimilarity`, `l1`, `l2`. The default is `cosineSimilarity`.\n","type":"string","default":"cosineSimilarity"},"size":{"description":"Number of results to return.","type":"integer","default":10,"maximum":100,"minimum":1},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["queryVector","column"]}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask":{"summary":"Ask data in your table a question","description":"Ask your table a question and have Xata answer.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"askTable","summary":"Ask your table a question","description":"Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"question":{"description":"The question you'd like to ask.","type":"string","minLength":3},"searchType":{"description":"The type of search to use. If set to `keyword` (the default), the search can be configured by passing\na `search` object with the following fields. For more details about each, see the Search endpoint documentation.\nAll fields are optional.\n * fuzziness - typo tolerance\n * target - columns to search into, and weights.\n * prefix - prefix search type.\n * filter - pre-filter before searching.\n * boosters - control relevancy.\nIf set to `vector`, a `vectorSearch` object must be passed, with the following parameters. For more details, see the Vector\nSearch endpoint documentation. The `column` and `contentColumn` parameters are required.\n * column - the vector column containing the embeddings.\n * contentColumn - the column that contains the text from which the embeddings where computed.\n * filter - pre-filter before searching.\n","type":"string","default":"keyword","enum":["keyword","vector"]},"search":{"type":"object","additionalProperties":false,"properties":{"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"boosters":{"type":"array","items":{"$ref":"#/components/schemas/BoosterExpression"}}}},"vectorSearch":{"type":"object","additionalProperties":false,"properties":{"column":{"description":"The column to use for vector search. It must be of type `vector`.","type":"string"},"contentColumn":{"description":"The column containing the text for vector search. Must be of type `text`.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"required":["column","contentColumn"]},"rules":{"type":"array","items":{"type":"string"}}},"additionalProperties":false,"required":["question"]}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","sessionId"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"},"records":{"description":"The IDs of the records that were used as context.","type":"array","items":{"type":"string"}},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","records","sessionId"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"description":"Unexpected Error"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/ask/{session_id}":{"summary":"Ask follow-up questions of your data","description":"Continue a conversation with your data. This endpoint lets you continue a question started via the /ask endpoint in order to dive deeper into your context or ask clarifying questions.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ChatSessionIDParam"}],"post":{"operationId":"askTableSession","summary":"Continue a conversation with your data","description":"Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"message":{"description":"The question you'd like to ask.","type":"string","minLength":3}},"additionalProperties":false}}}},"responses":{"200":{"description":"Response to the question","content":{"application/json":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}},"text/event-stream":{"schema":{"type":"object","properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/summarize":{"summary":"Summarize Table Data","description":"This endpoint summarizes from your database. It comes with a range\nof functions to help perform calculations on the data you have stored\nin your tables\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"summarizeTable","summary":"Summarize table","description":"This endpoint allows you to (optionally) define groups, and then to run\ncalculations on the values in each group. This is most helpful when \nyou'd like to understand the data you have in your database.\n\nA group is a combination of unique values. If you create a group for \n`sold_by`, `product_name`, we will return one row for every combination \nof `sold_by` and `product_name` you have in your database. When you \nwant to calculate statistics, you define these groups and ask Xata to \ncalculate data on each group.\n\n**Some questions you can ask of your data:**\n\nHow many records do I have in this table?\n- Set `columns: []` as we we want data from the entire table, so we ask\nfor no groups.\n- Set `summaries: {\"total\": {\"count\": \"*\"}}` in order to see the count \nof all records. We use `count: *` here we'd like to know the total \namount of rows; ignoring whether they are `null` or not.\n\nWhat are the top total sales for each product in July 2022 and sold \nmore than 10 units?\n- Set `filter: {soldAt: {\n \"$ge\": \"2022-07-01T00:00:00.000Z\", \n \"$lt\": \"2022-08-01T00:00:00.000Z\"}\n}` \nin order to limit the result set to sales recorded in July 2022.\n- Set `columns: [product_name]` as we'd like to run calculations on \neach unique product name in our table. Setting `columns` like this will \nproduce one row per unique product name.\n- Set `summaries: {\"total_sales\": {\"count\": \"product_name\"}}` as we'd \nlike to create a field called \"total_sales\" for each group. This field \nwill count all rows in each group with non-null product names.\n- Set `sort: [{\"total_sales\": \"desc\"}]` in order to bring the rows with \nthe highest total_sales field to the top.\n- Set `summariesFilter: {\"total_sales\": {\"$ge\": 10}}` to only send back data \nwith greater than or equal to 10 units.\n\n`columns`: tells Xata how to create each group. If you add `product_id` \nwe will create a new group for every unique `product_id`.\n\n`summaries`: tells Xata which calculations to run on each group. Xata\ncurrently supports count, min, max, sum, average.\n\n`sort`: tells Xata in which order you'd like to see results. You may \nsort by fields specified in `columns` as well as the summary names \ndefined in `summaries`.\n\nnote: Sorting on summarized values can be slower on very large tables; \nthis will impact your rate limit significantly more than other queries. \nTry use `filter` to reduce the amount of data being processed in order \nto reduce impact on your limits.\n\n`summariesFilter`: tells Xata how to filter the results of a summary. \nIt has the same syntax as `filter`, however, by using `summariesFilter`\nyou may also filter on the results of a query.\n\nnote: This is a much slower to use than `filter`. We recommend using \n`filter` wherever possible and `summariesFilter` when it's not \npossible to use `filter`.\n\n`page.size`: tells Xata how many records to return. If unspecified, Xata\nwill return the default size.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"columns":{"$ref":"#/components/schemas/ColumnsProjection"},"summaries":{"$ref":"#/components/schemas/SummaryExpressionList"},"sort":{"$ref":"#/components/schemas/SortExpression"},"summariesFilter":{"$ref":"#/components/schemas/FilterExpression"},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]},"page":{"type":"object","properties":{"size":{"description":"The number of records returned by summarize. If the amount of data you have exceeds this, or you have\nmore complex reporting requirements, we recommend that you use the aggregate endpoint instead.\n","type":"integer","default":20,"maximum":1000,"minimum":1}}}}}}}},"responses":{"200":{"$ref":"#/components/responses/SummarizeResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/tables/{table_name}/aggregate":{"summary":"Aggregate Table","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"operationId":"aggregateTable","summary":"Run aggregations over a table","description":"This endpoint allows you to run aggregations (analytics) on the data from one table.\nWhile the summary endpoint is served from a transactional store and the results are strongly \nconsistent, the aggregate endpoint is served from our columnar store and the results are \nonly eventually consistent. On the other hand, the aggregate endpoint uses a \nstore that is more appropiate for analytics, makes use of approximative algorithms \n(e.g for cardinality), and is generally faster and can do more complex aggregations.\n\nFor usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate).\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}}}}}},"responses":{"200":{"$ref":"#/components/responses/AggResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Search and Filter"]}},"/db/{db_branch_name}/sql":{"summary":"Query database using SQL","description":"This endpoint performs the SQL query across the entire database branch. Set your SQL query in the parameter `query`.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"sqlQuery","summary":"SQL query","description":"Run an SQL query across the database branch.","requestBody":{"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"statement":{"description":"The SQL statement.","type":"string","minLength":1},"params":{"description":"The query parameter list.","type":"array","nullable":true},"consistency":{"description":"The consistency level for this request.","type":"string","default":"strong","enum":["strong","eventual"]}},"example":{"statement":"select * from users;"},"required":["statement"]}}}},"responses":{"200":{"$ref":"#/components/responses/SQLResponse"},"201":{"$ref":"#/components/responses/SQLResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"tags":["SQL"]}}},"components":{"parameters":{"BranchNameParam":{"name":"branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/BranchName"},"description":"The Database Name"},"ChatSessionIDParam":{"name":"session_id","in":"path","required":true,"schema":{"type":"string","maxLength":36,"minLength":36,"title":"SessionID"}},"ColumnNameParam":{"name":"column_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ColumnName"},"description":"The Column name"},"ColumnsProjectionParam":{"name":"columns","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/ColumnsProjection"},"description":"Column filters"},"DBBranchNameParam":{"name":"db_branch_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBBranchName"},"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n"},"DBNameParam":{"name":"db_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBName"},"description":"The Database Name"},"FileAccessIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileAccessID"},"description":"The File Access Identifier"},"FileItemIDParam":{"name":"file_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/FileItemID"},"description":"The File Identifier"},"FileSignatureParam":{"name":"verify","in":"query","required":false,"explode":false,"schema":{"$ref":"#/components/schemas/FileSignature"},"description":"File access signature"},"RecordIDParam":{"name":"record_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/RecordID"},"description":"The Record name"},"TableNameParam":{"name":"table_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/TableName"},"description":"The Table name"}},"schemas":{"AggExpression":{"description":"The description of a single aggregation operation. It is an object with only one key-value pair.\nThe key represents the aggregation type, while the value is an object with the configuration of\nthe aggregation.\n","oneOf":[{"type":"object","additionalProperties":false,"properties":{"count":{"$ref":"#/components/schemas/CountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"sum":{"$ref":"#/components/schemas/SumAgg"}}},{"type":"object","additionalProperties":false,"properties":{"max":{"$ref":"#/components/schemas/MaxAgg"}}},{"type":"object","additionalProperties":false,"properties":{"min":{"$ref":"#/components/schemas/MinAgg"}}},{"type":"object","additionalProperties":false,"properties":{"average":{"$ref":"#/components/schemas/AverageAgg"}}},{"type":"object","additionalProperties":false,"properties":{"percentiles":{"$ref":"#/components/schemas/PercentilesAgg"}}},{"type":"object","additionalProperties":false,"properties":{"uniqueCount":{"$ref":"#/components/schemas/UniqueCountAgg"}}},{"type":"object","additionalProperties":false,"properties":{"dateHistogram":{"$ref":"#/components/schemas/DateHistogramAgg"}}},{"type":"object","additionalProperties":false,"properties":{"topValues":{"$ref":"#/components/schemas/TopValuesAgg"}}},{"type":"object","additionalProperties":false,"properties":{"numericHistogram":{"$ref":"#/components/schemas/NumericHistogramAgg"}}}]},"AggExpressionMap":{"description":"The description of the aggregations you wish to receive.\n","type":"object","example":{"totalCount":{"count":"*"},"dailyActiveUsers":{"dateHistogram":{"column":"date","interval":"1d","aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}}}}},"additionalProperties":{"$ref":"#/components/schemas/AggExpression"}},"AggResponse":{"oneOf":[{"type":"number","nullable":true},{"type":"object","properties":{"values":{"oneOf":[{"type":"array","items":{"type":"object","properties":{"$key":{"oneOf":[{"type":"string"},{"type":"number"}]},"$count":{"type":"integer"}},"additionalProperties":{"$ref":"#/components/schemas/AggResponse"},"required":["$key","$count"]}},{"type":"object","additionalProperties":{"type":"number"}}]}},"required":["values"]}]},"AverageAgg":{"description":"The average of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"BoosterExpression":{"description":"Booster Expression","oneOf":[{"type":"object","additionalProperties":false,"properties":{"valueBooster":{"$ref":"#/components/schemas/ValueBooster"}}},{"type":"object","additionalProperties":false,"properties":{"numericBooster":{"$ref":"#/components/schemas/NumericBooster"}}},{"type":"object","additionalProperties":false,"properties":{"dateBooster":{"$ref":"#/components/schemas/DateBooster"}}}]},"Branch":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"additionalProperties":false,"required":["name","createdAt"]},"BranchMetadata":{"description":"","type":"object","properties":{"repository":{"type":"string","minLength":1},"branch":{"$ref":"#/components/schemas/BranchName"},"stage":{"type":"string","minLength":1},"labels":{"type":"array","items":{"type":"string"}}},"example":{"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}},"BranchMigration":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"status":{"type":"string"},"title":{"type":"string"},"lastGitRevision":{"type":"string"},"localChanges":{"type":"boolean"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"newTables":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Table"}},"removedTables":{"type":"array","items":{"type":"string"}},"tableMigrations":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/TableMigration"}},"newTableOrder":{"type":"array","items":{"type":"string"}},"renamedTables":{"type":"array","items":{"$ref":"#/components/schemas/TableRename"}}},"required":["status","localChanges","newTableOrder"],"title":"Migration"},"BranchName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"BranchName"},"BranchOp":{"type":"object","properties":{"id":{"type":"string"},"parentID":{"type":"string"},"title":{"type":"string"},"message":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"modifiedAt":{"$ref":"#/components/schemas/DateTime"},"migration":{"$ref":"#/components/schemas/Commit"}},"required":["id","status","createdAt"]},"BranchWithCopyID":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"copyID":{"type":"string"}},"required":["branchName","dbBranchID","copyID"],"title":"BranchWithCopyID"},"Column":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string","enum":["bool","int","float","string","text","email","multiple","link","object","datetime","vector","file[]","file","json"]},"link":{"$ref":"#/components/schemas/ColumnLink"},"vector":{"$ref":"#/components/schemas/ColumnVector"},"file":{"$ref":"#/components/schemas/ColumnFile"},"file[]":{"$ref":"#/components/schemas/ColumnFile"},"notNull":{"type":"boolean"},"defaultValue":{"type":"string"},"unique":{"type":"boolean"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}}},"required":["name","type"],"title":"Column"},"ColumnFile":{"type":"object","properties":{"defaultPublicAccess":{"type":"boolean"}},"additionalProperties":false},"ColumnLink":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"ColumnMigration":{"type":"object","properties":{"old":{"$ref":"#/components/schemas/Column"},"new":{"$ref":"#/components/schemas/Column"}},"required":["old","new"],"title":"ColumnMigration"},"ColumnName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~\\.]+","title":"ColumnName"},"ColumnOpAdd":{"type":"object","properties":{"table":{"type":"string"},"column":{"$ref":"#/components/schemas/Column"}},"required":["table","column"]},"ColumnOpRemove":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"]},"ColumnOpRename":{"type":"object","properties":{"table":{"type":"string"},"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["table","oldName","newName"]},"ColumnVector":{"type":"object","properties":{"dimension":{"type":"integer","maximum":10000,"minimum":2}},"additionalProperties":false,"required":["dimension"]},"ColumnsProjection":{"type":"array","items":{"type":"string"},"example":["name","email","created_at"]},"Commit":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"mergeParentID":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","createdAt","checksum"]},"CountAgg":{"description":"Count the number of records with an optional filter.","oneOf":[{"type":"object","properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false},{"type":"string","description":"Use this form to count all records without any filter.","enum":["*"]}]},"DBBranch":{"type":"object","properties":{"databaseName":{"$ref":"#/components/schemas/DBName"},"branchName":{"$ref":"#/components/schemas/BranchName"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"version":{"type":"number"},"lastMigrationID":{"type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"},"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"schema":{"$ref":"#/components/schemas/Schema"}},"required":["databaseName","branchName","createdAt","id","version","lastMigrationID","schema"],"title":"DBBranch"},"DBBranchName":{"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n","type":"string","maxLength":511,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+:[a-zA-Z0-9_\\-~]+","title":"Tuple of database and branch name"},"DBName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"DBName"},"DataInputRecord":{"description":"Xata input record","type":"object","additionalProperties":{"nullable":true,"anyOf":[{"$ref":"#/components/schemas/RecordID"},{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"},{"$ref":"#/components/schemas/InputFileArray"},{"$ref":"#/components/schemas/InputFile"}]}},"DateBooster":{"description":"Boost records based on the value of a datetime column. It is configured via \"origin\", \"scale\", and \"decay\". The further away from the \"origin\",\nthe more the score is decayed. The decay function uses an exponential function. For example if origin is \"now\", and scale is 10 days and decay is 0.5, it\nshould be interpreted as: a record with a date 10 days before/after origin will be boosted 2 times less than a record with the date at origin.\nThe result of the exponential function is a boost between 0 and 1. The \"factor\" allows you to control how impactful this boost is, by multiplying it with a given value.\n","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"origin":{"description":"The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time.\nIf it is not specified, the current date and time is used.\n","type":"string"},"scale":{"description":"The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"decay":{"description":"The decay factor to expect at \"scale\" distance from the \"origin\".","type":"number"},"factor":{"description":"The factor with which to multiply the added boost.","type":"number","minimum":0},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","scale","decay"]},"DateHistogramAgg":{"description":"Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.\n","type":"object","properties":{"column":{"description":"The column to use for bucketing. Must be of type datetime.","type":"string"},"interval":{"description":"The fixed interval to use when bucketing. \nIt is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","type":"string","pattern":"^(\\d+)(d|h|m|s|ms)$"},"calendarInterval":{"description":"The calendar-aware interval to use when bucketing. Possible values are: `minute`,\n`hour`, `day`, `week`, `month`, `quarter`, `year`.\n","type":"string","enum":["minute","hour","day","week","month","quarter","year"]},"timezone":{"description":"The timezone to use for bucketing. By default, UTC is assumed.\nThe accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or\n`-08:00`.\n","type":"string","pattern":"^[+-][01]\\d:[0-5]\\d$"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column"]},"DateTime":{"type":"string","format":"date-time","title":"DateTime"},"FileAccessID":{"description":"File identifier in access URLs","type":"string","maxLength":296,"minLength":88,"pattern":"[a-v0-9=]+","title":"FileID"},"FileItemID":{"description":"Unique file identifier","type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"FileID"},"FileName":{"description":"File name","type":"string","maxLength":1024,"minLength":0,"pattern":"[0-9a-zA-Z!\\-_\\.\\*'\\(\\)]*"},"FileResponse":{"description":"File metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"size":{"type":"integer","format":"int64"},"version":{"type":"integer","format":"int64"},"attributes":{"type":"object"}},"required":["name","mediaType","size","version"]},"FileSignature":{"description":"File signature","type":"string"},"FilterColumn":{"anyOf":[{"$ref":"#/components/schemas/FilterColumnIncludes"},{"$ref":"#/components/schemas/FilterPredicate"},{"$ref":"#/components/schemas/FilterList"}]},"FilterColumnIncludes":{"type":"object","properties":{"$includes":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAny":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAll":{"$ref":"#/components/schemas/FilterPredicate"},"$includesNone":{"$ref":"#/components/schemas/FilterPredicate"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterExpression":{"type":"object","properties":{"$exists":{"type":"string"},"$existsNot":{"type":"string"},"$any":{"$ref":"#/components/schemas/FilterList"},"$all":{"$ref":"#/components/schemas/FilterList"},"$none":{"$ref":"#/components/schemas/FilterList"},"$not":{"$ref":"#/components/schemas/FilterList"}},"additionalProperties":{"$ref":"#/components/schemas/FilterColumn"},"minProperties":1},"FilterList":{"oneOf":[{"$ref":"#/components/schemas/FilterExpression"},{"type":"array","items":{"$ref":"#/components/schemas/FilterExpression"}}]},"FilterPredicate":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"},"minLength":1},{"$ref":"#/components/schemas/FilterPredicateOp"},{"$ref":"#/components/schemas/FilterPredicateRangeOp"}]},"FilterPredicateOp":{"type":"object","properties":{"$any":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$all":{"oneOf":[{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$none":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$not":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"type":"array","items":{"$ref":"#/components/schemas/FilterPredicate"}}]},"$is":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$isNot":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"type":"array","items":{"$ref":"#/components/schemas/FilterValue"}}]},"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"},"$contains":{"type":"string"},"$iContains":{"type":"string"},"$startsWith":{"type":"string"},"$endsWith":{"type":"string"},"$pattern":{"type":"string"},"$iPattern":{"type":"string"}},"additionalProperties":false,"maxProperties":1,"minProperties":1},"FilterPredicateRangeOp":{"type":"object","properties":{"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"}},"additionalProperties":false,"maxProperties":2,"minProperties":2},"FilterRangeValue":{"oneOf":[{"type":"number"},{"type":"string"}]},"FilterValue":{"oneOf":[{"type":"number"},{"type":"string"},{"type":"boolean"}]},"FuzzinessExpression":{"description":"Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein\ndistance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single\ncharacter typos per word are tolerated by search. You can set it to 0 to remove the typo tolerance or set it to 2\nto allow two typos in a word.\n","type":"integer","default":1,"maximum":2,"minimum":0},"HighlightExpression":{"type":"object","properties":{"enabled":{"description":"Set to `false` to disable highlighting. By default it is `true`.\n","type":"boolean"},"encodeHTML":{"description":"Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.\n","type":"boolean"}},"additionalProperties":false},"InputFile":{"description":"Object representing a file","type":"object","properties":{"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false,"required":["name"]},"InputFileArray":{"description":"Array of file entries","type":"array","items":{"$ref":"#/components/schemas/InputFileEntry"},"maxItems":50},"InputFileEntry":{"description":"Object representing a file in an array","properties":{"id":{"$ref":"#/components/schemas/FileItemID"},"name":{"$ref":"#/components/schemas/FileName"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"base64Content":{"description":"Base64 encoded content","type":"string","maxLength":20971520},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"additionalProperties":false},"ListBranchesResponse":{"type":"object","properties":{"databaseName":{"type":"string"},"branches":{"type":"array","items":{"$ref":"#/components/schemas/Branch"}}},"additionalProperties":false,"required":["databaseName","branches"]},"ListGitBranchesResponse":{"type":"object","properties":{"mapping":{"type":"array","items":{"type":"object","properties":{"gitBranch":{"type":"string"},"xataBranch":{"type":"string"}},"required":["gitBranch","xataBranch"]}}},"required":["mapping"]},"MaxAgg":{"description":"The max of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the max. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"MediaType":{"description":"Media type","type":"string","maxLength":255,"minLength":3,"pattern":"^\\w+/[-+.\\w]+$"},"MetricsDatapoint":{"type":"object","properties":{"timestamp":{"type":"string"},"value":{"type":"integer"}},"required":["timestamp","value"],"title":"Datapoint"},"MetricsLatency":{"type":"object","properties":{"p50":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}},"p90":{"type":"array","items":{"$ref":"#/components/schemas/MetricsDatapoint"}}},"title":"MetricsLatency"},"Migration":{"description":"Branch schema migration.","type":"object","properties":{"parentID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"]},"MigrationColumnOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addColumn":{"$ref":"#/components/schemas/ColumnOpAdd"}},"required":["addColumn"]},{"type":"object","additionalProperties":false,"properties":{"removeColumn":{"$ref":"#/components/schemas/ColumnOpRemove"}},"required":["removeColumn"]},{"type":"object","additionalProperties":false,"properties":{"renameColumn":{"$ref":"#/components/schemas/ColumnOpRename"}},"required":["renameColumn"]}]},"MigrationObject":{"type":"object","properties":{"title":{"type":"string"},"message":{"type":"string"},"id":{"type":"string"},"parentID":{"type":"string"},"checksum":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations","id","checksum"]},"MigrationOp":{"description":"Branch schema migration operations.","oneOf":[{"$ref":"#/components/schemas/MigrationTableOp"},{"$ref":"#/components/schemas/MigrationColumnOp"}]},"MigrationRequest":{"type":"object","properties":{"number":{"$ref":"#/components/schemas/MigrationRequestNumber"},"createdAt":{"description":"Migration request creation timestamp.","$ref":"#/components/schemas/DateTime"},"modifiedAt":{"description":"Last modified timestamp.","$ref":"#/components/schemas/DateTime"},"closedAt":{"description":"Timestamp when the migration request was closed.","$ref":"#/components/schemas/DateTime"},"mergedAt":{"description":"Timestamp when the migration request was merged.","$ref":"#/components/schemas/DateTime"},"status":{"type":"string","enum":["open","closed","merging","merged","failed"]},"title":{"description":"The migration request title.","type":"string"},"body":{"description":"The migration request body with detailed description.","type":"string"},"source":{"description":"Name of the source branch.","type":"string"},"target":{"description":"Name of the target branch.","type":"string"}},"additionalProperties":false},"MigrationRequestNumber":{"description":"The migration request number.","type":"integer","minimum":0},"MigrationStatus":{"type":"string","enum":["completed","pending","failed"]},"MigrationTableOp":{"oneOf":[{"type":"object","additionalProperties":false,"properties":{"addTable":{"$ref":"#/components/schemas/TableOpAdd"}},"required":["addTable"]},{"type":"object","additionalProperties":false,"properties":{"removeTable":{"$ref":"#/components/schemas/TableOpRemove"}},"required":["removeTable"]},{"type":"object","additionalProperties":false,"properties":{"renameTable":{"$ref":"#/components/schemas/TableOpRename"}},"required":["renameTable"]}]},"MinAgg":{"description":"The min of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the min. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"NumericBooster":{"description":"Boost records based on the value of a numeric column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"factor":{"description":"The factor with which to multiply the value of the column before adding it to the item score.","type":"number"},"modifier":{"description":"Modifier to be applied to the column value, before being multiplied with the factor. The possible values are:\n - none (default).\n - log: common logarithm (base 10)\n - log1p: add 1 then take the common logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - ln: natural logarithm (base e)\n - ln1p: add 1 then take the natural logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - square: raise the value to the power of two.\n - sqrt: take the square root of the value.\n - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`).\n","type":"string","enum":["none","log","log1p","ln","ln1p","square","sqrt","reciprocal"]},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","factor"]},"NumericHistogramAgg":{"description":"Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.\n","properties":{"column":{"description":"The column to use for bucketing. Must be of numeric type.","type":"string"},"interval":{"description":"The numeric interval to use for bucketing. The resulting buckets will be ranges \nwith this value as size.\n","type":"number","minimum":0},"offset":{"description":"By default the bucket keys start with 0 and then continue in `interval` steps. The bucket\nboundaries can be shifted by using the offset option. For example, if the `interval` is 100,\nbut you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset` \nto 50.\n","type":"number","default":0},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"}},"additionalProperties":false,"required":["column","interval"]},"ObjectValue":{"description":"Object column value","type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"array","items":{"type":"string"}},{"type":"array","items":{"type":"number"}},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/ObjectValue"}]}},"PageConfig":{"description":"Pagination settings.","type":"object","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"start":{"description":"Query the first page from the cursor.","type":"string"},"end":{"description":"Query the last page from the cursor.","type":"string"},"size":{"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.","type":"integer","default":20},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0}},"title":"PageConfig"},"PercentilesAgg":{"description":"Calculate given percentiles of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"},"percentiles":{"type":"array","items":{"type":"number"}}},"additionalProperties":false,"required":["column","percentiles"]},"PrefixExpression":{"description":"If the prefix type is set to \"disabled\" (the default), the search only matches full words. If the prefix type is set to \"phrase\", the search will return results that match prefixes of the search phrase.\n","type":"string","enum":["phrase","disabled"]},"ProjectionConfig":{"description":"A structured projection that allows for some configuration.","type":"object","properties":{"name":{"description":"The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations).","type":"string"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"as":{"description":"An alias for the projected field, this is how it will be returned in the response.","type":"string"},"sort":{"$ref":"#/components/schemas/SortExpression"},"limit":{"type":"integer","default":20},"offset":{"type":"integer","default":0}}},"QueryColumnsProjection":{"type":"array","items":{"oneOf":[{"type":"string"},{"$ref":"#/components/schemas/ProjectionConfig"}]}},"Record":{"description":"Xata Table Record","allOf":[{"$ref":"#/components/schemas/RecordMeta"},{"type":"object","additionalProperties":true}],"title":"Record"},"RecordID":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"RecordID"},"RecordMeta":{"description":"Xata Table Record Metadata","type":"object","properties":{"id":{"$ref":"#/components/schemas/RecordID"},"xata":{"type":"object","properties":{"version":{"description":"The record's version. Can be used for optimistic concurrency control.","type":"integer"},"createdAt":{"description":"The time when the record was created.","type":"string"},"updatedAt":{"description":"The time when the record was last updated.","type":"string"},"table":{"description":"The record's table name. APIs that return records from multiple tables will set this field accordingly.","type":"string"},"highlight":{"description":"Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.","type":"object","additionalProperties":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":true}]}},"score":{"description":"The record's relevancy score. This is returned by the search APIs.","type":"number"},"warnings":{"description":"Encoding/Decoding errors","type":"array","items":{"type":"string"}}},"required":["version"]}},"required":["id","xata"],"title":"RecordMeta"},"RecordsMetadata":{"description":"Records metadata","type":"object","properties":{"page":{"type":"object","properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetched","type":"boolean"},"size":{"description":"the number of records returned per page","type":"number"}},"required":["cursor","more","size"]}},"required":["page"]},"RevLink":{"type":"object","properties":{"table":{"type":"string"},"column":{"type":"string"}},"required":["table","column"],"title":"RevLink"},"SQLRecord":{"description":"Xata Table SQL Record","allOf":[{"type":"object","additionalProperties":true}],"title":"SQL Record"},"Schema":{"type":"object","properties":{"tables":{"type":"array","items":{"$ref":"#/components/schemas/Table"}},"tablesOrder":{"type":"array","items":{"type":"string"}}},"required":["tables"],"title":"Schema"},"SchemaEditScript":{"type":"object","properties":{"sourceMigrationID":{"type":"string"},"targetMigrationID":{"type":"string"},"operations":{"type":"array","items":{"$ref":"#/components/schemas/MigrationOp"}}},"required":["operations"],"title":"SchemaEditScript"},"SearchPageConfig":{"description":"Pagination settings for the search endpoints.","properties":{"size":{"description":"Set page size.","type":"integer","default":25,"maximum":200},"offset":{"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer","default":0,"maximum":800}},"title":"SearchPageConfig"},"SortExpression":{"oneOf":[{"type":"array","items":{"type":"string"}},{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}},{"type":"array","items":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/SortOrder"}}}],"title":"SortExpression"},"SortOrder":{"type":"string","enum":["asc","desc","random"],"title":"SortOrder"},"StartedFromMetadata":{"type":"object","properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"migrationID":{"type":"string"}},"required":["branchName","dbBranchID","migrationID"],"title":"StartedFromMetadata"},"SumAgg":{"description":"The sum of the numeric values in a particular column.","type":"object","properties":{"column":{"description":"The column on which to compute the sum. Must be a numeric type.","type":"string"}},"additionalProperties":false,"required":["column"]},"SummaryExpression":{"description":"A summary expression is the description of a single summary operation. It consists of a single\nkey representing the operation, and a value representing the column to be operated on.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n\nWe currently support several aggregation functions. Not all functions can be run on all column\ntypes.\n\n - `count` is used to count the number of records in each group. Use `{\"count\": \"*\"}` to count\n all columns present, otherwise `{\"count\": \"\"}` to count the number of non-null\n values are present at column path.\n\n Count can be used on any column type, and always returns an int.\n\n - `min` calculates the minimum value in each group. `min` is compatible with most types;\n string, multiple, text, email, int, float, and datetime. It returns a value of the same\n type as operated on. This means that `{\"lowest_latency\": {\"min\": \"latency\"}}` where\n `latency` is an int, will always return an int.\n\n - `max` calculates the maximum value in each group. `max` shares the same compatibility as\n `min`.\n\n - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will\n return a value of the same type as requested.\n\n - `average` averages all values in a group. `average` can be run on `int` and `float` types, and\n always returns a float.\n","type":"object","example":{"count":"deleted_at"}},"SummaryExpressionList":{"description":"The description of the summaries you wish to receive. Set each key to be the field name\nyou'd like for the summary. These names must not collide with other columns you've\nrequested from `columns`; including implicit requests like `settings.*`.\n\nThe value for each key needs to be an object. This object should contain one key and one \nvalue only. In this object, the key should be set to the summary function you wish to use\nand the value set to the column name to be summarized.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n","type":"object","example":{"all_users":{"count":"*"},"total_created":{"count":"created_at"},"min_cost":{"min":"cost"},"max_happiness":{"max":"happiness"},"total_revenue":{"sum":"revenue"},"average_speed":{"average":"speed"}},"additionalProperties":{"$ref":"#/components/schemas/SummaryExpression"}},"Table":{"type":"object","properties":{"id":{"type":"string"},"name":{"$ref":"#/components/schemas/TableName"},"columns":{"type":"array","items":{"$ref":"#/components/schemas/Column"}},"revLinks":{"type":"array","items":{"$ref":"#/components/schemas/RevLink"}}},"required":["name","columns"],"title":"Table"},"TableMigration":{"type":"object","properties":{"newColumns":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/Column"}},"removedColumns":{"type":"array","items":{"type":"string"}},"modifiedColumns":{"type":"array","items":{"$ref":"#/components/schemas/ColumnMigration"}},"newColumnOrder":{"type":"array","items":{"type":"string"}}},"required":["newColumnOrder"],"title":"TableMigration"},"TableName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"TableName"},"TableOpAdd":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRemove":{"type":"object","properties":{"table":{"type":"string"}},"required":["table"]},"TableOpRename":{"type":"object","properties":{"oldName":{"type":"string"},"newName":{"type":"string"}},"required":["oldName","newName"]},"TableRename":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1},"oldName":{"type":"string","minLength":1}},"example":{"newName":"newName","oldName":"oldName"},"required":["newName","oldName"]},"TargetExpression":{"description":"The target expression is used to filter the search results by the target columns.\n","type":"array","items":{"oneOf":[{"type":"string"},{"type":"object","properties":{"column":{"description":"The name of the column.","type":"string"},"weight":{"description":"The weight of the column.","type":"number","default":1,"maximum":10,"minimum":1}},"required":["column"],"additionalProperties":false}]}},"TopValuesAgg":{"description":"Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.\nThe top values as ordered by the number of records (`$count`) are returned.\n","properties":{"column":{"description":"The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.","type":"string"},"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"size":{"description":"The maximum number of unique values to return.\n","type":"integer","default":10,"maximum":1000}},"additionalProperties":false,"required":["column"]},"TransactionDeleteOp":{"description":"A delete operation. The transaction will continue if no record matches the ID by default. To override this behaviour, set failIfMissing to true.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"failIfMissing":{"description":"If true, the transaction will fail when the record doesn't exist.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionError":{"description":"An error message from a failing transaction operation","type":"object","properties":{"index":{"description":"The index of the failing operation","type":"integer"},"message":{"description":"The error message","type":"string"}},"required":["index","message"]},"TransactionFailure":{"description":"An array of errors, with indices, from the transaction.","type":"object","properties":{"id":{"description":"The request ID.","type":"string"},"errors":{"description":"An array of errors from the submitted operations.","type":"array","items":{"$ref":"#/components/schemas/TransactionError"}}},"required":["id","errors"]},"TransactionGetOp":{"description":"Get by id operation.","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id"]},"TransactionInsertOp":{"description":"Insert operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"record":{"description":"The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.\n","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be overwriting. Only valid with an\nexplicit ID is also set in the `record` key.\n","type":"integer"},"createOnly":{"description":"createOnly is used to change how Xata acts when an explicit ID is set in the `record` key. \n\nIf `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata \nwill cancel the transaction. \n\nIf `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no\nconflict, the record is inserted. If there is a conflict, Xata will replace the record.\n","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","record"]},"TransactionOperation":{"description":"A transaction operation","type":"object","oneOf":[{"type":"object","properties":{"insert":{"$ref":"#/components/schemas/TransactionInsertOp"}},"required":["insert"]},{"type":"object","properties":{"update":{"$ref":"#/components/schemas/TransactionUpdateOp"}},"required":["update"]},{"type":"object","properties":{"delete":{"$ref":"#/components/schemas/TransactionDeleteOp"}},"required":["delete"]},{"type":"object","properties":{"get":{"$ref":"#/components/schemas/TransactionGetOp"}},"required":["get"]}]},"TransactionResultColumns":{"description":"Fields to return in the transaction result.","type":"object","additionalProperties":true},"TransactionResultDelete":{"description":"A result from a delete operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["delete"]},"rows":{"description":"The number of deleted rows","type":"integer"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows"]},"TransactionResultGet":{"description":"A result from a get operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["get"]},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation"]},"TransactionResultInsert":{"description":"A result from an insert operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["insert"]},"rows":{"description":"The number of affected rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionResultUpdate":{"description":"A result from an update operation.","type":"object","properties":{"operation":{"description":"The type of operation who's result is being returned.","type":"string","enum":["update"]},"rows":{"description":"The number of updated rows","type":"integer"},"id":{"$ref":"#/components/schemas/RecordID"},"columns":{"$ref":"#/components/schemas/TransactionResultColumns"}},"required":["operation","rows","id"]},"TransactionSuccess":{"description":"An ordered array of results from the submitted operations.","type":"object","properties":{"results":{"type":"array","items":{"oneOf":[{"$ref":"#/components/schemas/TransactionResultInsert"},{"$ref":"#/components/schemas/TransactionResultUpdate"},{"$ref":"#/components/schemas/TransactionResultDelete"},{"$ref":"#/components/schemas/TransactionResultGet"}]}}},"required":["results"]},"TransactionUpdateOp":{"description":"Update operation","type":"object","properties":{"table":{"description":"The table name","type":"string"},"id":{"$ref":"#/components/schemas/RecordID"},"fields":{"description":"The fields of the record you'd like to update","type":"object","additionalProperties":true},"ifVersion":{"description":"The version of the record you expect to be updating","type":"integer"},"upsert":{"description":"Xata will insert this record if it cannot be found.","type":"boolean"},"columns":{"description":"If set, the call will return the requested fields as part of the response.","type":"array","items":{"type":"string"}}},"required":["table","id","fields"]},"UniqueCountAgg":{"description":"Count the number of distinct values in a particular column.","type":"object","properties":{"column":{"description":"The column from where to count the unique values.","type":"string"},"precisionThreshold":{"description":"The threshold under which the unique count is exact. If the number of unique\nvalues in the column is higher than this threshold, the results are approximate.\nMaximum value is 40,000, default value is 3000.\n","type":"integer"}},"additionalProperties":false,"required":["column"]},"ValueBooster":{"description":"Boost records with a particular value for a column.","type":"object","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"value":{"description":"The exact value to boost.","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]},"factor":{"description":"The factor with which to multiply the added boost.","type":"number"},"ifMatchesFilter":{"description":"Only apply this booster to the records for which the provided filter matches.\n","$ref":"#/components/schemas/FilterExpression"}},"additionalProperties":false,"required":["column","value","factor"]}},"responses":{"AggResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"aggs":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/AggResponse"}}},"example":{"aggs":{"dailyUniqueUsers":{"values":[{"$count":321,"$key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"$count":202,"$key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}}}}}},"AuthError":{"description":"Authentication Error","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"example":{"message":"invalid API key"},"required":["message"]}}}},"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"BranchMigrationPlan":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"version":{"type":"integer"},"migration":{"$ref":"#/components/schemas/BranchMigration"}},"required":["version","migration"]}}}},"BulkError":{"description":"Response with multiple errors of the bulk execution","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"status":{"type":"integer"}}}}},"required":["errors"]}}}},"BulkInsertResponse":{"description":"OK","content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"recordIDs":{"type":"array","items":{"type":"string"}}},"required":["recordIDs"]},{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}}},"required":["records"]}]}}}},"PutFileResponse":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}}},"QueryResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"meta":{"$ref":"#/components/schemas/RecordsMetadata"}},"required":["records","meta"]}}}},"RateLimitError":{"description":"Rate limit exceeded","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}},"text/event-stream":{"schema":{"type":"string"}}}},"RecordResponse":{"description":"Table Record Reponse","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}}},"RecordUpdateResponse":{"description":"Record ID and metadata","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Record"},{"type":"object","properties":{"id":{"type":"string"},"xata":{"type":"object","properties":{"version":{"type":"integer"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["version","createdAt","updatedAt"]}},"required":["id","xata"]}]}}}},"SQLResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/SQLRecord"}},"columns":{"description":"Name of the column and its PostgreSQL type","allOf":[{"type":"object"}]},"total":{"description":"Number of selected columns","type":"integer"},"warning":{"type":"string"}}}}}},"SchemaCompareResponse":{"description":"Schema comparison response.","content":{"application/json":{"schema":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/Schema"},"target":{"$ref":"#/components/schemas/Schema"},"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["source","target","edits"]}}}},"SchemaUpdateResponse":{"description":"Schema migration response with ID and migration status.","content":{"application/json":{"schema":{"type":"object","properties":{"migrationID":{"type":"string","minLength":1},"parentMigrationID":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["migrationID","parentMigrationID","status"]},"examples":{"example-1":{"value":{"migrationID":"mig_c7m19ilcefoebpqj12p0","parentMigrationID":"mig_c7m19ilcefoebpqj4312","status":"completed"}}}}}},"SearchResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"records":{"type":"array","items":{"$ref":"#/components/schemas/Record"}},"warning":{"type":"string"},"totalCount":{"description":"The total count of records matched. It will be accurately returned up to 10000 records.","type":"integer"}},"required":["records","totalCount"]}}}},"ServiceUnavailableError":{"description":"ServiceUnavailable","headers":{"Retry-After":{"schema":{"description":"Number of seconds to wait after retrying the operation","type":"string"}}},"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SimpleError":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SummarizeResponse":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"summaries":{"type":"array","items":{"type":"object"}}},"required":["summaries"]}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Database","description":"Database management.","x-displayName":"Database"},{"name":"Branch","description":"Branch management.","x-displayName":"Branch"},{"name":"Migrations","description":"Branch schema migrations and history.","x-displayName":"Migrations"},{"name":"Table","description":"Table management.","x-displayName":"Table"},{"name":"xbregion_other","x-displayName":"other"},{"name":"Records","description":"Record access API.","x-displayName":"Records"},{"name":"Search and Filter","description":"APIs for searching, querying, filtering, and aggregating records.","x-displayName":"Search and Filter"},{"name":"Files","description":"CRUD API for operating on binary content in file and file[] columns.","x-displayName":"Files"},{"name":"xbcell_other","x-displayName":"other"},{"name":"SQL","description":"SQL service access","x-displayName":"SQL"},{"name":"sql_other","x-displayName":"other"}],"x-tagGroups":[{"name":"xbregion","tags":["Database","Branch","Migrations","Table","Migration Requests","xbregion_other"],"description":"Xata.io Xatabases API"},{"name":"xbcell","tags":["Records","Search and Filter","Files","xbcell_other"],"description":"Xata.io Xatabases API"},{"name":"sql","tags":["SQL","sql_other"],"description":"Xata.io SQL API"}]} \ No newline at end of file diff --git a/internal/integration-tests/search_filter_client_test.go b/internal/integration-tests/search_filter_client_test.go index 349e74d..3c94190 100644 --- a/internal/integration-tests/search_filter_client_test.go +++ b/internal/integration-tests/search_filter_client_test.go @@ -563,7 +563,7 @@ func Test_searchAndFilterClient(t *testing.T) { assert.NoError(t, err) if (*aggTableRes.Aggs)["histogram"] != nil && (*aggTableRes.Aggs)["histogram"].AggResponseValues != nil { - return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values) > 0 + return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0 } return false }, time.Second*10, time.Second) @@ -589,7 +589,7 @@ func Test_searchAndFilterClient(t *testing.T) { }) assert.NoError(t, err) if (*aggTableRes.Aggs)["histogram"] != nil && (*aggTableRes.Aggs)["histogram"].AggResponseValues != nil { - return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values) > 0 + return len((*aggTableRes.Aggs)["histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0 } return false }, time.Second*10, time.Second) @@ -613,7 +613,7 @@ func Test_searchAndFilterClient(t *testing.T) { }) assert.NoError(t, err) if (*aggTableRes.Aggs)["top_values"] != nil && (*aggTableRes.Aggs)["top_values"].AggResponseValues != nil { - return len((*aggTableRes.Aggs)["top_values"].AggResponseValues.Values) > 0 + return len((*aggTableRes.Aggs)["top_values"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0 } return false }, time.Second*10, time.Second) @@ -638,7 +638,7 @@ func Test_searchAndFilterClient(t *testing.T) { }) assert.NoError(t, err) if (*aggTableRes.Aggs)["num_histogram"] != nil && (*aggTableRes.Aggs)["num_histogram"].AggResponseValues != nil { - return len((*aggTableRes.Aggs)["num_histogram"].AggResponseValues.Values) > 0 + return len((*aggTableRes.Aggs)["num_histogram"].AggResponseValues.Values.AggResponseValuesValuesItemList) > 0 } return false }, time.Second*10, time.Second) diff --git a/xata/branch_client.go b/xata/branch_client.go index 0a260c6..8cebfae 100644 --- a/xata/branch_client.go +++ b/xata/branch_client.go @@ -15,9 +15,11 @@ type BranchRequest struct { BranchName string } +type BranchMetadataWS xatagenworkspace.BranchMetadata + type CreateBranchRequestPayload struct { CreateBranchRequestFrom *string - Metadata *BranchMetadata + Metadata *BranchMetadataWS } type CreateBranchRequest struct { diff --git a/xata/internal/code-gen/code_gen.go b/xata/internal/code-gen/code_gen.go new file mode 100644 index 0000000..e30f044 --- /dev/null +++ b/xata/internal/code-gen/code_gen.go @@ -0,0 +1,352 @@ +package main + +import ( + "encoding/json" + "flag" + "fmt" + "io" + "log" + "os" + "os/exec" + "strings" +) + +// OpenAPI struct for parsing the OpenAPI YAML file +type OpenAPI struct { + OpenAPI string `yaml:"openapi" json:"openapi"` + Info map[string]any `yaml:"info" json:"info"` + Servers []map[string]any `yaml:"servers" json:"servers"` + Paths map[string]any `yaml:"paths" json:"paths"` + Components map[string]any `yaml:"components" json:"components"` + Tags []map[string]any `yaml:"tags" json:"tags"` + XTagGroups []map[string]any `yaml:"x-tagGroups" json:"x-tagGroups"` +} + +type scope int + +const ( + core scope = iota + workspace +) + +const ( + originalCorePath = "xata/internal/fern-core" + coreAPIspecs = "internal/docs/core-openapi.json" + workspaceAPIspecs = "internal/docs/workspace-openapi.json" + originalWorkspacePath = "xata/internal/fern-workspace" + scopeCore = "core" + scopeWorkspace = "workspace" + coreGeneratorsYamlFile = "core-generators.yml" + workspaceGeneratorsYamlFile = "workspace-generators.yml" + codeGenPath = "xata/internal/code-gen" + + fernGenerateCmd = "fern generate --log-level debug --local" + fernInitCmd = "fern init --openapi ../../../" + newSuffix = "-new" +) + +var ( + newCorePath = originalCorePath + newSuffix + newWorkspacePath = originalWorkspacePath + newSuffix + coreGeneratorsYamlPath = codeGenPath + "/yaml-files/" + coreGeneratorsYamlFile + workspaceGeneratorsYamlPath = codeGenPath + "/yaml-files/" + workspaceGeneratorsYamlFile +) + +func main() { + scope := flag.String("scope", "", "scope is one of: core or workspace") + flag.Parse() + + switch *scope { + case scopeCore: + err := generateFernCode(core, newCorePath, originalCorePath, coreAPIspecs, coreGeneratorsYamlPath) + if err != nil { + log.Fatal(err) + } + + log.Println("success generating core code") + case scopeWorkspace: + err := generateFernCode(workspace, newWorkspacePath, originalWorkspacePath, workspaceAPIspecs, workspaceGeneratorsYamlPath) + if err != nil { + log.Fatal(err) + } + + log.Println("success generating workspace code") + default: + log.Fatal("unknown scope: ", *scope) + } +} + +func generateFernCode(scope scope, newPath, originalPath, apiSPECS, generatorsYAML string) error { + rootWD, err := os.Getwd() + if err != nil { + return fmt.Errorf("unable to get root wd: %v", err) + } + + log.Println("creating new folder") + err = os.Mkdir(newPath, 0755) + if err != nil { + return fmt.Errorf("unable to create %v: %v", newPath, err) + } + + err = os.Chdir(newPath) + if err != nil { + return fmt.Errorf("unable to change dir to %v: %v", newPath, err) + } + + newPathWD, err := os.Getwd() + if err != nil { + return fmt.Errorf("unable to get %v wd: %v", newPathWD, err) + } + + log.Println("initializing fern") + output, err := executeOSCmd(fernInitCmd + apiSPECS) + if err != nil { + return fmt.Errorf("unable to fern init: %v", err) + } + + log.Println(output) + + err = os.Chdir(rootWD) + if err != nil { + return fmt.Errorf("unable to change dir to root wd: %v", err) + } + + log.Println("updating API specs") + switch scope { + case core: + log.Println("no action needed for core") + case workspace: + err = updateWorkspaceAPISpecs(newWorkspacePath + "/fern/api/openapi/workspace-openapi.json") + if err != nil { + return fmt.Errorf("unable to update workspace API specs: %v", err) + } + } + + log.Println("updating the generators file") + err = copyFile(generatorsYAML, newPath+"/fern/api/generators.yml") + if err != nil { + log.Fatal(err) + } + + err = os.Chdir(newPathWD) + if err != nil { + return fmt.Errorf("unable to change dir to %v: %v", newPath, err) + } + + log.Println("generating code") + output, err = executeOSCmd(fernGenerateCmd) + if err != nil { + return fmt.Errorf("unable to generate code: %v", err) + } + + log.Println(output) + + err = os.Chdir(rootWD) + if err != nil { + return fmt.Errorf("unable to get root wd: %v", err) + } + + log.Println("updating auto gen code") + switch scope { + case core: + log.Println("no action needed for core") + case workspace: + err = copySelfFromUtils("value_booster_value.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("insert_record_response.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("bulk_insert_table_records_response.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("update_record_with_id_response.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("insert_record_with_id_response.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("upsert_record_with_id_response.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("record.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("files_client.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("records_client.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("get_file_response.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("transaction_success_results_item.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + + err = copySelfFromUtils("column_type.go", newPath) + if err != nil { + return fmt.Errorf("unable to copy self: %v", err) + } + } + + err = os.RemoveAll(originalPath) + if err != nil { + return fmt.Errorf("unable to remove the original folder: %v", err) + } + + err = os.Rename(newPath, originalPath) + if err != nil { + return fmt.Errorf("unable to rename the new folder as the original folder") + } + + return nil +} + +func executeOSCmd(cmd string) (string, error) { + cmdDissected := strings.Fields(cmd) + + command := exec.Command(cmdDissected[0], cmdDissected[1:]...) + + output, err := command.CombinedOutput() + if err != nil { + return "", err + } + + return string(output), nil +} + +func copySelfFromUtils(fileName, newPath string) error { + suffix := "_" + genPath := "/generated/go/" + return copyFile(codeGenPath+"/go-files/"+fileName+suffix, newPath+genPath+fileName) + +} + +func copyFile(srcPath, destPath string) error { + srcFile, err := os.Open(srcPath) + if err != nil { + return err + } + defer srcFile.Close() + + destFile, err := os.Create(destPath) + if err != nil { + return err + } + defer destFile.Close() + + _, err = io.Copy(destFile, srcFile) + if err != nil { + return err + } + + return nil +} + +func updateWorkspaceAPISpecs(filePath string) error { + // Read the OpenAPI YAML file + openAPIData, err := os.ReadFile(filePath) + if err != nil { + fmt.Println("error reading OpenAPI file:", err) + return err + } + + // Unmarshal the OpenAPI data into a struct + var openAPI OpenAPI + + if err = json.Unmarshal(openAPIData, &openAPI); err != nil { + fmt.Println("error unmarshaling OpenAPI data:", err) + return err + } + + log.Println("removing deprecated path definitions") + delete(openAPI.Paths, "/db/{db_branch_name}/migrations") + delete(openAPI.Paths, "/db/{db_branch_name}/migrations/execute") + delete(openAPI.Paths, "/db/{db_branch_name}/migrations/plan") + + log.Println("updating file[] as fileMap") + columnEnums := openAPI.Components["schemas"].(map[string]any)["Column"].(map[string]any)["properties"].(map[string]any)["type"].(map[string]any)["enum"].([]any) + var newColumnEnums []string + for _, e := range columnEnums { + if e.(string) == "file[]" { + newColumnEnums = append(newColumnEnums, "fileMap") + } else { + newColumnEnums = append(newColumnEnums, e.(string)) + } + } + + openAPI.Components["schemas"].(map[string]any)["Column"].(map[string]any)["properties"].(map[string]any)["type"].(map[string]any)["enum"] = newColumnEnums + + for k, v := range openAPI.Components["schemas"].(map[string]any)["Column"].(map[string]any)["properties"].(map[string]any) { + if k == "file[]" { + openAPI.Components["schemas"].(map[string]any)["Column"].(map[string]any)["properties"].(map[string]any)["fileMap"] = v + delete(openAPI.Components["schemas"].(map[string]any)["Column"].(map[string]any)["properties"].(map[string]any), "file[]") + } + + } + + // TODO: Add issue link => https://github.com/omerdemirok/xata-go/issues/17 + log.Println("removing reference of ProjectionConfig from QueryColumnsProjection") + var newOneOf []any + for _, o := range openAPI.Components["schemas"].(map[string]any)["QueryColumnsProjection"].(map[string]any)["items"].(map[string]any)["oneOf"].([]any) { + if o.(map[string]any)["$ref"] != nil && o.(map[string]any)["$ref"] == "#/components/schemas/ProjectionConfig" { + continue + } + + newOneOf = append(newOneOf, o) + } + openAPI.Components["schemas"].(map[string]any)["QueryColumnsProjection"].(map[string]any)["items"].(map[string]any)["oneOf"] = newOneOf + + log.Println("remove object value") + delete(openAPI.Components["schemas"].(map[string]any), "ObjectValue") + + log.Println("removing reference for object value") + var newAnyOf []any + for _, o := range openAPI.Components["schemas"].(map[string]any)["DataInputRecord"].(map[string]any)["additionalProperties"].(map[string]any)["anyOf"].([]any) { + if o.(map[string]any)["$ref"] != nil && o.(map[string]any)["$ref"] == "#/components/schemas/ObjectValue" { + continue + } + + newAnyOf = append(newAnyOf, o) + } + openAPI.Components["schemas"].(map[string]any)["DataInputRecord"].(map[string]any)["additionalProperties"].(map[string]any)["anyOf"] = newAnyOf + + updatedOpenAPIData, err := json.Marshal(&openAPI) + if err != nil { + fmt.Println("Error marshaling updated OpenAPI data:", err) + return err + } + + // Save the updated OpenAPI data to a new file + err = os.WriteFile(filePath, updatedOpenAPIData, 0644) + if err != nil { + fmt.Println("Error saving updated OpenAPI file:", err) + return err + } + + log.Print("OpenAPI file updated and saved as", filePath) + return nil +} diff --git a/xata/internal/code-gen/go-files/bulk_insert_table_records_response.go_ b/xata/internal/code-gen/go-files/bulk_insert_table_records_response.go_ new file mode 100644 index 0000000..a17850f --- /dev/null +++ b/xata/internal/code-gen/go-files/bulk_insert_table_records_response.go_ @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type BulkInsertTableRecordsResponse map[string][]map[string]interface{} diff --git a/xata/internal/code-gen/go-files/column_type.go_ b/xata/internal/code-gen/go-files/column_type.go_ new file mode 100644 index 0000000..96cc191 --- /dev/null +++ b/xata/internal/code-gen/go-files/column_type.go_ @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + fmt "fmt" + strconv "strconv" +) + +type ColumnType uint8 + +const ( + ColumnTypeBool ColumnType = iota + 1 + ColumnTypeInt + ColumnTypeFloat + ColumnTypeString + ColumnTypeText + ColumnTypeEmail + ColumnTypeMultiple + ColumnTypeLink + ColumnTypeObject + ColumnTypeDatetime + ColumnTypeVector + ColumnTypeFile + ColumnTypeFileMap + ColumnTypeJson +) + +func (c ColumnType) String() string { + switch c { + default: + return strconv.Itoa(int(c)) + case ColumnTypeBool: + return "bool" + case ColumnTypeInt: + return "int" + case ColumnTypeFloat: + return "float" + case ColumnTypeString: + return "string" + case ColumnTypeText: + return "text" + case ColumnTypeEmail: + return "email" + case ColumnTypeMultiple: + return "multiple" + case ColumnTypeLink: + return "link" + case ColumnTypeObject: + return "object" + case ColumnTypeDatetime: + return "datetime" + case ColumnTypeVector: + return "vector" + case ColumnTypeFile: + return "file" + case ColumnTypeFileMap: + return "file[]" + case ColumnTypeJson: + return "json" + } +} + +func (c ColumnType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", c.String())), nil +} + +func (c *ColumnType) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "bool": + value := ColumnTypeBool + *c = value + case "int": + value := ColumnTypeInt + *c = value + case "float": + value := ColumnTypeFloat + *c = value + case "string": + value := ColumnTypeString + *c = value + case "text": + value := ColumnTypeText + *c = value + case "email": + value := ColumnTypeEmail + *c = value + case "multiple": + value := ColumnTypeMultiple + *c = value + case "link": + value := ColumnTypeLink + *c = value + case "object": + value := ColumnTypeObject + *c = value + case "datetime": + value := ColumnTypeDatetime + *c = value + case "vector": + value := ColumnTypeVector + *c = value + case "file": + value := ColumnTypeFile + *c = value + case "fileMap": + value := ColumnTypeFileMap + *c = value + case "json": + value := ColumnTypeJson + *c = value + } + return nil +} diff --git a/xata/internal/code-gen/go-files/files_client.go_ b/xata/internal/code-gen/go-files/files_client.go_ new file mode 100644 index 0000000..e66d7c4 --- /dev/null +++ b/xata/internal/code-gen/go-files/files_client.go_ @@ -0,0 +1,449 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-workspace/generated/go/core" + io "io" + http "net/http" +) + +type FilesClient interface { + GetFileItem(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, fileId FileItemId) (*GetFileResponse, error) + PutFileItem(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, fileId FileItemId, data []byte) (*FileResponse, error) + DeleteFileItem(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, fileId FileItemId) (*FileResponse, error) + GetFile(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName) (*GetFileResponse, error) + PutFile(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, data []byte) (*FileResponse, error) + DeleteFile(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName) (*FileResponse, error) + SetContentTypeHeader(value string) +} + +func NewFilesClient(opts ...core.ClientOption) FilesClient { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &filesClient{ + baseURL: options.BaseURL, + httpClient: options.HTTPClient, + header: options.ToHeader(), + } +} + +func (f *filesClient) SetContentTypeHeader(value string) { + f.header.Set("content-type", value) +} + +type filesClient struct { + baseURL string + httpClient core.HTTPClient + header http.Header +} + +// Retrieves file content from an array by file ID +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +// The Column name +// The File Identifier +func (f *filesClient) GetFileItem(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, fileId FileItemId) (*GetFileResponse, error) { + baseURL := "/" + if f.baseURL != "" { + baseURL = f.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v/column/%v/file/%v", dbBranchName, tableName, recordId, columnName, fileId) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + response := &GetFileResponse{} + if err := core.DoRequest( + ctx, + f.httpClient, + endpointURL, + http.MethodGet, + nil, + response, + false, + f.header, + errorDecoder, + ); err != nil { + return nil, err + } + return response, nil +} + +// Uploads the file content to an array given the file ID +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +// The Column name +// The File Identifier +func (f *filesClient) PutFileItem(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, fileId FileItemId, data []byte) (*FileResponse, error) { + baseURL := "/" + if f.baseURL != "" { + baseURL = f.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v/column/%v/file/%v", dbBranchName, tableName, recordId, columnName, fileId) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 422: + value := new(UnprocessableEntityError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *FileResponse + if err := core.DoRequest( + ctx, + f.httpClient, + endpointURL, + http.MethodPut, + data, + &response, + false, + f.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Deletes an item from an file array column given the file ID +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +// The Column name +// The File Identifier +func (f *filesClient) DeleteFileItem(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, fileId FileItemId) (*FileResponse, error) { + baseURL := "/" + if f.baseURL != "" { + baseURL = f.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v/column/%v/file/%v", dbBranchName, tableName, recordId, columnName, fileId) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *FileResponse + if err := core.DoRequest( + ctx, + f.httpClient, + endpointURL, + http.MethodDelete, + nil, + &response, + false, + f.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Retrieves the file content from a file column +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +// The Column name +func (f *filesClient) GetFile(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName) (*GetFileResponse, error) { + baseURL := "/" + if f.baseURL != "" { + baseURL = f.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v/column/%v/file", dbBranchName, tableName, recordId, columnName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + response := &GetFileResponse{} + if err := core.DoRequest( + ctx, + f.httpClient, + endpointURL, + http.MethodGet, + nil, + response, + false, + f.header, + errorDecoder, + ); err != nil { + return nil, err + } + return response, nil +} + +// Uploads the file content to the given file column +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +// The Column name +func (f *filesClient) PutFile(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName, data []byte) (*FileResponse, error) { + baseURL := "/" + if f.baseURL != "" { + baseURL = f.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v/column/%v/file", dbBranchName, tableName, recordId, columnName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 422: + value := new(UnprocessableEntityError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *FileResponse + if err := core.DoRequest( + ctx, + f.httpClient, + endpointURL, + http.MethodPut, + data, + &response, + false, + f.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Deletes a file referred in a file column +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +// The Column name +func (f *filesClient) DeleteFile(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, columnName ColumnName) (*FileResponse, error) { + baseURL := "/" + if f.baseURL != "" { + baseURL = f.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v/column/%v/file", dbBranchName, tableName, recordId, columnName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *FileResponse + if err := core.DoRequest( + ctx, + f.httpClient, + endpointURL, + http.MethodDelete, + nil, + &response, + false, + f.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} diff --git a/xata/internal/code-gen/go-files/get_file_response.go_ b/xata/internal/code-gen/go-files/get_file_response.go_ new file mode 100644 index 0000000..b6a1a42 --- /dev/null +++ b/xata/internal/code-gen/go-files/get_file_response.go_ @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 + +package api + +type GetFileResponse struct { + Content []byte +} + +func (r *GetFileResponse) Write(p []byte) (n int, err error) { + r.Content = append(r.Content, p...) + + return len(p), nil +} diff --git a/xata/internal/code-gen/go-files/insert_record_response.go_ b/xata/internal/code-gen/go-files/insert_record_response.go_ new file mode 100644 index 0000000..fb858a1 --- /dev/null +++ b/xata/internal/code-gen/go-files/insert_record_response.go_ @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type InsertRecordResponse map[string]interface{} diff --git a/xata/internal/code-gen/go-files/insert_record_with_id_response.go_ b/xata/internal/code-gen/go-files/insert_record_with_id_response.go_ new file mode 100644 index 0000000..a5fabe4 --- /dev/null +++ b/xata/internal/code-gen/go-files/insert_record_with_id_response.go_ @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type InsertRecordWithIdResponse map[string]interface{} diff --git a/xata/internal/code-gen/go-files/record.go_ b/xata/internal/code-gen/go-files/record.go_ new file mode 100644 index 0000000..2575a78 --- /dev/null +++ b/xata/internal/code-gen/go-files/record.go_ @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type Record map[string]interface{} diff --git a/xata/internal/code-gen/go-files/records_client.go_ b/xata/internal/code-gen/go-files/records_client.go_ new file mode 100644 index 0000000..7ff1a28 --- /dev/null +++ b/xata/internal/code-gen/go-files/records_client.go_ @@ -0,0 +1,637 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-workspace/generated/go/core" + io "io" + http "net/http" + url "net/url" +) + +type RecordsClient interface { + BranchTransaction(ctx context.Context, dbBranchName DbBranchName, request *BranchTransactionRequest) (*TransactionSuccess, error) + InsertRecord(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *InsertRecordRequest) (*InsertRecordResponse, error) + GetRecord(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *GetRecordRequest) (*Record, error) + UpsertRecordWithId(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *UpsertRecordWithIdRequest) (*UpsertRecordWithIdResponse, error) + InsertRecordWithId(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *InsertRecordWithIdRequest) (*InsertRecordWithIdResponse, error) + UpdateRecordWithId(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *UpdateRecordWithIdRequest) (*UpdateRecordWithIdResponse, error) + DeleteRecord(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId) error + BulkInsertTableRecords(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *BulkInsertTableRecordsRequest) (*BulkInsertTableRecordsResponse, error) +} + +func NewRecordsClient(opts ...core.ClientOption) RecordsClient { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &recordsClient{ + baseURL: options.BaseURL, + httpClient: options.HTTPClient, + header: options.ToHeader(), + } +} + +type recordsClient struct { + baseURL string + httpClient core.HTTPClient + header http.Header +} + +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +func (r *recordsClient) BranchTransaction(ctx context.Context, dbBranchName DbBranchName, request *BranchTransactionRequest) (*TransactionSuccess, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/transaction", dbBranchName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 429: + value := new(TooManyRequestsError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *TransactionSuccess + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Insert a new Record into the Table +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +func (r *recordsClient) InsertRecord(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *InsertRecordRequest) (*InsertRecordResponse, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data", dbBranchName, tableName) + + queryParams := make(url.Values) + for _, value := range request.Columns { + queryParams.Add("columns", fmt.Sprintf("%v", *value)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *InsertRecordResponse + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Retrieve record by ID +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +func (r *recordsClient) GetRecord(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *GetRecordRequest) (*Record, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v", dbBranchName, tableName, recordId) + + queryParams := make(url.Values) + for _, value := range request.Columns { + queryParams.Add("columns", fmt.Sprintf("%v", *value)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *Record + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodGet, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +func (r *recordsClient) UpsertRecordWithId(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *UpsertRecordWithIdRequest) (*UpsertRecordWithIdResponse, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v", dbBranchName, tableName, recordId) + + queryParams := make(url.Values) + if request.IfVersion != nil { + queryParams.Add("ifVersion", fmt.Sprintf("%v", *request.IfVersion)) + } + for _, value := range request.Columns { + queryParams.Add("columns", fmt.Sprintf("%v", *value)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 422: + value := new(UnprocessableEntityError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *UpsertRecordWithIdResponse + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation. +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +func (r *recordsClient) InsertRecordWithId(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *InsertRecordWithIdRequest) (*InsertRecordWithIdResponse, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v", dbBranchName, tableName, recordId) + + queryParams := make(url.Values) + if request.CreateOnly != nil { + queryParams.Add("createOnly", fmt.Sprintf("%v", *request.CreateOnly)) + } + if request.IfVersion != nil { + queryParams.Add("ifVersion", fmt.Sprintf("%v", *request.IfVersion)) + } + for _, value := range request.Columns { + queryParams.Add("columns", fmt.Sprintf("%v", *value)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 422: + value := new(UnprocessableEntityError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *InsertRecordWithIdResponse + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodPut, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +func (r *recordsClient) UpdateRecordWithId(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId, request *UpdateRecordWithIdRequest) (*UpdateRecordWithIdResponse, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v", dbBranchName, tableName, recordId) + + queryParams := make(url.Values) + if request.IfVersion != nil { + queryParams.Add("ifVersion", fmt.Sprintf("%v", *request.IfVersion)) + } + for _, value := range request.Columns { + queryParams.Add("columns", fmt.Sprintf("%v", *value)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 422: + value := new(UnprocessableEntityError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *UpdateRecordWithIdResponse + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodPatch, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +// The Record name +func (r *recordsClient) DeleteRecord(ctx context.Context, dbBranchName DbBranchName, tableName TableName, recordId RecordId) error { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/data/%v", dbBranchName, tableName, recordId) + + queryParams := make(url.Values) + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + //var response *Record + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodDelete, + nil, + nil, + false, + r.header, + errorDecoder, + ); err != nil { + return err + } + return nil +} + +// Bulk insert records +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +func (r *recordsClient) BulkInsertTableRecords(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *BulkInsertTableRecordsRequest) (*BulkInsertTableRecordsResponse, error) { + baseURL := "/" + if r.baseURL != "" { + baseURL = r.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/bulk", dbBranchName, tableName) + + queryParams := make(url.Values) + for _, value := range request.Columns { + queryParams.Add("columns", fmt.Sprintf("%v", *value)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 422: + value := new(UnprocessableEntityError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *BulkInsertTableRecordsResponse + if err := core.DoRequest( + ctx, + r.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + r.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} diff --git a/xata/internal/code-gen/go-files/transaction_success_results_item.go_ b/xata/internal/code-gen/go-files/transaction_success_results_item.go_ new file mode 100644 index 0000000..f13396b --- /dev/null +++ b/xata/internal/code-gen/go-files/transaction_success_results_item.go_ @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type TransactionSuccessResultsItem struct { + // The number of affected rows + Rows int `json:"rows,omitempty"` + Id RecordId `json:"id,omitempty"` + Columns *TransactionResultColumns `json:"columns,omitempty"` + Operation string `json:"operation"` +} diff --git a/xata/internal/code-gen/go-files/update_record_with_id_response.go_ b/xata/internal/code-gen/go-files/update_record_with_id_response.go_ new file mode 100644 index 0000000..efdbf04 --- /dev/null +++ b/xata/internal/code-gen/go-files/update_record_with_id_response.go_ @@ -0,0 +1,7 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type UpdateRecordWithIdResponse map[string]interface{} diff --git a/xata/internal/code-gen/go-files/upsert_record_with_id_response.go_ b/xata/internal/code-gen/go-files/upsert_record_with_id_response.go_ new file mode 100644 index 0000000..8af8613 --- /dev/null +++ b/xata/internal/code-gen/go-files/upsert_record_with_id_response.go_ @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +type UpsertRecordWithIdResponse map[string]interface{} + +//type UpsertRecordWithIdResponse struct { +// typeName string +// Record *Record +// UpsertRecordWithIdResponseId *UpsertRecordWithIdResponseId +//} +// +//func NewUpsertRecordWithIdResponseFromRecord(value *Record) *UpsertRecordWithIdResponse { +// return &UpsertRecordWithIdResponse{typeName: "record", Record: value} +//} +// +//func NewUpsertRecordWithIdResponseFromUpsertRecordWithIdResponseId(value *UpsertRecordWithIdResponseId) *UpsertRecordWithIdResponse { +// return &UpsertRecordWithIdResponse{typeName: "upsertRecordWithIdResponseId", UpsertRecordWithIdResponseId: value} +//} +// +//func (u *UpsertRecordWithIdResponse) UnmarshalJSON(data []byte) error { +// valueRecord := new(Record) +// if err := json.Unmarshal(data, &valueRecord); err == nil { +// u.typeName = "record" +// u.Record = valueRecord +// return nil +// } +// valueUpsertRecordWithIdResponseId := new(UpsertRecordWithIdResponseId) +// if err := json.Unmarshal(data, &valueUpsertRecordWithIdResponseId); err == nil { +// u.typeName = "upsertRecordWithIdResponseId" +// u.UpsertRecordWithIdResponseId = valueUpsertRecordWithIdResponseId +// return nil +// } +// return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +//} +// +//func (u UpsertRecordWithIdResponse) MarshalJSON() ([]byte, error) { +// switch u.typeName { +// default: +// return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) +// case "record": +// return json.Marshal(u.Record) +// case "upsertRecordWithIdResponseId": +// return json.Marshal(u.UpsertRecordWithIdResponseId) +// } +//} +// +//type UpsertRecordWithIdResponseVisitor interface { +// VisitRecord(*Record) error +// VisitUpsertRecordWithIdResponseId(*UpsertRecordWithIdResponseId) error +//} +// +//func (u *UpsertRecordWithIdResponse) Accept(v UpsertRecordWithIdResponseVisitor) error { +// switch u.typeName { +// default: +// return fmt.Errorf("invalid type %s in %T", u.typeName, u) +// case "record": +// return v.VisitRecord(u.Record) +// case "upsertRecordWithIdResponseId": +// return v.VisitUpsertRecordWithIdResponseId(u.UpsertRecordWithIdResponseId) +// } +//} diff --git a/xata/internal/code-gen/go-files/value_booster_value.go_ b/xata/internal/code-gen/go-files/value_booster_value.go_ new file mode 100644 index 0000000..3c27271 --- /dev/null +++ b/xata/internal/code-gen/go-files/value_booster_value.go_ @@ -0,0 +1,84 @@ +// SPDX-License-Identifier: Apache-2.0 + +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + fmt "fmt" +) + +// The exact value to boost. +type ValueBoosterValue struct { + typeName string + String string + Double float64 + Boolean bool +} + +func NewValueBoosterValueFromString(value string) *ValueBoosterValue { + return &ValueBoosterValue{typeName: "string", String: value} +} + +func NewValueBoosterValueFromDouble(value float64) *ValueBoosterValue { + return &ValueBoosterValue{typeName: "double", Double: value} +} + +func NewValueBoosterValueFromBoolean(value bool) *ValueBoosterValue { + return &ValueBoosterValue{typeName: "boolean", Boolean: value} +} + +func (v *ValueBoosterValue) UnmarshalJSON(data []byte) error { + var valueString string + if err := json.Unmarshal(data, &valueString); err == nil { + v.typeName = "string" + v.String = valueString + return nil + } + var valueDouble float64 + if err := json.Unmarshal(data, &valueDouble); err == nil { + v.typeName = "double" + v.Double = valueDouble + return nil + } + var valueBoolean bool + if err := json.Unmarshal(data, &valueBoolean); err == nil { + v.typeName = "boolean" + v.Boolean = valueBoolean + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, v) +} + +func (v ValueBoosterValue) MarshalJSON() ([]byte, error) { + switch v.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", v.typeName, v) + case "string": + return json.Marshal(v.String) + case "double": + return json.Marshal(v.Double) + case "boolean": + return json.Marshal(v.Boolean) + } +} + +type ValueBoosterValueVisitor interface { + VisitString(string) error + VisitDouble(float64) error + VisitBoolean(bool) error +} + +func (v *ValueBoosterValue) Accept(vv ValueBoosterValueVisitor) error { + switch v.typeName { + default: + return fmt.Errorf("invalid type %s in %T", v.typeName, v) + case "string": + return vv.VisitString(v.String) + case "double": + return vv.VisitDouble(v.Double) + case "boolean": + return vv.VisitBoolean(v.Boolean) + } +} diff --git a/xata/internal/code-gen/yaml-files/core-generators.yml b/xata/internal/code-gen/yaml-files/core-generators.yml new file mode 100644 index 0000000..f2d62ba --- /dev/null +++ b/xata/internal/code-gen/yaml-files/core-generators.yml @@ -0,0 +1,11 @@ +default-group: local +groups: + local: + generators: + - name: fernapi/fern-go-sdk + version: 0.0.14 + output: + location: local-file-system + path: ../../generated/go + config: + importPath: github.com/xataio/xata-go/xata/internal/fern-core/generated/go diff --git a/xata/internal/code-gen/yaml-files/workspace-generators.yml b/xata/internal/code-gen/yaml-files/workspace-generators.yml new file mode 100644 index 0000000..d9ce607 --- /dev/null +++ b/xata/internal/code-gen/yaml-files/workspace-generators.yml @@ -0,0 +1,11 @@ +default-group: local +groups: + local: + generators: + - name: fernapi/fern-go-sdk + version: 0.0.14 + output: + location: local-file-system + path: ../../generated/go + config: + importPath: github.com/xataio/xata-go/xata/internal/fern-workspace/generated/go diff --git a/xata/internal/fern-core/fern/api/openapi/core-openapi.json b/xata/internal/fern-core/fern/api/openapi/core-openapi.json new file mode 100644 index 0000000..3920b70 --- /dev/null +++ b/xata/internal/fern-core/fern/api/openapi/core-openapi.json @@ -0,0 +1 @@ +{"openapi":"3.0.0","info":{"title":"xata-auth","description":"Xata.io Auth API","version":"1.0","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"contact":{"name":"support@xata.io"}},"servers":[{"url":"/","description":""}],"paths":{"/user":{"summary":"User info","description":"This endpoint allows retrieving or updating a given user by their user ID.","get":{"operationId":"getUser","summary":"Get user details","description":"Return details of the user making the request","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithID"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]},"put":{"operationId":"updateUser","summary":"Update user info","description":"Update user info","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserWithID"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]},"delete":{"operationId":"deleteUser","summary":"Delete user","description":"Delete the user making the request","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Users"]}},"/user/keys":{"summary":"User API Keys","description":"This endpoint allows interacting with the API keys for a given user.","get":{"operationId":"getUserAPIKeys","summary":"Get the list of user API keys","description":"Retrieve a list of existing user API keys","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"required":["name","createdAt"]}}},"required":["keys"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]}},"/user/keys/{key_name}":{"summary":"Single User API Key","description":"This endpoint allows operations on a single API key for a given user.","parameters":[{"$ref":"#/components/parameters/APIKeyNameParam"}],"post":{"operationId":"createUserAPIKey","summary":"Create and return new API key","description":"Create and return new API key","responses":{"201":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"key":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"}},"required":["name","key","createdAt"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]},"delete":{"operationId":"deleteUserAPIKey","summary":"Delete an existing API key","description":"Delete an existing API key","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Authentication"]}},"/user/oauth/clients":{"summary":"User OAuth Clients","description":"this endpoint allows listing the clients the current user has authorized","get":{"operationId":"getUserOAuthClients","summary":"Get the list of user OAuth Clients","description":"Retrieve the list of OAuth Clients that a user has authorized","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"clients":{"type":"array","items":{"$ref":"#/components/schemas/OAuthClientPublicDetails"}}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/clients/{client_id}":{"parameters":[{"$ref":"#/components/parameters/OAuthClientIDParam"}],"delete":{"operationId":"deleteUserOAuthClient","summary":"Delete the oauth client for the user","description":"Delete the oauth client for the user and revoke all access","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/tokens":{"summary":"User OAuth Access Tokens","description":"this endpoint allows listing the valid access tokens on the current user's account","get":{"operationId":"getUserOAuthAccessTokens","summary":"Get the list of user OAuth Access Tokens","description":"Retrieve the list of valid OAuth Access Tokens on the current user's account","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"properties":{"accessTokens":{"type":"array","items":{"$ref":"#/components/schemas/OAuthAccessToken"}}},"required":["accessTokens"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/user/oauth/tokens/{token}":{"parameters":[{"$ref":"#/components/parameters/OAuthAccessTokenParam"}],"delete":{"operationId":"deleteOAuthAccessToken","summary":"delete an access token for a third party app","description":"Expires the access token for a third party app","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]},"patch":{"operationId":"updateOAuthAccessToken","summary":"updates an access token for a third party app","description":"Updates partially the access token for a third party app","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expires":{"description":"expiration time of the token as a unix timestamp","type":"integer"}},"required":["expires"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthAccessToken"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["OAuth"]}},"/workspaces":{"summary":"Workspaces","description":"This endpoint enables interacting with specific workspaces within Xata. For more information about workspaces, see the [docs](/concepts/workspaces).","get":{"operationId":"getWorkspacesList","summary":"Get list of workspaces","description":"Retrieve the list of workspaces the user belongs to","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"workspaces":{"type":"array","items":{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceID"},"name":{"type":"string"},"slug":{"type":"string"},"role":{"$ref":"#/components/schemas/Role"}},"required":["name","role","slug","id"]}}},"required":["workspaces"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"post":{"operationId":"createWorkspace","summary":"Create a new workspace","description":"Creates a new workspace with the user requesting it as its single owner.","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMeta"}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}":{"summary":"Workspace by ID","description":"This endpoint contains operations for a specific workspace, referenced by ID.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getWorkspace","summary":"Get an existing workspace","description":"Retrieve workspace info from a workspace ID","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"put":{"operationId":"updateWorkspace","summary":"Update an existing workspace","description":"Update workspace info","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMeta"}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Workspace"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"delete":{"operationId":"deleteWorkspace","summary":"Delete an existing workspace","description":"Delete the workspace with the provided ID","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/members":{"summary":"Workspace Members","description":"This endpoint allows operations concerning the members of a given workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getWorkspaceMembersList","summary":"Get the list members of a workspace","description":"Retrieve the list of members of the given workspace","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceMembers"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/members/{user_id}":{"summary":"Specific Workspace Member","description":"This endpoint enables operations on a specific member of a workspace, referenced by their user ID.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/UserIDParam"}],"put":{"operationId":"updateWorkspaceMemberRole","summary":"Update workspace member role","description":"Update a workspace member role. Workspaces must always have at least one owner, so this operation will fail if trying to remove owner role from the last owner in the workspace.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]},"delete":{"operationId":"removeWorkspaceMember","summary":"Remove a member from the workspace","description":"Remove the member from the workspace","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Workspaces"]}},"/workspaces/{workspace_id}/invites":{"summary":"Workspace Invites","description":"This endpoint enables working with invites for a given workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"post":{"operationId":"inviteWorkspaceMember","summary":"Invite a user to join the workspace","description":"Invite some user to join the workspace with the given role","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/Role"}},"required":["email","role"]}}}},"responses":{"201":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceInvite"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_id}":{"summary":"A specific invite within a given workspace","description":"This endpoint enables working with a given invite.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteIDParam"}],"patch":{"operationId":"updateWorkspaceMemberInvite","summary":"Updates an existing invite","description":"This operation provides a way to update an existing invite. Updates are performed in-place; they do not change the invite link, the expiry time, nor do they re-notify the recipient of the invite.\n","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"role":{"$ref":"#/components/schemas/Role"}},"required":["role"]}}}},"responses":{"200":{"description":"Updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspaceInvite"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]},"delete":{"operationId":"cancelWorkspaceMemberInvite","summary":"Deletes an invite","description":"This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.","responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_key}/accept":{"summary":"Accept an Invite","description":"This [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call)-style endpoint accepts a given invite to join a workspace.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteKeyParam"}],"post":{"operationId":"acceptWorkspaceMemberInvite","summary":"Accept the invitation to join a workspace","description":"Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace\n","responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/invites/{invite_id}/resend":{"summary":"Resend Invite notification","description":"Resend the notification for a previously generated Invite.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/InviteIDParam"}],"post":{"operationId":"resendWorkspaceMemberInvite","summary":"Resend Invite notification","description":"This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.","responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"403":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"tags":["Invites"]}},"/workspaces/{workspace_id}/dbs":{"summary":"Databases","description":"This path contains operations that can be performed on databases within Xata.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"getDatabaseList","summary":"List databases","description":"List all databases available in your Workspace.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListDatabasesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/dbs/{db_name}":{"summary":"Single Database","description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/DBNameParam"}],"put":{"operationId":"createDatabase","summary":"Create Database","description":"Create Database with identifier name","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"branchName":{"type":"string","minLength":1},"region":{"type":"string","minLength":1},"ui":{"type":"object","properties":{"color":{"type":"string"}}},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}},"example":{"branchName":"main","region":"us-east-1","metadata":{"repository":"github.com/my/repository","branch":"github repository","stage":"testing","labels":["development"]}},"required":["region"]}}}},"responses":{"201":{"description":"Created","headers":{"Location":{"schema":{"type":"string","format":"uri"}}},"content":{"application/json":{"schema":{"description":"","type":"object","properties":{"databaseName":{"type":"string","minLength":1},"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"example":{"databaseName":"New Database","status":"completed"},"required":["databaseName","status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"422":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"delete":{"operationId":"deleteDatabase","summary":"Delete Database","description":"Delete a database and all of its branches and tables permanently.","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"]}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"get":{"operationId":"getDatabaseMetadata","summary":"Get Database metadata","description":"Retrieve metadata of the given database","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]},"patch":{"operationId":"updateDatabaseMetadata","summary":"Update Database metadata","description":"Update the color of the selected database","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"ui":{"type":"object","properties":{"color":{"type":"string","minLength":1}}}}}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/dbs/{db_name}/rename":{"summary":"Rename database","description":"Given a parameter `db_name`, this path allows you to rename your Xata database. When you rename a database all URLs accessing the database have to be updated.","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"},{"$ref":"#/components/parameters/DBNameParam"}],"post":{"operationId":"renameDatabase","summary":"Rename Database","description":"Change the name of an existing database","requestBody":{"description":"","content":{"application/json":{"schema":{"description":"","type":"object","properties":{"newName":{"type":"string","minLength":1}},"required":["newName"]}}}},"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DatabaseMetadata"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"422":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}},"/workspaces/{workspace_id}/regions":{"summary":"Available regions","description":"This path allows to access the list of available database regions","parameters":[{"$ref":"#/components/parameters/WorkspaceIDParam"}],"get":{"operationId":"listRegions","summary":"List available regions","description":"List regions available to create a database on","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListRegionsResponse"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"tags":["Databases"]}}},"components":{"parameters":{"APIKeyNameParam":{"name":"key_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/APIKeyName"},"description":"API Key name"},"DBNameParam":{"name":"db_name","in":"path","required":true,"schema":{"$ref":"#/components/schemas/DBName"},"description":"The Database Name"},"InviteIDParam":{"name":"invite_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/InviteID"},"description":"Invite identifier"},"InviteKeyParam":{"name":"invite_key","in":"path","required":true,"schema":{"$ref":"#/components/schemas/InviteKey"},"description":"Invite Key (secret) for the invited user"},"OAuthAccessTokenParam":{"name":"token","in":"path","required":true,"schema":{"$ref":"#/components/schemas/AccessToken"}},"OAuthClientIDParam":{"name":"client_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/OAuthClientID"}},"UserIDParam":{"name":"user_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/UserID"},"description":"UserID"},"WorkspaceIDParam":{"name":"workspace_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/WorkspaceID"},"description":"Workspace ID"}},"schemas":{"APIKeyName":{"type":"string","pattern":"[a-zA-Z0-9_\\-~]*","title":"APIKeyName"},"AccessToken":{"type":"string","title":"AccessToken"},"AuthorizationCodeRequest":{"type":"object","properties":{"state":{"type":"string"},"redirectUri":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"}},"clientId":{"type":"string"},"responseType":{"$ref":"#/components/schemas/OAuthResponseType"}},"required":["clientId","responseType"]},"AuthorizationCodeResponse":{"type":"object","properties":{"state":{"type":"string"},"redirectUri":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/OAuthScope"}},"clientId":{"type":"string"},"expires":{"type":"string","format":"date-time","readOnly":true},"code":{"type":"string","readOnly":true}}},"BranchMetadata":{"description":"","type":"object","properties":{"repository":{"type":"string","minLength":1},"branch":{"$ref":"#/components/schemas/BranchName"},"stage":{"type":"string","minLength":1},"labels":{"type":"array","items":{"type":"string"}}},"example":{"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}},"BranchName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"BranchName"},"DBName":{"type":"string","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"DBName"},"DatabaseGithubSettings":{"description":"Github repository settings for this database (optional)","type":"object","properties":{"owner":{"description":"Repository owner (user or organization)","type":"string"},"repo":{"description":"Repository name","type":"string"}},"additionalProperties":false,"required":["owner","repo"]},"DatabaseMetadata":{"description":"Metadata of databases","type":"object","properties":{"name":{"description":"The machine-readable name of a database","type":"string"},"region":{"description":"Region where this database is hosted","type":"string"},"createdAt":{"description":"The time this database was created","$ref":"#/components/schemas/DateTime"},"ui":{"description":"Metadata about the database for display in Xata user interfaces","type":"object","properties":{"color":{"description":"The user-selected color for this database across interfaces","type":"string"}}}},"additionalProperties":false,"required":["name","createdAt","region"]},"DateTime":{"type":"string","format":"date-time","title":"DateTime"},"InviteID":{"type":"string","pattern":"[a-zA-Z0-9]+","title":"InviteID"},"InviteKey":{"type":"string","pattern":"^ik_[a-zA-Z0-9]+","title":"InviteKey"},"ListDatabasesResponse":{"type":"object","properties":{"databases":{"description":"A list of databases in a Xata workspace","type":"array","items":{"$ref":"#/components/schemas/DatabaseMetadata"}}},"required":["databases"]},"ListRegionsResponse":{"type":"object","properties":{"regions":{"description":"A list of regions where databases can be created","type":"array","items":{"$ref":"#/components/schemas/Region"}}},"required":["regions"]},"MigrationStatus":{"type":"string","enum":["completed","pending","failed"]},"OAuthAccessToken":{"type":"object","properties":{"token":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"expiresAt":{"type":"string","format":"date-time"},"clientId":{"type":"string"}},"required":["token","scopes","createdAt","updatedAt","expiresAt","clientId"]},"OAuthClientID":{"type":"string"},"OAuthClientPublicDetails":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"icon":{"type":"string"},"clientId":{"type":"string"}},"required":["clientId"]},"OAuthResponseType":{"type":"string","enum":["code"]},"OAuthScope":{"type":"string","enum":["admin:all"]},"Region":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]},"Role":{"type":"string","enum":["owner","maintainer"]},"User":{"type":"object","properties":{"email":{"type":"string","format":"email"},"fullname":{"type":"string"},"image":{"type":"string"}},"required":["fullname","email","image"]},"UserID":{"type":"string","pattern":"[a-zA-Z0-9_-~:]+","title":"UserID"},"UserWithID":{"allOf":[{"$ref":"#/components/schemas/User"},{"type":"object","properties":{"id":{"$ref":"#/components/schemas/UserID"}},"required":["id"]}]},"Workspace":{"allOf":[{"$ref":"#/components/schemas/WorkspaceMeta"},{"type":"object","properties":{"id":{"$ref":"#/components/schemas/WorkspaceID"},"memberCount":{"type":"integer"},"plan":{"type":"string","enum":["free","pro"]}},"required":["id","memberCount","plan"]}]},"WorkspaceID":{"type":"string","pattern":"^([a-zA-Z0-9][a-zA-Z0-9_\\-~]+-)?[a-zA-Z0-9]{6}","title":"WorkspaceID"},"WorkspaceInvite":{"type":"object","properties":{"inviteId":{"$ref":"#/components/schemas/InviteID"},"email":{"type":"string","format":"email"},"expires":{"type":"string","format":"date-time"},"role":{"$ref":"#/components/schemas/Role"}},"required":["inviteId","email","expires","role"]},"WorkspaceMember":{"type":"object","properties":{"userId":{"$ref":"#/components/schemas/UserID"},"fullname":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"$ref":"#/components/schemas/Role"}},"required":["userId","email","fullname","role"]},"WorkspaceMembers":{"type":"object","properties":{"members":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceMember"}},"invites":{"type":"array","items":{"$ref":"#/components/schemas/WorkspaceInvite"}}},"required":["members","invites"]},"WorkspaceMeta":{"type":"object","properties":{"name":{"type":"string"},"slug":{"type":"string"}},"required":["name"]}},"responses":{"AuthError":{"description":"Authentication Error","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"example":{"message":"invalid API key"},"required":["message"]}}}},"BadRequestError":{"description":"Bad Request","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}},"SimpleError":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"]}}}}},"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"Workspaces","description":"Workspaces management","x-displayName":"Workspaces"},{"name":"Users","description":"Users management","x-displayName":"Users"},{"name":"Invites","description":"Manage user invites.","x-displayName":"Invites"},{"name":"Authentication","description":"Authentication and API Key management.","x-displayName":"Authentication"},{"name":"OAuth","x-displayName":"OAuth"},{"name":"auth_other","x-displayName":"other"},{"name":"Databases","description":"Workspace databases management.","x-displayName":"Databases"},{"name":"xbcontrol_other","x-displayName":"other"}],"x-tagGroups":[{"name":"auth","tags":["Workspaces","Users","Invites","Authentication","OAuth","auth_other"],"description":"Xata.io Auth API"},{"name":"xbcontrol","tags":["Databases","xbcontrol_other"],"description":"Xata.io Xatabases API"}]} \ No newline at end of file diff --git a/xata/internal/fern-core/fern/api/openapi/openapi.yml b/xata/internal/fern-core/fern/api/openapi/openapi.yml deleted file mode 100644 index ae2a486..0000000 --- a/xata/internal/fern-core/fern/api/openapi/openapi.yml +++ /dev/null @@ -1,1460 +0,0 @@ -openapi: 3.0.0 -info: - title: xata-auth - description: Xata.io Auth API - version: '1.0' - license: - name: Apache 2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.html - contact: - name: support@xata.io -servers: - - url: / - description: '' -paths: - /user: - summary: User info - description: This endpoint allows retrieving or updating a given user by their user ID. - get: - operationId: getUser - summary: Get user details - description: Return details of the user making the request - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserWithID' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Users - put: - operationId: updateUser - summary: Update user info - description: Update user info - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/User' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/UserWithID' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Users - delete: - operationId: deleteUser - summary: Delete user - description: Delete the user making the request - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Users - /user/keys: - summary: User API Keys - description: This endpoint allows interacting with the API keys for a given user. - get: - operationId: getUserAPIKeys - summary: Get the list of user API keys - description: Retrieve a list of existing user API keys - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - keys: - type: array - items: - type: object - properties: - name: - type: string - createdAt: - $ref: '#/components/schemas/DateTime' - required: - - name - - createdAt - required: - - keys - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Authentication - /user/keys/{key_name}: - summary: Single User API Key - description: This endpoint allows operations on a single API key for a given user. - parameters: - - $ref: '#/components/parameters/APIKeyNameParam' - post: - operationId: createUserAPIKey - summary: Create and return new API key - description: Create and return new API key - responses: - '201': - description: OK - content: - application/json: - schema: - type: object - properties: - name: - type: string - key: - type: string - createdAt: - $ref: '#/components/schemas/DateTime' - required: - - name - - key - - createdAt - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Authentication - delete: - operationId: deleteUserAPIKey - summary: Delete an existing API key - description: Delete an existing API key - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Authentication - /user/oauth/clients: - summary: User OAuth Clients - description: this endpoint allows listing the clients the current user has authorized - get: - operationId: getUserOAuthClients - summary: Get the list of user OAuth Clients - description: Retrieve the list of OAuth Clients that a user has authorized - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - clients: - type: array - items: - $ref: '#/components/schemas/OAuthClientPublicDetails' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - OAuth - /user/oauth/clients/{client_id}: - parameters: - - $ref: '#/components/parameters/OAuthClientIDParam' - delete: - operationId: deleteUserOAuthClient - summary: Delete the oauth client for the user - description: Delete the oauth client for the user and revoke all access - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - OAuth - /user/oauth/tokens: - summary: User OAuth Access Tokens - description: >- - this endpoint allows listing the valid access tokens on the current user's - account - get: - operationId: getUserOAuthAccessTokens - summary: Get the list of user OAuth Access Tokens - description: >- - Retrieve the list of valid OAuth Access Tokens on the current user's - account - responses: - '200': - description: OK - content: - application/json: - schema: - properties: - accessTokens: - type: array - items: - $ref: '#/components/schemas/OAuthAccessToken' - required: - - accessTokens - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - OAuth - /user/oauth/tokens/{token}: - parameters: - - $ref: '#/components/parameters/OAuthAccessTokenParam' - delete: - operationId: deleteOAuthAccessToken - summary: delete an access token for a third party app - description: Expires the access token for a third party app - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '409': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - OAuth - patch: - operationId: updateOAuthAccessToken - summary: updates an access token for a third party app - description: Updates partially the access token for a third party app - requestBody: - content: - application/json: - schema: - type: object - properties: - expires: - description: expiration time of the token as a unix timestamp - type: integer - required: - - expires - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/OAuthAccessToken' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '409': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - OAuth - /workspaces: - summary: Workspaces - description: >- - This endpoint enables interacting with specific workspaces within Xata. - For more information about workspaces, see the - [docs](/concepts/workspaces). - get: - operationId: getWorkspacesList - summary: Get list of workspaces - description: Retrieve the list of workspaces the user belongs to - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - workspaces: - type: array - items: - type: object - properties: - id: - $ref: '#/components/schemas/WorkspaceID' - name: - type: string - slug: - type: string - role: - $ref: '#/components/schemas/Role' - required: - - name - - role - - slug - - id - required: - - workspaces - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - post: - operationId: createWorkspace - summary: Create a new workspace - description: Creates a new workspace with the user requesting it as its single owner. - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/WorkspaceMeta' - responses: - '201': - description: Created - content: - application/json: - schema: - $ref: '#/components/schemas/Workspace' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - /workspaces/{workspace_id}: - summary: Workspace by ID - description: >- - This endpoint contains operations for a specific workspace, referenced by - ID. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - get: - operationId: getWorkspace - summary: Get an existing workspace - description: Retrieve workspace info from a workspace ID - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Workspace' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - put: - operationId: updateWorkspace - summary: Update an existing workspace - description: Update workspace info - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/WorkspaceMeta' - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/Workspace' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - delete: - operationId: deleteWorkspace - summary: Delete an existing workspace - description: Delete the workspace with the provided ID - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - /workspaces/{workspace_id}/members: - summary: Workspace Members - description: >- - This endpoint allows operations concerning the members of a given - workspace. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - get: - operationId: getWorkspaceMembersList - summary: Get the list members of a workspace - description: Retrieve the list of members of the given workspace - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/WorkspaceMembers' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - /workspaces/{workspace_id}/members/{user_id}: - summary: Specific Workspace Member - description: >- - This endpoint enables operations on a specific member of a workspace, - referenced by their user ID. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - - $ref: '#/components/parameters/UserIDParam' - put: - operationId: updateWorkspaceMemberRole - summary: Update workspace member role - description: > - Update a workspace member role. Workspaces must always have at least one - owner, so this operation will fail if trying to remove owner role from - the last owner in the workspace. - requestBody: - content: - application/json: - schema: - type: object - properties: - role: - $ref: '#/components/schemas/Role' - required: - - role - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - delete: - operationId: removeWorkspaceMember - summary: Remove a member from the workspace - description: Remove the member from the workspace - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Workspaces - /workspaces/{workspace_id}/invites: - summary: Workspace Invites - description: This endpoint enables working with invites for a given workspace. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - post: - operationId: inviteWorkspaceMember - summary: Invite a user to join the workspace - description: Invite some user to join the workspace with the given role - requestBody: - content: - application/json: - schema: - type: object - properties: - email: - type: string - format: email - role: - $ref: '#/components/schemas/Role' - required: - - email - - role - responses: - '201': - description: Created - content: - application/json: - schema: - $ref: '#/components/schemas/WorkspaceInvite' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '409': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Invites - /workspaces/{workspace_id}/invites/{invite_id}: - summary: A specific invite within a given workspace - description: This endpoint enables working with a given invite. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - - $ref: '#/components/parameters/InviteIDParam' - patch: - operationId: updateWorkspaceMemberInvite - summary: Updates an existing invite - description: > - This operation provides a way to update an existing invite. Updates are - performed in-place; they do not change the invite link, the expiry time, - nor do they re-notify the recipient of the invite. - requestBody: - content: - application/json: - schema: - type: object - properties: - role: - $ref: '#/components/schemas/Role' - required: - - role - responses: - '200': - description: Updated successfully. - content: - application/json: - schema: - $ref: '#/components/schemas/WorkspaceInvite' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Invites - delete: - operationId: cancelWorkspaceMemberInvite - summary: Deletes an invite - description: >- - This operation provides a way to cancel invites by deleting them. - Already accepted invites cannot be deleted. - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Invites - /workspaces/{workspace_id}/invites/{invite_key}/accept: - summary: Accept an Invite - description: >- - This [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call)-style - endpoint accepts a given invite to join a workspace. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - - $ref: '#/components/parameters/InviteKeyParam' - post: - operationId: acceptWorkspaceMemberInvite - summary: Accept the invitation to join a workspace - description: > - Accept the invitation to join a workspace. If the operation succeeds the - user will be a member of the workspace - responses: - '204': - description: OK - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Invites - /workspaces/{workspace_id}/invites/{invite_id}/resend: - summary: Resend Invite notification - description: Resend the notification for a previously generated Invite. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - - $ref: '#/components/parameters/InviteIDParam' - post: - operationId: resendWorkspaceMemberInvite - summary: Resend Invite notification - description: >- - This operation provides a way to resend an Invite notification. Invite - notifications can only be sent for Invites not yet accepted. - responses: - '204': - description: OK - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '403': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - tags: - - Invites - /workspaces/{workspace_id}/dbs: - summary: Databases - description: >- - This path contains operations that can be performed on databases within - Xata. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - get: - operationId: getDatabaseList - summary: List databases - description: List all databases available in your Workspace. - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListDatabasesResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases - /workspaces/{workspace_id}/dbs/{db_name}: - summary: Single Database - description: >- - Given a parameter `db_name`, this path allows interacting with a specific - database on Xata. Below are a number of operations that can be performed - on a given database. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - - $ref: '#/components/parameters/DBNameParam' - put: - operationId: createDatabase - summary: Create Database - description: Create Database with identifier name - requestBody: - description: '' - content: - application/json: - schema: - description: '' - type: object - properties: - branchName: - type: string - minLength: 1 - region: - type: string - minLength: 1 - ui: - type: object - properties: - color: - type: string - metadata: - $ref: '#/components/schemas/BranchMetadata' - example: - branchName: main - region: us-east-1 - metadata: - repository: github.com/my/repository - branch: github repository - stage: testing - labels: - - development - required: - - region - responses: - '201': - description: Created - headers: - Location: - schema: - type: string - format: uri - content: - application/json: - schema: - description: '' - type: object - properties: - databaseName: - type: string - minLength: 1 - branchName: - type: string - status: - $ref: '#/components/schemas/MigrationStatus' - example: - databaseName: New Database - status: completed - required: - - databaseName - - status - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '422': - $ref: '#/components/responses/SimpleError' - '423': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases - delete: - operationId: deleteDatabase - summary: Delete Database - description: Delete a database and all of its branches and tables permanently. - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - status: - $ref: '#/components/schemas/MigrationStatus' - required: - - status - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases - get: - operationId: getDatabaseMetadata - summary: Get Database metadata - description: Retrieve metadata of the given database - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/DatabaseMetadata' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases - patch: - operationId: updateDatabaseMetadata - summary: Update Database metadata - description: Update the color of the selected database - requestBody: - description: '' - content: - application/json: - schema: - description: '' - type: object - properties: - ui: - type: object - properties: - color: - type: string - minLength: 1 - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/DatabaseMetadata' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases - /workspaces/{workspace_id}/dbs/{db_name}/rename: - summary: Rename database - description: >- - Given a parameter `db_name`, this path allows you to rename your Xata - database. When you rename a database all URLs accessing the database have - to be updated. - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - - $ref: '#/components/parameters/DBNameParam' - post: - operationId: renameDatabase - summary: Rename Database - description: Change the name of an existing database - requestBody: - description: '' - content: - application/json: - schema: - description: '' - type: object - properties: - newName: - type: string - minLength: 1 - required: - - newName - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/DatabaseMetadata' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '422': - $ref: '#/components/responses/SimpleError' - '423': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases - /workspaces/{workspace_id}/regions: - summary: Available regions - description: This path allows to access the list of available database regions - parameters: - - $ref: '#/components/parameters/WorkspaceIDParam' - get: - operationId: listRegions - summary: List available regions - description: List regions available to create a database on - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListRegionsResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - 5XX: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Databases -components: - parameters: - APIKeyNameParam: - name: key_name - in: path - required: true - schema: - $ref: '#/components/schemas/APIKeyName' - description: API Key name - DBNameParam: - name: db_name - in: path - required: true - schema: - $ref: '#/components/schemas/DBName' - description: The Database Name - InviteIDParam: - name: invite_id - in: path - required: true - schema: - $ref: '#/components/schemas/InviteID' - description: Invite identifier - InviteKeyParam: - name: invite_key - in: path - required: true - schema: - $ref: '#/components/schemas/InviteKey' - description: Invite Key (secret) for the invited user - OAuthAccessTokenParam: - name: token - in: path - required: true - schema: - $ref: '#/components/schemas/AccessToken' - OAuthClientIDParam: - name: client_id - in: path - required: true - schema: - $ref: '#/components/schemas/OAuthClientID' - UserIDParam: - name: user_id - in: path - required: true - schema: - $ref: '#/components/schemas/UserID' - description: UserID - WorkspaceIDParam: - name: workspace_id - in: path - required: true - schema: - $ref: '#/components/schemas/WorkspaceID' - description: Workspace ID - schemas: - APIKeyName: - type: string - pattern: '[a-zA-Z0-9_\-~]*' - title: APIKeyName - AccessToken: - type: string - title: AccessToken - AuthorizationCodeRequest: - type: object - properties: - state: - type: string - redirectUri: - type: string - scopes: - type: array - items: - $ref: '#/components/schemas/OAuthScope' - clientId: - type: string - responseType: - $ref: '#/components/schemas/OAuthResponseType' - required: - - clientId - - responseType - AuthorizationCodeResponse: - type: object - properties: - state: - type: string - redirectUri: - type: string - scopes: - type: array - items: - $ref: '#/components/schemas/OAuthScope' - clientId: - type: string - expires: - type: string - format: date-time - readOnly: true - code: - type: string - readOnly: true - BranchMetadata: - description: '' - type: object - properties: - repository: - type: string - minLength: 1 - branch: - $ref: '#/components/schemas/BranchName' - stage: - type: string - minLength: 1 - labels: - type: array - items: - type: string - example: - repository: github.com/my/repository - branch: feature-login - stage: testing - labels: - - epic-100 - BranchName: - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_\-~]+' - title: BranchName - DBName: - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_\-~]+' - title: DBName - DatabaseGithubSettings: - description: Github repository settings for this database (optional) - type: object - properties: - owner: - description: Repository owner (user or organization) - type: string - repo: - description: Repository name - type: string - additionalProperties: false - required: - - owner - - repo - DatabaseMetadata: - description: Metadata of databases - type: object - properties: - name: - description: The machine-readable name of a database - type: string - region: - description: Region where this database is hosted - type: string - createdAt: - description: The time this database was created - $ref: '#/components/schemas/DateTime' - ui: - description: Metadata about the database for display in Xata user interfaces - type: object - properties: - color: - description: The user-selected color for this database across interfaces - type: string - additionalProperties: false - required: - - name - - createdAt - - region - DateTime: - type: string - format: date-time - title: DateTime - InviteID: - type: string - pattern: '[a-zA-Z0-9]+' - title: InviteID - InviteKey: - type: string - pattern: ^ik_[a-zA-Z0-9]+ - title: InviteKey - ListDatabasesResponse: - type: object - properties: - databases: - description: A list of databases in a Xata workspace - type: array - items: - $ref: '#/components/schemas/DatabaseMetadata' - required: - - databases - ListRegionsResponse: - type: object - properties: - regions: - description: A list of regions where databases can be created - type: array - items: - $ref: '#/components/schemas/Region' - required: - - regions - MigrationStatus: - type: string - enum: - - completed - - pending - - failed - OAuthAccessToken: - type: object - properties: - token: - type: string - scopes: - type: array - items: - type: string - createdAt: - type: string - format: date-time - updatedAt: - type: string - format: date-time - expiresAt: - type: string - format: date-time - clientId: - type: string - required: - - token - - scopes - - createdAt - - updatedAt - - expiresAt - - clientId - OAuthClientID: - type: string - OAuthClientPublicDetails: - type: object - properties: - name: - type: string - description: - type: string - icon: - type: string - clientId: - type: string - required: - - clientId - OAuthResponseType: - type: string - enum: - - code - OAuthScope: - type: string - enum: - - admin:all - Region: - type: object - properties: - id: - type: string - name: - type: string - required: - - id - - name - Role: - type: string - enum: - - owner - - maintainer - User: - type: object - properties: - email: - type: string - format: email - fullname: - type: string - image: - type: string - required: - - fullname - - email - - image - UserID: - type: string - pattern: '[a-zA-Z0-9_-~:]+' - title: UserID - UserWithID: - allOf: - - $ref: '#/components/schemas/User' - - type: object - properties: - id: - $ref: '#/components/schemas/UserID' - required: - - id - Workspace: - allOf: - - $ref: '#/components/schemas/WorkspaceMeta' - - type: object - properties: - id: - $ref: '#/components/schemas/WorkspaceID' - memberCount: - type: integer - plan: - type: string - enum: - - free - - pro - required: - - id - - memberCount - - plan - WorkspaceID: - type: string - pattern: ^([a-zA-Z0-9][a-zA-Z0-9_\-~]+-)?[a-zA-Z0-9]{6} - title: WorkspaceID - WorkspaceInvite: - type: object - properties: - inviteId: - $ref: '#/components/schemas/InviteID' - email: - type: string - format: email - expires: - type: string - format: date-time - role: - $ref: '#/components/schemas/Role' - required: - - inviteId - - email - - expires - - role - WorkspaceMember: - type: object - properties: - userId: - $ref: '#/components/schemas/UserID' - fullname: - type: string - email: - type: string - format: email - role: - $ref: '#/components/schemas/Role' - required: - - userId - - email - - fullname - - role - WorkspaceMembers: - type: object - properties: - members: - type: array - items: - $ref: '#/components/schemas/WorkspaceMember' - invites: - type: array - items: - $ref: '#/components/schemas/WorkspaceInvite' - required: - - members - - invites - WorkspaceMeta: - type: object - properties: - name: - type: string - slug: - type: string - required: - - name - responses: - AuthError: - description: Authentication Error - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - example: - message: invalid API key - required: - - message - BadRequestError: - description: Bad Request - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - required: - - message - SimpleError: - description: Example response - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - required: - - message - securitySchemes: - bearerAuth: - type: http - scheme: bearer -tags: - - name: Workspaces - description: Workspaces management - x-displayName: Workspaces - - name: Users - description: Users management - x-displayName: Users - - name: Invites - description: Manage user invites. - x-displayName: Invites - - name: Authentication - description: Authentication and API Key management. - x-displayName: Authentication - - name: OAuth - x-displayName: OAuth - - name: auth_other - x-displayName: other - - name: Databases - description: Workspace databases management. - x-displayName: Databases - - name: xbcontrol_other - x-displayName: other -x-tagGroups: - - name: auth - tags: - - Workspaces - - Users - - Invites - - Authentication - - OAuth - - auth_other - description: Xata.io Auth API - - name: xbcontrol - tags: - - Databases - - xbcontrol_other - description: Xata.io Xatabases API diff --git a/xata/internal/fern-core/fern/fern.config.json b/xata/internal/fern-core/fern/fern.config.json index ce7a453..d0e34d8 100644 --- a/xata/internal/fern-core/fern/fern.config.json +++ b/xata/internal/fern-core/fern/fern.config.json @@ -1,4 +1,4 @@ { - "organization": "tomasdembelli", + "organization": "omerdemirok", "version": "0.14.3" } \ No newline at end of file diff --git a/xata/internal/fern-core/generated/go/access_token.go b/xata/internal/fern-core/generated/go/access_token.go index 5c99ff7..37b3622 100644 --- a/xata/internal/fern-core/generated/go/access_token.go +++ b/xata/internal/fern-core/generated/go/access_token.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/api_key_name.go b/xata/internal/fern-core/generated/go/api_key_name.go index 6075b56..07850d3 100644 --- a/xata/internal/fern-core/generated/go/api_key_name.go +++ b/xata/internal/fern-core/generated/go/api_key_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/authentication_client.go b/xata/internal/fern-core/generated/go/authentication_client.go index dc61439..3a0ae27 100644 --- a/xata/internal/fern-core/generated/go/authentication_client.go +++ b/xata/internal/fern-core/generated/go/authentication_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,9 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" io "io" http "net/http" - - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) type AuthenticationClient interface { diff --git a/xata/internal/fern-core/generated/go/authorization_code_request.go b/xata/internal/fern-core/generated/go/authorization_code_request.go index a3b9651..8369df6 100644 --- a/xata/internal/fern-core/generated/go/authorization_code_request.go +++ b/xata/internal/fern-core/generated/go/authorization_code_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/authorization_code_response.go b/xata/internal/fern-core/generated/go/authorization_code_response.go index d8b4895..20323b9 100644 --- a/xata/internal/fern-core/generated/go/authorization_code_response.go +++ b/xata/internal/fern-core/generated/go/authorization_code_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/bad_request_error.go b/xata/internal/fern-core/generated/go/bad_request_error.go index 53ddf7f..7b8ed67 100644 --- a/xata/internal/fern-core/generated/go/bad_request_error.go +++ b/xata/internal/fern-core/generated/go/bad_request_error.go @@ -1,12 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( json "encoding/json" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) diff --git a/xata/internal/fern-core/generated/go/branch_metadata.go b/xata/internal/fern-core/generated/go/branch_metadata.go index b999612..d6d4242 100644 --- a/xata/internal/fern-core/generated/go/branch_metadata.go +++ b/xata/internal/fern-core/generated/go/branch_metadata.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/branch_name.go b/xata/internal/fern-core/generated/go/branch_name.go index 16f4574..5866fb7 100644 --- a/xata/internal/fern-core/generated/go/branch_name.go +++ b/xata/internal/fern-core/generated/go/branch_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/client.go b/xata/internal/fern-core/generated/go/client.go index 3dea334..f2d16fe 100644 --- a/xata/internal/fern-core/generated/go/client.go +++ b/xata/internal/fern-core/generated/go/client.go @@ -1,13 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( - http "net/http" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" + http "net/http" ) type Client interface { diff --git a/xata/internal/fern-core/generated/go/client_options.go b/xata/internal/fern-core/generated/go/client_options.go index 020eb0a..8398099 100644 --- a/xata/internal/fern-core/generated/go/client_options.go +++ b/xata/internal/fern-core/generated/go/client_options.go @@ -1,13 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( - http "net/http" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" + http "net/http" ) // ClientWithBaseURL sets the client's base URL, overriding the diff --git a/xata/internal/fern-core/generated/go/conflict_error.go b/xata/internal/fern-core/generated/go/conflict_error.go index 2114ce4..2b2539d 100644 --- a/xata/internal/fern-core/generated/go/conflict_error.go +++ b/xata/internal/fern-core/generated/go/conflict_error.go @@ -1,12 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( json "encoding/json" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) diff --git a/xata/internal/fern-core/generated/go/core/client_option.go b/xata/internal/fern-core/generated/go/core/client_option.go index 87e6b85..485cf93 100644 --- a/xata/internal/fern-core/generated/go/core/client_option.go +++ b/xata/internal/fern-core/generated/go/core/client_option.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package core diff --git a/xata/internal/fern-core/generated/go/core/core.go b/xata/internal/fern-core/generated/go/core/core.go index 76679c8..6f7e370 100644 --- a/xata/internal/fern-core/generated/go/core/core.go +++ b/xata/internal/fern-core/generated/go/core/core.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - package core import ( diff --git a/xata/internal/fern-core/generated/go/create_database_request.go b/xata/internal/fern-core/generated/go/create_database_request.go index 46c9c8e..eafebb3 100644 --- a/xata/internal/fern-core/generated/go/create_database_request.go +++ b/xata/internal/fern-core/generated/go/create_database_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/create_database_request_ui.go b/xata/internal/fern-core/generated/go/create_database_request_ui.go index efbab34..876fb94 100644 --- a/xata/internal/fern-core/generated/go/create_database_request_ui.go +++ b/xata/internal/fern-core/generated/go/create_database_request_ui.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/create_database_response.go b/xata/internal/fern-core/generated/go/create_database_response.go index 631b7b4..747a20a 100644 --- a/xata/internal/fern-core/generated/go/create_database_response.go +++ b/xata/internal/fern-core/generated/go/create_database_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/create_user_api_key_response.go b/xata/internal/fern-core/generated/go/create_user_api_key_response.go index 55ad7aa..43e6848 100644 --- a/xata/internal/fern-core/generated/go/create_user_api_key_response.go +++ b/xata/internal/fern-core/generated/go/create_user_api_key_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/database_github_settings.go b/xata/internal/fern-core/generated/go/database_github_settings.go index edccc83..58d18cf 100644 --- a/xata/internal/fern-core/generated/go/database_github_settings.go +++ b/xata/internal/fern-core/generated/go/database_github_settings.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/database_metadata.go b/xata/internal/fern-core/generated/go/database_metadata.go index 33a5ba9..a818d27 100644 --- a/xata/internal/fern-core/generated/go/database_metadata.go +++ b/xata/internal/fern-core/generated/go/database_metadata.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/database_metadata_ui.go b/xata/internal/fern-core/generated/go/database_metadata_ui.go index bdbed0d..4bc7855 100644 --- a/xata/internal/fern-core/generated/go/database_metadata_ui.go +++ b/xata/internal/fern-core/generated/go/database_metadata_ui.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/databases_client.go b/xata/internal/fern-core/generated/go/databases_client.go index 8f3ff96..36894e8 100644 --- a/xata/internal/fern-core/generated/go/databases_client.go +++ b/xata/internal/fern-core/generated/go/databases_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,9 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" io "io" http "net/http" - - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) type DatabasesClient interface { diff --git a/xata/internal/fern-core/generated/go/date_time.go b/xata/internal/fern-core/generated/go/date_time.go index 180ae90..c0d5a95 100644 --- a/xata/internal/fern-core/generated/go/date_time.go +++ b/xata/internal/fern-core/generated/go/date_time.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/db_name.go b/xata/internal/fern-core/generated/go/db_name.go index 0ba11f3..031867d 100644 --- a/xata/internal/fern-core/generated/go/db_name.go +++ b/xata/internal/fern-core/generated/go/db_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/delete_database_response.go b/xata/internal/fern-core/generated/go/delete_database_response.go index d52ad60..215da21 100644 --- a/xata/internal/fern-core/generated/go/delete_database_response.go +++ b/xata/internal/fern-core/generated/go/delete_database_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/doc.go b/xata/internal/fern-core/generated/go/doc.go index 6bcf96a..2e77dad 100644 --- a/xata/internal/fern-core/generated/go/doc.go +++ b/xata/internal/fern-core/generated/go/doc.go @@ -1,6 +1,4 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. -// Workspace databases management. +// Manage user invites. package api diff --git a/xata/internal/fern-core/generated/go/environments.go b/xata/internal/fern-core/generated/go/environments.go index 902bb97..133438d 100644 --- a/xata/internal/fern-core/generated/go/environments.go +++ b/xata/internal/fern-core/generated/go/environments.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/forbidden_error.go b/xata/internal/fern-core/generated/go/forbidden_error.go index 32885d5..5a6064f 100644 --- a/xata/internal/fern-core/generated/go/forbidden_error.go +++ b/xata/internal/fern-core/generated/go/forbidden_error.go @@ -1,12 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( json "encoding/json" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) diff --git a/xata/internal/fern-core/generated/go/get_user_api_keys_response.go b/xata/internal/fern-core/generated/go/get_user_api_keys_response.go index 0e5a0e4..9937c09 100644 --- a/xata/internal/fern-core/generated/go/get_user_api_keys_response.go +++ b/xata/internal/fern-core/generated/go/get_user_api_keys_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/get_user_api_keys_response_keys_item.go b/xata/internal/fern-core/generated/go/get_user_api_keys_response_keys_item.go index 3a2e042..91d4971 100644 --- a/xata/internal/fern-core/generated/go/get_user_api_keys_response_keys_item.go +++ b/xata/internal/fern-core/generated/go/get_user_api_keys_response_keys_item.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/get_user_o_auth_access_tokens_response.go b/xata/internal/fern-core/generated/go/get_user_o_auth_access_tokens_response.go index c0aee51..de7c736 100644 --- a/xata/internal/fern-core/generated/go/get_user_o_auth_access_tokens_response.go +++ b/xata/internal/fern-core/generated/go/get_user_o_auth_access_tokens_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/get_user_o_auth_clients_response.go b/xata/internal/fern-core/generated/go/get_user_o_auth_clients_response.go index 6d0fe6c..1a31b30 100644 --- a/xata/internal/fern-core/generated/go/get_user_o_auth_clients_response.go +++ b/xata/internal/fern-core/generated/go/get_user_o_auth_clients_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/get_workspaces_list_response.go b/xata/internal/fern-core/generated/go/get_workspaces_list_response.go index efd1b9d..a632f98 100644 --- a/xata/internal/fern-core/generated/go/get_workspaces_list_response.go +++ b/xata/internal/fern-core/generated/go/get_workspaces_list_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/get_workspaces_list_response_workspaces_item.go b/xata/internal/fern-core/generated/go/get_workspaces_list_response_workspaces_item.go index 3d78f7c..bea9229 100644 --- a/xata/internal/fern-core/generated/go/get_workspaces_list_response_workspaces_item.go +++ b/xata/internal/fern-core/generated/go/get_workspaces_list_response_workspaces_item.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/invite_id.go b/xata/internal/fern-core/generated/go/invite_id.go index 071462d..b858123 100644 --- a/xata/internal/fern-core/generated/go/invite_id.go +++ b/xata/internal/fern-core/generated/go/invite_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/invite_key.go b/xata/internal/fern-core/generated/go/invite_key.go index 592da60..baf3a52 100644 --- a/xata/internal/fern-core/generated/go/invite_key.go +++ b/xata/internal/fern-core/generated/go/invite_key.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/invite_workspace_member_request.go b/xata/internal/fern-core/generated/go/invite_workspace_member_request.go index f7f6d22..dacafbb 100644 --- a/xata/internal/fern-core/generated/go/invite_workspace_member_request.go +++ b/xata/internal/fern-core/generated/go/invite_workspace_member_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/invites_client.go b/xata/internal/fern-core/generated/go/invites_client.go index 09418d1..b8aa897 100644 --- a/xata/internal/fern-core/generated/go/invites_client.go +++ b/xata/internal/fern-core/generated/go/invites_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,9 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" io "io" http "net/http" - - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) type InvitesClient interface { diff --git a/xata/internal/fern-core/generated/go/list_databases_response.go b/xata/internal/fern-core/generated/go/list_databases_response.go index dcea539..63f4341 100644 --- a/xata/internal/fern-core/generated/go/list_databases_response.go +++ b/xata/internal/fern-core/generated/go/list_databases_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/list_regions_response.go b/xata/internal/fern-core/generated/go/list_regions_response.go index 37797de..3fc7275 100644 --- a/xata/internal/fern-core/generated/go/list_regions_response.go +++ b/xata/internal/fern-core/generated/go/list_regions_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/migration_status.go b/xata/internal/fern-core/generated/go/migration_status.go index f1d3d7c..4f0ef17 100644 --- a/xata/internal/fern-core/generated/go/migration_status.go +++ b/xata/internal/fern-core/generated/go/migration_status.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/not_found_error.go b/xata/internal/fern-core/generated/go/not_found_error.go index aff9b8a..b8cee7a 100644 --- a/xata/internal/fern-core/generated/go/not_found_error.go +++ b/xata/internal/fern-core/generated/go/not_found_error.go @@ -1,12 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( json "encoding/json" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) diff --git a/xata/internal/fern-core/generated/go/o_auth_access_token.go b/xata/internal/fern-core/generated/go/o_auth_access_token.go index a6b520a..8c5e008 100644 --- a/xata/internal/fern-core/generated/go/o_auth_access_token.go +++ b/xata/internal/fern-core/generated/go/o_auth_access_token.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/o_auth_client.go b/xata/internal/fern-core/generated/go/o_auth_client.go index f712919..dabd0ea 100644 --- a/xata/internal/fern-core/generated/go/o_auth_client.go +++ b/xata/internal/fern-core/generated/go/o_auth_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,9 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" io "io" http "net/http" - - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) type OAuthClient interface { diff --git a/xata/internal/fern-core/generated/go/o_auth_client_id.go b/xata/internal/fern-core/generated/go/o_auth_client_id.go index 65bf707..f99e5f8 100644 --- a/xata/internal/fern-core/generated/go/o_auth_client_id.go +++ b/xata/internal/fern-core/generated/go/o_auth_client_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/o_auth_client_public_details.go b/xata/internal/fern-core/generated/go/o_auth_client_public_details.go index 11da440..be15ff0 100644 --- a/xata/internal/fern-core/generated/go/o_auth_client_public_details.go +++ b/xata/internal/fern-core/generated/go/o_auth_client_public_details.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/o_auth_response_type.go b/xata/internal/fern-core/generated/go/o_auth_response_type.go index e71fb10..087104a 100644 --- a/xata/internal/fern-core/generated/go/o_auth_response_type.go +++ b/xata/internal/fern-core/generated/go/o_auth_response_type.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/o_auth_scope.go b/xata/internal/fern-core/generated/go/o_auth_scope.go index 5fa2594..4ae1cf9 100644 --- a/xata/internal/fern-core/generated/go/o_auth_scope.go +++ b/xata/internal/fern-core/generated/go/o_auth_scope.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/pointer.go b/xata/internal/fern-core/generated/go/pointer.go index 1646ee9..82fb917 100644 --- a/xata/internal/fern-core/generated/go/pointer.go +++ b/xata/internal/fern-core/generated/go/pointer.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - package api import "time" diff --git a/xata/internal/fern-core/generated/go/region.go b/xata/internal/fern-core/generated/go/region.go index 5b5dbb3..f51d224 100644 --- a/xata/internal/fern-core/generated/go/region.go +++ b/xata/internal/fern-core/generated/go/region.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/rename_database_request.go b/xata/internal/fern-core/generated/go/rename_database_request.go index c07aff1..00219ea 100644 --- a/xata/internal/fern-core/generated/go/rename_database_request.go +++ b/xata/internal/fern-core/generated/go/rename_database_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/role.go b/xata/internal/fern-core/generated/go/role.go index ce2d51f..2c565e2 100644 --- a/xata/internal/fern-core/generated/go/role.go +++ b/xata/internal/fern-core/generated/go/role.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/unauthorized_error.go b/xata/internal/fern-core/generated/go/unauthorized_error.go index 428203b..2cb7dae 100644 --- a/xata/internal/fern-core/generated/go/unauthorized_error.go +++ b/xata/internal/fern-core/generated/go/unauthorized_error.go @@ -1,12 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( json "encoding/json" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) diff --git a/xata/internal/fern-core/generated/go/unprocessable_entity_error.go b/xata/internal/fern-core/generated/go/unprocessable_entity_error.go index a2e2b58..021363a 100644 --- a/xata/internal/fern-core/generated/go/unprocessable_entity_error.go +++ b/xata/internal/fern-core/generated/go/unprocessable_entity_error.go @@ -1,12 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api import ( json "encoding/json" - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) diff --git a/xata/internal/fern-core/generated/go/update_database_metadata_request.go b/xata/internal/fern-core/generated/go/update_database_metadata_request.go index 4a7d7e2..a9bc7ca 100644 --- a/xata/internal/fern-core/generated/go/update_database_metadata_request.go +++ b/xata/internal/fern-core/generated/go/update_database_metadata_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/update_database_metadata_request_ui.go b/xata/internal/fern-core/generated/go/update_database_metadata_request_ui.go index 5bf7e9e..6d76527 100644 --- a/xata/internal/fern-core/generated/go/update_database_metadata_request_ui.go +++ b/xata/internal/fern-core/generated/go/update_database_metadata_request_ui.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/update_o_auth_access_token_request.go b/xata/internal/fern-core/generated/go/update_o_auth_access_token_request.go index ce8d83f..b043ccc 100644 --- a/xata/internal/fern-core/generated/go/update_o_auth_access_token_request.go +++ b/xata/internal/fern-core/generated/go/update_o_auth_access_token_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/update_workspace_member_invite_request.go b/xata/internal/fern-core/generated/go/update_workspace_member_invite_request.go index affe03b..3bf02c0 100644 --- a/xata/internal/fern-core/generated/go/update_workspace_member_invite_request.go +++ b/xata/internal/fern-core/generated/go/update_workspace_member_invite_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/update_workspace_member_role_request.go b/xata/internal/fern-core/generated/go/update_workspace_member_role_request.go index 763de73..8644063 100644 --- a/xata/internal/fern-core/generated/go/update_workspace_member_role_request.go +++ b/xata/internal/fern-core/generated/go/update_workspace_member_role_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/user.go b/xata/internal/fern-core/generated/go/user.go index 8572067..0045701 100644 --- a/xata/internal/fern-core/generated/go/user.go +++ b/xata/internal/fern-core/generated/go/user.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/user_id.go b/xata/internal/fern-core/generated/go/user_id.go index f93fca8..3abfafe 100644 --- a/xata/internal/fern-core/generated/go/user_id.go +++ b/xata/internal/fern-core/generated/go/user_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/user_with_id.go b/xata/internal/fern-core/generated/go/user_with_id.go index 1d9dc06..080dcd5 100644 --- a/xata/internal/fern-core/generated/go/user_with_id.go +++ b/xata/internal/fern-core/generated/go/user_with_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/users_client.go b/xata/internal/fern-core/generated/go/users_client.go index 73a7123..d1e8827 100644 --- a/xata/internal/fern-core/generated/go/users_client.go +++ b/xata/internal/fern-core/generated/go/users_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -9,10 +7,9 @@ import ( context "context" json "encoding/json" errors "errors" + core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" io "io" http "net/http" - - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) type UsersClient interface { diff --git a/xata/internal/fern-core/generated/go/workspace.go b/xata/internal/fern-core/generated/go/workspace.go index ee883c7..30557d3 100644 --- a/xata/internal/fern-core/generated/go/workspace.go +++ b/xata/internal/fern-core/generated/go/workspace.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspace_id.go b/xata/internal/fern-core/generated/go/workspace_id.go index f8f9156..21bd9d7 100644 --- a/xata/internal/fern-core/generated/go/workspace_id.go +++ b/xata/internal/fern-core/generated/go/workspace_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspace_invite.go b/xata/internal/fern-core/generated/go/workspace_invite.go index 0fe927d..b1acb81 100644 --- a/xata/internal/fern-core/generated/go/workspace_invite.go +++ b/xata/internal/fern-core/generated/go/workspace_invite.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspace_member.go b/xata/internal/fern-core/generated/go/workspace_member.go index 41f8efc..2405e70 100644 --- a/xata/internal/fern-core/generated/go/workspace_member.go +++ b/xata/internal/fern-core/generated/go/workspace_member.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspace_members.go b/xata/internal/fern-core/generated/go/workspace_members.go index 4e29f99..db6e6cf 100644 --- a/xata/internal/fern-core/generated/go/workspace_members.go +++ b/xata/internal/fern-core/generated/go/workspace_members.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspace_meta.go b/xata/internal/fern-core/generated/go/workspace_meta.go index 5dca6ba..2c62e23 100644 --- a/xata/internal/fern-core/generated/go/workspace_meta.go +++ b/xata/internal/fern-core/generated/go/workspace_meta.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspace_plan.go b/xata/internal/fern-core/generated/go/workspace_plan.go index cb30705..be64e3a 100644 --- a/xata/internal/fern-core/generated/go/workspace_plan.go +++ b/xata/internal/fern-core/generated/go/workspace_plan.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-core/generated/go/workspaces_client.go b/xata/internal/fern-core/generated/go/workspaces_client.go index 86d41d2..5152c77 100644 --- a/xata/internal/fern-core/generated/go/workspaces_client.go +++ b/xata/internal/fern-core/generated/go/workspaces_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,9 @@ import ( json "encoding/json" errors "errors" fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" io "io" http "net/http" - - core "github.com/xataio/xata-go/xata/internal/fern-core/generated/go/core" ) type WorkspacesClient interface { diff --git a/xata/internal/fern-workspace/fern/api/openapi/openapi.yml b/xata/internal/fern-workspace/fern/api/openapi/openapi.yml deleted file mode 100644 index a111bef..0000000 --- a/xata/internal/fern-workspace/fern/api/openapi/openapi.yml +++ /dev/null @@ -1,6028 +0,0 @@ -openapi: 3.0.0 -info: - title: xata-xb - description: Xata.io Xatabases API - version: '1.0' - license: - name: Apache 2.0 - url: https://www.apache.org/licenses/LICENSE-2.0.html - contact: - name: support@xata.io -servers: - - url: / - description: '' -paths: - /dbs/{db_name}: - summary: Single Database - description: >- - Given a parameter `db_name`, this path allows interacting with a specific - database on Xata. Below are a number of operations that can be performed - on a given database. - parameters: - - $ref: '#/components/parameters/DBNameParam' - get: - operationId: getBranchList - summary: List branches - description: List all available Branches - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListBranchesResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - /db/{db_branch_name}: - summary: Database Branch by Name - description: >- - This path allows interacting with a given database branch, referenced by - parameter `db_branch_name`, which is expected in the format - `database_name:branch_name`. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - get: - operationId: getBranchDetails - summary: Get branch schema and metadata - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/DBBranch' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - put: - operationId: createBranch - summary: Create Database branch - parameters: - - name: from - in: query - description: Name of source branch to branch the new schema from - schema: - type: string - requestBody: - content: - application/json: - schema: - type: object - properties: - from: - description: Select the branch to fork from. Defaults to 'main' - type: string - metadata: - $ref: '#/components/schemas/BranchMetadata' - responses: - '201': - description: Created - headers: - Location: - schema: - type: string - format: uri - description: 'URI to newly created resource: /db/{db_branch_name}' - content: - application/json: - schema: - description: '' - type: object - properties: - databaseName: - type: string - minLength: 1 - branchName: - type: string - status: - $ref: '#/components/schemas/MigrationStatus' - example: - databaseName: mydatabase - branchName: mybranch - status: completed - required: - - databaseName - - branchName - - status - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '423': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - delete: - operationId: deleteBranch - summary: Delete Database branch - description: Delete the branch in the database and all its resources - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - status: - $ref: '#/components/schemas/MigrationStatus' - required: - - status - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '409': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - /db/{db_branch_name}/metadata: - summary: Branch Metadata - description: >- - This path allows interacting with the metadata of a specific database - branch. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - put: - operationId: updateBranchMetadata - summary: Update branch metadata - description: Update the branch metadata - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/BranchMetadata' - responses: - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - get: - operationId: getBranchMetadata - summary: Get Branch Metadata - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/BranchMetadata' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - /db/{db_branch_name}/stats: - summary: Branch Statistics - description: >- - This endpoint presents a number of statistics on a given database's - branch. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - get: - operationId: getBranchStats - summary: Branch stats - description: Get branch usage metrics. - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - timestamp: - type: string - interval: - type: string - resolution: - type: string - numberOfRecords: - type: array - items: - $ref: '#/components/schemas/MetricsDatapoint' - writesOverTime: - type: array - items: - $ref: '#/components/schemas/MetricsDatapoint' - readsOverTime: - type: array - items: - $ref: '#/components/schemas/MetricsDatapoint' - readLatency: - $ref: '#/components/schemas/MetricsLatency' - writeLatency: - $ref: '#/components/schemas/MetricsLatency' - warning: - type: string - required: - - timestamp - - interval - - resolution - '400': - $ref: '#/components/responses/SimpleError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - /dbs/{db_name}/gitBranches: - summary: Mapping of git to Xata branches - description: > - This path allows managing the mapping between git and Xata branches, which - is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git - branches to the associated Xata branches. - parameters: - - $ref: '#/components/parameters/DBNameParam' - get: - operationId: getGitBranchesMapping - summary: List git branches mapping - description: > - Lists all the git branches in the mapping, and their associated Xata - branches. - - - Example response: - - - ```json - - { - "mappings": [ - { - "gitBranch": "main", - "xataBranch": "main" - }, - { - "gitBranch": "gitBranch1", - "xataBranch": "xataBranch1" - } - { - "gitBranch": "xataBranch2", - "xataBranch": "xataBranch2" - } - ] - } - - ``` - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/ListGitBranchesResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - post: - operationId: addGitBranchesEntry - summary: Link a git branch to a Xata branch - description: > - Adds an entry to the mapping of git branches to Xata branches. The git - branch and the Xata branch must be present in the body of the request. - If the Xata branch doesn't exist, a 400 error is returned. - - - If the git branch is already present in the mapping, the old entry is - overwritten, and a warning message is included in the response. If the - git branch is added and didn't exist before, the response code is 204. - If the git branch existed and it was overwritten, the response code is - 201. - - - Example request: - - - ```json - - // POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches - - { - "gitBranch": "fix/bug123", - "xataBranch": "fix_bug" - } - - ``` - requestBody: - content: - application/json: - schema: - type: object - properties: - gitBranch: - description: The name of the Git branch. - type: string - xataBranch: - description: The name of the Xata branch. - $ref: '#/components/schemas/BranchName' - required: - - gitBranch - - xataBranch - responses: - '201': - description: Operation was successful with warnings - content: - application/json: - schema: - type: object - properties: - warning: - description: Warning message - type: string - example: - warning: >- - Git branch [fix/bug123] was already present in the mapping - and was overwritten. - '204': - description: Operation was successful without warnings - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - delete: - operationId: removeGitBranchesEntry - summary: Unlink a git branch to a Xata branch - description: > - Removes an entry from the mapping of git branches to Xata branches. The - name of the git branch must be passed as a query parameter. If the git - branch is not found, the endpoint returns a 404 status code. - - - Example request: - - - ```json - - // DELETE - https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123 - - ``` - parameters: - - name: gitBranch - in: query - description: The Git Branch to remove from the mapping - required: true - schema: - type: string - responses: - '204': - description: OK - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - description: The git branch was not found in the mapping - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - /dbs/{db_name}/resolveBranch: - summary: Resolve the branch to use - description: >- - This endpoint is typically used by the Xata SDKs to resolve the correct - branch to use in a particular situation. The main input is the git branch. - parameters: - - $ref: '#/components/parameters/DBNameParam' - get: - operationId: resolveBranch - summary: Resolve a Git Branch to a Xata branch - description: > - In order to resolve the database branch, the following algorithm is - used: - - * if the `gitBranch` was provided and is found in the [git branches - mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata - branch is returned - - * else, if a Xata branch with the exact same name as `gitBranch` exists, - return it - - * else, if `fallbackBranch` is provided and a branch with that name - exists, return it - - * else, return the default branch of the DB (`main` or the first branch) - - - Example call: - - - ```json - - // GET - https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test&fallbackBranch=tsg - - ``` - - - Example response: - - - ```json - - { - "branch": "main", - "reason": { - "code": "DEFAULT_BRANCH", - "message": "Default branch for this database (main)" - } - } - - ``` - parameters: - - name: gitBranch - in: query - description: The Git Branch - schema: - type: string - - name: fallbackBranch - in: query - description: Default branch to fallback to - schema: - type: string - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - branch: - type: string - reason: - type: object - properties: - code: - type: string - enum: - - FOUND_IN_MAPPING - - BRANCH_EXISTS - - FALLBACK_BRANCH - - DEFAULT_BRANCH - message: - type: string - required: - - code - - message - example: - branch: main - reason: - code: DEFAULT_BRANCH - message: Default branch for this database (main) - required: - - branch - - reason - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Branch - /db/{db_branch_name}/schema/history: - summary: Query schema history. - description: Query the branch its schema history. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: getBranchSchemaHistory - summary: Query schema history. - requestBody: - content: - application/json: - schema: - type: object - properties: - page: - type: object - properties: - after: - description: Query the next page that follow the cursor. - type: string - before: - description: Query the previous page before the cursor. - type: string - size: - description: >- - Set page size. If the size is missing it is read from - the cursor. If no cursor is given xata will choose the - default page size. - type: integer - default: 20 - since: - description: >- - Report only migrations that have been added since the given - Migration ID. - type: string - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - meta: - type: object - properties: - cursor: - description: last record id - type: string - more: - description: true if more records can be fetch - type: boolean - required: - - cursor - - more - logs: - type: array - items: - $ref: '#/components/schemas/Commit' - required: - - meta - - logs - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/schema/compare: - summary: Compare branch with custom schema. - description: Compare the branch schema with a custom provided schema. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: compareBranchWithUserSchema - summary: Compare branch with user schema. - requestBody: - content: - application/json: - schema: - type: object - properties: - schema: - $ref: '#/components/schemas/Schema' - schemaOperations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - branchOperations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - required: - - schema - responses: - '200': - $ref: '#/components/responses/SchemaCompareResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/schema/compare/{branch_name}: - summary: Compare branch schemas. - description: Compare the schema of any 2 branches. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/BranchNameParam' - post: - operationId: compareBranchSchemas - summary: Compare branch schemas. - requestBody: - content: - application/json: - schema: - type: object - properties: - sourceBranchOperations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - targetBranchOperations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - required: - - schema - responses: - '200': - $ref: '#/components/responses/SchemaCompareResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/schema/update: - summary: Update Branch schema - description: Update the branch schema with migration operations - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: updateBranchSchema - summary: Update Branch schema - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/Migration' - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/schema/preview: - summary: Preview branch schema edits. - description: Preview the resulting branch schema when applying the edit script. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: previewBranchSchemaEdit - summary: Preview branch schema edits. - requestBody: - content: - application/json: - schema: - type: object - properties: - edits: - $ref: '#/components/schemas/SchemaEditScript' - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - original: - $ref: '#/components/schemas/Schema' - updated: - $ref: '#/components/schemas/Schema' - required: - - original - - updated - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/schema/apply: - summary: Update Branch schema with edit script. - description: Update the branch from schema edit script. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: applyBranchSchemaEdit - summary: Apply edit script. - requestBody: - content: - application/json: - schema: - type: object - properties: - edits: - $ref: '#/components/schemas/SchemaEditScript' - required: - - edits - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/schema/push: - summary: Push migrations. - description: Apply a list of migrations to the current branch. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: pushBranchMigrations - summary: Push migrations. - description: > - The `schema/push` API accepts a list of migrations to be applied to the - - current branch. A list of applicable migrations can be fetched using - - the `schema/history` API from another branch or database. - - - The most recent migration must be part of the list or referenced (via - - `parentID`) by the first migration in the list of migrations to be - pushed. - - - Each migration in the list has an `id`, `parentID`, and `checksum`. The - - checksum for migrations are generated and verified by xata. The - - operation fails if any migration in the list has an invalid checksum. - requestBody: - content: - application/json: - schema: - type: object - properties: - migrations: - type: array - items: - $ref: '#/components/schemas/MigrationObject' - required: - - migrations - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Migrations - /db/{db_branch_name}/tables/{table_name}: - summary: Database Table by Name - description: This endpoint provides a way to mutate a specific table on a database. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - put: - operationId: createTable - summary: Create table - description: >- - Creates a new table with the given name. Returns 422 if a table with the - same name already exists. - responses: - '201': - description: Created - headers: - Location: - schema: - type: string - format: uri - description: >- - URI to newly created resource: - /db/{db_branch_name}/tables/{table_name} - content: - application/json: - schema: - description: '' - type: object - properties: - branchName: - type: string - tableName: - type: string - minLength: 1 - status: - $ref: '#/components/schemas/MigrationStatus' - example: - branchName: mydb_main - tableName: mytable - status: completed - required: - - branchName - - tableName - - status - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - delete: - operationId: deleteTable - summary: Delete table - description: Deletes the table with the given name. - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - status: - $ref: '#/components/schemas/MigrationStatus' - required: - - status - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - description: Not Found - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - patch: - operationId: updateTable - summary: Update table - description: >- - Update table. Currently there is only one update operation supported: - renaming the table by providing a new name. - - - In the example below, we rename a table from “users” to “people”: - - - ```json - - // PATCH /db/test:main/tables/users - - - { - "name": "people" - } - - ``` - requestBody: - description: '' - content: - application/json: - schema: - description: '' - type: object - properties: - name: - type: string - minLength: 1 - required: - - name - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - /db/{db_branch_name}/tables/{table_name}/schema: - summary: Table Schema - description: This endpoint enables reading or updating the schema of a given table. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - get: - operationId: getTableSchema - summary: Get table schema - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - columns: - type: array - items: - $ref: '#/components/schemas/Column' - required: - - columns - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - put: - operationId: setTableSchema - summary: Update table schema - requestBody: - content: - application/json: - schema: - type: object - properties: - columns: - type: array - items: - $ref: '#/components/schemas/Column' - required: - - columns - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '409': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - /db/{db_branch_name}/tables/{table_name}/columns: - summary: Table Columns - description: This endpoint allows working with a table's columns. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - get: - operationId: getTableColumns - summary: List table columns - description: > - Retrieves the list of table columns and their definition. This endpoint - returns the column list with object columns being reported with their - - full dot-separated path (flattened). - responses: - '200': - description: OK - content: - application/json: - schema: - type: object - properties: - columns: - type: array - items: - $ref: '#/components/schemas/Column' - example: - columns: - - name: name - type: string - - name: email - type: email - - name: settings.plan - type: string - - name: settings.dark - type: bool - required: - - columns - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - post: - operationId: addTableColumn - summary: Create new column - description: >- - Adds a new column to the table. The body of the request should contain - the column definition. - requestBody: - description: The column definition. - content: - application/json: - schema: - example: - name: columnName - type: string - $ref: '#/components/schemas/Column' - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - /db/{db_branch_name}/tables/{table_name}/columns/{column_name}: - summary: Single Table Column - description: This endpoint allows working with a single column from a given table. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/ColumnNameParam' - get: - operationId: getColumn - summary: Get column information - description: Get the definition of a single column. - responses: - '200': - description: OK - content: - application/json: - schema: - example: - value: - name: settings.labels - type: multiple - $ref: '#/components/schemas/Column' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - patch: - operationId: updateColumn - summary: Update column - description: >- - Update column with partial data. Can be used for renaming the column by - providing a new "name" field. - requestBody: - content: - application/json: - schema: - description: '' - type: object - properties: - name: - type: string - minLength: 1 - example: - name: newName - description: Sample new description - required: - - name - examples: - Rename column: - value: - name: new_name - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - delete: - operationId: deleteColumn - summary: Delete column - description: Deletes the specified column. - responses: - '200': - $ref: '#/components/responses/SchemaUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Table - /db/{db_branch_name}/transaction: - summary: Execute a transaction on a branch - description: > - Executes multiple operations together as one. This allows you to run a - number of - - operations that succeed as a single group; or fail with no changes to your - database. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: branchTransaction - summary: Execute a transaction on a branch - requestBody: - content: - application/json: - schema: - type: object - properties: - operations: - type: array - items: - $ref: '#/components/schemas/TransactionOperation' - required: - - operations - responses: - '200': - description: Returns the results of a successful transaction. - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionSuccess' - '400': - description: Returns errors from a failed transaction. - content: - application/json: - schema: - $ref: '#/components/schemas/TransactionFailure' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '429': - $ref: '#/components/responses/RateLimitError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - /db/{db_branch_name}/tables/{table_name}/data: - summary: Table Data - description: > - This endpoint enables mutating data into a given database table. To query - data, please see the [query endpoint](query). - - For a tutorial on using the Records API, see the [Record API - documentation](/rest-api/intro). - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/ColumnsProjectionParam' - post: - operationId: insertRecord - summary: Insert record - description: Insert a new Record into the Table - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DataInputRecord' - responses: - '201': - $ref: '#/components/responses/RecordUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - /db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file/{file_id}: - summary: File array access - description: >- - File array access endpoint allows upload, download and remove of file - items. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/RecordIDParam' - - $ref: '#/components/parameters/ColumnNameParam' - - $ref: '#/components/parameters/FileItemIDParam' - get: - operationId: getFileItem - summary: Download content from a file item in a file array column - description: Retrieves file content from an array by file ID - responses: - '200': - description: OK - content: - '*/*': - schema: - type: string - format: binary - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Files - put: - operationId: putFileItem - summary: Upload or update the content of a file item in a file array column - description: Uploads the file content to an array given the file ID - requestBody: - content: - '*/*': - schema: - type: string - format: binary - responses: - '200': - $ref: '#/components/responses/PutFileResponse' - '201': - $ref: '#/components/responses/PutFileResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Files - delete: - operationId: deleteFileItem - summary: Delete an item from a file array - description: Deletes an item from an file array column given the file ID - responses: - '200': - $ref: '#/components/responses/PutFileResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Files - /db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file: - summary: File column access - description: File access endpoint allows upload and download of binary file content. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/RecordIDParam' - - $ref: '#/components/parameters/ColumnNameParam' - get: - operationId: getFile - summary: Download content from a file column - description: Retrieves the file content from a file column - responses: - '200': - description: OK - content: - '*/*': - schema: - type: string - format: binary - '204': - description: no content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Files - put: - operationId: putFile - summary: Upload content to a file column - description: Uploads the file content to the given file column - requestBody: - content: - '*/*': - schema: - type: string - format: binary - responses: - '200': - $ref: '#/components/responses/PutFileResponse' - '201': - $ref: '#/components/responses/PutFileResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Files - delete: - operationId: deleteFile - summary: Remove the content from a file column - description: Deletes a file referred in a file column - responses: - '200': - $ref: '#/components/responses/PutFileResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Files - /db/{db_branch_name}/tables/{table_name}/data/{record_id}: - summary: Table Record - description: >- - This endpoint enables mutating a given record in a table, referenced by - its ID. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/RecordIDParam' - - $ref: '#/components/parameters/ColumnsProjectionParam' - get: - operationId: getRecord - summary: Get record by ID - description: Retrieve record by ID - responses: - '200': - $ref: '#/components/responses/RecordResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - put: - operationId: insertRecordWithID - summary: Insert record with ID - description: >- - By default, IDs are auto-generated when data is insterted into Xata. - Sending a request to this endpoint allows us to insert a record with a - pre-existing ID, bypassing the default automatic ID generation. - parameters: - - name: createOnly - in: query - schema: - type: boolean - - name: ifVersion - in: query - schema: - type: integer - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DataInputRecord' - responses: - '200': - $ref: '#/components/responses/RecordUpdateResponse' - '201': - $ref: '#/components/responses/RecordUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - patch: - operationId: updateRecordWithID - summary: Update record with ID - parameters: - - name: ifVersion - in: query - schema: - type: integer - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DataInputRecord' - responses: - '200': - $ref: '#/components/responses/RecordUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - post: - operationId: upsertRecordWithID - summary: Upsert record with ID - parameters: - - name: ifVersion - in: query - schema: - type: integer - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DataInputRecord' - responses: - '200': - $ref: '#/components/responses/RecordUpdateResponse' - '201': - $ref: '#/components/responses/RecordUpdateResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - delete: - operationId: deleteRecord - summary: Delete record from table - responses: - '200': - $ref: '#/components/responses/RecordResponse' - '204': - description: No Content - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - /db/{db_branch_name}/tables/{table_name}/bulk: - summary: Bulk Table Operations - description: > - This endpoint enables bulk operations on a given table. For now, we only - allow bulk inserting. - - - An example bulk request looks like this: - - - ```json - - // POST https://tutorial-ng7s8c.xata.sh/db/tutorial:main/tables/users/bulk - - - { - "records": [ - { - "email": "laurence@example.com", - "full_name": "Laurence Fishburne", - "team": "rec_c8hng2h26un90p8sr7k0" - }, - { - "email": "hugo@example.com", - "full_name": "Hugo Weaving", - "team": "rec_c8hng2h26un90p8sr7k0" - }, - { - "email": "joe@example.com", - "full_name": "Joe Pantoliano", - "team": "rec_c8hng2h26un90p8sr7k0" - } - ] - } - - ``` - - For more details, see the [this - section](/web-api/records/insert#inserting-records-in-bulk) from the - tutorial. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/ColumnsProjectionParam' - post: - operationId: bulkInsertTableRecords - summary: Bulk insert records - description: Bulk insert records - requestBody: - content: - application/json: - schema: - type: object - properties: - records: - type: array - items: - $ref: '#/components/schemas/DataInputRecord' - required: - - records - responses: - '200': - $ref: '#/components/responses/BulkInsertResponse' - '400': - $ref: '#/components/responses/BulkError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '422': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Records - x-experimental: true - /db/{db_branch_name}/tables/{table_name}/query: - summary: Query Table Data - description: > - This endpoint serves data from a given table, inside a specific database's - branch. - - For a tutorial on using the Records API, see the [Record API - documentation](/rest-api/intro). - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - post: - operationId: queryTable - summary: Query table - description: > - The Query Table API can be used to retrieve all records in a table. - - The API support filtering, sorting, selecting a subset of columns, and - pagination. - - - The overall structure of the request looks like this: - - - ```json - - // POST /db/:/tables/
/query - - { - "columns": [...], - "filter": { - "$all": [...], - "$any": [...] - ... - }, - "sort": { - "multiple": [...] - ... - }, - "page": { - ... - } - } - - ``` - - - For usage, see also the [API Guide](https://xata.io/docs/api-guide/get). - - - ### Column selection - - - If the `columns` array is not specified, all columns are included. For - link - - fields, only the ID column of the linked records is included in the - response. - - - If the `columns` array is specified, only the selected and internal - - columns `id` and `xata` are included. The `*` wildcard can be used to - - select all columns. - - - For objects and link fields, if the column name of the object is - specified, we - - include all of its sub-keys. If only some sub-keys are specified (via - dotted - - notation, e.g. `"settings.plan"` ), then only those sub-keys from the - object - - are included. - - - By the way of example, assuming two tables like this: - - - ```json {"truncate": true} - - { - "tables": [ - { - "name": "teams", - "columns": [ - { - "name": "name", - "type": "string" - }, - { - "name": "owner", - "type": "link", - "link": { - "table": "users" - } - }, - { - "name": "foundedDate", - "type": "datetime" - }, - ] - }, - { - "name": "users", - "columns": [ - { - "name": "email", - "type": "email" - }, - { - "name": "full_name", - "type": "string" - }, - { - "name": "address", - "type": "object", - "columns": [ - { - "name": "street", - "type": "string" - }, - { - "name": "number", - "type": "int" - }, - { - "name": "zipcode", - "type": "int" - } - ] - }, - { - "name": "team", - "type": "link", - "link": { - "table": "teams" - } - } - ] - } - ] - } - - ``` - - - A query like this: - - - ```json - - POST /db/:/tables/
/query - - { - "columns": [ - "name", - "address.*" - ] - } - - ``` - - - returns objects like: - - - ```json - - { - "name": "Kilian", - "address": { - "street": "New street", - "number": 41, - "zipcode": 10407 - } - } - - ``` - - - while a query like this: - - - ```json - - POST /db/:/tables/
/query - - { - "columns": [ - "name", - "address.street" - ] - } - - ``` - - - returns objects like: - - - ```json - - { - "id": "id1" - "xata": { - "version": 0 - } - "name": "Kilian", - "address": { - "street": "New street" - } - } - - ``` - - - If you want to return all columns from the main table and selected - columns from the linked table, you can do it like this: - - - ```json - - { - "columns": ["*", "team.name"] - } - - ``` - - - The `"*"` in the above means all columns, including columns of objects. - This returns data like: - - - ```json - - { - "id": "id1" - "xata": { - "version": 0 - } - "name": "Kilian", - "email": "kilian@gmail.com", - "address": { - "street": "New street", - "number": 41, - "zipcode": 10407 - }, - "team": { - "id": "XX", - "xata": { - "version": 0 - }, - "name": "first team" - } - } - - ``` - - - If you want all columns of the linked table, you can do: - - - ```json - - { - "columns": ["*", "team.*"] - } - - ``` - - - This returns, for example: - - - ```json - - { - "id": "id1" - "xata": { - "version": 0 - } - "name": "Kilian", - "email": "kilian@gmail.com", - "address": { - "street": "New street", - "number": 41, - "zipcode": 10407 - }, - "team": { - "id": "XX", - "xata": { - "version": 0 - }, - "name": "first team", - "code": "A1", - "foundedDate": "2020-03-04T10:43:54.32Z" - } - } - - ``` - - - ### Filtering - - - There are two types of operators: - - - - Operators that work on a single column: `$is`, `$contains`, - `$pattern`, - `$includes`, `$gt`, etc. - - Control operators that combine multiple conditions: `$any`, `$all`, - `$not` , - `$none`, etc. - - All operators start with an `$` to differentiate them from column names - - (which are not allowed to start with a dollar sign). - - - #### Exact matching and control operators - - - Filter by one column: - - - ```json - - { - "filter": { - "": "value" - } - } - - ``` - - - This is equivalent to using the `$is` operator: - - - ```json - - { - "filter": { - "": { - "$is": "value" - } - } - } - - ``` - - - For example: - - - ```json - - { - "filter": { - "name": "r2" - } - } - - ``` - - - Or: - - - ```json - - { - "filter": { - "name": { - "$is": "r2" - } - } - } - - ``` - - - For objects, both dots and nested versions work: - - - ```json - - { - "filter": { - "settings.plan": "free" - } - } - - ``` - - - ```json - - { - "filter": { - "settings": { - "plan": "free" - } - } - } - - ``` - - - If you want to OR together multiple values, you can use the `$any` - operator with an array of values: - - - ```json - - { - "filter": { - "settings.plan": { "$any": ["free", "paid"] } - } - } - - ``` - - - If you specify multiple columns in the same filter, they are logically - AND'ed together: - - - ```json - - { - "filter": { - "settings.dark": true, - "settings.plan": "free" - } - } - - ``` - - - The above matches if both conditions are met. - - - To be more explicit about it, you can use `$all` or `$any`: - - - ```json - - { - "filter": { - "$any": { - "settings.dark": true, - "settings.plan": "free" - } - } - } - - ``` - - - The `$all` and `$any` operators can also receive an array of objects, - which allows for repeating column names: - - - ```json - - { - "filter": { - "$any": [ - { - "name": "r1" - }, - { - "name": "r2" - } - ] - } - } - - ``` - - - You can check for a value being not-null with `$exists`: - - - ```json - - { - "filter": { - "$exists": "settings" - } - } - - ``` - - - This can be combined with `$all` or `$any` : - - - ```json - - { - "filter": { - "$all": [ - { - "$exists": "settings" - }, - { - "$exists": "name" - } - ] - } - } - - ``` - - - Or you can use the inverse operator `$notExists`: - - - ```json - - { - "filter": { - "$notExists": "settings" - } - } - - ``` - - - #### Partial match - - - `$contains` is the simplest operator for partial matching. Note that - `$contains` operator can - - cause performance issues at scale, because indices cannot be used. - - - ```json - - { - "filter": { - "": { - "$contains": "value" - } - } - } - - ``` - - - Wildcards are supported via the `$pattern` operator: - - - ```json - - { - "filter": { - "": { - "$pattern": "v*alu?" - } - } - } - - ``` - - - The `$pattern` operator accepts two wildcard characters: - - * `*` matches zero or more characters - - * `?` matches exactly one character - - - If you want to match a string that contains a wildcard character, you - can escape them using a backslash (`\`). You can escape a backslash by - usign another backslash. - - - You can also use the `$endsWith` and `$startsWith` operators: - - - ```json - - { - "filter": { - "": { - "$endsWith": ".gz" - }, - "": { - "$startsWith": "tmp-" - } - } - } - - ``` - - - #### Numeric or datetime ranges - - - ```json - - { - "filter": { - "": { - "$ge": 0, - "$lt": 100 - } - } - } - - ``` - - Date ranges support the same operators, with the date using the format - defined in - - [RFC 3339](https://www.rfc-editor.org/rfc/rfc3339): - - ```json - - { - "filter": { - "": { - "$gt": "2019-10-12T07:20:50.52Z", - "$lt": "2021-10-12T07:20:50.52Z" - } - } - } - - ``` - - The supported operators are `$gt`, `$lt`, `$ge`, `$le`. - - - #### Negations - - - A general `$not` operator can inverse any operation. - - - ```json - - { - "filter": { - "$not": { - "": "value1", - "": "value1" - } - } - } - - ``` - - - Note: in the above the two condition are AND together, so this does (NOT - ( ... - - AND ...)) - - - Or more complex: - - - ```json - - { - "filter": { - "$not": { - "$any": [ - { - "": "value1" - }, - { - "$all": [ - { - "": "value2" - }, - { - "": "value3" - } - ] - } - ] - } - } - } - - ``` - - - The `$not: { $any: {}}` can be shorted using the `$none` operator: - - - ```json - - { - "filter": { - "$none": { - "": "value1", - "": "value1" - } - } - } - - ``` - - - In addition, you can use operators like `$isNot` or `$notExists` to - simplify expressions: - - - ```json - - { - "filter": { - "": { - "$isNot": "2019-10-12T07:20:50.52Z" - } - } - } - - ``` - - - #### Working with arrays - - - To test that an array contains a value, use `$includesAny`. - - - ```json - - { - "filter": { - "": { - "$includesAny": "value" - } - } - } - - ``` - - - ##### `includesAny` - - - The `$includesAny` operator accepts a custom predicate that will check - if - - any value in the array column matches the predicate. The `$includes` - operator is a - - synonym for the `$includesAny` operator. - - - For example a complex predicate can include - - the `$all` , `$contains` and `$endsWith` operators: - - - ```json - - { - "filter": { - "": { - "$includes": { - "$all": [ - { "$contains": "label" }, - { "$not": { "$endsWith": "-debug" } } - ] - } - } - } - } - - ``` - - - ##### `includesNone` - - - The `$includesNone` operator succeeds if no array item matches the - - predicate. - - - ```json - - { - "filter": { - "settings.labels": { - "$includesNone": [{ "$contains": "label" }] - } - } - } - - ``` - - The above matches if none of the array values contain the string - "label". - - - ##### `includesAll` - - - The `$includesAll` operator succeeds if all array items match the - - predicate. - - - Here is an example of using the `$includesAll` operator: - - - ```json - - { - "filter": { - "settings.labels": { - "$includesAll": [{ "$contains": "label" }] - } - } - } - - ``` - - - The above matches if all array values contain the string "label". - - - ### Sorting - - - Sorting by one element: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "sort": { - "index": "asc" - } - } - - ``` - - - or descendently: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "sort": { - "index": "desc" - } - } - - ``` - - - Sorting by multiple fields: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "sort": [ - { - "index": "desc" - }, - { - "createdAt": "desc" - } - ] - } - - ``` - - - It is also possible to sort results randomly: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "sort": { - "*": "random" - } - } - - ``` - - - Note that a random sort does not apply to a specific column, hence the - special column name `"*"`. - - - A random sort can be combined with an ascending or descending sort on a - specific column: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "sort": [ - { - "name": "desc" - }, - { - "*": "random" - } - ] - } - - ``` - - - This will sort on the `name` column, breaking ties randomly. - - - ### Pagination - - - We offer cursor pagination and offset pagination. The cursor pagination - method can be used for sequential scrolling with unrestricted depth. The - offset pagination can be used to skip pages and is limited to 1000 - records. - - - Example of cursor pagination: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "page": { - "after":"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD" - } - } - - ``` - - - In the above example, the value of the `page.after` parameter is the - cursor returned by the previous query. A sample response is shown below: - - - ```json - - { - "meta": { - "page": { - "cursor": "fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD", - "more": true - } - }, - "records": [...] - } - - ``` - - - The `page` object might contain the follow keys, in addition to `size` - and `offset` that were introduced before: - - - - `after`: Return the next page 'after' the current cursor - - - `before`: Return the previous page 'before' the current cursor. - - - `start`: Resets the given cursor position to the beginning of the - query result set. - - Will return the first N records from the query result, where N is the - `page.size` parameter. - - - `end`: Resets the give cursor position to the end for the query result - set. - - Returns the last N records from the query result, where N is the - `page.size` parameter. - - - The request will fail if an invalid cursor value is given to - `page.before`, - - `page.after`, `page.start` , or `page.end`. No other cursor setting can - be - - used if `page.start` or `page.end` is set in a query. - - - If both `page.before` and `page.after` parameters are present we treat - the - - request as a range query. The range query will return all entries after - - `page.after`, but before `page.before`, up to `page.size` or the maximum - - page size. This query requires both cursors to use the same filters and - sort - - settings, plus we require `page.after < page.before`. The range query - returns - - a new cursor. If the range encompass multiple pages the next page in the - range - - can be queried by update `page.after` to the returned cursor while - keeping the - - `page.before` cursor from the first range query. - - - The `filter` , `columns`, `sort` , and `page.size` configuration will be - - encoded with the cursor. The pagination request will be invalid if - - `filter` or `sort` is set. The columns returned and page size can be - changed - - anytime by passing the `columns` or `page.size` settings to the next - query. - - - In the following example of size + offset pagination we retrieve the - third page of up to 100 results: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "page": { - "size": 100, - "offset": 200 - } - } - - ``` - - - The `page.size` parameter represents the maximum number of records - returned by this query. It has a default value of 20 and a maximum value - of 200. - - The `page.offset` parameter represents the number of matching records to - skip. It has a default value of 0 and a maximum value of 800. - - - Cursor pagination also works in combination with offset pagination. For - example, starting from a specific cursor position, using a page size of - 200 and an offset of 800, you can skip up to 5 pages of 200 records - forwards or backwards from the cursor's position: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "page": { - "size": 200, - "offset": 800, - "after": "fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD" - } - } - - ``` - - - **Special cursors:** - - - - `page.after=end`: Result points past the last entry. The list of - records - returned is empty, but `page.meta.cursor` will include a cursor that can be - used to "tail" the table from the end waiting for new data to be inserted. - - `page.before=end`: This cursor returns the last page. - - - `page.start=$cursor`: Start at the beginning of the result set of the - $cursor query. This is equivalent to querying the - first page without a cursor but applying `filter` and `sort` . Yet the `page.start` - cursor can be convenient at times as user code does not need to remember the - filter, sort, columns or page size configuration. All these information are - read from the cursor. - - `page.end=$cursor`: Move to the end of the result set of the $cursor - query. This is equivalent to querying the - last page with `page.before=end`, `filter`, and `sort` . Yet the - `page.end` cursor can be more convenient at times as user code does not - need to remember the filter, sort, columns or page size configuration. All - these information are read from the cursor. - - When using special cursors like `page.after="end"` or - `page.before="end"`, we - - still allow `filter` and `sort` to be set. - - - Example of getting the last page: - - - ```json - - POST /db/demo:main/tables/table/query - - { - "page": { - "size": 10, - "before": "end" - } - } - - ``` - requestBody: - content: - application/json: - schema: - type: object - properties: - filter: - $ref: '#/components/schemas/FilterExpression' - sort: - $ref: '#/components/schemas/SortExpression' - page: - $ref: '#/components/schemas/PageConfig' - columns: - $ref: '#/components/schemas/QueryColumnsProjection' - consistency: - description: The consistency level for this request. - type: string - default: strong - enum: - - strong - - eventual - responses: - '200': - $ref: '#/components/responses/QueryResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '503': - $ref: '#/components/responses/ServiceUnavailableError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/search: - summary: Search Database - description: > - This endpoint performs full text search across an entire database branch. - You can filter down to particular - - table by using the `tables` parameter. The `tables` parameter accepts a - mixed array of strings and objects. Using a string (the table name) - selects the full table. Using an object allows one to specify a filter as - well. The supported filters are the same as documented for the [query - endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the - following exceptions: - - * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of - type `text` - - * filtering on columns of type `multiple` is currently unsupported - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - post: - operationId: searchBranch - summary: Free text search - description: Run a free text search operation across the database branch. - requestBody: - content: - application/json: - schema: - description: '' - type: object - properties: - tables: - description: >- - An array with the tables in which to search. By default, all - tables are included. Optionally, filters can be included - that apply to each table. - type: array - items: - oneOf: - - type: string - - type: object - properties: - table: - description: The name of the table. - type: string - filter: - $ref: '#/components/schemas/FilterExpression' - target: - $ref: '#/components/schemas/TargetExpression' - boosters: - type: array - items: - $ref: '#/components/schemas/BoosterExpression' - additionalProperties: false - required: - - table - query: - description: The query string. - type: string - minLength: 1 - fuzziness: - $ref: '#/components/schemas/FuzzinessExpression' - prefix: - $ref: '#/components/schemas/PrefixExpression' - highlight: - $ref: '#/components/schemas/HighlightExpression' - page: - $ref: '#/components/schemas/SearchPageConfig' - example: - tables: - - users - - table: articles - filter: - author: Abigail - query: after a long day - required: - - query - responses: - '200': - $ref: '#/components/responses/SearchResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '503': - $ref: '#/components/responses/ServiceUnavailableError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/tables/{table_name}/search: - summary: Search Table - description: | - This endpoint performs full text search in a particular table. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - post: - operationId: searchTable - summary: Free text search in a table - description: > - Run a free text search operation in a particular table. - - - The endpoint accepts a `query` parameter that is used for the free text - search and a set of structured filters (via the `filter` parameter) that - are applied before the search. The `filter` parameter uses the same - syntax as the [query - endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the - following exceptions: - - * filters `$contains`, `$startsWith`, `$endsWith` don't work on columns - of type `text` - - * filtering on columns of type `multiple` is currently unsupported - requestBody: - content: - application/json: - schema: - description: '' - type: object - properties: - query: - description: The query string. - type: string - minLength: 1 - fuzziness: - $ref: '#/components/schemas/FuzzinessExpression' - target: - $ref: '#/components/schemas/TargetExpression' - prefix: - $ref: '#/components/schemas/PrefixExpression' - filter: - $ref: '#/components/schemas/FilterExpression' - highlight: - $ref: '#/components/schemas/HighlightExpression' - boosters: - type: array - items: - $ref: '#/components/schemas/BoosterExpression' - page: - $ref: '#/components/schemas/SearchPageConfig' - example: - query: after a long day - filter: - firstName: Abigail - required: - - query - responses: - '200': - $ref: '#/components/responses/SearchResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/tables/{table_name}/vectorSearch: - summary: Vector similarity search - description: | - This endpoint can be used to perform vector-based similarity searches. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - post: - operationId: vectorSearchTable - summary: Vector similarity search in a table - description: > - This endpoint can be used to perform vector-based similarity searches in - a table. - - It can be used for implementing semantic search and product - recommendation. To use this - - endpoint, you need a column of type vector. The input vector must have - the same - - dimension as the vector column. - requestBody: - content: - application/json: - schema: - description: '' - type: object - properties: - queryVector: - description: > - The vector to search for similarities. Must have the same - dimension as - - the vector column used. - type: array - items: - type: number - column: - description: >- - The vector column in which to search. It must be of type - `vector`. - type: string - similarityFunction: - description: > - The function used to measure the distance between two - points. Can be one of: - - `cosineSimilarity`, `l1`, `l2`. The default is - `cosineSimilarity`. - type: string - default: cosineSimilarity - size: - description: Number of results to return. - type: integer - default: 10 - maximum: 100 - minimum: 1 - filter: - $ref: '#/components/schemas/FilterExpression' - additionalProperties: false - required: - - queryVector - - column - responses: - '200': - $ref: '#/components/responses/SearchResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/tables/{table_name}/ask: - summary: Ask data in your table a question - description: Ask your table a question and have Xata answer. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - post: - operationId: askTable - summary: Ask your table a question - description: >- - Ask your table a question. If the `Accept` header is set to - `text/event-stream`, Xata will stream the results back as SSE's. - requestBody: - content: - application/json: - schema: - description: '' - type: object - properties: - question: - description: The question you'd like to ask. - type: string - minLength: 3 - searchType: - description: > - The type of search to use. If set to `keyword` (the - default), the search can be configured by passing - - a `search` object with the following fields. For more - details about each, see the Search endpoint documentation. - - All fields are optional. - * fuzziness - typo tolerance - * target - columns to search into, and weights. - * prefix - prefix search type. - * filter - pre-filter before searching. - * boosters - control relevancy. - If set to `vector`, a `vectorSearch` object must be passed, - with the following parameters. For more details, see the - Vector - - Search endpoint documentation. The `column` and - `contentColumn` parameters are required. - * column - the vector column containing the embeddings. - * contentColumn - the column that contains the text from which the embeddings where computed. - * filter - pre-filter before searching. - type: string - default: keyword - enum: - - keyword - - vector - search: - type: object - additionalProperties: false - properties: - fuzziness: - $ref: '#/components/schemas/FuzzinessExpression' - target: - $ref: '#/components/schemas/TargetExpression' - prefix: - $ref: '#/components/schemas/PrefixExpression' - filter: - $ref: '#/components/schemas/FilterExpression' - boosters: - type: array - items: - $ref: '#/components/schemas/BoosterExpression' - vectorSearch: - type: object - additionalProperties: false - properties: - column: - description: >- - The column to use for vector search. It must be of type - `vector`. - type: string - contentColumn: - description: >- - The column containing the text for vector search. Must - be of type `text`. - type: string - filter: - $ref: '#/components/schemas/FilterExpression' - required: - - column - - contentColumn - rules: - type: array - items: - type: string - additionalProperties: false - required: - - question - responses: - '200': - description: Response to the question - content: - application/json: - schema: - type: object - properties: - answer: - description: The answer to the input question - type: string - sessionId: - description: The session ID for the chat session. - type: string - required: - - answer - - sessionId - text/event-stream: - schema: - type: object - properties: - answer: - description: The answer to the input question - type: string - records: - description: The IDs of the records that were used as context. - type: array - items: - type: string - sessionId: - description: The session ID for the chat session. - type: string - required: - - answer - - records - - sessionId - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '429': - $ref: '#/components/responses/RateLimitError' - '503': - description: Unexpected Error - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/tables/{table_name}/ask/{session_id}: - summary: Ask follow-up questions of your data - description: >- - Continue a conversation with your data. This endpoint lets you continue a - question started via the /ask endpoint in order to dive deeper into your - context or ask clarifying questions. - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - - $ref: '#/components/parameters/ChatSessionIDParam' - post: - operationId: askTableSession - summary: Continue a conversation with your data - description: >- - Ask a follow-up question. If the `Accept` header is set to - `text/event-stream`, Xata will stream the results back as SSE's. - requestBody: - content: - application/json: - schema: - type: object - properties: - message: - description: The question you'd like to ask. - type: string - minLength: 3 - additionalProperties: false - responses: - '200': - description: Response to the question - content: - application/json: - schema: - type: object - properties: - answer: - description: The answer to the input question - type: string - required: - - answer - text/event-stream: - schema: - type: object - properties: - answer: - description: The answer to the input question - type: string - required: - - answer - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - '429': - $ref: '#/components/responses/RateLimitError' - '503': - $ref: '#/components/responses/ServiceUnavailableError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/tables/{table_name}/summarize: - summary: Summarize Table Data - description: | - This endpoint summarizes from your database. It comes with a range - of functions to help perform calculations on the data you have stored - in your tables - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - post: - operationId: summarizeTable - summary: Summarize table - description: > - This endpoint allows you to (optionally) define groups, and then to run - - calculations on the values in each group. This is most helpful when - - you'd like to understand the data you have in your database. - - - A group is a combination of unique values. If you create a group for - - `sold_by`, `product_name`, we will return one row for every combination - - of `sold_by` and `product_name` you have in your database. When you - - want to calculate statistics, you define these groups and ask Xata to - - calculate data on each group. - - - **Some questions you can ask of your data:** - - - How many records do I have in this table? - - - Set `columns: []` as we we want data from the entire table, so we ask - - for no groups. - - - Set `summaries: {"total": {"count": "*"}}` in order to see the count - - of all records. We use `count: *` here we'd like to know the total - - amount of rows; ignoring whether they are `null` or not. - - - What are the top total sales for each product in July 2022 and sold - - more than 10 units? - - - Set `filter: {soldAt: { - "$ge": "2022-07-01T00:00:00.000Z", - "$lt": "2022-08-01T00:00:00.000Z"} - }` - - in order to limit the result set to sales recorded in July 2022. - - - Set `columns: [product_name]` as we'd like to run calculations on - - each unique product name in our table. Setting `columns` like this will - - produce one row per unique product name. - - - Set `summaries: {"total_sales": {"count": "product_name"}}` as we'd - - like to create a field called "total_sales" for each group. This field - - will count all rows in each group with non-null product names. - - - Set `sort: [{"total_sales": "desc"}]` in order to bring the rows with - - the highest total_sales field to the top. - - - Set `summariesFilter: {"total_sales": {"$ge": 10}}` to only send back - data - - with greater than or equal to 10 units. - - - `columns`: tells Xata how to create each group. If you add `product_id` - - we will create a new group for every unique `product_id`. - - - `summaries`: tells Xata which calculations to run on each group. Xata - - currently supports count, min, max, sum, average. - - - `sort`: tells Xata in which order you'd like to see results. You may - - sort by fields specified in `columns` as well as the summary names - - defined in `summaries`. - - - note: Sorting on summarized values can be slower on very large tables; - - this will impact your rate limit significantly more than other queries. - - Try use `filter` to reduce the amount of data being processed in order - - to reduce impact on your limits. - - - `summariesFilter`: tells Xata how to filter the results of a summary. - - It has the same syntax as `filter`, however, by using `summariesFilter` - - you may also filter on the results of a query. - - - note: This is a much slower to use than `filter`. We recommend using - - `filter` wherever possible and `summariesFilter` when it's not - - possible to use `filter`. - - - `page.size`: tells Xata how many records to return. If unspecified, Xata - - will return the default size. - requestBody: - content: - application/json: - schema: - type: object - properties: - filter: - $ref: '#/components/schemas/FilterExpression' - columns: - $ref: '#/components/schemas/ColumnsProjection' - summaries: - $ref: '#/components/schemas/SummaryExpressionList' - sort: - $ref: '#/components/schemas/SortExpression' - summariesFilter: - $ref: '#/components/schemas/FilterExpression' - consistency: - description: The consistency level for this request. - type: string - default: strong - enum: - - strong - - eventual - page: - type: object - properties: - size: - description: > - The number of records returned by summarize. If the - amount of data you have exceeds this, or you have - - more complex reporting requirements, we recommend that - you use the aggregate endpoint instead. - type: integer - default: 20 - maximum: 1000 - minimum: 1 - responses: - '200': - $ref: '#/components/responses/SummarizeResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter - /db/{db_branch_name}/tables/{table_name}/aggregate: - summary: Aggregate Table - parameters: - - $ref: '#/components/parameters/DBBranchNameParam' - - $ref: '#/components/parameters/TableNameParam' - post: - operationId: aggregateTable - summary: Run aggregations over a table - description: > - This endpoint allows you to run aggregations (analytics) on the data - from one table. - - While the summary endpoint is served from a transactional store and the - results are strongly - - consistent, the aggregate endpoint is served from our columnar store and - the results are - - only eventually consistent. On the other hand, the aggregate endpoint - uses a - - store that is more appropiate for analytics, makes use of approximative - algorithms - - (e.g for cardinality), and is generally faster and can do more complex - aggregations. - - - For usage, see the [API - Guide](https://xata.io/docs/api-guide/aggregate). - requestBody: - content: - application/json: - schema: - type: object - properties: - filter: - $ref: '#/components/schemas/FilterExpression' - aggs: - $ref: '#/components/schemas/AggExpressionMap' - responses: - '200': - $ref: '#/components/responses/AggResponse' - '400': - $ref: '#/components/responses/BadRequestError' - '401': - $ref: '#/components/responses/AuthError' - '404': - $ref: '#/components/responses/SimpleError' - 5XX: - description: Unexpected Error - default: - description: Unexpected Error - security: - - bearerAuth: [] - tags: - - Search and Filter -components: - parameters: - BranchNameParam: - name: branch_name - in: path - required: true - schema: - $ref: '#/components/schemas/BranchName' - description: The Database Name - ChatSessionIDParam: - name: session_id - in: path - required: true - schema: - type: string - maxLength: 36 - minLength: 36 - title: SessionID - ColumnNameParam: - name: column_name - in: path - required: true - schema: - $ref: '#/components/schemas/ColumnName' - description: The Column name - ColumnsProjectionParam: - name: columns - in: query - required: false - explode: false - schema: - $ref: '#/components/schemas/ColumnsProjection' - description: Column filters - DBBranchNameParam: - name: db_branch_name - in: path - required: true - schema: - $ref: '#/components/schemas/DBBranchName' - description: | - The DBBranchName matches the pattern `{db_name}:{branch_name}`. - DBNameParam: - name: db_name - in: path - required: true - schema: - $ref: '#/components/schemas/DBName' - description: The Database Name - FileAccessIDParam: - name: file_id - in: path - required: true - schema: - $ref: '#/components/schemas/FileAccessID' - description: The File Access Identifier - FileItemIDParam: - name: file_id - in: path - required: true - schema: - $ref: '#/components/schemas/FileItemID' - description: The File Identifier - FileSignatureParam: - name: verify - in: query - required: false - explode: false - schema: - $ref: '#/components/schemas/FileSignature' - description: File access signature - RecordIDParam: - name: record_id - in: path - required: true - schema: - $ref: '#/components/schemas/RecordID' - description: The Record name - TableNameParam: - name: table_name - in: path - required: true - schema: - $ref: '#/components/schemas/TableName' - description: The Table name - schemas: - AggExpression: - description: > - The description of a single aggregation operation. It is an object with - only one key-value pair. - - The key represents the aggregation type, while the value is an object - with the configuration of - - the aggregation. - oneOf: - - type: object - additionalProperties: false - properties: - count: - $ref: '#/components/schemas/CountAgg' - - type: object - additionalProperties: false - properties: - sum: - $ref: '#/components/schemas/SumAgg' - - type: object - additionalProperties: false - properties: - max: - $ref: '#/components/schemas/MaxAgg' - - type: object - additionalProperties: false - properties: - min: - $ref: '#/components/schemas/MinAgg' - - type: object - additionalProperties: false - properties: - average: - $ref: '#/components/schemas/AverageAgg' - - type: object - additionalProperties: false - properties: - uniqueCount: - $ref: '#/components/schemas/UniqueCountAgg' - - type: object - additionalProperties: false - properties: - dateHistogram: - $ref: '#/components/schemas/DateHistogramAgg' - - type: object - additionalProperties: false - properties: - topValues: - $ref: '#/components/schemas/TopValuesAgg' - - type: object - additionalProperties: false - properties: - numericHistogram: - $ref: '#/components/schemas/NumericHistogramAgg' - AggExpressionMap: - description: | - The description of the aggregations you wish to receive. - type: object - example: - totalCount: - count: '*' - dailyActiveUsers: - dateHistogram: - column: date - interval: 1d - aggs: - uniqueUsers: - uniqueCount: - column: userID - additionalProperties: - $ref: '#/components/schemas/AggExpression' - AggResponse: - oneOf: - - type: number - nullable: true - - type: object - properties: - values: - type: array - items: - type: object - properties: - $key: - oneOf: - - type: string - - type: number - $count: - type: integer - additionalProperties: - $ref: '#/components/schemas/AggResponse' - required: - - $key - - $count - required: - - values - AverageAgg: - description: The average of the numeric values in a particular column. - type: object - properties: - column: - description: The column on which to compute the average. Must be a numeric type. - type: string - additionalProperties: false - required: - - column - BoosterExpression: - description: Booster Expression - oneOf: - - type: object - additionalProperties: false - properties: - valueBooster: - $ref: '#/components/schemas/ValueBooster' - - type: object - additionalProperties: false - properties: - numericBooster: - $ref: '#/components/schemas/NumericBooster' - - type: object - additionalProperties: false - properties: - dateBooster: - $ref: '#/components/schemas/DateBooster' - Branch: - type: object - properties: - name: - type: string - createdAt: - $ref: '#/components/schemas/DateTime' - additionalProperties: false - required: - - name - - createdAt - BranchMetadata: - description: '' - type: object - properties: - repository: - type: string - minLength: 1 - branch: - $ref: '#/components/schemas/BranchName' - stage: - type: string - minLength: 1 - labels: - type: array - items: - type: string - example: - repository: github.com/my/repository - branch: feature-login - stage: testing - labels: - - epic-100 - BranchMigration: - type: object - properties: - id: - type: string - parentID: - type: string - status: - type: string - title: - type: string - lastGitRevision: - type: string - localChanges: - type: boolean - createdAt: - $ref: '#/components/schemas/DateTime' - newTables: - type: object - additionalProperties: - $ref: '#/components/schemas/Table' - removedTables: - type: array - items: - type: string - tableMigrations: - type: object - additionalProperties: - $ref: '#/components/schemas/TableMigration' - newTableOrder: - type: array - items: - type: string - renamedTables: - type: array - items: - $ref: '#/components/schemas/TableRename' - required: - - status - - localChanges - - newTableOrder - title: Migration - BranchName: - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_\-~]+' - title: BranchName - BranchOp: - type: object - properties: - id: - type: string - parentID: - type: string - title: - type: string - message: - type: string - status: - $ref: '#/components/schemas/MigrationStatus' - createdAt: - $ref: '#/components/schemas/DateTime' - modifiedAt: - $ref: '#/components/schemas/DateTime' - migration: - $ref: '#/components/schemas/Commit' - required: - - id - - status - - createdAt - BranchWithCopyID: - type: object - properties: - branchName: - $ref: '#/components/schemas/BranchName' - dbBranchID: - type: string - copyID: - type: string - required: - - branchName - - dbBranchID - - copyID - title: BranchWithCopyID - Column: - type: object - properties: - name: - type: string - type: - type: string - enum: - - bool - - int - - float - - string - - text - - email - - multiple - - link - - object - - datetime - - vector - - file - - fileArray - - json - link: - $ref: '#/components/schemas/ColumnLink' - vector: - $ref: '#/components/schemas/ColumnVector' - file: - $ref: '#/components/schemas/ColumnFile' - fileArray: - $ref: '#/components/schemas/ColumnFile' - notNull: - type: boolean - defaultValue: - type: string - unique: - type: boolean - columns: - type: array - items: - $ref: '#/components/schemas/Column' - required: - - name - - type - title: Column - ColumnFile: - type: object - properties: - defaultPublicAccess: - type: boolean - additionalProperties: false - ColumnLink: - type: object - properties: - table: - type: string - required: - - table - ColumnMigration: - type: object - properties: - old: - $ref: '#/components/schemas/Column' - new: - $ref: '#/components/schemas/Column' - required: - - old - - new - title: ColumnMigration - ColumnName: - type: string - pattern: '[a-zA-Z0-9_\-~\.]+' - title: ColumnName - ColumnOpAdd: - type: object - properties: - table: - type: string - column: - $ref: '#/components/schemas/Column' - required: - - table - - column - ColumnOpRemove: - type: object - properties: - table: - type: string - column: - type: string - required: - - table - - column - ColumnOpRename: - type: object - properties: - table: - type: string - oldName: - type: string - newName: - type: string - required: - - table - - oldName - - newName - ColumnVector: - type: object - properties: - dimension: - type: integer - maximum: 10000 - minimum: 2 - additionalProperties: false - required: - - dimension - ColumnsProjection: - type: array - items: - type: string - example: - - name - - email - - created_at - Commit: - type: object - properties: - title: - type: string - message: - type: string - id: - type: string - parentID: - type: string - checksum: - type: string - mergeParentID: - type: string - createdAt: - $ref: '#/components/schemas/DateTime' - operations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - required: - - operations - - id - - createdAt - - checksum - CountAgg: - description: Count the number of records with an optional filter. - oneOf: - - type: object - properties: - filter: - $ref: '#/components/schemas/FilterExpression' - additionalProperties: false - - type: string - description: Use this form to count all records without any filter. - enum: - - '*' - DBBranch: - type: object - properties: - databaseName: - $ref: '#/components/schemas/DBName' - branchName: - $ref: '#/components/schemas/BranchName' - createdAt: - $ref: '#/components/schemas/DateTime' - id: - type: string - version: - type: number - lastMigrationID: - type: string - metadata: - $ref: '#/components/schemas/BranchMetadata' - startedFrom: - $ref: '#/components/schemas/StartedFromMetadata' - schema: - $ref: '#/components/schemas/Schema' - required: - - databaseName - - branchName - - createdAt - - id - - version - - lastMigrationID - - schema - title: DBBranch - DBBranchName: - description: | - The DBBranchName matches the pattern `{db_name}:{branch_name}`. - type: string - maxLength: 511 - minLength: 1 - pattern: '[a-zA-Z0-9_\-~]+:[a-zA-Z0-9_\-~]+' - title: Tuple of database and branch name - DBName: - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_\-~]+' - title: DBName - DataInputRecord: - description: Xata input record - type: object - additionalProperties: - nullable: true - anyOf: - - $ref: '#/components/schemas/RecordID' - - type: string - - type: boolean - - type: number - - type: array - items: - type: string - - type: array - items: - type: number - - $ref: '#/components/schemas/DateTime' - - $ref: '#/components/schemas/InputFileArray' - - $ref: '#/components/schemas/InputFile' - DateBooster: - description: > - Boost records based on the value of a datetime column. It is configured - via "origin", "scale", and "decay". The further away from the "origin", - - the more the score is decayed. The decay function uses an exponential - function. For example if origin is "now", and scale is 10 days and decay - is 0.5, it - - should be interpreted as: a record with a date 10 days before/after - origin will be boosted 2 times less than a record with the date at - origin. - - The result of the exponential function is a boost between 0 and 1. The - "factor" allows you to control how impactful this boost is, by - multiplying it with a given value. - properties: - column: - description: The column in which to look for the value. - type: string - origin: - description: > - The datetime (formatted as RFC3339) from where to apply the score - decay function. The maximum boost will be applied for records with - values at this time. - - If it is not specified, the current date and time is used. - type: string - scale: - description: > - The duration at which distance from origin the score is decayed with - factor, using an exponential function. It is formatted as number + - units, for example: `5d`, `20m`, `10s`. - type: string - pattern: ^(\d+)(d|h|m|s|ms)$ - decay: - description: The decay factor to expect at "scale" distance from the "origin". - type: number - factor: - description: The factor with which to multiply the added boost. - type: number - minimum: 0 - ifMatchesFilter: - description: > - Only apply this booster to the records for which the provided filter - matches. - $ref: '#/components/schemas/FilterExpression' - additionalProperties: false - required: - - column - - scale - - decay - DateHistogramAgg: - description: > - Split data into buckets by a datetime column. Accepts sub-aggregations - for each bucket. - type: object - properties: - column: - description: The column to use for bucketing. Must be of type datetime. - type: string - interval: - description: | - The fixed interval to use when bucketing. - It is formatted as number + units, for example: `5d`, `20m`, `10s`. - type: string - pattern: ^(\d+)(d|h|m|s|ms)$ - calendarInterval: - description: > - The calendar-aware interval to use when bucketing. Possible values - are: `minute`, - - `hour`, `day`, `week`, `month`, `quarter`, `year`. - type: string - enum: - - minute - - hour - - day - - week - - month - - quarter - - year - timezone: - description: > - The timezone to use for bucketing. By default, UTC is assumed. - - The accepted format is as an ISO 8601 UTC offset. For example: - `+01:00` or - - `-08:00`. - type: string - pattern: ^[+-][01]\d:[0-5]\d$ - aggs: - $ref: '#/components/schemas/AggExpressionMap' - additionalProperties: false - required: - - column - DateTime: - type: string - format: date-time - title: DateTime - FileAccessID: - description: File identifier in access URLs - type: string - maxLength: 296 - minLength: 88 - pattern: '[a-v0-9=]+' - title: FileID - FileItemID: - description: Unique file identifier - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_-~:]+' - title: FileID - FileName: - description: File name - type: string - maxLength: 1024 - minLength: 0 - pattern: '[0-9a-zA-Z!\-_\.\*''\(\)]*' - FileResponse: - description: File metadata - type: object - properties: - id: - $ref: '#/components/schemas/FileItemID' - name: - $ref: '#/components/schemas/FileName' - mediaType: - $ref: '#/components/schemas/MediaType' - size: - type: integer - format: int64 - version: - type: integer - format: int64 - attributes: - type: object - required: - - name - - mediaType - - size - - version - FileSignature: - description: File signature - type: string - FilterColumn: - anyOf: - - $ref: '#/components/schemas/FilterColumnIncludes' - - $ref: '#/components/schemas/FilterPredicate' - - $ref: '#/components/schemas/FilterList' - FilterColumnIncludes: - type: object - properties: - $includes: - $ref: '#/components/schemas/FilterPredicate' - $includesAny: - $ref: '#/components/schemas/FilterPredicate' - $includesAll: - $ref: '#/components/schemas/FilterPredicate' - $includesNone: - $ref: '#/components/schemas/FilterPredicate' - additionalProperties: false - maxProperties: 1 - minProperties: 1 - FilterExpression: - type: object - properties: - $exists: - type: string - $existsNot: - type: string - $any: - $ref: '#/components/schemas/FilterList' - $all: - $ref: '#/components/schemas/FilterList' - $none: - $ref: '#/components/schemas/FilterList' - $not: - $ref: '#/components/schemas/FilterList' - additionalProperties: - $ref: '#/components/schemas/FilterColumn' - minProperties: 1 - FilterList: - oneOf: - - $ref: '#/components/schemas/FilterExpression' - - type: array - items: - $ref: '#/components/schemas/FilterExpression' - FilterPredicate: - oneOf: - - $ref: '#/components/schemas/FilterValue' - - type: array - items: - $ref: '#/components/schemas/FilterPredicate' - minLength: 1 - - $ref: '#/components/schemas/FilterPredicateOp' - - $ref: '#/components/schemas/FilterPredicateRangeOp' - FilterPredicateOp: - type: object - properties: - $any: - oneOf: - - type: array - items: - $ref: '#/components/schemas/FilterPredicate' - $all: - oneOf: - - type: array - items: - $ref: '#/components/schemas/FilterPredicate' - $none: - oneOf: - - $ref: '#/components/schemas/FilterPredicate' - - type: array - items: - $ref: '#/components/schemas/FilterPredicate' - $not: - oneOf: - - $ref: '#/components/schemas/FilterPredicate' - - type: array - items: - $ref: '#/components/schemas/FilterPredicate' - $is: - oneOf: - - $ref: '#/components/schemas/FilterValue' - - type: array - items: - $ref: '#/components/schemas/FilterValue' - $isNot: - oneOf: - - $ref: '#/components/schemas/FilterValue' - - type: array - items: - $ref: '#/components/schemas/FilterValue' - $lt: - $ref: '#/components/schemas/FilterRangeValue' - $le: - $ref: '#/components/schemas/FilterRangeValue' - $gt: - $ref: '#/components/schemas/FilterRangeValue' - $ge: - $ref: '#/components/schemas/FilterRangeValue' - $contains: - type: string - $startsWith: - type: string - $endsWith: - type: string - $pattern: - type: string - additionalProperties: false - maxProperties: 1 - minProperties: 1 - FilterPredicateRangeOp: - type: object - properties: - $lt: - $ref: '#/components/schemas/FilterRangeValue' - $le: - $ref: '#/components/schemas/FilterRangeValue' - $gt: - $ref: '#/components/schemas/FilterRangeValue' - $ge: - $ref: '#/components/schemas/FilterRangeValue' - additionalProperties: false - maxProperties: 2 - minProperties: 2 - FilterRangeValue: - oneOf: - - type: number - - type: string - FilterValue: - oneOf: - - type: number - - type: string - - type: boolean - FuzzinessExpression: - description: > - Maximum [Levenshtein - distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the - search terms. The Levenshtein - - distance is the number of one character changes needed to make two - strings equal. The default is 1, meaning that single - - character typos per word are tolerated by search. You can set it to 0 to - remove the typo tolerance or set it to 2 - - to allow two typos in a word. - type: integer - default: 1 - maximum: 2 - minimum: 0 - HighlightExpression: - type: object - properties: - enabled: - description: | - Set to `false` to disable highlighting. By default it is `true`. - type: boolean - encodeHTML: - description: > - Set to `false` to disable HTML encoding in highlight snippets. By - default it is `true`. - type: boolean - additionalProperties: false - InputFile: - description: Object representing a file - type: object - properties: - name: - $ref: '#/components/schemas/FileName' - mediaType: - $ref: '#/components/schemas/MediaType' - base64Content: - description: Base64 encoded content - type: string - maxLength: 20971520 - enablePublicUrl: - description: Enable public access to the file - type: boolean - signedUrlTimeout: - description: Time to live for signed URLs - type: integer - additionalProperties: false - required: - - name - InputFileArray: - description: Array of file entries - type: array - items: - $ref: '#/components/schemas/InputFileEntry' - maxItems: 50 - InputFileEntry: - description: Object representing a file in an array - properties: - id: - $ref: '#/components/schemas/FileItemID' - name: - $ref: '#/components/schemas/FileName' - mediaType: - $ref: '#/components/schemas/MediaType' - base64Content: - description: Base64 encoded content - type: string - maxLength: 20971520 - enablePublicUrl: - description: Enable public access to the file - type: boolean - signedUrlTimeout: - description: Time to live for signed URLs - type: integer - additionalProperties: false - ListBranchesResponse: - type: object - properties: - databaseName: - type: string - branches: - type: array - items: - $ref: '#/components/schemas/Branch' - additionalProperties: false - required: - - databaseName - - branches - ListGitBranchesResponse: - type: object - properties: - mapping: - type: array - items: - type: object - properties: - gitBranch: - type: string - xataBranch: - type: string - required: - - gitBranch - - xataBranch - required: - - mapping - MaxAgg: - description: The max of the numeric values in a particular column. - type: object - properties: - column: - description: The column on which to compute the max. Must be a numeric type. - type: string - additionalProperties: false - required: - - column - MediaType: - description: Media type - type: string - maxLength: 255 - minLength: 3 - pattern: ^\w+/[-+.\w]+$ - MetricsDatapoint: - type: object - properties: - timestamp: - type: string - value: - type: integer - required: - - timestamp - - value - title: Datapoint - MetricsLatency: - type: object - properties: - p50: - type: array - items: - $ref: '#/components/schemas/MetricsDatapoint' - p90: - type: array - items: - $ref: '#/components/schemas/MetricsDatapoint' - title: MetricsLatency - Migration: - description: Branch schema migration. - type: object - properties: - parentID: - type: string - operations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - required: - - operations - MigrationColumnOp: - oneOf: - - type: object - additionalProperties: false - properties: - addColumn: - $ref: '#/components/schemas/ColumnOpAdd' - required: - - addColumn - - type: object - additionalProperties: false - properties: - removeColumn: - $ref: '#/components/schemas/ColumnOpRemove' - required: - - removeColumn - - type: object - additionalProperties: false - properties: - renameColumn: - $ref: '#/components/schemas/ColumnOpRename' - required: - - renameColumn - MigrationObject: - type: object - properties: - title: - type: string - message: - type: string - id: - type: string - parentID: - type: string - checksum: - type: string - operations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - required: - - operations - - id - - checksum - MigrationOp: - description: Branch schema migration operations. - oneOf: - - $ref: '#/components/schemas/MigrationTableOp' - - $ref: '#/components/schemas/MigrationColumnOp' - MigrationRequest: - type: object - properties: - number: - $ref: '#/components/schemas/MigrationRequestNumber' - createdAt: - description: Migration request creation timestamp. - $ref: '#/components/schemas/DateTime' - modifiedAt: - description: Last modified timestamp. - $ref: '#/components/schemas/DateTime' - closedAt: - description: Timestamp when the migration request was closed. - $ref: '#/components/schemas/DateTime' - mergedAt: - description: Timestamp when the migration request was merged. - $ref: '#/components/schemas/DateTime' - status: - type: string - enum: - - open - - closed - - merging - - merged - - failed - title: - description: The migration request title. - type: string - body: - description: The migration request body with detailed description. - type: string - source: - description: Name of the source branch. - type: string - target: - description: Name of the target branch. - type: string - additionalProperties: false - MigrationRequestNumber: - description: The migration request number. - type: integer - minimum: 0 - MigrationStatus: - type: string - enum: - - completed - - pending - - failed - MigrationTableOp: - oneOf: - - type: object - additionalProperties: false - properties: - addTable: - $ref: '#/components/schemas/TableOpAdd' - required: - - addTable - - type: object - additionalProperties: false - properties: - removeTable: - $ref: '#/components/schemas/TableOpRemove' - required: - - removeTable - - type: object - additionalProperties: false - properties: - renameTable: - $ref: '#/components/schemas/TableOpRename' - required: - - renameTable - MinAgg: - description: The min of the numeric values in a particular column. - type: object - properties: - column: - description: The column on which to compute the min. Must be a numeric type. - type: string - additionalProperties: false - required: - - column - NumericBooster: - description: Boost records based on the value of a numeric column. - type: object - properties: - column: - description: The column in which to look for the value. - type: string - factor: - description: >- - The factor with which to multiply the value of the column before - adding it to the item score. - type: number - modifier: - description: > - Modifier to be applied to the column value, before being multiplied - with the factor. The possible values are: - - none (default). - - log: common logarithm (base 10) - - log1p: add 1 then take the common logarithm. This ensures that the value is positive if the - value is between 0 and 1. - - ln: natural logarithm (base e) - - ln1p: add 1 then take the natural logarithm. This ensures that the value is positive if the - value is between 0 and 1. - - square: raise the value to the power of two. - - sqrt: take the square root of the value. - - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`). - type: string - enum: - - none - - log - - log1p - - ln - - ln1p - - square - - sqrt - - reciprocal - ifMatchesFilter: - description: > - Only apply this booster to the records for which the provided filter - matches. - $ref: '#/components/schemas/FilterExpression' - additionalProperties: false - required: - - column - - factor - NumericHistogramAgg: - description: > - Split data into buckets by dynamic numeric ranges. Accepts - sub-aggregations for each bucket. - properties: - column: - description: The column to use for bucketing. Must be of numeric type. - type: string - interval: - description: > - The numeric interval to use for bucketing. The resulting buckets - will be ranges - - with this value as size. - type: number - minimum: 0 - offset: - description: > - By default the bucket keys start with 0 and then continue in - `interval` steps. The bucket - - boundaries can be shifted by using the offset option. For example, - if the `interval` is 100, - - but you prefer the bucket boundaries to be `[50, 150), [150, 250), - etc.`, you can set `offset` - - to 50. - type: number - default: 0 - aggs: - $ref: '#/components/schemas/AggExpressionMap' - additionalProperties: false - required: - - column - - interval - PageConfig: - description: Pagination settings. - type: object - properties: - after: - description: Query the next page that follow the cursor. - type: string - before: - description: Query the previous page before the cursor. - type: string - start: - description: Query the first page from the cursor. - type: string - end: - description: Query the last page from the cursor. - type: string - size: - description: >- - Set page size. If the size is missing it is read from the cursor. If - no cursor is given Xata will choose the default page size. - type: integer - default: 20 - offset: - description: >- - Use offset to skip entries. To skip pages set offset to a multiple - of size. - type: integer - default: 0 - title: PageConfig - PrefixExpression: - description: > - If the prefix type is set to "disabled" (the default), the search only - matches full words. If the prefix type is set to "phrase", the search - will return results that match prefixes of the search phrase. - type: string - enum: - - phrase - - disabled - ProjectionConfig: - description: A structured projection that allows for some configuration. - type: object - properties: - name: - description: >- - The name of the column to project or a reverse link specification, - see [API - Guide](https://xata.io/docs/concepts/data-model#links-and-relations). - type: string - columns: - $ref: '#/components/schemas/QueryColumnsProjection' - as: - description: >- - An alias for the projected field, this is how it will be returned in - the response. - type: string - sort: - $ref: '#/components/schemas/SortExpression' - limit: - type: integer - default: 20 - offset: - type: integer - default: 0 - QueryColumnsProjection: - type: array - items: - oneOf: - - type: string -# - $ref: '#/components/schemas/ProjectionConfig' - Record: - description: Xata Table Record - allOf: - - $ref: '#/components/schemas/RecordMeta' - - type: object - additionalProperties: false - title: Record - RecordID: - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_-~:]+' - title: RecordID - RecordMeta: - description: Xata Table Record Metadata - type: object - properties: - id: - $ref: '#/components/schemas/RecordID' - xata: - type: object - properties: - version: - description: >- - The record's version. Can be used for optimistic concurrency - control. - type: integer - createdAt: - description: The time when the record was created. - type: string - updatedAt: - description: The time when the record was last updated. - type: string - table: - description: >- - The record's table name. APIs that return records from multiple - tables will set this field accordingly. - type: string - highlight: - description: >- - Highlights of the record. This is used by the search APIs to - indicate which fields and parts of the fields have matched the - search. - type: object - additionalProperties: - oneOf: - - type: array - items: - type: string - - type: object - additionalProperties: true - score: - description: >- - The record's relevancy score. This is returned by the search - APIs. - type: number - warnings: - description: Encoding/Decoding errors - type: array - items: - type: string - required: - - version - required: - - id - - xata - title: RecordMeta - RecordsMetadata: - description: Records metadata - type: object - properties: - page: - type: object - properties: - cursor: - description: last record id - type: string - more: - description: true if more records can be fetched - type: boolean - size: - description: the number of records returned per page - type: number - required: - - cursor - - more - - size - required: - - page - RevLink: - type: object - properties: - table: - type: string - column: - type: string - required: - - table - - column - title: RevLink - SQLRecord: - description: Xata Table SQL Record - allOf: - - type: object - additionalProperties: true - title: SQL Record - Schema: - type: object - properties: - tables: - type: array - items: - $ref: '#/components/schemas/Table' - tablesOrder: - type: array - items: - type: string - required: - - tables - title: Schema - SchemaEditScript: - type: object - properties: - sourceMigrationID: - type: string - targetMigrationID: - type: string - operations: - type: array - items: - $ref: '#/components/schemas/MigrationOp' - required: - - operations - title: SchemaEditScript - SearchPageConfig: - description: Pagination settings for the search endpoints. - properties: - size: - description: Set page size. - type: integer - default: 25 - maximum: 200 - offset: - description: >- - Use offset to skip entries. To skip pages set offset to a multiple - of size. - type: integer - default: 0 - maximum: 800 - title: SearchPageConfig - SortExpression: - oneOf: - - type: array - items: - type: string - - type: object - additionalProperties: - $ref: '#/components/schemas/SortOrder' - - type: array - items: - type: object - additionalProperties: - $ref: '#/components/schemas/SortOrder' - title: SortExpression - SortOrder: - type: string - enum: - - asc - - desc - - random - title: SortOrder - StartedFromMetadata: - type: object - properties: - branchName: - $ref: '#/components/schemas/BranchName' - dbBranchID: - type: string - migrationID: - type: string - required: - - branchName - - dbBranchID - - migrationID - title: StartedFromMetadata - SumAgg: - description: The sum of the numeric values in a particular column. - type: object - properties: - column: - description: The column on which to compute the sum. Must be a numeric type. - type: string - additionalProperties: false - required: - - column - SummaryExpression: - description: > - A summary expression is the description of a single summary operation. - It consists of a single - - key representing the operation, and a value representing the column to - be operated on. - - - The column being summarized cannot be an internal column (id, xata.*), - nor the base of - - an object, i.e. if `settings` is an object with `dark_mode` as a field, - you may summarize - - `settings.dark_mode` but not `settings` nor `settings.*`. - - - We currently support several aggregation functions. Not all functions - can be run on all column - - types. - - - `count` is used to count the number of records in each group. Use `{"count": "*"}` to count - all columns present, otherwise `{"count": ""}` to count the number of non-null - values are present at column path. - - Count can be used on any column type, and always returns an int. - - - `min` calculates the minimum value in each group. `min` is compatible with most types; - string, multiple, text, email, int, float, and datetime. It returns a value of the same - type as operated on. This means that `{"lowest_latency": {"min": "latency"}}` where - `latency` is an int, will always return an int. - - - `max` calculates the maximum value in each group. `max` shares the same compatibility as - `min`. - - - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will - return a value of the same type as requested. - - - `average` averages all values in a group. `average` can be run on `int` and `float` types, and - always returns a float. - type: object - example: - count: deleted_at - SummaryExpressionList: - description: > - The description of the summaries you wish to receive. Set each key to be - the field name - - you'd like for the summary. These names must not collide with other - columns you've - - requested from `columns`; including implicit requests like `settings.*`. - - - The value for each key needs to be an object. This object should contain - one key and one - - value only. In this object, the key should be set to the summary - function you wish to use - - and the value set to the column name to be summarized. - - - The column being summarized cannot be an internal column (id, xata.*), - nor the base of - - an object, i.e. if `settings` is an object with `dark_mode` as a field, - you may summarize - - `settings.dark_mode` but not `settings` nor `settings.*`. - type: object - example: - all_users: - count: '*' - total_created: - count: created_at - min_cost: - min: cost - max_happiness: - max: happiness - total_revenue: - sum: revenue - average_speed: - average: speed - additionalProperties: - $ref: '#/components/schemas/SummaryExpression' - Table: - type: object - properties: - id: - type: string - name: - $ref: '#/components/schemas/TableName' - columns: - type: array - items: - $ref: '#/components/schemas/Column' - revLinks: - type: array - items: - $ref: '#/components/schemas/RevLink' - required: - - name - - columns - title: Table - TableMigration: - type: object - properties: - newColumns: - type: object - additionalProperties: - $ref: '#/components/schemas/Column' - removedColumns: - type: array - items: - type: string - modifiedColumns: - type: array - items: - $ref: '#/components/schemas/ColumnMigration' - newColumnOrder: - type: array - items: - type: string - required: - - newColumnOrder - title: TableMigration - TableName: - type: string - maxLength: 255 - minLength: 1 - pattern: '[a-zA-Z0-9_\-~]+' - title: TableName - TableOpAdd: - type: object - properties: - table: - type: string - required: - - table - TableOpRemove: - type: object - properties: - table: - type: string - required: - - table - TableOpRename: - type: object - properties: - oldName: - type: string - newName: - type: string - required: - - oldName - - newName - TableRename: - description: '' - type: object - properties: - newName: - type: string - minLength: 1 - oldName: - type: string - minLength: 1 - example: - newName: newName - oldName: oldName - required: - - newName - - oldName - TargetExpression: - description: > - The target expression is used to filter the search results by the target - columns. - type: array - items: - oneOf: - - type: string - - type: object - properties: - column: - description: The name of the column. - type: string - weight: - description: The weight of the column. - type: number - default: 1 - maximum: 10 - minimum: 1 - required: - - column - additionalProperties: false - TopValuesAgg: - description: > - Split data into buckets by the unique values in a column. Accepts - sub-aggregations for each bucket. - - The top values as ordered by the number of records (`$count`) are - returned. - properties: - column: - description: >- - The column to use for bucketing. Accepted types are `string`, - `email`, `int`, `float`, or `bool`. - type: string - aggs: - $ref: '#/components/schemas/AggExpressionMap' - size: - description: | - The maximum number of unique values to return. - type: integer - default: 10 - maximum: 1000 - additionalProperties: false - required: - - column - TransactionDeleteOp: - description: >- - A delete operation. The transaction will continue if no record matches - the ID by default. To override this behaviour, set failIfMissing to - true. - type: object - properties: - table: - description: The table name - type: string - id: - $ref: '#/components/schemas/RecordID' - failIfMissing: - description: If true, the transaction will fail when the record doesn't exist. - type: boolean - columns: - description: >- - If set, the call will return the requested fields as part of the - response. - type: array - items: - type: string - required: - - table - - id - TransactionError: - description: An error message from a failing transaction operation - type: object - properties: - index: - description: The index of the failing operation - type: integer - message: - description: The error message - type: string - required: - - index - - message - TransactionFailure: - description: An array of errors, with indices, from the transaction. - type: object - properties: - id: - description: The request ID. - type: string - errors: - description: An array of errors from the submitted operations. - type: array - items: - $ref: '#/components/schemas/TransactionError' - required: - - id - - errors - TransactionGetOp: - description: Get by id operation. - type: object - properties: - table: - description: The table name - type: string - id: - $ref: '#/components/schemas/RecordID' - columns: - description: >- - If set, the call will return the requested fields as part of the - response. - type: array - items: - type: string - required: - - table - - id - TransactionInsertOp: - description: Insert operation - type: object - properties: - table: - description: The table name - type: string - record: - description: > - The record to insert. The `id` field is optional; when specified, it - will be used as the ID for the record. - type: object - additionalProperties: true - ifVersion: - description: > - The version of the record you expect to be overwriting. Only valid - with an - - explicit ID is also set in the `record` key. - type: integer - createOnly: - description: > - createOnly is used to change how Xata acts when an explicit ID is - set in the `record` key. - - - If `createOnly` is set to `true`, Xata will only attempt to insert - the record. If there's a conflict, Xata - - will cancel the transaction. - - - If `createOnly` is set to `false`, Xata will attempt to insert the - record. If there's no - - conflict, the record is inserted. If there is a conflict, Xata will - replace the record. - type: boolean - columns: - description: >- - If set, the call will return the requested fields as part of the - response. - type: array - items: - type: string - required: - - table - - record - TransactionOperation: - description: A transaction operation - type: object - oneOf: - - type: object - properties: - insert: - $ref: '#/components/schemas/TransactionInsertOp' - required: - - insert - - type: object - properties: - update: - $ref: '#/components/schemas/TransactionUpdateOp' - required: - - update - - type: object - properties: - delete: - $ref: '#/components/schemas/TransactionDeleteOp' - required: - - delete - - type: object - properties: - get: - $ref: '#/components/schemas/TransactionGetOp' - required: - - get - TransactionResultColumns: - description: Fields to return in the transaction result. - type: object - additionalProperties: true - TransactionResultDelete: - description: A result from a delete operation. - type: object - properties: - operation: - description: The type of operation who's result is being returned. - type: string - enum: - - delete - rows: - description: The number of deleted rows - type: integer - columns: - $ref: '#/components/schemas/TransactionResultColumns' - required: - - operation - - rows - TransactionResultGet: - description: A result from a get operation. - type: object - properties: - operation: - description: The type of operation who's result is being returned. - type: string - enum: - - get - columns: - $ref: '#/components/schemas/TransactionResultColumns' - required: - - operation - TransactionResultInsert: - description: A result from an insert operation. - type: object - properties: - operation: - description: The type of operation who's result is being returned. - type: string - enum: - - insert - rows: - description: The number of affected rows - type: integer - id: - $ref: '#/components/schemas/RecordID' - columns: - $ref: '#/components/schemas/TransactionResultColumns' - required: - - operation - - rows - - id - TransactionResultUpdate: - description: A result from an update operation. - type: object - properties: - operation: - description: The type of operation who's result is being returned. - type: string - enum: - - update - rows: - description: The number of updated rows - type: integer - id: - $ref: '#/components/schemas/RecordID' - columns: - $ref: '#/components/schemas/TransactionResultColumns' - required: - - operation - - rows - - id - TransactionSuccess: - description: An ordered array of results from the submitted operations. - type: object - properties: - results: - type: array - items: - oneOf: - - $ref: '#/components/schemas/TransactionResultInsert' - - $ref: '#/components/schemas/TransactionResultUpdate' - - $ref: '#/components/schemas/TransactionResultDelete' - - $ref: '#/components/schemas/TransactionResultGet' - required: - - results - TransactionUpdateOp: - description: Update operation - type: object - properties: - table: - description: The table name - type: string - id: - $ref: '#/components/schemas/RecordID' - fields: - description: The fields of the record you'd like to update - type: object - additionalProperties: true - ifVersion: - description: The version of the record you expect to be updating - type: integer - upsert: - description: Xata will insert this record if it cannot be found. - type: boolean - columns: - description: >- - If set, the call will return the requested fields as part of the - response. - type: array - items: - type: string - required: - - table - - id - - fields - UniqueCountAgg: - description: Count the number of distinct values in a particular column. - type: object - properties: - column: - description: The column from where to count the unique values. - type: string - precisionThreshold: - description: > - The threshold under which the unique count is exact. If the number - of unique - - values in the column is higher than this threshold, the results are - approximate. - - Maximum value is 40,000, default value is 3000. - type: integer - additionalProperties: false - required: - - column - ValueBooster: - description: Boost records with a particular value for a column. - type: object - properties: - column: - description: The column in which to look for the value. - type: string - value: - description: The exact value to boost. - oneOf: - - type: string - - type: number - - type: boolean - factor: - description: The factor with which to multiply the added boost. - type: number - ifMatchesFilter: - description: > - Only apply this booster to the records for which the provided filter - matches. - $ref: '#/components/schemas/FilterExpression' - additionalProperties: false - required: - - column - - value - - factor - responses: - AggResponse: - description: OK - content: - application/json: - schema: - type: object - properties: - aggs: - type: object - additionalProperties: - $ref: '#/components/schemas/AggResponse' - example: - aggs: - dailyUniqueUsers: - values: - - $count: 321 - $key: '2022-02-22T22:22:22Z' - uniqueUsers: 134 - - $count: 202 - $key: '2022-02-23T22:22:22Z' - uniqueUsers: 90 - AuthError: - description: Authentication Error - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - example: - message: invalid API key - required: - - message - BadRequestError: - description: Bad Request - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - required: - - message - BranchMigrationPlan: - description: Example response - content: - application/json: - schema: - type: object - properties: - version: - type: integer - migration: - $ref: '#/components/schemas/BranchMigration' - required: - - version - - migration - BulkError: - description: Response with multiple errors of the bulk execution - content: - application/json: - schema: - type: object - properties: - errors: - type: array - items: - type: object - properties: - message: - type: string - status: - type: integer - required: - - errors - BulkInsertResponse: - description: OK - content: - application/json: - schema: - oneOf: - - type: object - properties: - recordIDs: - type: array - items: - type: string - required: - - recordIDs - - type: object - properties: - records: - type: array - items: - $ref: '#/components/schemas/Record' - required: - - records - PutFileResponse: - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/FileResponse' - QueryResponse: - description: OK - content: - application/json: - schema: - type: object - properties: - records: - type: array - items: - $ref: '#/components/schemas/Record' - meta: - $ref: '#/components/schemas/RecordsMetadata' - required: - - records - - meta - RateLimitError: - description: Rate limit exceeded - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - required: - - message - RecordResponse: - description: Table Record Reponse - content: - application/json: - schema: - $ref: '#/components/schemas/Record' - RecordUpdateResponse: - description: Record ID and metadata - content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/Record' - - type: object - properties: - id: - type: string - xata: - type: object - properties: - version: - type: integer - createdAt: - type: string - updatedAt: - type: string - required: - - version - - createdAt - - updatedAt - required: - - id - - xata - SQLResponse: - description: OK - content: - application/json: - schema: - type: object - properties: - records: - type: array - items: - $ref: '#/components/schemas/SQLRecord' - warning: - type: string - SchemaCompareResponse: - description: Schema comparison response. - content: - application/json: - schema: - type: object - properties: - source: - $ref: '#/components/schemas/Schema' - target: - $ref: '#/components/schemas/Schema' - edits: - $ref: '#/components/schemas/SchemaEditScript' - required: - - source - - target - - edits - SchemaUpdateResponse: - description: Schema migration response with ID and migration status. - content: - application/json: - schema: - type: object - properties: - migrationID: - type: string - minLength: 1 - parentMigrationID: - type: string - status: - $ref: '#/components/schemas/MigrationStatus' - required: - - migrationID - - parentMigrationID - - status - examples: - example-1: - value: - migrationID: mig_c7m19ilcefoebpqj12p0 - parentMigrationID: mig_c7m19ilcefoebpqj4312 - status: completed - SearchResponse: - description: OK - content: - application/json: - schema: - type: object - properties: - records: - type: array - items: - $ref: '#/components/schemas/Record' - warning: - type: string - totalCount: - description: >- - The total count of records matched. It will be accurately - returned up to 10000 records. - type: integer - required: - - records - - totalCount - ServiceUnavailableError: - description: ServiceUnavailable - headers: - Retry-After: - schema: - description: Number of seconds to wait after retrying the operation - type: string - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - required: - - message - SimpleError: - description: Example response - content: - application/json: - schema: - type: object - properties: - id: - type: string - message: - type: string - required: - - message - SummarizeResponse: - description: OK - content: - application/json: - schema: - type: object - properties: - summaries: - type: array - items: - type: object - required: - - summaries - securitySchemes: - bearerAuth: - type: http - scheme: bearer -tags: - - name: Database - description: Database management. - x-displayName: Database - - name: Branch - description: Branch management. - x-displayName: Branch - - name: Migrations - description: Branch schema migrations and history. - x-displayName: Migrations - - name: Table - description: Table management. - x-displayName: Table - - name: xbregion_other - x-displayName: other - - name: Records - description: Record access API. - x-displayName: Records - - name: Search and Filter - description: APIs for searching, querying, filtering, and aggregating records. - x-displayName: Search and Filter - - name: Files - description: CRUD API for operating on binary content in file and file[] columns. - x-displayName: Files - - name: xbcell_other - x-displayName: other - - name: SQL - description: SQL service access - x-displayName: SQL - - name: sql_other - x-displayName: other -x-tagGroups: - - name: xbregion - tags: - - Database - - Branch - - Migrations - - Table - - Migration Requests - - xbregion_other - description: Xata.io Xatabases API - - name: xbcell - tags: - - Records - - Search and Filter - - Files - - xbcell_other - description: Xata.io Xatabases API - - name: sql - tags: - - SQL - - sql_other - description: Xata.io SQL API diff --git a/xata/internal/fern-workspace/fern/api/openapi/workspace-openapi.json b/xata/internal/fern-workspace/fern/api/openapi/workspace-openapi.json new file mode 100644 index 0000000..23f4dfb --- /dev/null +++ b/xata/internal/fern-workspace/fern/api/openapi/workspace-openapi.json @@ -0,0 +1 @@ +{"openapi":"3.0.0","info":{"contact":{"name":"support@xata.io"},"description":"Xata.io Xatabases API","license":{"name":"Apache 2.0","url":"https://www.apache.org/licenses/LICENSE-2.0.html"},"title":"xata-xb","version":"1.0"},"servers":[{"description":"","url":"/"}],"paths":{"/db/{db_branch_name}":{"delete":{"description":"Delete the branch in the database and all its resources","operationId":"deleteBranch","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Delete Database branch","tags":["Branch"]},"description":"This path allows interacting with a given database branch, referenced by parameter `db_branch_name`, which is expected in the format `database_name:branch_name`.","get":{"operationId":"getBranchDetails","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DBBranch"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Get branch schema and metadata","tags":["Branch"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"put":{"operationId":"createBranch","parameters":[{"description":"Name of source branch to branch the new schema from","in":"query","name":"from","schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"properties":{"from":{"description":"Select the branch to fork from. Defaults to 'main'","type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"}},"type":"object"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"description":"","example":{"branchName":"mybranch","databaseName":"mydatabase","status":"completed"},"properties":{"branchName":{"type":"string"},"databaseName":{"minLength":1,"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["databaseName","branchName","status"],"type":"object"}}},"description":"Created","headers":{"Location":{"description":"URI to newly created resource: /db/{db_branch_name}","schema":{"format":"uri","type":"string"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"423":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Create Database branch","tags":["Branch"]},"summary":"Database Branch by Name"},"/db/{db_branch_name}/metadata":{"description":"This path allows interacting with the metadata of a specific database branch.","get":{"operationId":"getBranchMetadata","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Get Branch Metadata","tags":["Branch"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"put":{"description":"Update the branch metadata","operationId":"updateBranchMetadata","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchMetadata"}}}},"responses":{"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Update branch metadata","tags":["Branch"]},"summary":"Branch Metadata"},"/db/{db_branch_name}/schema/apply":{"description":"Update the branch from schema edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"applyBranchSchemaEdit","requestBody":{"content":{"application/json":{"schema":{"properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"required":["edits"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Apply edit script.","tags":["Migrations"]},"summary":"Update Branch schema with edit script."},"/db/{db_branch_name}/schema/compare":{"description":"Compare the branch schema with a custom provided schema.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"compareBranchWithUserSchema","requestBody":{"content":{"application/json":{"schema":{"properties":{"branchOperations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"},"schema":{"$ref":"#/components/schemas/Schema"},"schemaOperations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"}},"required":["schema"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Compare branch with user schema.","tags":["Migrations"]},"summary":"Compare branch with custom schema."},"/db/{db_branch_name}/schema/compare/{branch_name}":{"description":"Compare the schema of any 2 branches.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/BranchNameParam"}],"post":{"operationId":"compareBranchSchemas","requestBody":{"content":{"application/json":{"schema":{"properties":{"sourceBranchOperations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"},"targetBranchOperations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"}},"required":["schema"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaCompareResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Compare branch schemas.","tags":["Migrations"]},"summary":"Compare branch schemas."},"/db/{db_branch_name}/schema/history":{"description":"Query the branch its schema history.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"getBranchSchemaHistory","requestBody":{"content":{"application/json":{"schema":{"properties":{"page":{"properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"size":{"default":20,"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.","type":"integer"}},"type":"object"},"since":{"description":"Report only migrations that have been added since the given Migration ID.","type":"string"}},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"logs":{"items":{"$ref":"#/components/schemas/Commit"},"type":"array"},"meta":{"properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetch","type":"boolean"}},"required":["cursor","more"],"type":"object"}},"required":["meta","logs"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Query schema history.","tags":["Migrations"]},"summary":"Query schema history."},"/db/{db_branch_name}/schema/preview":{"description":"Preview the resulting branch schema when applying the edit script.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"previewBranchSchemaEdit","requestBody":{"content":{"application/json":{"schema":{"properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"}},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"original":{"$ref":"#/components/schemas/Schema"},"updated":{"$ref":"#/components/schemas/Schema"}},"required":["original","updated"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Preview branch schema edits.","tags":["Migrations"]},"summary":"Preview branch schema edits."},"/db/{db_branch_name}/schema/push":{"description":"Apply a list of migrations to the current branch.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"description":"The `schema/push` API accepts a list of migrations to be applied to the\ncurrent branch. A list of applicable migrations can be fetched using\nthe `schema/history` API from another branch or database.\n\nThe most recent migration must be part of the list or referenced (via\n`parentID`) by the first migration in the list of migrations to be pushed.\n\nEach migration in the list has an `id`, `parentID`, and `checksum`. The\nchecksum for migrations are generated and verified by xata. The\noperation fails if any migration in the list has an invalid checksum.\n","operationId":"pushBranchMigrations","requestBody":{"content":{"application/json":{"schema":{"properties":{"migrations":{"items":{"$ref":"#/components/schemas/MigrationObject"},"type":"array"}},"required":["migrations"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Push migrations.","tags":["Migrations"]},"summary":"Push migrations."},"/db/{db_branch_name}/schema/update":{"description":"Update the branch schema with migration operations","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"updateBranchSchema","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Migration"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Update Branch schema","tags":["Migrations"]},"summary":"Update Branch schema"},"/db/{db_branch_name}/search":{"description":"This endpoint performs full text search across an entire database branch. You can filter down to particular\ntable by using the `tables` parameter. The `tables` parameter accepts a mixed array of strings and objects. Using a string (the table name) selects the full table. Using an object allows one to specify a filter as well. The supported filters are the same as documented for the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"description":"Run a free text search operation across the database branch.","operationId":"searchBranch","requestBody":{"content":{"application/json":{"schema":{"description":"","example":{"query":"after a long day","tables":["users",{"filter":{"author":"Abigail"},"table":"articles"}]},"properties":{"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"page":{"$ref":"#/components/schemas/SearchPageConfig"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"query":{"description":"The query string.","minLength":1,"type":"string"},"tables":{"description":"An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table.","items":{"oneOf":[{"type":"string"},{"additionalProperties":false,"properties":{"boosters":{"items":{"$ref":"#/components/schemas/BoosterExpression"},"type":"array"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"table":{"description":"The name of the table.","type":"string"},"target":{"$ref":"#/components/schemas/TargetExpression"}},"required":["table"],"type":"object"}]},"type":"array"}},"required":["query"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Free text search","tags":["Search and Filter"]},"summary":"Search Database"},"/db/{db_branch_name}/sql":{"description":"This endpoint performs the SQL query across the entire database branch. Set your SQL query in the parameter `query`.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"description":"Run an SQL query across the database branch.","operationId":"sqlQuery","requestBody":{"content":{"application/json":{"schema":{"description":"","example":{"statement":"select * from users;"},"properties":{"consistency":{"default":"strong","description":"The consistency level for this request.","enum":["strong","eventual"],"type":"string"},"params":{"description":"The query parameter list.","nullable":true,"type":"array"},"statement":{"description":"The SQL statement.","minLength":1,"type":"string"}},"required":["statement"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SQLResponse"},"201":{"$ref":"#/components/responses/SQLResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"summary":"SQL query","tags":["SQL"]},"summary":"Query database using SQL"},"/db/{db_branch_name}/stats":{"description":"This endpoint presents a number of statistics on a given database's branch.","get":{"description":"Get branch usage metrics.","operationId":"getBranchStats","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"interval":{"type":"string"},"numberOfRecords":{"items":{"$ref":"#/components/schemas/MetricsDatapoint"},"type":"array"},"readLatency":{"$ref":"#/components/schemas/MetricsLatency"},"readsOverTime":{"items":{"$ref":"#/components/schemas/MetricsDatapoint"},"type":"array"},"resolution":{"type":"string"},"timestamp":{"type":"string"},"warning":{"type":"string"},"writeLatency":{"$ref":"#/components/schemas/MetricsLatency"},"writesOverTime":{"items":{"$ref":"#/components/schemas/MetricsDatapoint"},"type":"array"}},"required":["timestamp","interval","resolution"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/SimpleError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Branch stats","tags":["Branch"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"summary":"Branch Statistics"},"/db/{db_branch_name}/tables/{table_name}":{"delete":{"description":"Deletes the table with the given name.","operationId":"deleteTable","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["status"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"Not Found"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Delete table","tags":["Table"]},"description":"This endpoint provides a way to mutate a specific table on a database.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"patch":{"description":"Update table. Currently there is only one update operation supported: renaming the table by providing a new name.\n\nIn the example below, we rename a table from “users” to “people”:\n\n```json\n// PATCH /db/test:main/tables/users\n\n{\n \"name\": \"people\"\n}\n```","operationId":"updateTable","requestBody":{"content":{"application/json":{"schema":{"description":"","properties":{"name":{"minLength":1,"type":"string"}},"required":["name"],"type":"object"}}},"description":""},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Update table","tags":["Table"]},"put":{"description":"Creates a new table with the given name. Returns 422 if a table with the same name already exists.","operationId":"createTable","responses":{"201":{"content":{"application/json":{"schema":{"description":"","example":{"branchName":"mydb_main","status":"completed","tableName":"mytable"},"properties":{"branchName":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"},"tableName":{"minLength":1,"type":"string"}},"required":["branchName","tableName","status"],"type":"object"}}},"description":"Created","headers":{"Location":{"description":"URI to newly created resource: /db/{db_branch_name}/tables/{table_name}","schema":{"format":"uri","type":"string"}}}},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Create table","tags":["Table"]},"summary":"Database Table by Name"},"/db/{db_branch_name}/tables/{table_name}/aggregate":{"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"This endpoint allows you to run aggregations (analytics) on the data from one table.\nWhile the summary endpoint is served from a transactional store and the results are strongly \nconsistent, the aggregate endpoint is served from our columnar store and the results are \nonly eventually consistent. On the other hand, the aggregate endpoint uses a \nstore that is more appropiate for analytics, makes use of approximative algorithms \n(e.g for cardinality), and is generally faster and can do more complex aggregations.\n\nFor usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate).\n","operationId":"aggregateTable","requestBody":{"content":{"application/json":{"schema":{"properties":{"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/AggResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Run aggregations over a table","tags":["Search and Filter"]},"summary":"Aggregate Table"},"/db/{db_branch_name}/tables/{table_name}/ask":{"description":"Ask your table a question and have Xata answer.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","operationId":"askTable","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"","properties":{"question":{"description":"The question you'd like to ask.","minLength":3,"type":"string"},"rules":{"items":{"type":"string"},"type":"array"},"search":{"additionalProperties":false,"properties":{"boosters":{"items":{"$ref":"#/components/schemas/BoosterExpression"},"type":"array"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"target":{"$ref":"#/components/schemas/TargetExpression"}},"type":"object"},"searchType":{"default":"keyword","description":"The type of search to use. If set to `keyword` (the default), the search can be configured by passing\na `search` object with the following fields. For more details about each, see the Search endpoint documentation.\nAll fields are optional.\n * fuzziness - typo tolerance\n * target - columns to search into, and weights.\n * prefix - prefix search type.\n * filter - pre-filter before searching.\n * boosters - control relevancy.\nIf set to `vector`, a `vectorSearch` object must be passed, with the following parameters. For more details, see the Vector\nSearch endpoint documentation. The `column` and `contentColumn` parameters are required.\n * column - the vector column containing the embeddings.\n * contentColumn - the column that contains the text from which the embeddings where computed.\n * filter - pre-filter before searching.\n","enum":["keyword","vector"],"type":"string"},"vectorSearch":{"additionalProperties":false,"properties":{"column":{"description":"The column to use for vector search. It must be of type `vector`.","type":"string"},"contentColumn":{"description":"The column containing the text for vector search. Must be of type `text`.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"}},"required":["column","contentColumn"],"type":"object"}},"required":["question"],"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"answer":{"description":"The answer to the input question","type":"string"},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","sessionId"],"type":"object"}},"text/event-stream":{"schema":{"properties":{"answer":{"description":"The answer to the input question","type":"string"},"records":{"description":"The IDs of the records that were used as context.","items":{"type":"string"},"type":"array"},"sessionId":{"description":"The session ID for the chat session.","type":"string"}},"required":["answer","records","sessionId"],"type":"object"}}},"description":"Response to the question"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"description":"Unexpected Error"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Ask your table a question","tags":["Search and Filter"]},"summary":"Ask data in your table a question"},"/db/{db_branch_name}/tables/{table_name}/ask/{session_id}":{"description":"Continue a conversation with your data. This endpoint lets you continue a question started via the /ask endpoint in order to dive deeper into your context or ask clarifying questions.","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ChatSessionIDParam"}],"post":{"description":"Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's.","operationId":"askTableSession","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"properties":{"message":{"description":"The question you'd like to ask.","minLength":3,"type":"string"}},"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"],"type":"object"}},"text/event-stream":{"schema":{"properties":{"answer":{"description":"The answer to the input question","type":"string"}},"required":["answer"],"type":"object"}}},"description":"Response to the question"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Continue a conversation with your data","tags":["Search and Filter"]},"summary":"Ask follow-up questions of your data"},"/db/{db_branch_name}/tables/{table_name}/bulk":{"description":"This endpoint enables bulk operations on a given table. For now, we only allow bulk inserting.\n\nAn example bulk request looks like this:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/db/tutorial:main/tables/users/bulk\n\n{\n \"records\": [\n {\n \"email\": \"laurence@example.com\",\n \"full_name\": \"Laurence Fishburne\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"hugo@example.com\",\n \"full_name\": \"Hugo Weaving\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n },\n {\n \"email\": \"joe@example.com\",\n \"full_name\": \"Joe Pantoliano\",\n \"team\": \"rec_c8hng2h26un90p8sr7k0\"\n }\n ]\n}\n```\nFor more details, see the [this section](/web-api/records/insert#inserting-records-in-bulk) from the tutorial.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"description":"Bulk insert records","operationId":"bulkInsertTableRecords","requestBody":{"content":{"application/json":{"schema":{"properties":{"records":{"items":{"$ref":"#/components/schemas/DataInputRecord"},"type":"array"}},"required":["records"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/BulkInsertResponse"},"400":{"$ref":"#/components/responses/BulkError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Bulk insert records","tags":["Records"],"x-experimental":true},"summary":"Bulk Table Operations"},"/db/{db_branch_name}/tables/{table_name}/columns":{"description":"This endpoint allows working with a table's columns.","get":{"description":"Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their\nfull dot-separated path (flattened).\n","operationId":"getTableColumns","responses":{"200":{"content":{"application/json":{"schema":{"example":{"columns":[{"name":"name","type":"string"},{"name":"email","type":"email"},{"name":"settings.plan","type":"string"},{"name":"settings.dark","type":"bool"}]},"properties":{"columns":{"items":{"$ref":"#/components/schemas/Column"},"type":"array"}},"required":["columns"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"List table columns","tags":["Table"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"Adds a new column to the table. The body of the request should contain the column definition.","operationId":"addTableColumn","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Column","example":{"name":"columnName","type":"string"}}}},"description":"The column definition."},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Create new column","tags":["Table"]},"summary":"Table Columns"},"/db/{db_branch_name}/tables/{table_name}/columns/{column_name}":{"delete":{"description":"Deletes the specified column.","operationId":"deleteColumn","responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Delete column","tags":["Table"]},"description":"This endpoint allows working with a single column from a given table.","get":{"description":"Get the definition of a single column.","operationId":"getColumn","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Column","example":{"value":{"name":"settings.labels","type":"multiple"}}}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Get column information","tags":["Table"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"patch":{"description":"Update column with partial data. Can be used for renaming the column by providing a new \"name\" field.","operationId":"updateColumn","requestBody":{"content":{"application/json":{"examples":{"Rename column":{"value":{"name":"new_name"}}},"schema":{"description":"","example":{"description":"Sample new description","name":"newName"},"properties":{"name":{"minLength":1,"type":"string"}},"required":["name"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Update column","tags":["Table"]},"summary":"Single Table Column"},"/db/{db_branch_name}/tables/{table_name}/data":{"description":"This endpoint enables mutating data into a given database table. To query data, please see the [query endpoint](query).\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"post":{"description":"Insert a new Record into the Table","operationId":"insertRecord","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Insert record","tags":["Records"]},"summary":"Table Data"},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}":{"delete":{"operationId":"deleteRecord","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Delete record from table","tags":["Records"]},"description":"This endpoint enables mutating a given record in a table, referenced by its ID.","get":{"description":"Retrieve record by ID","operationId":"getRecord","responses":{"200":{"$ref":"#/components/responses/RecordResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Get record by ID","tags":["Records"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnsProjectionParam"}],"patch":{"operationId":"updateRecordWithID","parameters":[{"in":"query","name":"ifVersion","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Update record with ID","tags":["Records"]},"post":{"operationId":"upsertRecordWithID","parameters":[{"in":"query","name":"ifVersion","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Upsert record with ID","tags":["Records"]},"put":{"description":"By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.","operationId":"insertRecordWithID","parameters":[{"in":"query","name":"createOnly","schema":{"type":"boolean"}},{"in":"query","name":"ifVersion","schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataInputRecord"}}}},"responses":{"200":{"$ref":"#/components/responses/RecordUpdateResponse"},"201":{"$ref":"#/components/responses/RecordUpdateResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Insert record with ID","tags":["Records"]},"summary":"Table Record"},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file":{"delete":{"description":"Deletes a file referred in a file column","operationId":"deleteFile","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Remove the content from a file column","tags":["Files"]},"description":"File access endpoint allows upload and download of binary file content.","get":{"description":"Retrieves the file content from a file column","operationId":"getFile","responses":{"200":{"content":{"*/*":{"schema":{"format":"binary","type":"string"}}},"description":"OK"},"204":{"description":"no content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Download content from a file column","tags":["Files"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"}],"put":{"description":"Uploads the file content to the given file column","operationId":"putFile","requestBody":{"content":{"*/*":{"schema":{"format":"binary","type":"string"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Upload content to a file column","tags":["Files"]},"summary":"File column access"},"/db/{db_branch_name}/tables/{table_name}/data/{record_id}/column/{column_name}/file/{file_id}":{"delete":{"description":"Deletes an item from an file array column given the file ID","operationId":"deleteFileItem","responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Delete an item from a file array","tags":["Files"]},"description":"File array access endpoint allows upload, download and remove of file items.","get":{"description":"Retrieves file content from an array by file ID","operationId":"getFileItem","responses":{"200":{"content":{"*/*":{"schema":{"format":"binary","type":"string"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Download content from a file item in a file array column","tags":["Files"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"},{"$ref":"#/components/parameters/RecordIDParam"},{"$ref":"#/components/parameters/ColumnNameParam"},{"$ref":"#/components/parameters/FileItemIDParam"}],"put":{"description":"Uploads the file content to an array given the file ID","operationId":"putFileItem","requestBody":{"content":{"*/*":{"schema":{"format":"binary","type":"string"}}}},"responses":{"200":{"$ref":"#/components/responses/PutFileResponse"},"201":{"$ref":"#/components/responses/PutFileResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"422":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Upload or update the content of a file item in a file array column","tags":["Files"]},"summary":"File array access"},"/db/{db_branch_name}/tables/{table_name}/query":{"description":"This endpoint serves data from a given table, inside a specific database's branch.\nFor a tutorial on using the Records API, see the [Record API documentation](/rest-api/intro).\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"The Query Table API can be used to retrieve all records in a table.\nThe API support filtering, sorting, selecting a subset of columns, and pagination.\n\nThe overall structure of the request looks like this:\n\n```json\n// POST /db/\u003cdbname\u003e:\u003cbranch\u003e/tables/\u003ctable\u003e/query\n{\n \"columns\": [...],\n \"filter\": {\n \"$all\": [...],\n \"$any\": [...]\n ...\n },\n \"sort\": {\n \"multiple\": [...]\n ...\n },\n \"page\": {\n ...\n }\n}\n```\n\nFor usage, see also the [API Guide](https://xata.io/docs/api-guide/get).\n\n### Column selection\n\nIf the `columns` array is not specified, all columns are included. For link\nfields, only the ID column of the linked records is included in the response.\n\nIf the `columns` array is specified, only the selected and internal\ncolumns `id` and `xata` are included. The `*` wildcard can be used to\nselect all columns.\n\nFor objects and link fields, if the column name of the object is specified, we\ninclude all of its sub-keys. If only some sub-keys are specified (via dotted\nnotation, e.g. `\"settings.plan\"` ), then only those sub-keys from the object\nare included.\n\nBy the way of example, assuming two tables like this:\n\n```json {\"truncate\": true}\n{\n \"tables\": [\n {\n \"name\": \"teams\",\n \"columns\": [\n {\n \"name\": \"name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"owner\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"users\"\n }\n },\n {\n \"name\": \"foundedDate\",\n \"type\": \"datetime\"\n },\n ]\n },\n {\n \"name\": \"users\",\n \"columns\": [\n {\n \"name\": \"email\",\n \"type\": \"email\"\n },\n {\n \"name\": \"full_name\",\n \"type\": \"string\"\n },\n {\n \"name\": \"address\",\n \"type\": \"object\",\n \"columns\": [\n {\n \"name\": \"street\",\n \"type\": \"string\"\n },\n {\n \"name\": \"number\",\n \"type\": \"int\"\n },\n {\n \"name\": \"zipcode\",\n \"type\": \"int\"\n }\n ]\n },\n {\n \"name\": \"team\",\n \"type\": \"link\",\n \"link\": {\n \"table\": \"teams\"\n }\n }\n ]\n }\n ]\n}\n```\n\nA query like this:\n\n```json\nPOST /db/\u003cdbname\u003e:\u003cbranch\u003e/tables/\u003ctable\u003e/query\n{\n \"columns\": [\n \"name\",\n \"address.*\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n }\n}\n```\n\nwhile a query like this:\n\n```json\nPOST /db/\u003cdbname\u003e:\u003cbranch\u003e/tables/\u003ctable\u003e/query\n{\n \"columns\": [\n \"name\",\n \"address.street\"\n ]\n}\n```\n\nreturns objects like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"address\": {\n \"street\": \"New street\"\n }\n}\n```\n\nIf you want to return all columns from the main table and selected columns from the linked table, you can do it like this:\n\n```json\n{\n \"columns\": [\"*\", \"team.name\"]\n}\n```\n\nThe `\"*\"` in the above means all columns, including columns of objects. This returns data like:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\"\n }\n}\n```\n\nIf you want all columns of the linked table, you can do:\n\n```json\n{\n \"columns\": [\"*\", \"team.*\"]\n}\n```\n\nThis returns, for example:\n\n```json\n{\n \"id\": \"id1\"\n \"xata\": {\n \"version\": 0\n }\n \"name\": \"Kilian\",\n \"email\": \"kilian@gmail.com\",\n \"address\": {\n \"street\": \"New street\",\n \"number\": 41,\n \"zipcode\": 10407\n },\n \"team\": {\n \"id\": \"XX\",\n \"xata\": {\n \"version\": 0\n },\n \"name\": \"first team\",\n \"code\": \"A1\",\n \"foundedDate\": \"2020-03-04T10:43:54.32Z\"\n }\n}\n```\n\n### Filtering\n\nThere are two types of operators:\n\n- Operators that work on a single column: `$is`, `$contains`, `$pattern`,\n `$includes`, `$gt`, etc.\n- Control operators that combine multiple conditions: `$any`, `$all`, `$not` ,\n `$none`, etc.\n\nAll operators start with an `$` to differentiate them from column names\n(which are not allowed to start with a dollar sign).\n\n#### Exact matching and control operators\n\nFilter by one column:\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": \"value\"\n }\n}\n```\n\nThis is equivalent to using the `$is` operator:\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$is\": \"value\"\n }\n }\n}\n```\n\nFor example:\n\n```json\n{\n \"filter\": {\n \"name\": \"r2\"\n }\n}\n```\n\nOr:\n\n```json\n{\n \"filter\": {\n \"name\": {\n \"$is\": \"r2\"\n }\n }\n}\n```\n\nFor objects, both dots and nested versions work:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": \"free\"\n }\n}\n```\n\n```json\n{\n \"filter\": {\n \"settings\": {\n \"plan\": \"free\"\n }\n }\n}\n```\n\nIf you want to OR together multiple values, you can use the `$any` operator with an array of values:\n\n```json\n{\n \"filter\": {\n \"settings.plan\": { \"$any\": [\"free\", \"paid\"] }\n }\n}\n```\n\nIf you specify multiple columns in the same filter, they are logically AND'ed together:\n\n```json\n{\n \"filter\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n}\n```\n\nThe above matches if both conditions are met.\n\nTo be more explicit about it, you can use `$all` or `$any`:\n\n```json\n{\n \"filter\": {\n \"$any\": {\n \"settings.dark\": true,\n \"settings.plan\": \"free\"\n }\n }\n}\n```\n\nThe `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:\n\n```json\n{\n \"filter\": {\n \"$any\": [\n {\n \"name\": \"r1\"\n },\n {\n \"name\": \"r2\"\n }\n ]\n }\n}\n```\n\nYou can check for a value being not-null with `$exists`:\n\n```json\n{\n \"filter\": {\n \"$exists\": \"settings\"\n }\n}\n```\n\nThis can be combined with `$all` or `$any` :\n\n```json\n{\n \"filter\": {\n \"$all\": [\n {\n \"$exists\": \"settings\"\n },\n {\n \"$exists\": \"name\"\n }\n ]\n }\n}\n```\n\nOr you can use the inverse operator `$notExists`:\n\n```json\n{\n \"filter\": {\n \"$notExists\": \"settings\"\n }\n}\n```\n\n#### Partial match\n\n`$contains` is the simplest operator for partial matching. Note that `$contains` operator can\ncause performance issues at scale, because indices cannot be used.\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$contains\": \"value\"\n }\n }\n}\n```\n\nWildcards are supported via the `$pattern` operator:\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$pattern\": \"v*alu?\"\n }\n }\n}\n```\n\nThe `$pattern` operator accepts two wildcard characters:\n* `*` matches zero or more characters\n* `?` matches exactly one character\n\nIf you want to match a string that contains a wildcard character, you can escape them using a backslash (`\\`). You can escape a backslash by usign another backslash.\n\nYou can also use the `$endsWith` and `$startsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$endsWith\": \".gz\"\n },\n \"\u003ccolumn_name\u003e\": {\n \"$startsWith\": \"tmp-\"\n }\n }\n}\n```\n\n#### Numeric or datetime ranges\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$ge\": 0,\n \"$lt\": 100\n }\n }\n}\n```\nDate ranges support the same operators, with the date using the format defined in\n[RFC 3339](https://www.rfc-editor.org/rfc/rfc3339):\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$gt\": \"2019-10-12T07:20:50.52Z\",\n \"$lt\": \"2021-10-12T07:20:50.52Z\"\n }\n }\n}\n```\nThe supported operators are `$gt`, `$lt`, `$ge`, `$le`.\n\n#### Negations\n\nA general `$not` operator can inverse any operation.\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"\u003ccolumn_name1\u003e\": \"value1\",\n \"\u003ccolumn_name2\u003e\": \"value1\"\n }\n }\n}\n```\n\nNote: in the above the two condition are AND together, so this does (NOT ( ...\nAND ...))\n\nOr more complex:\n\n```json\n{\n \"filter\": {\n \"$not\": {\n \"$any\": [\n {\n \"\u003ccolumn_name1\u003e\": \"value1\"\n },\n {\n \"$all\": [\n {\n \"\u003ccolumn_name2\u003e\": \"value2\"\n },\n {\n \"\u003ccolumn_name3\u003e\": \"value3\"\n }\n ]\n }\n ]\n }\n }\n}\n```\n\nThe `$not: { $any: {}}` can be shorted using the `$none` operator:\n\n```json\n{\n \"filter\": {\n \"$none\": {\n \"\u003ccolumn_name1\u003e\": \"value1\",\n \"\u003ccolumn_name2\u003e\": \"value1\"\n }\n }\n}\n```\n\nIn addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:\n\n```json\n{\n \"filter\": {\n \"\u003ccolumn_name\u003e\": {\n \"$isNot\": \"2019-10-12T07:20:50.52Z\"\n }\n }\n}\n```\n\n#### Working with arrays\n\nTo test that an array contains a value, use `$includesAny`.\n\n```json\n{\n \"filter\": {\n \"\u003carray_name\u003e\": {\n \"$includesAny\": \"value\"\n }\n }\n}\n```\n\n##### `includesAny`\n\nThe `$includesAny` operator accepts a custom predicate that will check if\nany value in the array column matches the predicate. The `$includes` operator is a\nsynonym for the `$includesAny` operator.\n\nFor example a complex predicate can include\nthe `$all` , `$contains` and `$endsWith` operators:\n\n```json\n{\n \"filter\": {\n \"\u003carray name\u003e\": {\n \"$includes\": {\n \"$all\": [\n { \"$contains\": \"label\" },\n { \"$not\": { \"$endsWith\": \"-debug\" } }\n ]\n }\n }\n }\n}\n```\n\n##### `includesNone`\n\nThe `$includesNone` operator succeeds if no array item matches the\npredicate.\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesNone\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\nThe above matches if none of the array values contain the string \"label\".\n\n##### `includesAll`\n\nThe `$includesAll` operator succeeds if all array items match the\npredicate.\n\nHere is an example of using the `$includesAll` operator:\n\n```json\n{\n \"filter\": {\n \"settings.labels\": {\n \"$includesAll\": [{ \"$contains\": \"label\" }]\n }\n }\n}\n```\n\nThe above matches if all array values contain the string \"label\".\n\n### Sorting\n\nSorting by one element:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"asc\"\n }\n}\n```\n\nor descendently:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"index\": \"desc\"\n }\n}\n```\n\nSorting by multiple fields:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"index\": \"desc\"\n },\n {\n \"createdAt\": \"desc\"\n }\n ]\n}\n```\n\nIt is also possible to sort results randomly:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": {\n \"*\": \"random\"\n }\n}\n```\n\nNote that a random sort does not apply to a specific column, hence the special column name `\"*\"`.\n\nA random sort can be combined with an ascending or descending sort on a specific column:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"sort\": [\n {\n \"name\": \"desc\"\n },\n {\n \"*\": \"random\"\n }\n ]\n}\n```\n\nThis will sort on the `name` column, breaking ties randomly.\n\n### Pagination\n\nWe offer cursor pagination and offset pagination. The cursor pagination method can be used for sequential scrolling with unrestricted depth. The offset pagination can be used to skip pages and is limited to 1000 records.\n\nExample of cursor pagination:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"after\":\"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\nIn the above example, the value of the `page.after` parameter is the cursor returned by the previous query. A sample response is shown below:\n\n```json\n{\n \"meta\": {\n \"page\": {\n \"cursor\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\",\n \"more\": true\n }\n },\n \"records\": [...]\n}\n```\n\nThe `page` object might contain the follow keys, in addition to `size` and `offset` that were introduced before:\n\n- `after`: Return the next page 'after' the current cursor\n- `before`: Return the previous page 'before' the current cursor.\n- `start`: Resets the given cursor position to the beginning of the query result set. \nWill return the first N records from the query result, where N is the `page.size` parameter. \n- `end`: Resets the give cursor position to the end for the query result set. \nReturns the last N records from the query result, where N is the `page.size` parameter.\n\nThe request will fail if an invalid cursor value is given to `page.before`,\n`page.after`, `page.start` , or `page.end`. No other cursor setting can be\nused if `page.start` or `page.end` is set in a query.\n\nIf both `page.before` and `page.after` parameters are present we treat the\nrequest as a range query. The range query will return all entries after\n`page.after`, but before `page.before`, up to `page.size` or the maximum\npage size. This query requires both cursors to use the same filters and sort\nsettings, plus we require `page.after \u003c page.before`. The range query returns\na new cursor. If the range encompass multiple pages the next page in the range\ncan be queried by update `page.after` to the returned cursor while keeping the\n`page.before` cursor from the first range query.\n\nThe `filter` , `columns`, `sort` , and `page.size` configuration will be\nencoded with the cursor. The pagination request will be invalid if\n`filter` or `sort` is set. The columns returned and page size can be changed\nanytime by passing the `columns` or `page.size` settings to the next query.\n\nIn the following example of size + offset pagination we retrieve the third page of up to 100 results:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 100,\n \"offset\": 200\n }\n}\n```\n\nThe `page.size` parameter represents the maximum number of records returned by this query. It has a default value of 20 and a maximum value of 200.\nThe `page.offset` parameter represents the number of matching records to skip. It has a default value of 0 and a maximum value of 800.\n\nCursor pagination also works in combination with offset pagination. For example, starting from a specific cursor position, using a page size of 200 and an offset of 800, you can skip up to 5 pages of 200 records forwards or backwards from the cursor's position:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 200,\n \"offset\": 800,\n \"after\": \"fMoxCsIwFIDh3WP8c4amDai5hO5SJCRNfaVSeC9b6d1FD\"\n }\n}\n```\n\n**Special cursors:**\n\n- `page.after=end`: Result points past the last entry. The list of records\n returned is empty, but `page.meta.cursor` will include a cursor that can be\n used to \"tail\" the table from the end waiting for new data to be inserted.\n- `page.before=end`: This cursor returns the last page.\n- `page.start=$cursor`: Start at the beginning of the result set of the $cursor query. This is equivalent to querying the\n first page without a cursor but applying `filter` and `sort` . Yet the `page.start`\n cursor can be convenient at times as user code does not need to remember the\n filter, sort, columns or page size configuration. All these information are\n read from the cursor.\n- `page.end=$cursor`: Move to the end of the result set of the $cursor query. This is equivalent to querying the\n last page with `page.before=end`, `filter`, and `sort` . Yet the\n `page.end` cursor can be more convenient at times as user code does not\n need to remember the filter, sort, columns or page size configuration. All\n these information are read from the cursor.\n\nWhen using special cursors like `page.after=\"end\"` or `page.before=\"end\"`, we\nstill allow `filter` and `sort` to be set.\n\nExample of getting the last page:\n\n```json\nPOST /db/demo:main/tables/table/query\n{\n \"page\": {\n \"size\": 10,\n \"before\": \"end\"\n }\n}\n```\n","operationId":"queryTable","requestBody":{"content":{"application/json":{"schema":{"properties":{"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"consistency":{"default":"strong","description":"The consistency level for this request.","enum":["strong","eventual"],"type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"page":{"$ref":"#/components/schemas/PageConfig"},"sort":{"$ref":"#/components/schemas/SortExpression"}},"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/QueryResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"503":{"$ref":"#/components/responses/ServiceUnavailableError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Query table","tags":["Search and Filter"]},"summary":"Query Table Data"},"/db/{db_branch_name}/tables/{table_name}/schema":{"description":"This endpoint enables reading or updating the schema of a given table.","get":{"operationId":"getTableSchema","responses":{"200":{"content":{"application/json":{"schema":{"properties":{"columns":{"items":{"$ref":"#/components/schemas/Column"},"type":"array"}},"required":["columns"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Get table schema","tags":["Table"]},"parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"put":{"operationId":"setTableSchema","requestBody":{"content":{"application/json":{"schema":{"properties":{"columns":{"items":{"$ref":"#/components/schemas/Column"},"type":"array"}},"required":["columns"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SchemaUpdateResponse"},"204":{"description":"No Content"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"409":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Update table schema","tags":["Table"]},"summary":"Table Schema"},"/db/{db_branch_name}/tables/{table_name}/search":{"description":"This endpoint performs full text search in a particular table.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"Run a free text search operation in a particular table.\n\nThe endpoint accepts a `query` parameter that is used for the free text search and a set of structured filters (via the `filter` parameter) that are applied before the search. The `filter` parameter uses the same syntax as the [query endpoint](/api-reference/db/db_branch_name/tables/table_name/) with the following exceptions:\n* filters `$contains`, `$startsWith`, `$endsWith` don't work on columns of type `text`\n* filtering on columns of type `multiple` is currently unsupported\n","operationId":"searchTable","requestBody":{"content":{"application/json":{"schema":{"description":"","example":{"filter":{"firstName":"Abigail"},"query":"after a long day"},"properties":{"boosters":{"items":{"$ref":"#/components/schemas/BoosterExpression"},"type":"array"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"fuzziness":{"$ref":"#/components/schemas/FuzzinessExpression"},"highlight":{"$ref":"#/components/schemas/HighlightExpression"},"page":{"$ref":"#/components/schemas/SearchPageConfig"},"prefix":{"$ref":"#/components/schemas/PrefixExpression"},"query":{"description":"The query string.","minLength":1,"type":"string"},"target":{"$ref":"#/components/schemas/TargetExpression"}},"required":["query"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Free text search in a table","tags":["Search and Filter"]},"summary":"Search Table"},"/db/{db_branch_name}/tables/{table_name}/summarize":{"description":"This endpoint summarizes from your database. It comes with a range\nof functions to help perform calculations on the data you have stored\nin your tables\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"This endpoint allows you to (optionally) define groups, and then to run\ncalculations on the values in each group. This is most helpful when \nyou'd like to understand the data you have in your database.\n\nA group is a combination of unique values. If you create a group for \n`sold_by`, `product_name`, we will return one row for every combination \nof `sold_by` and `product_name` you have in your database. When you \nwant to calculate statistics, you define these groups and ask Xata to \ncalculate data on each group.\n\n**Some questions you can ask of your data:**\n\nHow many records do I have in this table?\n- Set `columns: []` as we we want data from the entire table, so we ask\nfor no groups.\n- Set `summaries: {\"total\": {\"count\": \"*\"}}` in order to see the count \nof all records. We use `count: *` here we'd like to know the total \namount of rows; ignoring whether they are `null` or not.\n\nWhat are the top total sales for each product in July 2022 and sold \nmore than 10 units?\n- Set `filter: {soldAt: {\n \"$ge\": \"2022-07-01T00:00:00.000Z\", \n \"$lt\": \"2022-08-01T00:00:00.000Z\"}\n}` \nin order to limit the result set to sales recorded in July 2022.\n- Set `columns: [product_name]` as we'd like to run calculations on \neach unique product name in our table. Setting `columns` like this will \nproduce one row per unique product name.\n- Set `summaries: {\"total_sales\": {\"count\": \"product_name\"}}` as we'd \nlike to create a field called \"total_sales\" for each group. This field \nwill count all rows in each group with non-null product names.\n- Set `sort: [{\"total_sales\": \"desc\"}]` in order to bring the rows with \nthe highest total_sales field to the top.\n- Set `summariesFilter: {\"total_sales\": {\"$ge\": 10}}` to only send back data \nwith greater than or equal to 10 units.\n\n`columns`: tells Xata how to create each group. If you add `product_id` \nwe will create a new group for every unique `product_id`.\n\n`summaries`: tells Xata which calculations to run on each group. Xata\ncurrently supports count, min, max, sum, average.\n\n`sort`: tells Xata in which order you'd like to see results. You may \nsort by fields specified in `columns` as well as the summary names \ndefined in `summaries`.\n\nnote: Sorting on summarized values can be slower on very large tables; \nthis will impact your rate limit significantly more than other queries. \nTry use `filter` to reduce the amount of data being processed in order \nto reduce impact on your limits.\n\n`summariesFilter`: tells Xata how to filter the results of a summary. \nIt has the same syntax as `filter`, however, by using `summariesFilter`\nyou may also filter on the results of a query.\n\nnote: This is a much slower to use than `filter`. We recommend using \n`filter` wherever possible and `summariesFilter` when it's not \npossible to use `filter`.\n\n`page.size`: tells Xata how many records to return. If unspecified, Xata\nwill return the default size.\n","operationId":"summarizeTable","requestBody":{"content":{"application/json":{"schema":{"properties":{"columns":{"$ref":"#/components/schemas/ColumnsProjection"},"consistency":{"default":"strong","description":"The consistency level for this request.","enum":["strong","eventual"],"type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"page":{"properties":{"size":{"default":20,"description":"The number of records returned by summarize. If the amount of data you have exceeds this, or you have\nmore complex reporting requirements, we recommend that you use the aggregate endpoint instead.\n","maximum":1000,"minimum":1,"type":"integer"}},"type":"object"},"sort":{"$ref":"#/components/schemas/SortExpression"},"summaries":{"$ref":"#/components/schemas/SummaryExpressionList"},"summariesFilter":{"$ref":"#/components/schemas/FilterExpression"}},"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SummarizeResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Summarize table","tags":["Search and Filter"]},"summary":"Summarize Table Data"},"/db/{db_branch_name}/tables/{table_name}/vectorSearch":{"description":"This endpoint can be used to perform vector-based similarity searches.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"},{"$ref":"#/components/parameters/TableNameParam"}],"post":{"description":"This endpoint can be used to perform vector-based similarity searches in a table. \nIt can be used for implementing semantic search and product recommendation. To use this\nendpoint, you need a column of type vector. The input vector must have the same\ndimension as the vector column.\n","operationId":"vectorSearchTable","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":false,"description":"","properties":{"column":{"description":"The vector column in which to search. It must be of type `vector`.","type":"string"},"filter":{"$ref":"#/components/schemas/FilterExpression"},"queryVector":{"description":"The vector to search for similarities. Must have the same dimension as\nthe vector column used.\n","items":{"type":"number"},"type":"array"},"similarityFunction":{"default":"cosineSimilarity","description":"The function used to measure the distance between two points. Can be one of:\n`cosineSimilarity`, `l1`, `l2`. The default is `cosineSimilarity`.\n","type":"string"},"size":{"default":10,"description":"Number of results to return.","maximum":100,"minimum":1,"type":"integer"}},"required":["queryVector","column"],"type":"object"}}}},"responses":{"200":{"$ref":"#/components/responses/SearchResponse"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Vector similarity search in a table","tags":["Search and Filter"]},"summary":"Vector similarity search"},"/db/{db_branch_name}/transaction":{"description":"Executes multiple operations together as one. This allows you to run a number of \noperations that succeed as a single group; or fail with no changes to your database.\n","parameters":[{"$ref":"#/components/parameters/DBBranchNameParam"}],"post":{"operationId":"branchTransaction","requestBody":{"content":{"application/json":{"schema":{"properties":{"operations":{"items":{"$ref":"#/components/schemas/TransactionOperation"},"type":"array"}},"required":["operations"],"type":"object"}}}},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionSuccess"}}},"description":"Returns the results of a successful transaction."},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransactionFailure"}}},"description":"Returns errors from a failed transaction."},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"429":{"$ref":"#/components/responses/RateLimitError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Execute a transaction on a branch","tags":["Records"]},"summary":"Execute a transaction on a branch"},"/dbs/{db_name}":{"description":"Given a parameter `db_name`, this path allows interacting with a specific database on Xata. Below are a number of operations that can be performed on a given database.","get":{"description":"List all available Branches","operationId":"getBranchList","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListBranchesResponse"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"$ref":"#/components/responses/SimpleError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"List branches","tags":["Branch"]},"parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"summary":"Single Database"},"/dbs/{db_name}/gitBranches":{"delete":{"description":"Removes an entry from the mapping of git branches to Xata branches. The name of the git branch must be passed as a query parameter. If the git branch is not found, the endpoint returns a 404 status code.\n\nExample request:\n\n```json\n// DELETE https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches?gitBranch=fix%2Fbug123\n```\n","operationId":"removeGitBranchesEntry","parameters":[{"description":"The Git Branch to remove from the mapping","in":"query","name":"gitBranch","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"404":{"description":"The git branch was not found in the mapping"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Unlink a git branch to a Xata branch","tags":["Branch"]},"description":"This path allows managing the mapping between git and Xata branches, which is used by the `/dbs/{db_name}/resolveBranch` endpoint to resolve git branches to the associated Xata branches.\n","get":{"description":"Lists all the git branches in the mapping, and their associated Xata branches.\n\nExample response:\n\n```json\n{\n \"mappings\": [\n {\n \"gitBranch\": \"main\",\n \"xataBranch\": \"main\"\n },\n {\n \"gitBranch\": \"gitBranch1\",\n \"xataBranch\": \"xataBranch1\"\n }\n {\n \"gitBranch\": \"xataBranch2\",\n \"xataBranch\": \"xataBranch2\"\n }\n ]\n}\n```\n","operationId":"getGitBranchesMapping","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListGitBranchesResponse"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"List git branches mapping","tags":["Branch"]},"parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"post":{"description":"Adds an entry to the mapping of git branches to Xata branches. The git branch and the Xata branch must be present in the body of the request. If the Xata branch doesn't exist, a 400 error is returned.\n\nIf the git branch is already present in the mapping, the old entry is overwritten, and a warning message is included in the response. If the git branch is added and didn't exist before, the response code is 204. If the git branch existed and it was overwritten, the response code is 201.\n\nExample request:\n\n```json\n// POST https://tutorial-ng7s8c.xata.sh/dbs/demo/gitBranches\n{\n \"gitBranch\": \"fix/bug123\",\n \"xataBranch\": \"fix_bug\"\n}\n```\n","operationId":"addGitBranchesEntry","requestBody":{"content":{"application/json":{"schema":{"properties":{"gitBranch":{"description":"The name of the Git branch.","type":"string"},"xataBranch":{"$ref":"#/components/schemas/BranchName","description":"The name of the Xata branch."}},"required":["gitBranch","xataBranch"],"type":"object"}}}},"responses":{"201":{"content":{"application/json":{"schema":{"example":{"warning":"Git branch [fix/bug123] was already present in the mapping and was overwritten."},"properties":{"warning":{"description":"Warning message","type":"string"}},"type":"object"}}},"description":"Operation was successful with warnings"},"204":{"description":"Operation was successful without warnings"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Link a git branch to a Xata branch","tags":["Branch"]},"summary":"Mapping of git to Xata branches"},"/dbs/{db_name}/resolveBranch":{"description":"This endpoint is typically used by the Xata SDKs to resolve the correct branch to use in a particular situation. The main input is the git branch.","get":{"description":"In order to resolve the database branch, the following algorithm is used:\n* if the `gitBranch` was provided and is found in the [git branches mapping](/api-reference/dbs/db_name/gitBranches), the associated Xata branch is returned\n* else, if a Xata branch with the exact same name as `gitBranch` exists, return it\n* else, if `fallbackBranch` is provided and a branch with that name exists, return it\n* else, return the default branch of the DB (`main` or the first branch)\n\nExample call:\n\n```json\n// GET https://tutorial-ng7s8c.xata.sh/dbs/demo/dbs/demo/resolveBranch?gitBranch=test\u0026fallbackBranch=tsg\n```\n\nExample response:\n\n```json\n{\n \"branch\": \"main\",\n \"reason\": {\n \"code\": \"DEFAULT_BRANCH\",\n \"message\": \"Default branch for this database (main)\"\n }\n}\n```\n","operationId":"resolveBranch","parameters":[{"description":"The Git Branch","in":"query","name":"gitBranch","schema":{"type":"string"}},{"description":"Default branch to fallback to","in":"query","name":"fallbackBranch","schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"example":{"branch":"main","reason":{"code":"DEFAULT_BRANCH","message":"Default branch for this database (main)"}},"properties":{"branch":{"type":"string"},"reason":{"properties":{"code":{"enum":["FOUND_IN_MAPPING","BRANCH_EXISTS","FALLBACK_BRANCH","DEFAULT_BRANCH"],"type":"string"},"message":{"type":"string"}},"required":["code","message"],"type":"object"}},"required":["branch","reason"],"type":"object"}}},"description":"OK"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/AuthError"},"5XX":{"description":"Unexpected Error"},"default":{"description":"Unexpected Error"}},"security":[{"bearerAuth":[]}],"summary":"Resolve a Git Branch to a Xata branch","tags":["Branch"]},"parameters":[{"$ref":"#/components/parameters/DBNameParam"}],"summary":"Resolve the branch to use"}},"components":{"parameters":{"BranchNameParam":{"description":"The Database Name","in":"path","name":"branch_name","required":true,"schema":{"$ref":"#/components/schemas/BranchName"}},"ChatSessionIDParam":{"in":"path","name":"session_id","required":true,"schema":{"maxLength":36,"minLength":36,"title":"SessionID","type":"string"}},"ColumnNameParam":{"description":"The Column name","in":"path","name":"column_name","required":true,"schema":{"$ref":"#/components/schemas/ColumnName"}},"ColumnsProjectionParam":{"description":"Column filters","explode":false,"in":"query","name":"columns","required":false,"schema":{"$ref":"#/components/schemas/ColumnsProjection"}},"DBBranchNameParam":{"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n","in":"path","name":"db_branch_name","required":true,"schema":{"$ref":"#/components/schemas/DBBranchName"}},"DBNameParam":{"description":"The Database Name","in":"path","name":"db_name","required":true,"schema":{"$ref":"#/components/schemas/DBName"}},"FileAccessIDParam":{"description":"The File Access Identifier","in":"path","name":"file_id","required":true,"schema":{"$ref":"#/components/schemas/FileAccessID"}},"FileItemIDParam":{"description":"The File Identifier","in":"path","name":"file_id","required":true,"schema":{"$ref":"#/components/schemas/FileItemID"}},"FileSignatureParam":{"description":"File access signature","explode":false,"in":"query","name":"verify","required":false,"schema":{"$ref":"#/components/schemas/FileSignature"}},"RecordIDParam":{"description":"The Record name","in":"path","name":"record_id","required":true,"schema":{"$ref":"#/components/schemas/RecordID"}},"TableNameParam":{"description":"The Table name","in":"path","name":"table_name","required":true,"schema":{"$ref":"#/components/schemas/TableName"}}},"responses":{"AggResponse":{"content":{"application/json":{"schema":{"example":{"aggs":{"dailyUniqueUsers":{"values":[{"$count":321,"$key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"$count":202,"$key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}},"properties":{"aggs":{"additionalProperties":{"$ref":"#/components/schemas/AggResponse"},"type":"object"}},"type":"object"}}},"description":"OK"},"AuthError":{"content":{"application/json":{"schema":{"example":{"message":"invalid API key"},"properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"],"type":"object"}}},"description":"Authentication Error"},"BadRequestError":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"],"type":"object"}}},"description":"Bad Request"},"BranchMigrationPlan":{"content":{"application/json":{"schema":{"properties":{"migration":{"$ref":"#/components/schemas/BranchMigration"},"version":{"type":"integer"}},"required":["version","migration"],"type":"object"}}},"description":"Example response"},"BulkError":{"content":{"application/json":{"schema":{"properties":{"errors":{"items":{"properties":{"message":{"type":"string"},"status":{"type":"integer"}},"type":"object"},"type":"array"}},"required":["errors"],"type":"object"}}},"description":"Response with multiple errors of the bulk execution"},"BulkInsertResponse":{"content":{"application/json":{"schema":{"oneOf":[{"properties":{"recordIDs":{"items":{"type":"string"},"type":"array"}},"required":["recordIDs"],"type":"object"},{"properties":{"records":{"items":{"$ref":"#/components/schemas/Record"},"type":"array"}},"required":["records"],"type":"object"}]}}},"description":"OK"},"PutFileResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FileResponse"}}},"description":"OK"},"QueryResponse":{"content":{"application/json":{"schema":{"properties":{"meta":{"$ref":"#/components/schemas/RecordsMetadata"},"records":{"items":{"$ref":"#/components/schemas/Record"},"type":"array"}},"required":["records","meta"],"type":"object"}}},"description":"OK"},"RateLimitError":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"],"type":"object"}},"text/event-stream":{"schema":{"type":"string"}}},"description":"Rate limit exceeded"},"RecordResponse":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Record"}}},"description":"Table Record Reponse"},"RecordUpdateResponse":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/Record"},{"properties":{"id":{"type":"string"},"xata":{"properties":{"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"version":{"type":"integer"}},"required":["version","createdAt","updatedAt"],"type":"object"}},"required":["id","xata"],"type":"object"}]}}},"description":"Record ID and metadata"},"SQLResponse":{"content":{"application/json":{"schema":{"properties":{"columns":{"allOf":[{"type":"object"}],"description":"Name of the column and its PostgreSQL type"},"records":{"items":{"$ref":"#/components/schemas/SQLRecord"},"type":"array"},"total":{"description":"Number of selected columns","type":"integer"},"warning":{"type":"string"}},"type":"object"}}},"description":"OK"},"SchemaCompareResponse":{"content":{"application/json":{"schema":{"properties":{"edits":{"$ref":"#/components/schemas/SchemaEditScript"},"source":{"$ref":"#/components/schemas/Schema"},"target":{"$ref":"#/components/schemas/Schema"}},"required":["source","target","edits"],"type":"object"}}},"description":"Schema comparison response."},"SchemaUpdateResponse":{"content":{"application/json":{"examples":{"example-1":{"value":{"migrationID":"mig_c7m19ilcefoebpqj12p0","parentMigrationID":"mig_c7m19ilcefoebpqj4312","status":"completed"}}},"schema":{"properties":{"migrationID":{"minLength":1,"type":"string"},"parentMigrationID":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"}},"required":["migrationID","parentMigrationID","status"],"type":"object"}}},"description":"Schema migration response with ID and migration status."},"SearchResponse":{"content":{"application/json":{"schema":{"properties":{"records":{"items":{"$ref":"#/components/schemas/Record"},"type":"array"},"totalCount":{"description":"The total count of records matched. It will be accurately returned up to 10000 records.","type":"integer"},"warning":{"type":"string"}},"required":["records","totalCount"],"type":"object"}}},"description":"OK"},"ServiceUnavailableError":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"],"type":"object"}}},"description":"ServiceUnavailable","headers":{"Retry-After":{"schema":{"description":"Number of seconds to wait after retrying the operation","type":"string"}}}},"SimpleError":{"content":{"application/json":{"schema":{"properties":{"id":{"type":"string"},"message":{"type":"string"}},"required":["message"],"type":"object"}}},"description":"Example response"},"SummarizeResponse":{"content":{"application/json":{"schema":{"properties":{"summaries":{"items":{"type":"object"},"type":"array"}},"required":["summaries"],"type":"object"}}},"description":"OK"}},"schemas":{"AggExpression":{"description":"The description of a single aggregation operation. It is an object with only one key-value pair.\nThe key represents the aggregation type, while the value is an object with the configuration of\nthe aggregation.\n","oneOf":[{"additionalProperties":false,"properties":{"count":{"$ref":"#/components/schemas/CountAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"sum":{"$ref":"#/components/schemas/SumAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"max":{"$ref":"#/components/schemas/MaxAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"min":{"$ref":"#/components/schemas/MinAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"average":{"$ref":"#/components/schemas/AverageAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"percentiles":{"$ref":"#/components/schemas/PercentilesAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"uniqueCount":{"$ref":"#/components/schemas/UniqueCountAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"dateHistogram":{"$ref":"#/components/schemas/DateHistogramAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"topValues":{"$ref":"#/components/schemas/TopValuesAgg"}},"type":"object"},{"additionalProperties":false,"properties":{"numericHistogram":{"$ref":"#/components/schemas/NumericHistogramAgg"}},"type":"object"}]},"AggExpressionMap":{"additionalProperties":{"$ref":"#/components/schemas/AggExpression"},"description":"The description of the aggregations you wish to receive.\n","example":{"dailyActiveUsers":{"dateHistogram":{"aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}},"column":"date","interval":"1d"}},"totalCount":{"count":"*"}},"type":"object"},"AggResponse":{"oneOf":[{"nullable":true,"type":"number"},{"properties":{"values":{"oneOf":[{"items":{"additionalProperties":{"$ref":"#/components/schemas/AggResponse"},"properties":{"$count":{"type":"integer"},"$key":{"oneOf":[{"type":"string"},{"type":"number"}]}},"required":["$key","$count"],"type":"object"},"type":"array"},{"additionalProperties":{"type":"number"},"type":"object"}]}},"required":["values"],"type":"object"}]},"AverageAgg":{"additionalProperties":false,"description":"The average of the numeric values in a particular column.","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"}},"required":["column"],"type":"object"},"BoosterExpression":{"description":"Booster Expression","oneOf":[{"additionalProperties":false,"properties":{"valueBooster":{"$ref":"#/components/schemas/ValueBooster"}},"type":"object"},{"additionalProperties":false,"properties":{"numericBooster":{"$ref":"#/components/schemas/NumericBooster"}},"type":"object"},{"additionalProperties":false,"properties":{"dateBooster":{"$ref":"#/components/schemas/DateBooster"}},"type":"object"}]},"Branch":{"additionalProperties":false,"properties":{"createdAt":{"$ref":"#/components/schemas/DateTime"},"name":{"type":"string"}},"required":["name","createdAt"],"type":"object"},"BranchMetadata":{"description":"","example":{"branch":"feature-login","labels":["epic-100"],"repository":"github.com/my/repository","stage":"testing"},"properties":{"branch":{"$ref":"#/components/schemas/BranchName"},"labels":{"items":{"type":"string"},"type":"array"},"repository":{"minLength":1,"type":"string"},"stage":{"minLength":1,"type":"string"}},"type":"object"},"BranchMigration":{"properties":{"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"lastGitRevision":{"type":"string"},"localChanges":{"type":"boolean"},"newTableOrder":{"items":{"type":"string"},"type":"array"},"newTables":{"additionalProperties":{"$ref":"#/components/schemas/Table"},"type":"object"},"parentID":{"type":"string"},"removedTables":{"items":{"type":"string"},"type":"array"},"renamedTables":{"items":{"$ref":"#/components/schemas/TableRename"},"type":"array"},"status":{"type":"string"},"tableMigrations":{"additionalProperties":{"$ref":"#/components/schemas/TableMigration"},"type":"object"},"title":{"type":"string"}},"required":["status","localChanges","newTableOrder"],"title":"Migration","type":"object"},"BranchName":{"maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"BranchName","type":"string"},"BranchOp":{"properties":{"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"message":{"type":"string"},"migration":{"$ref":"#/components/schemas/Commit"},"modifiedAt":{"$ref":"#/components/schemas/DateTime"},"parentID":{"type":"string"},"status":{"$ref":"#/components/schemas/MigrationStatus"},"title":{"type":"string"}},"required":["id","status","createdAt"],"type":"object"},"BranchWithCopyID":{"properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"copyID":{"type":"string"},"dbBranchID":{"type":"string"}},"required":["branchName","dbBranchID","copyID"],"title":"BranchWithCopyID","type":"object"},"Column":{"properties":{"columns":{"items":{"$ref":"#/components/schemas/Column"},"type":"array"},"defaultValue":{"type":"string"},"file":{"$ref":"#/components/schemas/ColumnFile"},"fileMap":{"$ref":"#/components/schemas/ColumnFile"},"link":{"$ref":"#/components/schemas/ColumnLink"},"name":{"type":"string"},"notNull":{"type":"boolean"},"type":{"enum":["bool","int","float","string","text","email","multiple","link","object","datetime","vector","fileMap","file","json"],"type":"string"},"unique":{"type":"boolean"},"vector":{"$ref":"#/components/schemas/ColumnVector"}},"required":["name","type"],"title":"Column","type":"object"},"ColumnFile":{"additionalProperties":false,"properties":{"defaultPublicAccess":{"type":"boolean"}},"type":"object"},"ColumnLink":{"properties":{"table":{"type":"string"}},"required":["table"],"type":"object"},"ColumnMigration":{"properties":{"new":{"$ref":"#/components/schemas/Column"},"old":{"$ref":"#/components/schemas/Column"}},"required":["old","new"],"title":"ColumnMigration","type":"object"},"ColumnName":{"pattern":"[a-zA-Z0-9_\\-~\\.]+","title":"ColumnName","type":"string"},"ColumnOpAdd":{"properties":{"column":{"$ref":"#/components/schemas/Column"},"table":{"type":"string"}},"required":["table","column"],"type":"object"},"ColumnOpRemove":{"properties":{"column":{"type":"string"},"table":{"type":"string"}},"required":["table","column"],"type":"object"},"ColumnOpRename":{"properties":{"newName":{"type":"string"},"oldName":{"type":"string"},"table":{"type":"string"}},"required":["table","oldName","newName"],"type":"object"},"ColumnVector":{"additionalProperties":false,"properties":{"dimension":{"maximum":10000,"minimum":2,"type":"integer"}},"required":["dimension"],"type":"object"},"ColumnsProjection":{"example":["name","email","created_at"],"items":{"type":"string"},"type":"array"},"Commit":{"properties":{"checksum":{"type":"string"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"id":{"type":"string"},"mergeParentID":{"type":"string"},"message":{"type":"string"},"operations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"},"parentID":{"type":"string"},"title":{"type":"string"}},"required":["operations","id","createdAt","checksum"],"type":"object"},"CountAgg":{"description":"Count the number of records with an optional filter.","oneOf":[{"additionalProperties":false,"properties":{"filter":{"$ref":"#/components/schemas/FilterExpression"}},"type":"object"},{"description":"Use this form to count all records without any filter.","enum":["*"],"type":"string"}]},"DBBranch":{"properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"createdAt":{"$ref":"#/components/schemas/DateTime"},"databaseName":{"$ref":"#/components/schemas/DBName"},"id":{"type":"string"},"lastMigrationID":{"type":"string"},"metadata":{"$ref":"#/components/schemas/BranchMetadata"},"schema":{"$ref":"#/components/schemas/Schema"},"startedFrom":{"$ref":"#/components/schemas/StartedFromMetadata"},"version":{"type":"number"}},"required":["databaseName","branchName","createdAt","id","version","lastMigrationID","schema"],"title":"DBBranch","type":"object"},"DBBranchName":{"description":"The DBBranchName matches the pattern `{db_name}:{branch_name}`.\n","maxLength":511,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+:[a-zA-Z0-9_\\-~]+","title":"Tuple of database and branch name","type":"string"},"DBName":{"maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"DBName","type":"string"},"DataInputRecord":{"additionalProperties":{"anyOf":[{"$ref":"#/components/schemas/RecordID"},{"type":"string"},{"type":"boolean"},{"type":"number"},{"items":{"type":"string"},"type":"array"},{"items":{"type":"number"},"type":"array"},{"$ref":"#/components/schemas/DateTime"},{"$ref":"#/components/schemas/InputFileArray"},{"$ref":"#/components/schemas/InputFile"}],"nullable":true},"description":"Xata input record","type":"object"},"DateBooster":{"additionalProperties":false,"description":"Boost records based on the value of a datetime column. It is configured via \"origin\", \"scale\", and \"decay\". The further away from the \"origin\",\nthe more the score is decayed. The decay function uses an exponential function. For example if origin is \"now\", and scale is 10 days and decay is 0.5, it\nshould be interpreted as: a record with a date 10 days before/after origin will be boosted 2 times less than a record with the date at origin.\nThe result of the exponential function is a boost between 0 and 1. The \"factor\" allows you to control how impactful this boost is, by multiplying it with a given value.\n","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"decay":{"description":"The decay factor to expect at \"scale\" distance from the \"origin\".","type":"number"},"factor":{"description":"The factor with which to multiply the added boost.","minimum":0,"type":"number"},"ifMatchesFilter":{"$ref":"#/components/schemas/FilterExpression","description":"Only apply this booster to the records for which the provided filter matches.\n"},"origin":{"description":"The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time.\nIf it is not specified, the current date and time is used.\n","type":"string"},"scale":{"description":"The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","pattern":"^(\\d+)(d|h|m|s|ms)$","type":"string"}},"required":["column","scale","decay"]},"DateHistogramAgg":{"additionalProperties":false,"description":"Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.\n","properties":{"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"calendarInterval":{"description":"The calendar-aware interval to use when bucketing. Possible values are: `minute`,\n`hour`, `day`, `week`, `month`, `quarter`, `year`.\n","enum":["minute","hour","day","week","month","quarter","year"],"type":"string"},"column":{"description":"The column to use for bucketing. Must be of type datetime.","type":"string"},"interval":{"description":"The fixed interval to use when bucketing. \nIt is formatted as number + units, for example: `5d`, `20m`, `10s`.\n","pattern":"^(\\d+)(d|h|m|s|ms)$","type":"string"},"timezone":{"description":"The timezone to use for bucketing. By default, UTC is assumed.\nThe accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or\n`-08:00`.\n","pattern":"^[+-][01]\\d:[0-5]\\d$","type":"string"}},"required":["column"],"type":"object"},"DateTime":{"format":"date-time","title":"DateTime","type":"string"},"FileAccessID":{"description":"File identifier in access URLs","maxLength":296,"minLength":88,"pattern":"[a-v0-9=]+","title":"FileID","type":"string"},"FileItemID":{"description":"Unique file identifier","maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"FileID","type":"string"},"FileName":{"description":"File name","maxLength":1024,"minLength":0,"pattern":"[0-9a-zA-Z!\\-_\\.\\*'\\(\\)]*","type":"string"},"FileResponse":{"description":"File metadata","properties":{"attributes":{"type":"object"},"id":{"$ref":"#/components/schemas/FileItemID"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"name":{"$ref":"#/components/schemas/FileName"},"size":{"format":"int64","type":"integer"},"version":{"format":"int64","type":"integer"}},"required":["name","mediaType","size","version"],"type":"object"},"FileSignature":{"description":"File signature","type":"string"},"FilterColumn":{"anyOf":[{"$ref":"#/components/schemas/FilterColumnIncludes"},{"$ref":"#/components/schemas/FilterPredicate"},{"$ref":"#/components/schemas/FilterList"}]},"FilterColumnIncludes":{"additionalProperties":false,"maxProperties":1,"minProperties":1,"properties":{"$includes":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAll":{"$ref":"#/components/schemas/FilterPredicate"},"$includesAny":{"$ref":"#/components/schemas/FilterPredicate"},"$includesNone":{"$ref":"#/components/schemas/FilterPredicate"}},"type":"object"},"FilterExpression":{"additionalProperties":{"$ref":"#/components/schemas/FilterColumn"},"minProperties":1,"properties":{"$all":{"$ref":"#/components/schemas/FilterList"},"$any":{"$ref":"#/components/schemas/FilterList"},"$exists":{"type":"string"},"$existsNot":{"type":"string"},"$none":{"$ref":"#/components/schemas/FilterList"},"$not":{"$ref":"#/components/schemas/FilterList"}},"type":"object"},"FilterList":{"oneOf":[{"$ref":"#/components/schemas/FilterExpression"},{"items":{"$ref":"#/components/schemas/FilterExpression"},"type":"array"}]},"FilterPredicate":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"items":{"$ref":"#/components/schemas/FilterPredicate"},"minLength":1,"type":"array"},{"$ref":"#/components/schemas/FilterPredicateOp"},{"$ref":"#/components/schemas/FilterPredicateRangeOp"}]},"FilterPredicateOp":{"additionalProperties":false,"maxProperties":1,"minProperties":1,"properties":{"$all":{"oneOf":[{"items":{"$ref":"#/components/schemas/FilterPredicate"},"type":"array"}]},"$any":{"oneOf":[{"items":{"$ref":"#/components/schemas/FilterPredicate"},"type":"array"}]},"$contains":{"type":"string"},"$endsWith":{"type":"string"},"$ge":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$iContains":{"type":"string"},"$iPattern":{"type":"string"},"$is":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"items":{"$ref":"#/components/schemas/FilterValue"},"type":"array"}]},"$isNot":{"oneOf":[{"$ref":"#/components/schemas/FilterValue"},{"items":{"$ref":"#/components/schemas/FilterValue"},"type":"array"}]},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$lt":{"$ref":"#/components/schemas/FilterRangeValue"},"$none":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"items":{"$ref":"#/components/schemas/FilterPredicate"},"type":"array"}]},"$not":{"oneOf":[{"$ref":"#/components/schemas/FilterPredicate"},{"items":{"$ref":"#/components/schemas/FilterPredicate"},"type":"array"}]},"$pattern":{"type":"string"},"$startsWith":{"type":"string"}},"type":"object"},"FilterPredicateRangeOp":{"additionalProperties":false,"maxProperties":2,"minProperties":2,"properties":{"$ge":{"$ref":"#/components/schemas/FilterRangeValue"},"$gt":{"$ref":"#/components/schemas/FilterRangeValue"},"$le":{"$ref":"#/components/schemas/FilterRangeValue"},"$lt":{"$ref":"#/components/schemas/FilterRangeValue"}},"type":"object"},"FilterRangeValue":{"oneOf":[{"type":"number"},{"type":"string"}]},"FilterValue":{"oneOf":[{"type":"number"},{"type":"string"},{"type":"boolean"}]},"FuzzinessExpression":{"default":1,"description":"Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein\ndistance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single\ncharacter typos per word are tolerated by search. You can set it to 0 to remove the typo tolerance or set it to 2\nto allow two typos in a word.\n","maximum":2,"minimum":0,"type":"integer"},"HighlightExpression":{"additionalProperties":false,"properties":{"enabled":{"description":"Set to `false` to disable highlighting. By default it is `true`.\n","type":"boolean"},"encodeHTML":{"description":"Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.\n","type":"boolean"}},"type":"object"},"InputFile":{"additionalProperties":false,"description":"Object representing a file","properties":{"base64Content":{"description":"Base64 encoded content","maxLength":20971520,"type":"string"},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"name":{"$ref":"#/components/schemas/FileName"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}},"required":["name"],"type":"object"},"InputFileArray":{"description":"Array of file entries","items":{"$ref":"#/components/schemas/InputFileEntry"},"maxItems":50,"type":"array"},"InputFileEntry":{"additionalProperties":false,"description":"Object representing a file in an array","properties":{"base64Content":{"description":"Base64 encoded content","maxLength":20971520,"type":"string"},"enablePublicUrl":{"description":"Enable public access to the file","type":"boolean"},"id":{"$ref":"#/components/schemas/FileItemID"},"mediaType":{"$ref":"#/components/schemas/MediaType"},"name":{"$ref":"#/components/schemas/FileName"},"signedUrlTimeout":{"description":"Time to live for signed URLs","type":"integer"}}},"ListBranchesResponse":{"additionalProperties":false,"properties":{"branches":{"items":{"$ref":"#/components/schemas/Branch"},"type":"array"},"databaseName":{"type":"string"}},"required":["databaseName","branches"],"type":"object"},"ListGitBranchesResponse":{"properties":{"mapping":{"items":{"properties":{"gitBranch":{"type":"string"},"xataBranch":{"type":"string"}},"required":["gitBranch","xataBranch"],"type":"object"},"type":"array"}},"required":["mapping"],"type":"object"},"MaxAgg":{"additionalProperties":false,"description":"The max of the numeric values in a particular column.","properties":{"column":{"description":"The column on which to compute the max. Must be a numeric type.","type":"string"}},"required":["column"],"type":"object"},"MediaType":{"description":"Media type","maxLength":255,"minLength":3,"pattern":"^\\w+/[-+.\\w]+$","type":"string"},"MetricsDatapoint":{"properties":{"timestamp":{"type":"string"},"value":{"type":"integer"}},"required":["timestamp","value"],"title":"Datapoint","type":"object"},"MetricsLatency":{"properties":{"p50":{"items":{"$ref":"#/components/schemas/MetricsDatapoint"},"type":"array"},"p90":{"items":{"$ref":"#/components/schemas/MetricsDatapoint"},"type":"array"}},"title":"MetricsLatency","type":"object"},"Migration":{"description":"Branch schema migration.","properties":{"operations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"},"parentID":{"type":"string"}},"required":["operations"],"type":"object"},"MigrationColumnOp":{"oneOf":[{"additionalProperties":false,"properties":{"addColumn":{"$ref":"#/components/schemas/ColumnOpAdd"}},"required":["addColumn"],"type":"object"},{"additionalProperties":false,"properties":{"removeColumn":{"$ref":"#/components/schemas/ColumnOpRemove"}},"required":["removeColumn"],"type":"object"},{"additionalProperties":false,"properties":{"renameColumn":{"$ref":"#/components/schemas/ColumnOpRename"}},"required":["renameColumn"],"type":"object"}]},"MigrationObject":{"properties":{"checksum":{"type":"string"},"id":{"type":"string"},"message":{"type":"string"},"operations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"},"parentID":{"type":"string"},"title":{"type":"string"}},"required":["operations","id","checksum"],"type":"object"},"MigrationOp":{"description":"Branch schema migration operations.","oneOf":[{"$ref":"#/components/schemas/MigrationTableOp"},{"$ref":"#/components/schemas/MigrationColumnOp"}]},"MigrationRequest":{"additionalProperties":false,"properties":{"body":{"description":"The migration request body with detailed description.","type":"string"},"closedAt":{"$ref":"#/components/schemas/DateTime","description":"Timestamp when the migration request was closed."},"createdAt":{"$ref":"#/components/schemas/DateTime","description":"Migration request creation timestamp."},"mergedAt":{"$ref":"#/components/schemas/DateTime","description":"Timestamp when the migration request was merged."},"modifiedAt":{"$ref":"#/components/schemas/DateTime","description":"Last modified timestamp."},"number":{"$ref":"#/components/schemas/MigrationRequestNumber"},"source":{"description":"Name of the source branch.","type":"string"},"status":{"enum":["open","closed","merging","merged","failed"],"type":"string"},"target":{"description":"Name of the target branch.","type":"string"},"title":{"description":"The migration request title.","type":"string"}},"type":"object"},"MigrationRequestNumber":{"description":"The migration request number.","minimum":0,"type":"integer"},"MigrationStatus":{"enum":["completed","pending","failed"],"type":"string"},"MigrationTableOp":{"oneOf":[{"additionalProperties":false,"properties":{"addTable":{"$ref":"#/components/schemas/TableOpAdd"}},"required":["addTable"],"type":"object"},{"additionalProperties":false,"properties":{"removeTable":{"$ref":"#/components/schemas/TableOpRemove"}},"required":["removeTable"],"type":"object"},{"additionalProperties":false,"properties":{"renameTable":{"$ref":"#/components/schemas/TableOpRename"}},"required":["renameTable"],"type":"object"}]},"MinAgg":{"additionalProperties":false,"description":"The min of the numeric values in a particular column.","properties":{"column":{"description":"The column on which to compute the min. Must be a numeric type.","type":"string"}},"required":["column"],"type":"object"},"NumericBooster":{"additionalProperties":false,"description":"Boost records based on the value of a numeric column.","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"factor":{"description":"The factor with which to multiply the value of the column before adding it to the item score.","type":"number"},"ifMatchesFilter":{"$ref":"#/components/schemas/FilterExpression","description":"Only apply this booster to the records for which the provided filter matches.\n"},"modifier":{"description":"Modifier to be applied to the column value, before being multiplied with the factor. The possible values are:\n - none (default).\n - log: common logarithm (base 10)\n - log1p: add 1 then take the common logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - ln: natural logarithm (base e)\n - ln1p: add 1 then take the natural logarithm. This ensures that the value is positive if the\n value is between 0 and 1.\n - square: raise the value to the power of two.\n - sqrt: take the square root of the value.\n - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`).\n","enum":["none","log","log1p","ln","ln1p","square","sqrt","reciprocal"],"type":"string"}},"required":["column","factor"],"type":"object"},"NumericHistogramAgg":{"additionalProperties":false,"description":"Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.\n","properties":{"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"column":{"description":"The column to use for bucketing. Must be of numeric type.","type":"string"},"interval":{"description":"The numeric interval to use for bucketing. The resulting buckets will be ranges \nwith this value as size.\n","minimum":0,"type":"number"},"offset":{"default":0,"description":"By default the bucket keys start with 0 and then continue in `interval` steps. The bucket\nboundaries can be shifted by using the offset option. For example, if the `interval` is 100,\nbut you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset` \nto 50.\n","type":"number"}},"required":["column","interval"]},"PageConfig":{"description":"Pagination settings.","properties":{"after":{"description":"Query the next page that follow the cursor.","type":"string"},"before":{"description":"Query the previous page before the cursor.","type":"string"},"end":{"description":"Query the last page from the cursor.","type":"string"},"offset":{"default":0,"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","type":"integer"},"size":{"default":20,"description":"Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.","type":"integer"},"start":{"description":"Query the first page from the cursor.","type":"string"}},"title":"PageConfig","type":"object"},"PercentilesAgg":{"additionalProperties":false,"description":"Calculate given percentiles of the numeric values in a particular column.","properties":{"column":{"description":"The column on which to compute the average. Must be a numeric type.","type":"string"},"percentiles":{"items":{"type":"number"},"type":"array"}},"required":["column","percentiles"],"type":"object"},"PrefixExpression":{"description":"If the prefix type is set to \"disabled\" (the default), the search only matches full words. If the prefix type is set to \"phrase\", the search will return results that match prefixes of the search phrase.\n","enum":["phrase","disabled"],"type":"string"},"ProjectionConfig":{"description":"A structured projection that allows for some configuration.","properties":{"as":{"description":"An alias for the projected field, this is how it will be returned in the response.","type":"string"},"columns":{"$ref":"#/components/schemas/QueryColumnsProjection"},"limit":{"default":20,"type":"integer"},"name":{"description":"The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations).","type":"string"},"offset":{"default":0,"type":"integer"},"sort":{"$ref":"#/components/schemas/SortExpression"}},"type":"object"},"QueryColumnsProjection":{"items":{"oneOf":[{"type":"string"}]},"type":"array"},"Record":{"allOf":[{"$ref":"#/components/schemas/RecordMeta"},{"additionalProperties":true,"type":"object"}],"description":"Xata Table Record","title":"Record"},"RecordID":{"maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_-~:]+","title":"RecordID","type":"string"},"RecordMeta":{"description":"Xata Table Record Metadata","properties":{"id":{"$ref":"#/components/schemas/RecordID"},"xata":{"properties":{"createdAt":{"description":"The time when the record was created.","type":"string"},"highlight":{"additionalProperties":{"oneOf":[{"items":{"type":"string"},"type":"array"},{"additionalProperties":true,"type":"object"}]},"description":"Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.","type":"object"},"score":{"description":"The record's relevancy score. This is returned by the search APIs.","type":"number"},"table":{"description":"The record's table name. APIs that return records from multiple tables will set this field accordingly.","type":"string"},"updatedAt":{"description":"The time when the record was last updated.","type":"string"},"version":{"description":"The record's version. Can be used for optimistic concurrency control.","type":"integer"},"warnings":{"description":"Encoding/Decoding errors","items":{"type":"string"},"type":"array"}},"required":["version"],"type":"object"}},"required":["id","xata"],"title":"RecordMeta","type":"object"},"RecordsMetadata":{"description":"Records metadata","properties":{"page":{"properties":{"cursor":{"description":"last record id","type":"string"},"more":{"description":"true if more records can be fetched","type":"boolean"},"size":{"description":"the number of records returned per page","type":"number"}},"required":["cursor","more","size"],"type":"object"}},"required":["page"],"type":"object"},"RevLink":{"properties":{"column":{"type":"string"},"table":{"type":"string"}},"required":["table","column"],"title":"RevLink","type":"object"},"SQLRecord":{"allOf":[{"additionalProperties":true,"type":"object"}],"description":"Xata Table SQL Record","title":"SQL Record"},"Schema":{"properties":{"tables":{"items":{"$ref":"#/components/schemas/Table"},"type":"array"},"tablesOrder":{"items":{"type":"string"},"type":"array"}},"required":["tables"],"title":"Schema","type":"object"},"SchemaEditScript":{"properties":{"operations":{"items":{"$ref":"#/components/schemas/MigrationOp"},"type":"array"},"sourceMigrationID":{"type":"string"},"targetMigrationID":{"type":"string"}},"required":["operations"],"title":"SchemaEditScript","type":"object"},"SearchPageConfig":{"description":"Pagination settings for the search endpoints.","properties":{"offset":{"default":0,"description":"Use offset to skip entries. To skip pages set offset to a multiple of size.","maximum":800,"type":"integer"},"size":{"default":25,"description":"Set page size.","maximum":200,"type":"integer"}},"title":"SearchPageConfig"},"SortExpression":{"oneOf":[{"items":{"type":"string"},"type":"array"},{"additionalProperties":{"$ref":"#/components/schemas/SortOrder"},"type":"object"},{"items":{"additionalProperties":{"$ref":"#/components/schemas/SortOrder"},"type":"object"},"type":"array"}],"title":"SortExpression"},"SortOrder":{"enum":["asc","desc","random"],"title":"SortOrder","type":"string"},"StartedFromMetadata":{"properties":{"branchName":{"$ref":"#/components/schemas/BranchName"},"dbBranchID":{"type":"string"},"migrationID":{"type":"string"}},"required":["branchName","dbBranchID","migrationID"],"title":"StartedFromMetadata","type":"object"},"SumAgg":{"additionalProperties":false,"description":"The sum of the numeric values in a particular column.","properties":{"column":{"description":"The column on which to compute the sum. Must be a numeric type.","type":"string"}},"required":["column"],"type":"object"},"SummaryExpression":{"description":"A summary expression is the description of a single summary operation. It consists of a single\nkey representing the operation, and a value representing the column to be operated on.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n\nWe currently support several aggregation functions. Not all functions can be run on all column\ntypes.\n\n - `count` is used to count the number of records in each group. Use `{\"count\": \"*\"}` to count\n all columns present, otherwise `{\"count\": \"\u003ccolumn_path\u003e\"}` to count the number of non-null\n values are present at column path.\n\n Count can be used on any column type, and always returns an int.\n\n - `min` calculates the minimum value in each group. `min` is compatible with most types;\n string, multiple, text, email, int, float, and datetime. It returns a value of the same\n type as operated on. This means that `{\"lowest_latency\": {\"min\": \"latency\"}}` where\n `latency` is an int, will always return an int.\n\n - `max` calculates the maximum value in each group. `max` shares the same compatibility as\n `min`.\n\n - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will\n return a value of the same type as requested.\n\n - `average` averages all values in a group. `average` can be run on `int` and `float` types, and\n always returns a float.\n","example":{"count":"deleted_at"},"type":"object"},"SummaryExpressionList":{"additionalProperties":{"$ref":"#/components/schemas/SummaryExpression"},"description":"The description of the summaries you wish to receive. Set each key to be the field name\nyou'd like for the summary. These names must not collide with other columns you've\nrequested from `columns`; including implicit requests like `settings.*`.\n\nThe value for each key needs to be an object. This object should contain one key and one \nvalue only. In this object, the key should be set to the summary function you wish to use\nand the value set to the column name to be summarized.\n\nThe column being summarized cannot be an internal column (id, xata.*), nor the base of\nan object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize\n`settings.dark_mode` but not `settings` nor `settings.*`.\n","example":{"all_users":{"count":"*"},"average_speed":{"average":"speed"},"max_happiness":{"max":"happiness"},"min_cost":{"min":"cost"},"total_created":{"count":"created_at"},"total_revenue":{"sum":"revenue"}},"type":"object"},"Table":{"properties":{"columns":{"items":{"$ref":"#/components/schemas/Column"},"type":"array"},"id":{"type":"string"},"name":{"$ref":"#/components/schemas/TableName"},"revLinks":{"items":{"$ref":"#/components/schemas/RevLink"},"type":"array"}},"required":["name","columns"],"title":"Table","type":"object"},"TableMigration":{"properties":{"modifiedColumns":{"items":{"$ref":"#/components/schemas/ColumnMigration"},"type":"array"},"newColumnOrder":{"items":{"type":"string"},"type":"array"},"newColumns":{"additionalProperties":{"$ref":"#/components/schemas/Column"},"type":"object"},"removedColumns":{"items":{"type":"string"},"type":"array"}},"required":["newColumnOrder"],"title":"TableMigration","type":"object"},"TableName":{"maxLength":255,"minLength":1,"pattern":"[a-zA-Z0-9_\\-~]+","title":"TableName","type":"string"},"TableOpAdd":{"properties":{"table":{"type":"string"}},"required":["table"],"type":"object"},"TableOpRemove":{"properties":{"table":{"type":"string"}},"required":["table"],"type":"object"},"TableOpRename":{"properties":{"newName":{"type":"string"},"oldName":{"type":"string"}},"required":["oldName","newName"],"type":"object"},"TableRename":{"description":"","example":{"newName":"newName","oldName":"oldName"},"properties":{"newName":{"minLength":1,"type":"string"},"oldName":{"minLength":1,"type":"string"}},"required":["newName","oldName"],"type":"object"},"TargetExpression":{"description":"The target expression is used to filter the search results by the target columns.\n","items":{"oneOf":[{"type":"string"},{"additionalProperties":false,"properties":{"column":{"description":"The name of the column.","type":"string"},"weight":{"default":1,"description":"The weight of the column.","maximum":10,"minimum":1,"type":"number"}},"required":["column"],"type":"object"}]},"type":"array"},"TopValuesAgg":{"additionalProperties":false,"description":"Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.\nThe top values as ordered by the number of records (`$count`) are returned.\n","properties":{"aggs":{"$ref":"#/components/schemas/AggExpressionMap"},"column":{"description":"The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.","type":"string"},"size":{"default":10,"description":"The maximum number of unique values to return.\n","maximum":1000,"type":"integer"}},"required":["column"]},"TransactionDeleteOp":{"description":"A delete operation. The transaction will continue if no record matches the ID by default. To override this behaviour, set failIfMissing to true.","properties":{"columns":{"description":"If set, the call will return the requested fields as part of the response.","items":{"type":"string"},"type":"array"},"failIfMissing":{"description":"If true, the transaction will fail when the record doesn't exist.","type":"boolean"},"id":{"$ref":"#/components/schemas/RecordID"},"table":{"description":"The table name","type":"string"}},"required":["table","id"],"type":"object"},"TransactionError":{"description":"An error message from a failing transaction operation","properties":{"index":{"description":"The index of the failing operation","type":"integer"},"message":{"description":"The error message","type":"string"}},"required":["index","message"],"type":"object"},"TransactionFailure":{"description":"An array of errors, with indices, from the transaction.","properties":{"errors":{"description":"An array of errors from the submitted operations.","items":{"$ref":"#/components/schemas/TransactionError"},"type":"array"},"id":{"description":"The request ID.","type":"string"}},"required":["id","errors"],"type":"object"},"TransactionGetOp":{"description":"Get by id operation.","properties":{"columns":{"description":"If set, the call will return the requested fields as part of the response.","items":{"type":"string"},"type":"array"},"id":{"$ref":"#/components/schemas/RecordID"},"table":{"description":"The table name","type":"string"}},"required":["table","id"],"type":"object"},"TransactionInsertOp":{"description":"Insert operation","properties":{"columns":{"description":"If set, the call will return the requested fields as part of the response.","items":{"type":"string"},"type":"array"},"createOnly":{"description":"createOnly is used to change how Xata acts when an explicit ID is set in the `record` key. \n\nIf `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata \nwill cancel the transaction. \n\nIf `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no\nconflict, the record is inserted. If there is a conflict, Xata will replace the record.\n","type":"boolean"},"ifVersion":{"description":"The version of the record you expect to be overwriting. Only valid with an\nexplicit ID is also set in the `record` key.\n","type":"integer"},"record":{"additionalProperties":true,"description":"The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.\n","type":"object"},"table":{"description":"The table name","type":"string"}},"required":["table","record"],"type":"object"},"TransactionOperation":{"description":"A transaction operation","oneOf":[{"properties":{"insert":{"$ref":"#/components/schemas/TransactionInsertOp"}},"required":["insert"],"type":"object"},{"properties":{"update":{"$ref":"#/components/schemas/TransactionUpdateOp"}},"required":["update"],"type":"object"},{"properties":{"delete":{"$ref":"#/components/schemas/TransactionDeleteOp"}},"required":["delete"],"type":"object"},{"properties":{"get":{"$ref":"#/components/schemas/TransactionGetOp"}},"required":["get"],"type":"object"}],"type":"object"},"TransactionResultColumns":{"additionalProperties":true,"description":"Fields to return in the transaction result.","type":"object"},"TransactionResultDelete":{"description":"A result from a delete operation.","properties":{"columns":{"$ref":"#/components/schemas/TransactionResultColumns"},"operation":{"description":"The type of operation who's result is being returned.","enum":["delete"],"type":"string"},"rows":{"description":"The number of deleted rows","type":"integer"}},"required":["operation","rows"],"type":"object"},"TransactionResultGet":{"description":"A result from a get operation.","properties":{"columns":{"$ref":"#/components/schemas/TransactionResultColumns"},"operation":{"description":"The type of operation who's result is being returned.","enum":["get"],"type":"string"}},"required":["operation"],"type":"object"},"TransactionResultInsert":{"description":"A result from an insert operation.","properties":{"columns":{"$ref":"#/components/schemas/TransactionResultColumns"},"id":{"$ref":"#/components/schemas/RecordID"},"operation":{"description":"The type of operation who's result is being returned.","enum":["insert"],"type":"string"},"rows":{"description":"The number of affected rows","type":"integer"}},"required":["operation","rows","id"],"type":"object"},"TransactionResultUpdate":{"description":"A result from an update operation.","properties":{"columns":{"$ref":"#/components/schemas/TransactionResultColumns"},"id":{"$ref":"#/components/schemas/RecordID"},"operation":{"description":"The type of operation who's result is being returned.","enum":["update"],"type":"string"},"rows":{"description":"The number of updated rows","type":"integer"}},"required":["operation","rows","id"],"type":"object"},"TransactionSuccess":{"description":"An ordered array of results from the submitted operations.","properties":{"results":{"items":{"oneOf":[{"$ref":"#/components/schemas/TransactionResultInsert"},{"$ref":"#/components/schemas/TransactionResultUpdate"},{"$ref":"#/components/schemas/TransactionResultDelete"},{"$ref":"#/components/schemas/TransactionResultGet"}]},"type":"array"}},"required":["results"],"type":"object"},"TransactionUpdateOp":{"description":"Update operation","properties":{"columns":{"description":"If set, the call will return the requested fields as part of the response.","items":{"type":"string"},"type":"array"},"fields":{"additionalProperties":true,"description":"The fields of the record you'd like to update","type":"object"},"id":{"$ref":"#/components/schemas/RecordID"},"ifVersion":{"description":"The version of the record you expect to be updating","type":"integer"},"table":{"description":"The table name","type":"string"},"upsert":{"description":"Xata will insert this record if it cannot be found.","type":"boolean"}},"required":["table","id","fields"],"type":"object"},"UniqueCountAgg":{"additionalProperties":false,"description":"Count the number of distinct values in a particular column.","properties":{"column":{"description":"The column from where to count the unique values.","type":"string"},"precisionThreshold":{"description":"The threshold under which the unique count is exact. If the number of unique\nvalues in the column is higher than this threshold, the results are approximate.\nMaximum value is 40,000, default value is 3000.\n","type":"integer"}},"required":["column"],"type":"object"},"ValueBooster":{"additionalProperties":false,"description":"Boost records with a particular value for a column.","properties":{"column":{"description":"The column in which to look for the value.","type":"string"},"factor":{"description":"The factor with which to multiply the added boost.","type":"number"},"ifMatchesFilter":{"$ref":"#/components/schemas/FilterExpression","description":"Only apply this booster to the records for which the provided filter matches.\n"},"value":{"description":"The exact value to boost.","oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"}]}},"required":["column","value","factor"],"type":"object"}},"securitySchemes":{"bearerAuth":{"scheme":"bearer","type":"http"}}},"tags":[{"description":"Database management.","name":"Database","x-displayName":"Database"},{"description":"Branch management.","name":"Branch","x-displayName":"Branch"},{"description":"Branch schema migrations and history.","name":"Migrations","x-displayName":"Migrations"},{"description":"Table management.","name":"Table","x-displayName":"Table"},{"name":"xbregion_other","x-displayName":"other"},{"description":"Record access API.","name":"Records","x-displayName":"Records"},{"description":"APIs for searching, querying, filtering, and aggregating records.","name":"Search and Filter","x-displayName":"Search and Filter"},{"description":"CRUD API for operating on binary content in file and file[] columns.","name":"Files","x-displayName":"Files"},{"name":"xbcell_other","x-displayName":"other"},{"description":"SQL service access","name":"SQL","x-displayName":"SQL"},{"name":"sql_other","x-displayName":"other"}],"x-tagGroups":[{"description":"Xata.io Xatabases API","name":"xbregion","tags":["Database","Branch","Migrations","Table","Migration Requests","xbregion_other"]},{"description":"Xata.io Xatabases API","name":"xbcell","tags":["Records","Search and Filter","Files","xbcell_other"]},{"description":"Xata.io SQL API","name":"sql","tags":["SQL","sql_other"]}]} \ No newline at end of file diff --git a/xata/internal/fern-workspace/fern/fern.config.json b/xata/internal/fern-workspace/fern/fern.config.json index ce7a453..d0e34d8 100644 --- a/xata/internal/fern-workspace/fern/fern.config.json +++ b/xata/internal/fern-workspace/fern/fern.config.json @@ -1,4 +1,4 @@ { - "organization": "tomasdembelli", + "organization": "omerdemirok", "version": "0.14.3" } \ No newline at end of file diff --git a/xata/internal/fern-workspace/generated/go/add_git_branches_entry_request.go b/xata/internal/fern-workspace/generated/go/add_git_branches_entry_request.go index 8a38065..866854e 100644 --- a/xata/internal/fern-workspace/generated/go/add_git_branches_entry_request.go +++ b/xata/internal/fern-workspace/generated/go/add_git_branches_entry_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/add_git_branches_entry_response.go b/xata/internal/fern-workspace/generated/go/add_git_branches_entry_response.go index 1d3a6ce..ce72286 100644 --- a/xata/internal/fern-workspace/generated/go/add_git_branches_entry_response.go +++ b/xata/internal/fern-workspace/generated/go/add_git_branches_entry_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/add_table_column_response.go b/xata/internal/fern-workspace/generated/go/add_table_column_response.go index dca09f1..0640246 100644 --- a/xata/internal/fern-workspace/generated/go/add_table_column_response.go +++ b/xata/internal/fern-workspace/generated/go/add_table_column_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression.go b/xata/internal/fern-workspace/generated/go/agg_expression.go index 6239ef4..a1839f3 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -19,6 +17,7 @@ type AggExpression struct { AggExpressionMax *AggExpressionMax AggExpressionMin *AggExpressionMin AggExpressionAverage *AggExpressionAverage + AggExpressionPercentiles *AggExpressionPercentiles AggExpressionUniqueCount *AggExpressionUniqueCount AggExpressionDateHistogram *AggExpressionDateHistogram AggExpressionTopValues *AggExpressionTopValues @@ -45,6 +44,10 @@ func NewAggExpressionFromAggExpressionAverage(value *AggExpressionAverage) *AggE return &AggExpression{typeName: "aggExpressionAverage", AggExpressionAverage: value} } +func NewAggExpressionFromAggExpressionPercentiles(value *AggExpressionPercentiles) *AggExpression { + return &AggExpression{typeName: "aggExpressionPercentiles", AggExpressionPercentiles: value} +} + func NewAggExpressionFromAggExpressionUniqueCount(value *AggExpressionUniqueCount) *AggExpression { return &AggExpression{typeName: "aggExpressionUniqueCount", AggExpressionUniqueCount: value} } @@ -92,6 +95,12 @@ func (a *AggExpression) UnmarshalJSON(data []byte) error { a.AggExpressionAverage = valueAggExpressionAverage return nil } + valueAggExpressionPercentiles := new(AggExpressionPercentiles) + if err := json.Unmarshal(data, &valueAggExpressionPercentiles); err == nil { + a.typeName = "aggExpressionPercentiles" + a.AggExpressionPercentiles = valueAggExpressionPercentiles + return nil + } valueAggExpressionUniqueCount := new(AggExpressionUniqueCount) if err := json.Unmarshal(data, &valueAggExpressionUniqueCount); err == nil { a.typeName = "aggExpressionUniqueCount" @@ -133,6 +142,8 @@ func (a AggExpression) MarshalJSON() ([]byte, error) { return json.Marshal(a.AggExpressionMin) case "aggExpressionAverage": return json.Marshal(a.AggExpressionAverage) + case "aggExpressionPercentiles": + return json.Marshal(a.AggExpressionPercentiles) case "aggExpressionUniqueCount": return json.Marshal(a.AggExpressionUniqueCount) case "aggExpressionDateHistogram": @@ -150,6 +161,7 @@ type AggExpressionVisitor interface { VisitAggExpressionMax(*AggExpressionMax) error VisitAggExpressionMin(*AggExpressionMin) error VisitAggExpressionAverage(*AggExpressionAverage) error + VisitAggExpressionPercentiles(*AggExpressionPercentiles) error VisitAggExpressionUniqueCount(*AggExpressionUniqueCount) error VisitAggExpressionDateHistogram(*AggExpressionDateHistogram) error VisitAggExpressionTopValues(*AggExpressionTopValues) error @@ -170,6 +182,8 @@ func (a *AggExpression) Accept(v AggExpressionVisitor) error { return v.VisitAggExpressionMin(a.AggExpressionMin) case "aggExpressionAverage": return v.VisitAggExpressionAverage(a.AggExpressionAverage) + case "aggExpressionPercentiles": + return v.VisitAggExpressionPercentiles(a.AggExpressionPercentiles) case "aggExpressionUniqueCount": return v.VisitAggExpressionUniqueCount(a.AggExpressionUniqueCount) case "aggExpressionDateHistogram": diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_average.go b/xata/internal/fern-workspace/generated/go/agg_expression_average.go index 59ac460..fd42880 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_average.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_average.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_count.go b/xata/internal/fern-workspace/generated/go/agg_expression_count.go index 9426f07..282995c 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_count.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_count.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_date_histogram.go b/xata/internal/fern-workspace/generated/go/agg_expression_date_histogram.go index 5288497..0a4971a 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_date_histogram.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_date_histogram.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_map.go b/xata/internal/fern-workspace/generated/go/agg_expression_map.go index dc2170b..9ba14b4 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_map.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_map.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_max.go b/xata/internal/fern-workspace/generated/go/agg_expression_max.go index 00a8d92..65c5674 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_max.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_max.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_min.go b/xata/internal/fern-workspace/generated/go/agg_expression_min.go index 6fb8f95..d895daa 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_min.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_min.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_numeric_histogram.go b/xata/internal/fern-workspace/generated/go/agg_expression_numeric_histogram.go index 0eeb40e..7f08431 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_numeric_histogram.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_numeric_histogram.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_percentiles.go b/xata/internal/fern-workspace/generated/go/agg_expression_percentiles.go new file mode 100644 index 0000000..578238a --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/agg_expression_percentiles.go @@ -0,0 +1,7 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +type AggExpressionPercentiles struct { + Percentiles *PercentilesAgg `json:"percentiles,omitempty"` +} diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_sum.go b/xata/internal/fern-workspace/generated/go/agg_expression_sum.go index b403fed..f78b588 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_sum.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_sum.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_top_values.go b/xata/internal/fern-workspace/generated/go/agg_expression_top_values.go index 3e45856..8025917 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_top_values.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_top_values.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_expression_unique_count.go b/xata/internal/fern-workspace/generated/go/agg_expression_unique_count.go index ed9be0e..aadefad 100644 --- a/xata/internal/fern-workspace/generated/go/agg_expression_unique_count.go +++ b/xata/internal/fern-workspace/generated/go/agg_expression_unique_count.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_response.go b/xata/internal/fern-workspace/generated/go/agg_response.go index 6b188b8..63b9579 100644 --- a/xata/internal/fern-workspace/generated/go/agg_response.go +++ b/xata/internal/fern-workspace/generated/go/agg_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/agg_response_values.go b/xata/internal/fern-workspace/generated/go/agg_response_values.go index 648475f..9e8a2da 100644 --- a/xata/internal/fern-workspace/generated/go/agg_response_values.go +++ b/xata/internal/fern-workspace/generated/go/agg_response_values.go @@ -1,9 +1,7 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type AggResponseValues struct { - Values []*AggResponseValuesValuesItem `json:"values,omitempty"` + Values *AggResponseValuesValues `json:"values,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/agg_response_values_values.go b/xata/internal/fern-workspace/generated/go/agg_response_values_values.go new file mode 100644 index 0000000..aa9aa05 --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/agg_response_values_values.go @@ -0,0 +1,65 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + fmt "fmt" +) + +type AggResponseValuesValues struct { + typeName string + AggResponseValuesValuesItemList []*AggResponseValuesValuesItem + StringDoubleMap map[string]float64 +} + +func NewAggResponseValuesValuesFromAggResponseValuesValuesItemList(value []*AggResponseValuesValuesItem) *AggResponseValuesValues { + return &AggResponseValuesValues{typeName: "aggResponseValuesValuesItemList", AggResponseValuesValuesItemList: value} +} + +func NewAggResponseValuesValuesFromStringDoubleMap(value map[string]float64) *AggResponseValuesValues { + return &AggResponseValuesValues{typeName: "stringDoubleMap", StringDoubleMap: value} +} + +func (a *AggResponseValuesValues) UnmarshalJSON(data []byte) error { + var valueAggResponseValuesValuesItemList []*AggResponseValuesValuesItem + if err := json.Unmarshal(data, &valueAggResponseValuesValuesItemList); err == nil { + a.typeName = "aggResponseValuesValuesItemList" + a.AggResponseValuesValuesItemList = valueAggResponseValuesValuesItemList + return nil + } + var valueStringDoubleMap map[string]float64 + if err := json.Unmarshal(data, &valueStringDoubleMap); err == nil { + a.typeName = "stringDoubleMap" + a.StringDoubleMap = valueStringDoubleMap + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, a) +} + +func (a AggResponseValuesValues) MarshalJSON() ([]byte, error) { + switch a.typeName { + default: + return nil, fmt.Errorf("invalid type %s in %T", a.typeName, a) + case "aggResponseValuesValuesItemList": + return json.Marshal(a.AggResponseValuesValuesItemList) + case "stringDoubleMap": + return json.Marshal(a.StringDoubleMap) + } +} + +type AggResponseValuesValuesVisitor interface { + VisitAggResponseValuesValuesItemList([]*AggResponseValuesValuesItem) error + VisitStringDoubleMap(map[string]float64) error +} + +func (a *AggResponseValuesValues) Accept(v AggResponseValuesValuesVisitor) error { + switch a.typeName { + default: + return fmt.Errorf("invalid type %s in %T", a.typeName, a) + case "aggResponseValuesValuesItemList": + return v.VisitAggResponseValuesValuesItemList(a.AggResponseValuesValuesItemList) + case "stringDoubleMap": + return v.VisitStringDoubleMap(a.StringDoubleMap) + } +} diff --git a/xata/internal/fern-workspace/generated/go/agg_response_values_values_item.go b/xata/internal/fern-workspace/generated/go/agg_response_values_values_item.go index 30199cd..b317901 100644 --- a/xata/internal/fern-workspace/generated/go/agg_response_values_values_item.go +++ b/xata/internal/fern-workspace/generated/go/agg_response_values_values_item.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type AggResponseValuesValuesItem struct { - Key *AggResponseValuesValuesItemKey `json:"$key,omitempty"` Count int `json:"$count"` + Key *AggResponseValuesValuesItemKey `json:"$key,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/agg_response_values_values_item_key.go b/xata/internal/fern-workspace/generated/go/agg_response_values_values_item_key.go index e31f72f..899403f 100644 --- a/xata/internal/fern-workspace/generated/go/agg_response_values_values_item_key.go +++ b/xata/internal/fern-workspace/generated/go/agg_response_values_values_item_key.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/aggregate_table_request.go b/xata/internal/fern-workspace/generated/go/aggregate_table_request.go index d8b79ff..34f034f 100644 --- a/xata/internal/fern-workspace/generated/go/aggregate_table_request.go +++ b/xata/internal/fern-workspace/generated/go/aggregate_table_request.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // AggregateTableRequest is an in-lined request used by the AggregateTable endpoint. type AggregateTableRequest struct { - Filter *FilterExpression `json:"filter,omitempty"` Aggs *AggExpressionMap `json:"aggs,omitempty"` + Filter *FilterExpression `json:"filter,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/aggregate_table_response.go b/xata/internal/fern-workspace/generated/go/aggregate_table_response.go index a555e64..c76bb90 100644 --- a/xata/internal/fern-workspace/generated/go/aggregate_table_response.go +++ b/xata/internal/fern-workspace/generated/go/aggregate_table_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_request.go b/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_request.go index 4d546aa..ebb44cd 100644 --- a/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_request.go +++ b/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_response.go b/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_response.go index 79abc76..800ee08 100644 --- a/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_response.go +++ b/xata/internal/fern-workspace/generated/go/apply_branch_schema_edit_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/ask_table_request.go b/xata/internal/fern-workspace/generated/go/ask_table_request.go index 2c8b089..434c1a5 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_request.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -7,7 +5,9 @@ package api // AskTableRequest is an in-lined request used by the AskTable endpoint. type AskTableRequest struct { // The question you'd like to ask. - Question string `json:"question"` + Question string `json:"question"` + Rules *[]string `json:"rules,omitempty"` + Search *AskTableRequestSearch `json:"search,omitempty"` // The type of search to use. If set to `keyword` (the default), the search can be configured by passing // a `search` object with the following fields. For more details about each, see the Search endpoint documentation. // All fields are optional. @@ -23,7 +23,5 @@ type AskTableRequest struct { // - contentColumn - the column that contains the text from which the embeddings where computed. // - filter - pre-filter before searching. SearchType *AskTableRequestSearchType `json:"searchType,omitempty"` - Search *AskTableRequestSearch `json:"search,omitempty"` VectorSearch *AskTableRequestVectorSearch `json:"vectorSearch,omitempty"` - Rules *[]string `json:"rules,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/ask_table_request_search.go b/xata/internal/fern-workspace/generated/go/ask_table_request_search.go index 604c8ed..8659a26 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_request_search.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_request_search.go @@ -1,13 +1,11 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type AskTableRequestSearch struct { + Boosters *[]*BoosterExpression `json:"boosters,omitempty"` + Filter *FilterExpression `json:"filter,omitempty"` Fuzziness *FuzzinessExpression `json:"fuzziness,omitempty"` - Target *TargetExpression `json:"target,omitempty"` Prefix *PrefixExpression `json:"prefix,omitempty"` - Filter *FilterExpression `json:"filter,omitempty"` - Boosters *[]*BoosterExpression `json:"boosters,omitempty"` + Target *TargetExpression `json:"target,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/ask_table_request_search_type.go b/xata/internal/fern-workspace/generated/go/ask_table_request_search_type.go index c0651b8..2e421df 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_request_search_type.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_request_search_type.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/ask_table_request_vector_search.go b/xata/internal/fern-workspace/generated/go/ask_table_request_vector_search.go index 3b60766..6860b01 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_request_vector_search.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_request_vector_search.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/ask_table_response.go b/xata/internal/fern-workspace/generated/go/ask_table_response.go index 1dab2b9..89d4627 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_response.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/ask_table_session_request.go b/xata/internal/fern-workspace/generated/go/ask_table_session_request.go index 0e5b3b3..78b5e3c 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_session_request.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_session_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/ask_table_session_response.go b/xata/internal/fern-workspace/generated/go/ask_table_session_response.go index ddfa49e..c84c3fd 100644 --- a/xata/internal/fern-workspace/generated/go/ask_table_session_response.go +++ b/xata/internal/fern-workspace/generated/go/ask_table_session_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/average_agg.go b/xata/internal/fern-workspace/generated/go/average_agg.go index 37b0c12..3bd8122 100644 --- a/xata/internal/fern-workspace/generated/go/average_agg.go +++ b/xata/internal/fern-workspace/generated/go/average_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/bad_request_error.go b/xata/internal/fern-workspace/generated/go/bad_request_error.go index 8f64123..95f9799 100644 --- a/xata/internal/fern-workspace/generated/go/bad_request_error.go +++ b/xata/internal/fern-workspace/generated/go/bad_request_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/booster_expression.go b/xata/internal/fern-workspace/generated/go/booster_expression.go index 2ee1c57..f3fa9c7 100644 --- a/xata/internal/fern-workspace/generated/go/booster_expression.go +++ b/xata/internal/fern-workspace/generated/go/booster_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/booster_expression_date_booster.go b/xata/internal/fern-workspace/generated/go/booster_expression_date_booster.go index 9c4dce5..c4dd382 100644 --- a/xata/internal/fern-workspace/generated/go/booster_expression_date_booster.go +++ b/xata/internal/fern-workspace/generated/go/booster_expression_date_booster.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/booster_expression_numeric_booster.go b/xata/internal/fern-workspace/generated/go/booster_expression_numeric_booster.go index 17fb834..fa3936e 100644 --- a/xata/internal/fern-workspace/generated/go/booster_expression_numeric_booster.go +++ b/xata/internal/fern-workspace/generated/go/booster_expression_numeric_booster.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/booster_expression_value_booster.go b/xata/internal/fern-workspace/generated/go/booster_expression_value_booster.go index 5e52842..47db243 100644 --- a/xata/internal/fern-workspace/generated/go/booster_expression_value_booster.go +++ b/xata/internal/fern-workspace/generated/go/booster_expression_value_booster.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/branch.go b/xata/internal/fern-workspace/generated/go/branch.go index 24ea918..9930cd9 100644 --- a/xata/internal/fern-workspace/generated/go/branch.go +++ b/xata/internal/fern-workspace/generated/go/branch.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type Branch struct { - Name string `json:"name"` CreatedAt DateTime `json:"createdAt"` + Name string `json:"name"` } diff --git a/xata/internal/fern-workspace/generated/go/branch_client.go b/xata/internal/fern-workspace/generated/go/branch_client.go index 82846de..3216eac 100644 --- a/xata/internal/fern-workspace/generated/go/branch_client.go +++ b/xata/internal/fern-workspace/generated/go/branch_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -17,13 +15,13 @@ import ( ) type BranchClient interface { - GetBranchList(ctx context.Context, dbName DbName) (*ListBranchesResponse, error) GetBranchDetails(ctx context.Context, dbBranchName DbBranchName) (*DbBranch, error) CreateBranch(ctx context.Context, dbBranchName DbBranchName, request *CreateBranchRequest) (*CreateBranchResponse, error) DeleteBranch(ctx context.Context, dbBranchName DbBranchName) (*DeleteBranchResponse, error) GetBranchMetadata(ctx context.Context, dbBranchName DbBranchName) (*BranchMetadata, error) UpdateBranchMetadata(ctx context.Context, dbBranchName DbBranchName, request *BranchMetadata) error GetBranchStats(ctx context.Context, dbBranchName DbBranchName) (*GetBranchStatsResponse, error) + GetBranchList(ctx context.Context, dbName DbName) (*ListBranchesResponse, error) GetGitBranchesMapping(ctx context.Context, dbName DbName) (*ListGitBranchesResponse, error) AddGitBranchesEntry(ctx context.Context, dbName DbName, request *AddGitBranchesEntryRequest) (*AddGitBranchesEntryResponse, error) RemoveGitBranchesEntry(ctx context.Context, dbName DbName, request *RemoveGitBranchesEntryRequest) error @@ -48,15 +46,13 @@ type branchClient struct { header http.Header } -// List all available Branches -// -// The Database Name -func (b *branchClient) GetBranchList(ctx context.Context, dbName DbName) (*ListBranchesResponse, error) { +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +func (b *branchClient) GetBranchDetails(ctx context.Context, dbBranchName DbBranchName) (*DbBranch, error) { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"dbs/%v", dbName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -91,7 +87,7 @@ func (b *branchClient) GetBranchList(ctx context.Context, dbName DbName) (*ListB return apiError } - var response *ListBranchesResponse + var response *DbBranch if err := core.DoRequest( ctx, b.httpClient, @@ -109,13 +105,21 @@ func (b *branchClient) GetBranchList(ctx context.Context, dbName DbName) (*ListB } // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (b *branchClient) GetBranchDetails(ctx context.Context, dbBranchName DbBranchName) (*DbBranch, error) { +func (b *branchClient) CreateBranch(ctx context.Context, dbBranchName DbBranchName, request *CreateBranchRequest) (*CreateBranchResponse, error) { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v", dbBranchName) + queryParams := make(url.Values) + if request.From != nil { + queryParams.Add("from", fmt.Sprintf("%v", *request.From)) + } + if len(queryParams) > 0 { + endpointURL += "?" + queryParams.Encode() + } + errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) if err != nil { @@ -149,13 +153,13 @@ func (b *branchClient) GetBranchDetails(ctx context.Context, dbBranchName DbBran return apiError } - var response *DbBranch + var response *CreateBranchResponse if err := core.DoRequest( ctx, b.httpClient, endpointURL, - http.MethodGet, - nil, + http.MethodPut, + request, &response, false, b.header, @@ -166,22 +170,16 @@ func (b *branchClient) GetBranchDetails(ctx context.Context, dbBranchName DbBran return response, nil } +// Delete the branch in the database and all its resources +// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (b *branchClient) CreateBranch(ctx context.Context, dbBranchName DbBranchName, request *CreateBranchRequest) (*CreateBranchResponse, error) { +func (b *branchClient) DeleteBranch(ctx context.Context, dbBranchName DbBranchName) (*DeleteBranchResponse, error) { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL } endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v", dbBranchName) - queryParams := make(url.Values) - if request.From != nil { - queryParams.Add("from", fmt.Sprintf("%v", *request.From)) - } - if len(queryParams) > 0 { - endpointURL += "?" + queryParams.Encode() - } - errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) if err != nil { @@ -211,17 +209,24 @@ func (b *branchClient) CreateBranch(ctx context.Context, dbBranchName DbBranchNa return err } return value + case 409: + value := new(ConflictError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value } return apiError } - var response *CreateBranchResponse + var response *DeleteBranchResponse if err := core.DoRequest( ctx, b.httpClient, endpointURL, - http.MethodPut, - request, + http.MethodDelete, + nil, &response, false, b.header, @@ -232,15 +237,13 @@ func (b *branchClient) CreateBranch(ctx context.Context, dbBranchName DbBranchNa return response, nil } -// Delete the branch in the database and all its resources -// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (b *branchClient) DeleteBranch(ctx context.Context, dbBranchName DbBranchName) (*DeleteBranchResponse, error) { +func (b *branchClient) GetBranchMetadata(ctx context.Context, dbBranchName DbBranchName) (*BranchMetadata, error) { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/metadata", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -271,23 +274,16 @@ func (b *branchClient) DeleteBranch(ctx context.Context, dbBranchName DbBranchNa return err } return value - case 409: - value := new(ConflictError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value } return apiError } - var response *DeleteBranchResponse + var response *BranchMetadata if err := core.DoRequest( ctx, b.httpClient, endpointURL, - http.MethodDelete, + http.MethodGet, nil, &response, false, @@ -299,8 +295,10 @@ func (b *branchClient) DeleteBranch(ctx context.Context, dbBranchName DbBranchNa return response, nil } +// Update the branch metadata +// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (b *branchClient) GetBranchMetadata(ctx context.Context, dbBranchName DbBranchName) (*BranchMetadata, error) { +func (b *branchClient) UpdateBranchMetadata(ctx context.Context, dbBranchName DbBranchName, request *BranchMetadata) error { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL @@ -340,32 +338,31 @@ func (b *branchClient) GetBranchMetadata(ctx context.Context, dbBranchName DbBra return apiError } - var response *BranchMetadata if err := core.DoRequest( ctx, b.httpClient, endpointURL, - http.MethodGet, + http.MethodPut, + request, nil, - &response, false, b.header, errorDecoder, ); err != nil { - return response, err + return err } - return response, nil + return nil } -// Update the branch metadata +// Get branch usage metrics. // // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (b *branchClient) UpdateBranchMetadata(ctx context.Context, dbBranchName DbBranchName, request *BranchMetadata) error { +func (b *branchClient) GetBranchStats(ctx context.Context, dbBranchName DbBranchName) (*GetBranchStatsResponse, error) { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/metadata", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/stats", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -400,31 +397,32 @@ func (b *branchClient) UpdateBranchMetadata(ctx context.Context, dbBranchName Db return apiError } + var response *GetBranchStatsResponse if err := core.DoRequest( ctx, b.httpClient, endpointURL, - http.MethodPut, - request, + http.MethodGet, nil, + &response, false, b.header, errorDecoder, ); err != nil { - return err + return response, err } - return nil + return response, nil } -// Get branch usage metrics. +// List all available Branches // -// The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (b *branchClient) GetBranchStats(ctx context.Context, dbBranchName DbBranchName) (*GetBranchStatsResponse, error) { +// The Database Name +func (b *branchClient) GetBranchList(ctx context.Context, dbName DbName) (*ListBranchesResponse, error) { baseURL := "/" if b.baseURL != "" { baseURL = b.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/stats", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"dbs/%v", dbName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -459,7 +457,7 @@ func (b *branchClient) GetBranchStats(ctx context.Context, dbBranchName DbBranch return apiError } - var response *GetBranchStatsResponse + var response *ListBranchesResponse if err := core.DoRequest( ctx, b.httpClient, diff --git a/xata/internal/fern-workspace/generated/go/branch_metadata.go b/xata/internal/fern-workspace/generated/go/branch_metadata.go index b999612..01b750d 100644 --- a/xata/internal/fern-workspace/generated/go/branch_metadata.go +++ b/xata/internal/fern-workspace/generated/go/branch_metadata.go @@ -1,14 +1,12 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type BranchMetadata struct { + Branch *BranchName `json:"branch,omitempty"` + Labels *[]string `json:"labels,omitempty"` // `non-empty` - Repository *string `json:"repository,omitempty"` - Branch *BranchName `json:"branch,omitempty"` + Repository *string `json:"repository,omitempty"` // `non-empty` - Stage *string `json:"stage,omitempty"` - Labels *[]string `json:"labels,omitempty"` + Stage *string `json:"stage,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/branch_migration.go b/xata/internal/fern-workspace/generated/go/branch_migration.go index ef70f7b..b3457fe 100644 --- a/xata/internal/fern-workspace/generated/go/branch_migration.go +++ b/xata/internal/fern-workspace/generated/go/branch_migration.go @@ -1,20 +1,18 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type BranchMigration struct { + CreatedAt *DateTime `json:"createdAt,omitempty"` Id *string `json:"id,omitempty"` - ParentId *string `json:"parentID,omitempty"` - Status string `json:"status"` - Title *string `json:"title,omitempty"` LastGitRevision *string `json:"lastGitRevision,omitempty"` LocalChanges bool `json:"localChanges"` - CreatedAt *DateTime `json:"createdAt,omitempty"` + NewTableOrder []string `json:"newTableOrder,omitempty"` NewTables *map[string]*Table `json:"newTables,omitempty"` + ParentId *string `json:"parentID,omitempty"` RemovedTables *[]string `json:"removedTables,omitempty"` - TableMigrations *map[string]*TableMigration `json:"tableMigrations,omitempty"` - NewTableOrder []string `json:"newTableOrder,omitempty"` RenamedTables *[]*TableRename `json:"renamedTables,omitempty"` + Status string `json:"status"` + TableMigrations *map[string]*TableMigration `json:"tableMigrations,omitempty"` + Title *string `json:"title,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/branch_name.go b/xata/internal/fern-workspace/generated/go/branch_name.go index 16f4574..5866fb7 100644 --- a/xata/internal/fern-workspace/generated/go/branch_name.go +++ b/xata/internal/fern-workspace/generated/go/branch_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/branch_op.go b/xata/internal/fern-workspace/generated/go/branch_op.go index 8d09fda..4b3a943 100644 --- a/xata/internal/fern-workspace/generated/go/branch_op.go +++ b/xata/internal/fern-workspace/generated/go/branch_op.go @@ -1,16 +1,14 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type BranchOp struct { + CreatedAt DateTime `json:"createdAt"` Id string `json:"id"` - ParentId *string `json:"parentID,omitempty"` - Title *string `json:"title,omitempty"` Message *string `json:"message,omitempty"` - Status MigrationStatus `json:"status,omitempty"` - CreatedAt DateTime `json:"createdAt"` - ModifiedAt *DateTime `json:"modifiedAt,omitempty"` Migration *Commit `json:"migration,omitempty"` + ModifiedAt *DateTime `json:"modifiedAt,omitempty"` + ParentId *string `json:"parentID,omitempty"` + Status MigrationStatus `json:"status,omitempty"` + Title *string `json:"title,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/branch_transaction_request.go b/xata/internal/fern-workspace/generated/go/branch_transaction_request.go index 500ed8b..fcc82c6 100644 --- a/xata/internal/fern-workspace/generated/go/branch_transaction_request.go +++ b/xata/internal/fern-workspace/generated/go/branch_transaction_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/branch_with_copy_id.go b/xata/internal/fern-workspace/generated/go/branch_with_copy_id.go index ebee9db..73d8301 100644 --- a/xata/internal/fern-workspace/generated/go/branch_with_copy_id.go +++ b/xata/internal/fern-workspace/generated/go/branch_with_copy_id.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type BranchWithCopyId struct { BranchName BranchName `json:"branchName"` - DbBranchId string `json:"dbBranchID"` CopyId string `json:"copyID"` + DbBranchId string `json:"dbBranchID"` } diff --git a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_request.go b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_request.go index 46a406b..1c2caf2 100644 --- a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_request.go +++ b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response.go b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response.go index cc35f59..a17850f 100644 --- a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response.go +++ b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response.go @@ -5,65 +5,3 @@ package api type BulkInsertTableRecordsResponse map[string][]map[string]interface{} - -//import ( -// json "encoding/json" -// fmt "fmt" -//) -// -//type BulkInsertTableRecordsResponse struct { -// typeName string -// BulkInsertTableRecordsResponseRecordIDs *BulkInsertTableRecordsResponseRecordIDs -// BulkInsertTableRecordsResponseRecords *BulkInsertTableRecordsResponseRecords -//} -// -//func NewBulkInsertTableRecordsResponseFromBulkInsertTableRecordsResponseRecordIDs(value *BulkInsertTableRecordsResponseRecordIDs) *BulkInsertTableRecordsResponse { -// return &BulkInsertTableRecordsResponse{typeName: "bulkInsertTableRecordsResponseRecordIDs", BulkInsertTableRecordsResponseRecordIDs: value} -//} -// -//func NewBulkInsertTableRecordsResponseFromBulkInsertTableRecordsResponseRecords(value *BulkInsertTableRecordsResponseRecords) *BulkInsertTableRecordsResponse { -// return &BulkInsertTableRecordsResponse{typeName: "bulkInsertTableRecordsResponseRecords", BulkInsertTableRecordsResponseRecords: value} -//} -// -//func (b *BulkInsertTableRecordsResponse) UnmarshalJSON(data []byte) error { -// valueBulkInsertTableRecordsResponseRecordIDs := new(BulkInsertTableRecordsResponseRecordIDs) -// if err := json.Unmarshal(data, &valueBulkInsertTableRecordsResponseRecordIDs); err == nil { -// b.typeName = "bulkInsertTableRecordsResponseRecordIDs" -// b.BulkInsertTableRecordsResponseRecordIDs = valueBulkInsertTableRecordsResponseRecordIDs -// return nil -// } -// valueBulkInsertTableRecordsResponseRecords := new(BulkInsertTableRecordsResponseRecords) -// if err := json.Unmarshal(data, &valueBulkInsertTableRecordsResponseRecords); err == nil { -// b.typeName = "bulkInsertTableRecordsResponseRecords" -// b.BulkInsertTableRecordsResponseRecords = valueBulkInsertTableRecordsResponseRecords -// return nil -// } -// return fmt.Errorf("%s cannot be deserialized as a %T", data, b) -//} -// -//func (b BulkInsertTableRecordsResponse) MarshalJSON() ([]byte, error) { -// switch b.typeName { -// default: -// return nil, fmt.Errorf("invalid type %s in %T", b.typeName, b) -// case "bulkInsertTableRecordsResponseRecordIDs": -// return json.Marshal(b.BulkInsertTableRecordsResponseRecordIDs) -// case "bulkInsertTableRecordsResponseRecords": -// return json.Marshal(b.BulkInsertTableRecordsResponseRecords) -// } -//} -// -//type BulkInsertTableRecordsResponseVisitor interface { -// VisitBulkInsertTableRecordsResponseRecordIDs(*BulkInsertTableRecordsResponseRecordIDs) error -// VisitBulkInsertTableRecordsResponseRecords(*BulkInsertTableRecordsResponseRecords) error -//} -// -//func (b *BulkInsertTableRecordsResponse) Accept(v BulkInsertTableRecordsResponseVisitor) error { -// switch b.typeName { -// default: -// return fmt.Errorf("invalid type %s in %T", b.typeName, b) -// case "bulkInsertTableRecordsResponseRecordIDs": -// return v.VisitBulkInsertTableRecordsResponseRecordIDs(b.BulkInsertTableRecordsResponseRecordIDs) -// case "bulkInsertTableRecordsResponseRecords": -// return v.VisitBulkInsertTableRecordsResponseRecords(b.BulkInsertTableRecordsResponseRecords) -// } -//} diff --git a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_record_i_ds.go b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_record_i_ds.go index e68424d..11200dc 100644 --- a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_record_i_ds.go +++ b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_record_i_ds.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_records.go b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_records.go index 3c0575e..f866fac 100644 --- a/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_records.go +++ b/xata/internal/fern-workspace/generated/go/bulk_insert_table_records_response_records.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/client.go b/xata/internal/fern-workspace/generated/go/client.go index e19a6d9..1e3de47 100644 --- a/xata/internal/fern-workspace/generated/go/client.go +++ b/xata/internal/fern-workspace/generated/go/client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -12,10 +10,11 @@ import ( type Client interface { Branch() BranchClient Migrations() MigrationsClient + SearchAndFilter() SearchAndFilterClient + Sql() SqlClient Table() TableClient Records() RecordsClient Files() FilesClient - SearchAndFilter() SearchAndFilterClient } func NewClient(opts ...core.ClientOption) Client { @@ -29,10 +28,11 @@ func NewClient(opts ...core.ClientOption) Client { header: options.ToHeader(), branchClient: NewBranchClient(opts...), migrationsClient: NewMigrationsClient(opts...), + searchAndFilterClient: NewSearchAndFilterClient(opts...), + sqlClient: NewSqlClient(opts...), tableClient: NewTableClient(opts...), recordsClient: NewRecordsClient(opts...), filesClient: NewFilesClient(opts...), - searchAndFilterClient: NewSearchAndFilterClient(opts...), } } @@ -42,10 +42,11 @@ type client struct { header http.Header branchClient BranchClient migrationsClient MigrationsClient + searchAndFilterClient SearchAndFilterClient + sqlClient SqlClient tableClient TableClient recordsClient RecordsClient filesClient FilesClient - searchAndFilterClient SearchAndFilterClient } func (c *client) Branch() BranchClient { @@ -56,6 +57,14 @@ func (c *client) Migrations() MigrationsClient { return c.migrationsClient } +func (c *client) SearchAndFilter() SearchAndFilterClient { + return c.searchAndFilterClient +} + +func (c *client) Sql() SqlClient { + return c.sqlClient +} + func (c *client) Table() TableClient { return c.tableClient } @@ -67,7 +76,3 @@ func (c *client) Records() RecordsClient { func (c *client) Files() FilesClient { return c.filesClient } - -func (c *client) SearchAndFilter() SearchAndFilterClient { - return c.searchAndFilterClient -} diff --git a/xata/internal/fern-workspace/generated/go/client_options.go b/xata/internal/fern-workspace/generated/go/client_options.go index 76c4b11..d4d1764 100644 --- a/xata/internal/fern-workspace/generated/go/client_options.go +++ b/xata/internal/fern-workspace/generated/go/client_options.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/column.go b/xata/internal/fern-workspace/generated/go/column.go index a4c6c16..8c56941 100644 --- a/xata/internal/fern-workspace/generated/go/column.go +++ b/xata/internal/fern-workspace/generated/go/column.go @@ -1,18 +1,16 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type Column struct { - Name string `json:"name"` - Type ColumnType `json:"type,omitempty"` - Link *ColumnLink `json:"link,omitempty"` - Vector *ColumnVector `json:"vector,omitempty"` + Columns *[]*Column `json:"columns,omitempty"` + DefaultValue *string `json:"defaultValue,omitempty"` File *ColumnFile `json:"file,omitempty"` FileMap *ColumnFile `json:"fileMap,omitempty"` + Link *ColumnLink `json:"link,omitempty"` + Name string `json:"name"` NotNull *bool `json:"notNull,omitempty"` - DefaultValue *string `json:"defaultValue,omitempty"` + Type ColumnType `json:"type,omitempty"` Unique *bool `json:"unique,omitempty"` - Columns *[]*Column `json:"columns,omitempty"` + Vector *ColumnVector `json:"vector,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/column_file.go b/xata/internal/fern-workspace/generated/go/column_file.go index 9f2a46b..ae8e5a3 100644 --- a/xata/internal/fern-workspace/generated/go/column_file.go +++ b/xata/internal/fern-workspace/generated/go/column_file.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/column_link.go b/xata/internal/fern-workspace/generated/go/column_link.go index 92d9c3b..9a511d1 100644 --- a/xata/internal/fern-workspace/generated/go/column_link.go +++ b/xata/internal/fern-workspace/generated/go/column_link.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/column_migration.go b/xata/internal/fern-workspace/generated/go/column_migration.go index 5227d9e..4eec771 100644 --- a/xata/internal/fern-workspace/generated/go/column_migration.go +++ b/xata/internal/fern-workspace/generated/go/column_migration.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type ColumnMigration struct { - Old *Column `json:"old,omitempty"` New *Column `json:"new,omitempty"` + Old *Column `json:"old,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/column_name.go b/xata/internal/fern-workspace/generated/go/column_name.go index bafdfd2..e4ebf6a 100644 --- a/xata/internal/fern-workspace/generated/go/column_name.go +++ b/xata/internal/fern-workspace/generated/go/column_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/column_op_add.go b/xata/internal/fern-workspace/generated/go/column_op_add.go index 6b6464b..e5adad3 100644 --- a/xata/internal/fern-workspace/generated/go/column_op_add.go +++ b/xata/internal/fern-workspace/generated/go/column_op_add.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type ColumnOpAdd struct { - Table string `json:"table"` Column *Column `json:"column,omitempty"` + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/column_op_remove.go b/xata/internal/fern-workspace/generated/go/column_op_remove.go index 70020fa..303bcd0 100644 --- a/xata/internal/fern-workspace/generated/go/column_op_remove.go +++ b/xata/internal/fern-workspace/generated/go/column_op_remove.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type ColumnOpRemove struct { - Table string `json:"table"` Column string `json:"column"` + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/column_op_rename.go b/xata/internal/fern-workspace/generated/go/column_op_rename.go index e935400..d6c2028 100644 --- a/xata/internal/fern-workspace/generated/go/column_op_rename.go +++ b/xata/internal/fern-workspace/generated/go/column_op_rename.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type ColumnOpRename struct { - Table string `json:"table"` - OldName string `json:"oldName"` NewName string `json:"newName"` + OldName string `json:"oldName"` + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/column_vector.go b/xata/internal/fern-workspace/generated/go/column_vector.go index 918a84b..31806e7 100644 --- a/xata/internal/fern-workspace/generated/go/column_vector.go +++ b/xata/internal/fern-workspace/generated/go/column_vector.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/columns_projection.go b/xata/internal/fern-workspace/generated/go/columns_projection.go index 84d0afc..d72d608 100644 --- a/xata/internal/fern-workspace/generated/go/columns_projection.go +++ b/xata/internal/fern-workspace/generated/go/columns_projection.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/commit.go b/xata/internal/fern-workspace/generated/go/commit.go index 98356c8..a47d5cd 100644 --- a/xata/internal/fern-workspace/generated/go/commit.go +++ b/xata/internal/fern-workspace/generated/go/commit.go @@ -1,16 +1,14 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type Commit struct { - Title *string `json:"title,omitempty"` - Message *string `json:"message,omitempty"` - Id string `json:"id"` - ParentId *string `json:"parentID,omitempty"` Checksum string `json:"checksum"` - MergeParentId *string `json:"mergeParentID,omitempty"` CreatedAt DateTime `json:"createdAt"` + Id string `json:"id"` + MergeParentId *string `json:"mergeParentID,omitempty"` + Message *string `json:"message,omitempty"` Operations []*MigrationOp `json:"operations,omitempty"` + ParentId *string `json:"parentID,omitempty"` + Title *string `json:"title,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/compare_branch_schemas_request.go b/xata/internal/fern-workspace/generated/go/compare_branch_schemas_request.go index 5e792cc..7add64d 100644 --- a/xata/internal/fern-workspace/generated/go/compare_branch_schemas_request.go +++ b/xata/internal/fern-workspace/generated/go/compare_branch_schemas_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/compare_branch_schemas_response.go b/xata/internal/fern-workspace/generated/go/compare_branch_schemas_response.go index f5e30b0..8841134 100644 --- a/xata/internal/fern-workspace/generated/go/compare_branch_schemas_response.go +++ b/xata/internal/fern-workspace/generated/go/compare_branch_schemas_response.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type CompareBranchSchemasResponse struct { + Edits *SchemaEditScript `json:"edits,omitempty"` Source *Schema `json:"source,omitempty"` Target *Schema `json:"target,omitempty"` - Edits *SchemaEditScript `json:"edits,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_request.go b/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_request.go index 73e9bb0..659c50d 100644 --- a/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_request.go +++ b/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_request.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // CompareBranchWithUserSchemaRequest is an in-lined request used by the CompareBranchWithUserSchema endpoint. type CompareBranchWithUserSchemaRequest struct { + BranchOperations *[]*MigrationOp `json:"branchOperations,omitempty"` Schema *Schema `json:"schema,omitempty"` SchemaOperations *[]*MigrationOp `json:"schemaOperations,omitempty"` - BranchOperations *[]*MigrationOp `json:"branchOperations,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_response.go b/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_response.go index fb74e3d..c7b98e0 100644 --- a/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_response.go +++ b/xata/internal/fern-workspace/generated/go/compare_branch_with_user_schema_response.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type CompareBranchWithUserSchemaResponse struct { + Edits *SchemaEditScript `json:"edits,omitempty"` Source *Schema `json:"source,omitempty"` Target *Schema `json:"target,omitempty"` - Edits *SchemaEditScript `json:"edits,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/conflict_error.go b/xata/internal/fern-workspace/generated/go/conflict_error.go index 9674735..029b69f 100644 --- a/xata/internal/fern-workspace/generated/go/conflict_error.go +++ b/xata/internal/fern-workspace/generated/go/conflict_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/core/client_option.go b/xata/internal/fern-workspace/generated/go/core/client_option.go index 87e6b85..485cf93 100644 --- a/xata/internal/fern-workspace/generated/go/core/client_option.go +++ b/xata/internal/fern-workspace/generated/go/core/client_option.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package core diff --git a/xata/internal/fern-workspace/generated/go/core/core.go b/xata/internal/fern-workspace/generated/go/core/core.go index 76679c8..6f7e370 100644 --- a/xata/internal/fern-workspace/generated/go/core/core.go +++ b/xata/internal/fern-workspace/generated/go/core/core.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - package core import ( diff --git a/xata/internal/fern-workspace/generated/go/count_agg.go b/xata/internal/fern-workspace/generated/go/count_agg.go index aaed687..fd956c3 100644 --- a/xata/internal/fern-workspace/generated/go/count_agg.go +++ b/xata/internal/fern-workspace/generated/go/count_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/count_agg_filter.go b/xata/internal/fern-workspace/generated/go/count_agg_filter.go index a2e63dc..b0be00b 100644 --- a/xata/internal/fern-workspace/generated/go/count_agg_filter.go +++ b/xata/internal/fern-workspace/generated/go/count_agg_filter.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/create_branch_request.go b/xata/internal/fern-workspace/generated/go/create_branch_request.go index 0aec089..8666918 100644 --- a/xata/internal/fern-workspace/generated/go/create_branch_request.go +++ b/xata/internal/fern-workspace/generated/go/create_branch_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/create_branch_response.go b/xata/internal/fern-workspace/generated/go/create_branch_response.go index 4ac8094..f370331 100644 --- a/xata/internal/fern-workspace/generated/go/create_branch_response.go +++ b/xata/internal/fern-workspace/generated/go/create_branch_response.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type CreateBranchResponse struct { + BranchName string `json:"branchName"` // `non-empty` DatabaseName string `json:"databaseName"` - BranchName string `json:"branchName"` Status MigrationStatus `json:"status,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/create_table_response.go b/xata/internal/fern-workspace/generated/go/create_table_response.go index aee2e44..a88b8c7 100644 --- a/xata/internal/fern-workspace/generated/go/create_table_response.go +++ b/xata/internal/fern-workspace/generated/go/create_table_response.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type CreateTableResponse struct { - BranchName string `json:"branchName"` + BranchName string `json:"branchName"` + Status MigrationStatus `json:"status,omitempty"` // `non-empty` - TableName string `json:"tableName"` - Status MigrationStatus `json:"status,omitempty"` + TableName string `json:"tableName"` } diff --git a/xata/internal/fern-workspace/generated/go/data_input_record.go b/xata/internal/fern-workspace/generated/go/data_input_record.go index 34cc017..fcc846c 100644 --- a/xata/internal/fern-workspace/generated/go/data_input_record.go +++ b/xata/internal/fern-workspace/generated/go/data_input_record.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/data_input_record_value.go b/xata/internal/fern-workspace/generated/go/data_input_record_value.go index 77d44d0..f29962f 100644 --- a/xata/internal/fern-workspace/generated/go/data_input_record_value.go +++ b/xata/internal/fern-workspace/generated/go/data_input_record_value.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/date_booster.go b/xata/internal/fern-workspace/generated/go/date_booster.go index bd45a13..a96eb0b 100644 --- a/xata/internal/fern-workspace/generated/go/date_booster.go +++ b/xata/internal/fern-workspace/generated/go/date_booster.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -11,14 +9,14 @@ package api type DateBooster struct { // The column in which to look for the value. Column string `json:"column"` - // The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time. - // If it is not specified, the current date and time is used. - Origin *string `json:"origin,omitempty"` - // The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`. - Scale string `json:"scale"` // The decay factor to expect at "scale" distance from the "origin". Decay float64 `json:"decay"` // The factor with which to multiply the added boost. Factor *float64 `json:"factor,omitempty"` IfMatchesFilter *FilterExpression `json:"ifMatchesFilter,omitempty"` + // The datetime (formatted as RFC3339) from where to apply the score decay function. The maximum boost will be applied for records with values at this time. + // If it is not specified, the current date and time is used. + Origin *string `json:"origin,omitempty"` + // The duration at which distance from origin the score is decayed with factor, using an exponential function. It is formatted as number + units, for example: `5d`, `20m`, `10s`. + Scale string `json:"scale"` } diff --git a/xata/internal/fern-workspace/generated/go/date_histogram_agg.go b/xata/internal/fern-workspace/generated/go/date_histogram_agg.go index 1c2257d..df6346e 100644 --- a/xata/internal/fern-workspace/generated/go/date_histogram_agg.go +++ b/xata/internal/fern-workspace/generated/go/date_histogram_agg.go @@ -1,22 +1,20 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket. type DateHistogramAgg struct { + Aggs *AggExpressionMap `json:"aggs,omitempty"` + // The calendar-aware interval to use when bucketing. Possible values are: `minute`, + // `hour`, `day`, `week`, `month`, `quarter`, `year`. + CalendarInterval *DateHistogramAggCalendarInterval `json:"calendarInterval,omitempty"` // The column to use for bucketing. Must be of type datetime. Column string `json:"column"` // The fixed interval to use when bucketing. // It is formatted as number + units, for example: `5d`, `20m`, `10s`. Interval *string `json:"interval,omitempty"` - // The calendar-aware interval to use when bucketing. Possible values are: `minute`, - // `hour`, `day`, `week`, `month`, `quarter`, `year`. - CalendarInterval *DateHistogramAggCalendarInterval `json:"calendarInterval,omitempty"` // The timezone to use for bucketing. By default, UTC is assumed. // The accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or // `-08:00`. - Timezone *string `json:"timezone,omitempty"` - Aggs *AggExpressionMap `json:"aggs,omitempty"` + Timezone *string `json:"timezone,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/date_histogram_agg_calendar_interval.go b/xata/internal/fern-workspace/generated/go/date_histogram_agg_calendar_interval.go index 785126d..3924df2 100644 --- a/xata/internal/fern-workspace/generated/go/date_histogram_agg_calendar_interval.go +++ b/xata/internal/fern-workspace/generated/go/date_histogram_agg_calendar_interval.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/date_time.go b/xata/internal/fern-workspace/generated/go/date_time.go index 180ae90..c0d5a95 100644 --- a/xata/internal/fern-workspace/generated/go/date_time.go +++ b/xata/internal/fern-workspace/generated/go/date_time.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/db_branch.go b/xata/internal/fern-workspace/generated/go/db_branch.go index 1e5026c..c4862b9 100644 --- a/xata/internal/fern-workspace/generated/go/db_branch.go +++ b/xata/internal/fern-workspace/generated/go/db_branch.go @@ -1,17 +1,15 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type DbBranch struct { - DatabaseName DbName `json:"databaseName"` BranchName BranchName `json:"branchName"` CreatedAt DateTime `json:"createdAt"` + DatabaseName DbName `json:"databaseName"` Id string `json:"id"` - Version float64 `json:"version"` LastMigrationId string `json:"lastMigrationID"` Metadata *BranchMetadata `json:"metadata,omitempty"` - StartedFrom *StartedFromMetadata `json:"startedFrom,omitempty"` Schema *Schema `json:"schema,omitempty"` + StartedFrom *StartedFromMetadata `json:"startedFrom,omitempty"` + Version float64 `json:"version"` } diff --git a/xata/internal/fern-workspace/generated/go/db_branch_name.go b/xata/internal/fern-workspace/generated/go/db_branch_name.go index 7257dab..2f07c39 100644 --- a/xata/internal/fern-workspace/generated/go/db_branch_name.go +++ b/xata/internal/fern-workspace/generated/go/db_branch_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/db_name.go b/xata/internal/fern-workspace/generated/go/db_name.go index 0ba11f3..031867d 100644 --- a/xata/internal/fern-workspace/generated/go/db_name.go +++ b/xata/internal/fern-workspace/generated/go/db_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/delete_branch_response.go b/xata/internal/fern-workspace/generated/go/delete_branch_response.go index a2c7519..7709e1e 100644 --- a/xata/internal/fern-workspace/generated/go/delete_branch_response.go +++ b/xata/internal/fern-workspace/generated/go/delete_branch_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/delete_column_response.go b/xata/internal/fern-workspace/generated/go/delete_column_response.go index 8746cdb..6aeafe3 100644 --- a/xata/internal/fern-workspace/generated/go/delete_column_response.go +++ b/xata/internal/fern-workspace/generated/go/delete_column_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/delete_record_request.go b/xata/internal/fern-workspace/generated/go/delete_record_request.go index 8b066b5..a03429c 100644 --- a/xata/internal/fern-workspace/generated/go/delete_record_request.go +++ b/xata/internal/fern-workspace/generated/go/delete_record_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/delete_table_response.go b/xata/internal/fern-workspace/generated/go/delete_table_response.go index a476398..72aceb7 100644 --- a/xata/internal/fern-workspace/generated/go/delete_table_response.go +++ b/xata/internal/fern-workspace/generated/go/delete_table_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/doc.go b/xata/internal/fern-workspace/generated/go/doc.go index 6314793..1e738be 100644 --- a/xata/internal/fern-workspace/generated/go/doc.go +++ b/xata/internal/fern-workspace/generated/go/doc.go @@ -1,6 +1,4 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. -// CRUD API for operating on binary content in file and file[] columns. +// APIs for searching, querying, filtering, and aggregating records. package api diff --git a/xata/internal/fern-workspace/generated/go/environments.go b/xata/internal/fern-workspace/generated/go/environments.go index 902bb97..133438d 100644 --- a/xata/internal/fern-workspace/generated/go/environments.go +++ b/xata/internal/fern-workspace/generated/go/environments.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/file_access_id.go b/xata/internal/fern-workspace/generated/go/file_access_id.go index 2808ee4..f22535d 100644 --- a/xata/internal/fern-workspace/generated/go/file_access_id.go +++ b/xata/internal/fern-workspace/generated/go/file_access_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/file_item_id.go b/xata/internal/fern-workspace/generated/go/file_item_id.go index 37dc1fb..66bbe89 100644 --- a/xata/internal/fern-workspace/generated/go/file_item_id.go +++ b/xata/internal/fern-workspace/generated/go/file_item_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/file_name.go b/xata/internal/fern-workspace/generated/go/file_name.go index 6be0c8e..967563c 100644 --- a/xata/internal/fern-workspace/generated/go/file_name.go +++ b/xata/internal/fern-workspace/generated/go/file_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/file_response.go b/xata/internal/fern-workspace/generated/go/file_response.go index 2bfa0c9..7454ef6 100644 --- a/xata/internal/fern-workspace/generated/go/file_response.go +++ b/xata/internal/fern-workspace/generated/go/file_response.go @@ -1,15 +1,13 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // File metadata type FileResponse struct { + Attributes *map[string]any `json:"attributes,omitempty"` Id *FileItemId `json:"id,omitempty"` - Name FileName `json:"name"` MediaType MediaType `json:"mediaType"` + Name FileName `json:"name"` Size int `json:"size"` Version int `json:"version"` - Attributes *map[string]any `json:"attributes,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/file_signature.go b/xata/internal/fern-workspace/generated/go/file_signature.go index 78b0c30..dbe1465 100644 --- a/xata/internal/fern-workspace/generated/go/file_signature.go +++ b/xata/internal/fern-workspace/generated/go/file_signature.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_column.go b/xata/internal/fern-workspace/generated/go/filter_column.go index 553d826..f56eb58 100644 --- a/xata/internal/fern-workspace/generated/go/filter_column.go +++ b/xata/internal/fern-workspace/generated/go/filter_column.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_column_includes.go b/xata/internal/fern-workspace/generated/go/filter_column_includes.go index 2690f95..7e78baf 100644 --- a/xata/internal/fern-workspace/generated/go/filter_column_includes.go +++ b/xata/internal/fern-workspace/generated/go/filter_column_includes.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type FilterColumnIncludes struct { Includes *FilterPredicate `json:"$includes,omitempty"` - IncludesAny *FilterPredicate `json:"$includesAny,omitempty"` IncludesAll *FilterPredicate `json:"$includesAll,omitempty"` + IncludesAny *FilterPredicate `json:"$includesAny,omitempty"` IncludesNone *FilterPredicate `json:"$includesNone,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/filter_expression.go b/xata/internal/fern-workspace/generated/go/filter_expression.go index afb338c..5b6e4de 100644 --- a/xata/internal/fern-workspace/generated/go/filter_expression.go +++ b/xata/internal/fern-workspace/generated/go/filter_expression.go @@ -1,14 +1,12 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type FilterExpression struct { + All *FilterList `json:"$all,omitempty"` + Any *FilterList `json:"$any,omitempty"` Exists *string `json:"$exists,omitempty"` ExistsNot *string `json:"$existsNot,omitempty"` - Any *FilterList `json:"$any,omitempty"` - All *FilterList `json:"$all,omitempty"` None *FilterList `json:"$none,omitempty"` Not *FilterList `json:"$not,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/filter_list.go b/xata/internal/fern-workspace/generated/go/filter_list.go index 3867171..1bc0df9 100644 --- a/xata/internal/fern-workspace/generated/go/filter_list.go +++ b/xata/internal/fern-workspace/generated/go/filter_list.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate.go b/xata/internal/fern-workspace/generated/go/filter_predicate.go index 4c8517e..7683f50 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate_op.go b/xata/internal/fern-workspace/generated/go/filter_predicate_op.go index 74571a2..0c011f0 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate_op.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate_op.go @@ -1,22 +1,22 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type FilterPredicateOp struct { - Any *[]*FilterPredicate `json:"$any,omitempty"` All *[]*FilterPredicate `json:"$all,omitempty"` - None *FilterPredicateOpNone `json:"$none,omitempty"` - Not *FilterPredicateOpNot `json:"$not,omitempty"` + Any *[]*FilterPredicate `json:"$any,omitempty"` + Contains *string `json:"$contains,omitempty"` + EndsWith *string `json:"$endsWith,omitempty"` + Ge *FilterRangeValue `json:"$ge,omitempty"` + Gt *FilterRangeValue `json:"$gt,omitempty"` + IContains *string `json:"$iContains,omitempty"` + IPattern *string `json:"$iPattern,omitempty"` Is *FilterPredicateOpIs `json:"$is,omitempty"` IsNot *FilterPredicateOpIsNot `json:"$isNot,omitempty"` - Lt *FilterRangeValue `json:"$lt,omitempty"` Le *FilterRangeValue `json:"$le,omitempty"` - Gt *FilterRangeValue `json:"$gt,omitempty"` - Ge *FilterRangeValue `json:"$ge,omitempty"` - Contains *string `json:"$contains,omitempty"` - StartsWith *string `json:"$startsWith,omitempty"` - EndsWith *string `json:"$endsWith,omitempty"` + Lt *FilterRangeValue `json:"$lt,omitempty"` + None *FilterPredicateOpNone `json:"$none,omitempty"` + Not *FilterPredicateOpNot `json:"$not,omitempty"` Pattern *string `json:"$pattern,omitempty"` + StartsWith *string `json:"$startsWith,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate_op_is.go b/xata/internal/fern-workspace/generated/go/filter_predicate_op_is.go index 627c9ff..0e83d4b 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate_op_is.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate_op_is.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate_op_is_not.go b/xata/internal/fern-workspace/generated/go/filter_predicate_op_is_not.go index 80526c1..d2b3281 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate_op_is_not.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate_op_is_not.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate_op_none.go b/xata/internal/fern-workspace/generated/go/filter_predicate_op_none.go index 0af4e1b..edd0b60 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate_op_none.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate_op_none.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate_op_not.go b/xata/internal/fern-workspace/generated/go/filter_predicate_op_not.go index d63f631..2dd6fe7 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate_op_not.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate_op_not.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_predicate_range_op.go b/xata/internal/fern-workspace/generated/go/filter_predicate_range_op.go index 9796efa..3e7a1d6 100644 --- a/xata/internal/fern-workspace/generated/go/filter_predicate_range_op.go +++ b/xata/internal/fern-workspace/generated/go/filter_predicate_range_op.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type FilterPredicateRangeOp struct { - Lt *FilterRangeValue `json:"$lt,omitempty"` - Le *FilterRangeValue `json:"$le,omitempty"` - Gt *FilterRangeValue `json:"$gt,omitempty"` Ge *FilterRangeValue `json:"$ge,omitempty"` + Gt *FilterRangeValue `json:"$gt,omitempty"` + Le *FilterRangeValue `json:"$le,omitempty"` + Lt *FilterRangeValue `json:"$lt,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/filter_range_value.go b/xata/internal/fern-workspace/generated/go/filter_range_value.go index 0581b71..108c091 100644 --- a/xata/internal/fern-workspace/generated/go/filter_range_value.go +++ b/xata/internal/fern-workspace/generated/go/filter_range_value.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/filter_value.go b/xata/internal/fern-workspace/generated/go/filter_value.go index d232079..6ab4c72 100644 --- a/xata/internal/fern-workspace/generated/go/filter_value.go +++ b/xata/internal/fern-workspace/generated/go/filter_value.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/fuzziness_expression.go b/xata/internal/fern-workspace/generated/go/fuzziness_expression.go index a0e47db..263b4fa 100644 --- a/xata/internal/fern-workspace/generated/go/fuzziness_expression.go +++ b/xata/internal/fern-workspace/generated/go/fuzziness_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request.go b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request.go index 29f1a5d..51622fb 100644 --- a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request.go +++ b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request_page.go b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request_page.go index 2ddd82b..68d091a 100644 --- a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request_page.go +++ b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_request_page.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response.go b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response.go index ca39e5b..974e0d2 100644 --- a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response.go +++ b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type GetBranchSchemaHistoryResponse struct { - Meta *GetBranchSchemaHistoryResponseMeta `json:"meta,omitempty"` Logs []*Commit `json:"logs,omitempty"` + Meta *GetBranchSchemaHistoryResponseMeta `json:"meta,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response_meta.go b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response_meta.go index 58eb7f0..4aebd66 100644 --- a/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response_meta.go +++ b/xata/internal/fern-workspace/generated/go/get_branch_schema_history_response_meta.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/get_branch_stats_response.go b/xata/internal/fern-workspace/generated/go/get_branch_stats_response.go index 6657a4a..cf31d07 100644 --- a/xata/internal/fern-workspace/generated/go/get_branch_stats_response.go +++ b/xata/internal/fern-workspace/generated/go/get_branch_stats_response.go @@ -1,17 +1,15 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type GetBranchStatsResponse struct { - Timestamp string `json:"timestamp"` Interval string `json:"interval"` - Resolution string `json:"resolution"` NumberOfRecords *[]*MetricsDatapoint `json:"numberOfRecords,omitempty"` - WritesOverTime *[]*MetricsDatapoint `json:"writesOverTime,omitempty"` - ReadsOverTime *[]*MetricsDatapoint `json:"readsOverTime,omitempty"` ReadLatency *MetricsLatency `json:"readLatency,omitempty"` - WriteLatency *MetricsLatency `json:"writeLatency,omitempty"` + ReadsOverTime *[]*MetricsDatapoint `json:"readsOverTime,omitempty"` + Resolution string `json:"resolution"` + Timestamp string `json:"timestamp"` Warning *string `json:"warning,omitempty"` + WriteLatency *MetricsLatency `json:"writeLatency,omitempty"` + WritesOverTime *[]*MetricsDatapoint `json:"writesOverTime,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/get_record_request.go b/xata/internal/fern-workspace/generated/go/get_record_request.go index 91798ba..a796e1d 100644 --- a/xata/internal/fern-workspace/generated/go/get_record_request.go +++ b/xata/internal/fern-workspace/generated/go/get_record_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/get_table_columns_response.go b/xata/internal/fern-workspace/generated/go/get_table_columns_response.go index f277827..6d0484e 100644 --- a/xata/internal/fern-workspace/generated/go/get_table_columns_response.go +++ b/xata/internal/fern-workspace/generated/go/get_table_columns_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/get_table_schema_response.go b/xata/internal/fern-workspace/generated/go/get_table_schema_response.go index 1c6e44c..e46767d 100644 --- a/xata/internal/fern-workspace/generated/go/get_table_schema_response.go +++ b/xata/internal/fern-workspace/generated/go/get_table_schema_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/highlight_expression.go b/xata/internal/fern-workspace/generated/go/highlight_expression.go index 7673228..4279bd1 100644 --- a/xata/internal/fern-workspace/generated/go/highlight_expression.go +++ b/xata/internal/fern-workspace/generated/go/highlight_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/input_file.go b/xata/internal/fern-workspace/generated/go/input_file.go index daaf6a0..6dc11d4 100644 --- a/xata/internal/fern-workspace/generated/go/input_file.go +++ b/xata/internal/fern-workspace/generated/go/input_file.go @@ -1,17 +1,15 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Object representing a file type InputFile struct { - Name FileName `json:"name"` - MediaType *MediaType `json:"mediaType,omitempty"` // Base64 encoded content `<= 20971520 characters` Base64Content *string `json:"base64Content,omitempty"` // Enable public access to the file - EnablePublicUrl *bool `json:"enablePublicUrl,omitempty"` + EnablePublicUrl *bool `json:"enablePublicUrl,omitempty"` + MediaType *MediaType `json:"mediaType,omitempty"` + Name FileName `json:"name"` // Time to live for signed URLs SignedUrlTimeout *int `json:"signedUrlTimeout,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/input_file_array.go b/xata/internal/fern-workspace/generated/go/input_file_array.go index 3d5176f..047a459 100644 --- a/xata/internal/fern-workspace/generated/go/input_file_array.go +++ b/xata/internal/fern-workspace/generated/go/input_file_array.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/input_file_entry.go b/xata/internal/fern-workspace/generated/go/input_file_entry.go index 8216441..87c5182 100644 --- a/xata/internal/fern-workspace/generated/go/input_file_entry.go +++ b/xata/internal/fern-workspace/generated/go/input_file_entry.go @@ -1,18 +1,16 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Object representing a file in an array type InputFileEntry struct { - Id *FileItemId `json:"id,omitempty"` - Name *FileName `json:"name,omitempty"` - MediaType *MediaType `json:"mediaType,omitempty"` // Base64 encoded content `<= 20971520 characters` Base64Content *string `json:"base64Content,omitempty"` // Enable public access to the file - EnablePublicUrl *bool `json:"enablePublicUrl,omitempty"` + EnablePublicUrl *bool `json:"enablePublicUrl,omitempty"` + Id *FileItemId `json:"id,omitempty"` + MediaType *MediaType `json:"mediaType,omitempty"` + Name *FileName `json:"name,omitempty"` // Time to live for signed URLs SignedUrlTimeout *int `json:"signedUrlTimeout,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/insert_record_request.go b/xata/internal/fern-workspace/generated/go/insert_record_request.go index d410a08..912d408 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_request.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/insert_record_response.go b/xata/internal/fern-workspace/generated/go/insert_record_response.go index ea74caf..fb858a1 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_response.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_response.go @@ -4,61 +4,4 @@ package api -//type InsertRecordResponse struct { -// typeName string -// Record *Record -// InsertRecordResponseId *InsertRecordResponseId -//} - type InsertRecordResponse map[string]interface{} - -//func NewInsertRecordResponseFromRecord(value *Record) *InsertRecordResponse { -// return &InsertRecordResponse{typeName: "record", Record: value} -//} -// -//func NewInsertRecordResponseFromInsertRecordResponseId(value *InsertRecordResponseId) *InsertRecordResponse { -// return &InsertRecordResponse{typeName: "insertRecordResponseId", InsertRecordResponseId: value} -//} -// -//func (i *InsertRecordResponse) UnmarshalJSON(data []byte) error { -// valueRecord := new(Record) -// if err := json.Unmarshal(data, &valueRecord); err == nil { -// i.typeName = "record" -// i.Record = valueRecord -// return nil -// } -// valueInsertRecordResponseId := new(InsertRecordResponseId) -// if err := json.Unmarshal(data, &valueInsertRecordResponseId); err == nil { -// i.typeName = "insertRecordResponseId" -// i.InsertRecordResponseId = valueInsertRecordResponseId -// return nil -// } -// return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -//} -// -//func (i InsertRecordResponse) MarshalJSON() ([]byte, error) { -// switch i.typeName { -// default: -// return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) -// case "record": -// return json.Marshal(i.Record) -// case "insertRecordResponseId": -// return json.Marshal(i.InsertRecordResponseId) -// } -//} -// -//type InsertRecordResponseVisitor interface { -// VisitRecord(*Record) error -// VisitInsertRecordResponseId(*InsertRecordResponseId) error -//} -// -//func (i *InsertRecordResponse) Accept(v InsertRecordResponseVisitor) error { -// switch i.typeName { -// default: -// return fmt.Errorf("invalid type %s in %T", i.typeName, i) -// case "record": -// return v.VisitRecord(i.Record) -// case "insertRecordResponseId": -// return v.VisitInsertRecordResponseId(i.InsertRecordResponseId) -// } -//} diff --git a/xata/internal/fern-workspace/generated/go/insert_record_response_id.go b/xata/internal/fern-workspace/generated/go/insert_record_response_id.go index 57a1c92..b7fd884 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_response_id.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_response_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/insert_record_response_id_xata.go b/xata/internal/fern-workspace/generated/go/insert_record_response_id_xata.go index e30b2d9..e2f47b8 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_response_id_xata.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_response_id_xata.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type InsertRecordResponseIdXata struct { - Version int `json:"version"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` + Version int `json:"version"` } diff --git a/xata/internal/fern-workspace/generated/go/insert_record_with_id_request.go b/xata/internal/fern-workspace/generated/go/insert_record_with_id_request.go index aaf05cd..5ca5d00 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_with_id_request.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_with_id_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/insert_record_with_id_response.go b/xata/internal/fern-workspace/generated/go/insert_record_with_id_response.go index 1270e24..a5fabe4 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_with_id_response.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_with_id_response.go @@ -5,61 +5,3 @@ package api type InsertRecordWithIdResponse map[string]interface{} - -// -//type InsertRecordWithIdResponse struct { -// typeName string -// Record *Record -// InsertRecordWithIdResponseId *InsertRecordWithIdResponseId -//} -// -//func NewInsertRecordWithIdResponseFromRecord(value *Record) *InsertRecordWithIdResponse { -// return &InsertRecordWithIdResponse{typeName: "record", Record: value} -//} -// -//func NewInsertRecordWithIdResponseFromInsertRecordWithIdResponseId(value *InsertRecordWithIdResponseId) *InsertRecordWithIdResponse { -// return &InsertRecordWithIdResponse{typeName: "insertRecordWithIdResponseId", InsertRecordWithIdResponseId: value} -//} -// -//func (i *InsertRecordWithIdResponse) UnmarshalJSON(data []byte) error { -// valueRecord := new(Record) -// if err := json.Unmarshal(data, &valueRecord); err == nil { -// i.typeName = "record" -// i.Record = valueRecord -// return nil -// } -// valueInsertRecordWithIdResponseId := new(InsertRecordWithIdResponseId) -// if err := json.Unmarshal(data, &valueInsertRecordWithIdResponseId); err == nil { -// i.typeName = "insertRecordWithIdResponseId" -// i.InsertRecordWithIdResponseId = valueInsertRecordWithIdResponseId -// return nil -// } -// return fmt.Errorf("%s cannot be deserialized as a %T", data, i) -//} -// -//func (i InsertRecordWithIdResponse) MarshalJSON() ([]byte, error) { -// switch i.typeName { -// default: -// return nil, fmt.Errorf("invalid type %s in %T", i.typeName, i) -// case "record": -// return json.Marshal(i.Record) -// case "insertRecordWithIdResponseId": -// return json.Marshal(i.InsertRecordWithIdResponseId) -// } -//} -// -//type InsertRecordWithIdResponseVisitor interface { -// VisitRecord(*Record) error -// VisitInsertRecordWithIdResponseId(*InsertRecordWithIdResponseId) error -//} -// -//func (i *InsertRecordWithIdResponse) Accept(v InsertRecordWithIdResponseVisitor) error { -// switch i.typeName { -// default: -// return fmt.Errorf("invalid type %s in %T", i.typeName, i) -// case "record": -// return v.VisitRecord(i.Record) -// case "insertRecordWithIdResponseId": -// return v.VisitInsertRecordWithIdResponseId(i.InsertRecordWithIdResponseId) -// } -//} diff --git a/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id.go b/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id.go index c1322a3..7000e8b 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id_xata.go b/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id_xata.go index 799b947..ac979df 100644 --- a/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id_xata.go +++ b/xata/internal/fern-workspace/generated/go/insert_record_with_id_response_id_xata.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type InsertRecordWithIdResponseIdXata struct { - Version int `json:"version"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` + Version int `json:"version"` } diff --git a/xata/internal/fern-workspace/generated/go/list_branches_response.go b/xata/internal/fern-workspace/generated/go/list_branches_response.go index 9a3d82e..f37176a 100644 --- a/xata/internal/fern-workspace/generated/go/list_branches_response.go +++ b/xata/internal/fern-workspace/generated/go/list_branches_response.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type ListBranchesResponse struct { - DatabaseName string `json:"databaseName"` Branches []*Branch `json:"branches,omitempty"` + DatabaseName string `json:"databaseName"` } diff --git a/xata/internal/fern-workspace/generated/go/list_git_branches_response.go b/xata/internal/fern-workspace/generated/go/list_git_branches_response.go index 9876ec3..d9c7826 100644 --- a/xata/internal/fern-workspace/generated/go/list_git_branches_response.go +++ b/xata/internal/fern-workspace/generated/go/list_git_branches_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/list_git_branches_response_mapping_item.go b/xata/internal/fern-workspace/generated/go/list_git_branches_response_mapping_item.go index 8e75932..f838044 100644 --- a/xata/internal/fern-workspace/generated/go/list_git_branches_response_mapping_item.go +++ b/xata/internal/fern-workspace/generated/go/list_git_branches_response_mapping_item.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/max_agg.go b/xata/internal/fern-workspace/generated/go/max_agg.go index ee5d0ca..cca7bc0 100644 --- a/xata/internal/fern-workspace/generated/go/max_agg.go +++ b/xata/internal/fern-workspace/generated/go/max_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/media_type.go b/xata/internal/fern-workspace/generated/go/media_type.go index 99e89aa..a3cdf00 100644 --- a/xata/internal/fern-workspace/generated/go/media_type.go +++ b/xata/internal/fern-workspace/generated/go/media_type.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/metrics_datapoint.go b/xata/internal/fern-workspace/generated/go/metrics_datapoint.go index 0f0d1ba..1b8a85b 100644 --- a/xata/internal/fern-workspace/generated/go/metrics_datapoint.go +++ b/xata/internal/fern-workspace/generated/go/metrics_datapoint.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/metrics_latency.go b/xata/internal/fern-workspace/generated/go/metrics_latency.go index e9f61ec..65b09a7 100644 --- a/xata/internal/fern-workspace/generated/go/metrics_latency.go +++ b/xata/internal/fern-workspace/generated/go/metrics_latency.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration.go b/xata/internal/fern-workspace/generated/go/migration.go index ca817bf..ebd7f8b 100644 --- a/xata/internal/fern-workspace/generated/go/migration.go +++ b/xata/internal/fern-workspace/generated/go/migration.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Migration is an in-lined request used by the UpdateBranchSchema endpoint. type Migration struct { - ParentId *string `json:"parentID,omitempty"` Operations []*MigrationOp `json:"operations,omitempty"` + ParentId *string `json:"parentID,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/migration_column_op.go b/xata/internal/fern-workspace/generated/go/migration_column_op.go index 8386455..483cde2 100644 --- a/xata/internal/fern-workspace/generated/go/migration_column_op.go +++ b/xata/internal/fern-workspace/generated/go/migration_column_op.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_column_op_add_column.go b/xata/internal/fern-workspace/generated/go/migration_column_op_add_column.go index cfe1f59..4d12a86 100644 --- a/xata/internal/fern-workspace/generated/go/migration_column_op_add_column.go +++ b/xata/internal/fern-workspace/generated/go/migration_column_op_add_column.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_column_op_remove_column.go b/xata/internal/fern-workspace/generated/go/migration_column_op_remove_column.go index 9b56cdb..1a8a391 100644 --- a/xata/internal/fern-workspace/generated/go/migration_column_op_remove_column.go +++ b/xata/internal/fern-workspace/generated/go/migration_column_op_remove_column.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_column_op_rename_column.go b/xata/internal/fern-workspace/generated/go/migration_column_op_rename_column.go index d2fc267..7dcbcff 100644 --- a/xata/internal/fern-workspace/generated/go/migration_column_op_rename_column.go +++ b/xata/internal/fern-workspace/generated/go/migration_column_op_rename_column.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_object.go b/xata/internal/fern-workspace/generated/go/migration_object.go index af4320c..97ef99b 100644 --- a/xata/internal/fern-workspace/generated/go/migration_object.go +++ b/xata/internal/fern-workspace/generated/go/migration_object.go @@ -1,14 +1,12 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type MigrationObject struct { - Title *string `json:"title,omitempty"` - Message *string `json:"message,omitempty"` - Id string `json:"id"` - ParentId *string `json:"parentID,omitempty"` Checksum string `json:"checksum"` + Id string `json:"id"` + Message *string `json:"message,omitempty"` Operations []*MigrationOp `json:"operations,omitempty"` + ParentId *string `json:"parentID,omitempty"` + Title *string `json:"title,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/migration_op.go b/xata/internal/fern-workspace/generated/go/migration_op.go index bd07741..54b8c2c 100644 --- a/xata/internal/fern-workspace/generated/go/migration_op.go +++ b/xata/internal/fern-workspace/generated/go/migration_op.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_request.go b/xata/internal/fern-workspace/generated/go/migration_request.go index 80472e1..b12d8b9 100644 --- a/xata/internal/fern-workspace/generated/go/migration_request.go +++ b/xata/internal/fern-workspace/generated/go/migration_request.go @@ -1,22 +1,20 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type MigrationRequest struct { - Number *MigrationRequestNumber `json:"number,omitempty"` - CreatedAt *DateTime `json:"createdAt,omitempty"` - ModifiedAt *DateTime `json:"modifiedAt,omitempty"` + // The migration request body with detailed description. + Body *string `json:"body,omitempty"` ClosedAt *DateTime `json:"closedAt,omitempty"` + CreatedAt *DateTime `json:"createdAt,omitempty"` MergedAt *DateTime `json:"mergedAt,omitempty"` - Status *MigrationRequestStatus `json:"status,omitempty"` - // The migration request title. - Title *string `json:"title,omitempty"` - // The migration request body with detailed description. - Body *string `json:"body,omitempty"` + ModifiedAt *DateTime `json:"modifiedAt,omitempty"` + Number *MigrationRequestNumber `json:"number,omitempty"` // Name of the source branch. - Source *string `json:"source,omitempty"` + Source *string `json:"source,omitempty"` + Status *MigrationRequestStatus `json:"status,omitempty"` // Name of the target branch. Target *string `json:"target,omitempty"` + // The migration request title. + Title *string `json:"title,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/migration_request_number.go b/xata/internal/fern-workspace/generated/go/migration_request_number.go index 6c99459..1e1d1ff 100644 --- a/xata/internal/fern-workspace/generated/go/migration_request_number.go +++ b/xata/internal/fern-workspace/generated/go/migration_request_number.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_request_status.go b/xata/internal/fern-workspace/generated/go/migration_request_status.go index 741776c..507becc 100644 --- a/xata/internal/fern-workspace/generated/go/migration_request_status.go +++ b/xata/internal/fern-workspace/generated/go/migration_request_status.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_status.go b/xata/internal/fern-workspace/generated/go/migration_status.go index f1d3d7c..4f0ef17 100644 --- a/xata/internal/fern-workspace/generated/go/migration_status.go +++ b/xata/internal/fern-workspace/generated/go/migration_status.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_table_op.go b/xata/internal/fern-workspace/generated/go/migration_table_op.go index 128a8b5..3980d91 100644 --- a/xata/internal/fern-workspace/generated/go/migration_table_op.go +++ b/xata/internal/fern-workspace/generated/go/migration_table_op.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_table_op_add_table.go b/xata/internal/fern-workspace/generated/go/migration_table_op_add_table.go index 42871e8..72df288 100644 --- a/xata/internal/fern-workspace/generated/go/migration_table_op_add_table.go +++ b/xata/internal/fern-workspace/generated/go/migration_table_op_add_table.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_table_op_remove_table.go b/xata/internal/fern-workspace/generated/go/migration_table_op_remove_table.go index 1dc2166..c8cd3ef 100644 --- a/xata/internal/fern-workspace/generated/go/migration_table_op_remove_table.go +++ b/xata/internal/fern-workspace/generated/go/migration_table_op_remove_table.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migration_table_op_rename_table.go b/xata/internal/fern-workspace/generated/go/migration_table_op_rename_table.go index 6515baf..bdaeba0 100644 --- a/xata/internal/fern-workspace/generated/go/migration_table_op_rename_table.go +++ b/xata/internal/fern-workspace/generated/go/migration_table_op_rename_table.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/migrations_client.go b/xata/internal/fern-workspace/generated/go/migrations_client.go index 257f63a..d0e1472 100644 --- a/xata/internal/fern-workspace/generated/go/migrations_client.go +++ b/xata/internal/fern-workspace/generated/go/migrations_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -16,13 +14,13 @@ import ( ) type MigrationsClient interface { - GetBranchSchemaHistory(ctx context.Context, dbBranchName DbBranchName, request *GetBranchSchemaHistoryRequest) (*GetBranchSchemaHistoryResponse, error) + ApplyBranchSchemaEdit(ctx context.Context, dbBranchName DbBranchName, request *ApplyBranchSchemaEditRequest) (*ApplyBranchSchemaEditResponse, error) CompareBranchWithUserSchema(ctx context.Context, dbBranchName DbBranchName, request *CompareBranchWithUserSchemaRequest) (*CompareBranchWithUserSchemaResponse, error) CompareBranchSchemas(ctx context.Context, dbBranchName DbBranchName, branchName BranchName, request *CompareBranchSchemasRequest) (*CompareBranchSchemasResponse, error) - UpdateBranchSchema(ctx context.Context, dbBranchName DbBranchName, request *Migration) (*UpdateBranchSchemaResponse, error) + GetBranchSchemaHistory(ctx context.Context, dbBranchName DbBranchName, request *GetBranchSchemaHistoryRequest) (*GetBranchSchemaHistoryResponse, error) PreviewBranchSchemaEdit(ctx context.Context, dbBranchName DbBranchName, request *PreviewBranchSchemaEditRequest) (*PreviewBranchSchemaEditResponse, error) - ApplyBranchSchemaEdit(ctx context.Context, dbBranchName DbBranchName, request *ApplyBranchSchemaEditRequest) (*ApplyBranchSchemaEditResponse, error) PushBranchMigrations(ctx context.Context, dbBranchName DbBranchName, request *PushBranchMigrationsRequest) (*PushBranchMigrationsResponse, error) + UpdateBranchSchema(ctx context.Context, dbBranchName DbBranchName, request *Migration) (*UpdateBranchSchemaResponse, error) } func NewMigrationsClient(opts ...core.ClientOption) MigrationsClient { @@ -44,12 +42,12 @@ type migrationsClient struct { } // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (m *migrationsClient) GetBranchSchemaHistory(ctx context.Context, dbBranchName DbBranchName, request *GetBranchSchemaHistoryRequest) (*GetBranchSchemaHistoryResponse, error) { +func (m *migrationsClient) ApplyBranchSchemaEdit(ctx context.Context, dbBranchName DbBranchName, request *ApplyBranchSchemaEditRequest) (*ApplyBranchSchemaEditResponse, error) { baseURL := "/" if m.baseURL != "" { baseURL = m.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/history", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/apply", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -84,7 +82,7 @@ func (m *migrationsClient) GetBranchSchemaHistory(ctx context.Context, dbBranchN return apiError } - var response *GetBranchSchemaHistoryResponse + var response *ApplyBranchSchemaEditResponse if err := core.DoRequest( ctx, m.httpClient, @@ -220,12 +218,12 @@ func (m *migrationsClient) CompareBranchSchemas(ctx context.Context, dbBranchNam } // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (m *migrationsClient) UpdateBranchSchema(ctx context.Context, dbBranchName DbBranchName, request *Migration) (*UpdateBranchSchemaResponse, error) { +func (m *migrationsClient) GetBranchSchemaHistory(ctx context.Context, dbBranchName DbBranchName, request *GetBranchSchemaHistoryRequest) (*GetBranchSchemaHistoryResponse, error) { baseURL := "/" if m.baseURL != "" { baseURL = m.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/update", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/history", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -260,7 +258,7 @@ func (m *migrationsClient) UpdateBranchSchema(ctx context.Context, dbBranchName return apiError } - var response *UpdateBranchSchemaResponse + var response *GetBranchSchemaHistoryResponse if err := core.DoRequest( ctx, m.httpClient, @@ -335,13 +333,24 @@ func (m *migrationsClient) PreviewBranchSchemaEdit(ctx context.Context, dbBranch return response, nil } +// The `schema/push` API accepts a list of migrations to be applied to the +// current branch. A list of applicable migrations can be fetched using +// the `schema/history` API from another branch or database. +// +// The most recent migration must be part of the list or referenced (via +// `parentID`) by the first migration in the list of migrations to be pushed. +// +// Each migration in the list has an `id`, `parentID`, and `checksum`. The +// checksum for migrations are generated and verified by xata. The +// operation fails if any migration in the list has an invalid checksum. +// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (m *migrationsClient) ApplyBranchSchemaEdit(ctx context.Context, dbBranchName DbBranchName, request *ApplyBranchSchemaEditRequest) (*ApplyBranchSchemaEditResponse, error) { +func (m *migrationsClient) PushBranchMigrations(ctx context.Context, dbBranchName DbBranchName, request *PushBranchMigrationsRequest) (*PushBranchMigrationsResponse, error) { baseURL := "/" if m.baseURL != "" { baseURL = m.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/apply", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/push", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -376,7 +385,7 @@ func (m *migrationsClient) ApplyBranchSchemaEdit(ctx context.Context, dbBranchNa return apiError } - var response *ApplyBranchSchemaEditResponse + var response *PushBranchMigrationsResponse if err := core.DoRequest( ctx, m.httpClient, @@ -393,24 +402,13 @@ func (m *migrationsClient) ApplyBranchSchemaEdit(ctx context.Context, dbBranchNa return response, nil } -// The `schema/push` API accepts a list of migrations to be applied to the -// current branch. A list of applicable migrations can be fetched using -// the `schema/history` API from another branch or database. -// -// The most recent migration must be part of the list or referenced (via -// `parentID`) by the first migration in the list of migrations to be pushed. -// -// Each migration in the list has an `id`, `parentID`, and `checksum`. The -// checksum for migrations are generated and verified by xata. The -// operation fails if any migration in the list has an invalid checksum. -// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (m *migrationsClient) PushBranchMigrations(ctx context.Context, dbBranchName DbBranchName, request *PushBranchMigrationsRequest) (*PushBranchMigrationsResponse, error) { +func (m *migrationsClient) UpdateBranchSchema(ctx context.Context, dbBranchName DbBranchName, request *Migration) (*UpdateBranchSchemaResponse, error) { baseURL := "/" if m.baseURL != "" { baseURL = m.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/push", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/schema/update", dbBranchName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -445,7 +443,7 @@ func (m *migrationsClient) PushBranchMigrations(ctx context.Context, dbBranchNam return apiError } - var response *PushBranchMigrationsResponse + var response *UpdateBranchSchemaResponse if err := core.DoRequest( ctx, m.httpClient, diff --git a/xata/internal/fern-workspace/generated/go/min_agg.go b/xata/internal/fern-workspace/generated/go/min_agg.go index 5c64485..b8d2691 100644 --- a/xata/internal/fern-workspace/generated/go/min_agg.go +++ b/xata/internal/fern-workspace/generated/go/min_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/not_found_error.go b/xata/internal/fern-workspace/generated/go/not_found_error.go index 45d407b..53bb40a 100644 --- a/xata/internal/fern-workspace/generated/go/not_found_error.go +++ b/xata/internal/fern-workspace/generated/go/not_found_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/numeric_booster.go b/xata/internal/fern-workspace/generated/go/numeric_booster.go index fd78f9c..a837a16 100644 --- a/xata/internal/fern-workspace/generated/go/numeric_booster.go +++ b/xata/internal/fern-workspace/generated/go/numeric_booster.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -9,7 +7,8 @@ type NumericBooster struct { // The column in which to look for the value. Column string `json:"column"` // The factor with which to multiply the value of the column before adding it to the item score. - Factor float64 `json:"factor"` + Factor float64 `json:"factor"` + IfMatchesFilter *FilterExpression `json:"ifMatchesFilter,omitempty"` // Modifier to be applied to the column value, before being multiplied with the factor. The possible values are: // - none (default). // - log: common logarithm (base 10) @@ -21,6 +20,5 @@ type NumericBooster struct { // - square: raise the value to the power of two. // - sqrt: take the square root of the value. // - reciprocal: reciprocate the value (if the value is `x`, the reciprocal is `1/x`). - Modifier *NumericBoosterModifier `json:"modifier,omitempty"` - IfMatchesFilter *FilterExpression `json:"ifMatchesFilter,omitempty"` + Modifier *NumericBoosterModifier `json:"modifier,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/numeric_booster_modifier.go b/xata/internal/fern-workspace/generated/go/numeric_booster_modifier.go index 52518aa..8ba9e96 100644 --- a/xata/internal/fern-workspace/generated/go/numeric_booster_modifier.go +++ b/xata/internal/fern-workspace/generated/go/numeric_booster_modifier.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/numeric_histogram_agg.go b/xata/internal/fern-workspace/generated/go/numeric_histogram_agg.go index 683d7ac..eac140a 100644 --- a/xata/internal/fern-workspace/generated/go/numeric_histogram_agg.go +++ b/xata/internal/fern-workspace/generated/go/numeric_histogram_agg.go @@ -1,11 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket. type NumericHistogramAgg struct { + Aggs *AggExpressionMap `json:"aggs,omitempty"` // The column to use for bucketing. Must be of numeric type. Column string `json:"column"` // The numeric interval to use for bucketing. The resulting buckets will be ranges @@ -15,6 +14,5 @@ type NumericHistogramAgg struct { // boundaries can be shifted by using the offset option. For example, if the `interval` is 100, // but you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset` // to 50. - Offset *float64 `json:"offset,omitempty"` - Aggs *AggExpressionMap `json:"aggs,omitempty"` + Offset *float64 `json:"offset,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/page_config.go b/xata/internal/fern-workspace/generated/go/page_config.go index 45249ca..ab25f4f 100644 --- a/xata/internal/fern-workspace/generated/go/page_config.go +++ b/xata/internal/fern-workspace/generated/go/page_config.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,12 +8,12 @@ type PageConfig struct { After *string `json:"after,omitempty"` // Query the previous page before the cursor. Before *string `json:"before,omitempty"` - // Query the first page from the cursor. - Start *string `json:"start,omitempty"` // Query the last page from the cursor. End *string `json:"end,omitempty"` - // Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size. - Size *int `json:"size,omitempty"` // Use offset to skip entries. To skip pages set offset to a multiple of size. Offset *int `json:"offset,omitempty"` + // Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size. + Size *int `json:"size,omitempty"` + // Query the first page from the cursor. + Start *string `json:"start,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/percentiles_agg.go b/xata/internal/fern-workspace/generated/go/percentiles_agg.go new file mode 100644 index 0000000..733e44c --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/percentiles_agg.go @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +// Calculate given percentiles of the numeric values in a particular column. +type PercentilesAgg struct { + // The column on which to compute the average. Must be a numeric type. + Column string `json:"column"` + Percentiles []float64 `json:"percentiles,omitempty"` +} diff --git a/xata/internal/fern-workspace/generated/go/pointer.go b/xata/internal/fern-workspace/generated/go/pointer.go index 1646ee9..82fb917 100644 --- a/xata/internal/fern-workspace/generated/go/pointer.go +++ b/xata/internal/fern-workspace/generated/go/pointer.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - package api import "time" diff --git a/xata/internal/fern-workspace/generated/go/prefix_expression.go b/xata/internal/fern-workspace/generated/go/prefix_expression.go index 895d148..2eccf6a 100644 --- a/xata/internal/fern-workspace/generated/go/prefix_expression.go +++ b/xata/internal/fern-workspace/generated/go/prefix_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_request.go b/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_request.go index 69ed189..8325caa 100644 --- a/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_request.go +++ b/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_response.go b/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_response.go index b97bcab..ec3fd71 100644 --- a/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_response.go +++ b/xata/internal/fern-workspace/generated/go/preview_branch_schema_edit_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/projection_config.go b/xata/internal/fern-workspace/generated/go/projection_config.go index 6209666..173ed8a 100644 --- a/xata/internal/fern-workspace/generated/go/projection_config.go +++ b/xata/internal/fern-workspace/generated/go/projection_config.go @@ -1,17 +1,15 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // A structured projection that allows for some configuration. type ProjectionConfig struct { - // The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations). - Name *string `json:"name,omitempty"` - Columns *QueryColumnsProjection `json:"columns,omitempty"` // An alias for the projected field, this is how it will be returned in the response. - As *string `json:"as,omitempty"` - Sort *SortExpression `json:"sort,omitempty"` - Limit *int `json:"limit,omitempty"` + As *string `json:"as,omitempty"` + Columns *QueryColumnsProjection `json:"columns,omitempty"` + Limit *int `json:"limit,omitempty"` + // The name of the column to project or a reverse link specification, see [API Guide](https://xata.io/docs/concepts/data-model#links-and-relations). + Name *string `json:"name,omitempty"` Offset *int `json:"offset,omitempty"` + Sort *SortExpression `json:"sort,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/push_branch_migrations_request.go b/xata/internal/fern-workspace/generated/go/push_branch_migrations_request.go index c350509..f46c1e1 100644 --- a/xata/internal/fern-workspace/generated/go/push_branch_migrations_request.go +++ b/xata/internal/fern-workspace/generated/go/push_branch_migrations_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/push_branch_migrations_response.go b/xata/internal/fern-workspace/generated/go/push_branch_migrations_response.go index 862969d..b7b9ef4 100644 --- a/xata/internal/fern-workspace/generated/go/push_branch_migrations_response.go +++ b/xata/internal/fern-workspace/generated/go/push_branch_migrations_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/query_columns_projection.go b/xata/internal/fern-workspace/generated/go/query_columns_projection.go index 216e22a..bba4d13 100644 --- a/xata/internal/fern-workspace/generated/go/query_columns_projection.go +++ b/xata/internal/fern-workspace/generated/go/query_columns_projection.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/query_table_request.go b/xata/internal/fern-workspace/generated/go/query_table_request.go index 50ca98e..7d82bb6 100644 --- a/xata/internal/fern-workspace/generated/go/query_table_request.go +++ b/xata/internal/fern-workspace/generated/go/query_table_request.go @@ -1,15 +1,13 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // QueryTableRequest is an in-lined request used by the QueryTable endpoint. type QueryTableRequest struct { - Filter *FilterExpression `json:"filter,omitempty"` - Sort *SortExpression `json:"sort,omitempty"` - Page *PageConfig `json:"page,omitempty"` Columns *QueryColumnsProjection `json:"columns,omitempty"` // The consistency level for this request. Consistency *QueryTableRequestConsistency `json:"consistency,omitempty"` + Filter *FilterExpression `json:"filter,omitempty"` + Page *PageConfig `json:"page,omitempty"` + Sort *SortExpression `json:"sort,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/query_table_request_consistency.go b/xata/internal/fern-workspace/generated/go/query_table_request_consistency.go index 86f8179..69d6bd1 100644 --- a/xata/internal/fern-workspace/generated/go/query_table_request_consistency.go +++ b/xata/internal/fern-workspace/generated/go/query_table_request_consistency.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/query_table_response.go b/xata/internal/fern-workspace/generated/go/query_table_response.go index 6db210d..6ba074e 100644 --- a/xata/internal/fern-workspace/generated/go/query_table_response.go +++ b/xata/internal/fern-workspace/generated/go/query_table_response.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type QueryTableResponse struct { - Records []*Record `json:"records,omitempty"` Meta *RecordsMetadata `json:"meta,omitempty"` + Records []*Record `json:"records,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/record.go b/xata/internal/fern-workspace/generated/go/record.go index bc06de4..2575a78 100644 --- a/xata/internal/fern-workspace/generated/go/record.go +++ b/xata/internal/fern-workspace/generated/go/record.go @@ -4,11 +4,4 @@ package api -// Xata Table Record -//type Record struct { -// Id RecordId `json:"id"` -// Xata *RecordMetaXata `json:"xata,omitempty"` -// Unknowns map[string]interface{} -//} - type Record map[string]interface{} diff --git a/xata/internal/fern-workspace/generated/go/record_id.go b/xata/internal/fern-workspace/generated/go/record_id.go index 1c6fc97..7e6356b 100644 --- a/xata/internal/fern-workspace/generated/go/record_id.go +++ b/xata/internal/fern-workspace/generated/go/record_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/record_meta.go b/xata/internal/fern-workspace/generated/go/record_meta.go index 4a7a593..87a716d 100644 --- a/xata/internal/fern-workspace/generated/go/record_meta.go +++ b/xata/internal/fern-workspace/generated/go/record_meta.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/record_meta_xata.go b/xata/internal/fern-workspace/generated/go/record_meta_xata.go index 711472f..e83b55d 100644 --- a/xata/internal/fern-workspace/generated/go/record_meta_xata.go +++ b/xata/internal/fern-workspace/generated/go/record_meta_xata.go @@ -1,22 +1,20 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type RecordMetaXata struct { - // The record's version. Can be used for optimistic concurrency control. - Version int `json:"version"` // The time when the record was created. CreatedAt *string `json:"createdAt,omitempty"` - // The time when the record was last updated. - UpdatedAt *string `json:"updatedAt,omitempty"` - // The record's table name. APIs that return records from multiple tables will set this field accordingly. - Table *string `json:"table,omitempty"` // Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search. Highlight *map[string]*RecordMetaXataHighlightValue `json:"highlight,omitempty"` // The record's relevancy score. This is returned by the search APIs. Score *float64 `json:"score,omitempty"` + // The record's table name. APIs that return records from multiple tables will set this field accordingly. + Table *string `json:"table,omitempty"` + // The time when the record was last updated. + UpdatedAt *string `json:"updatedAt,omitempty"` + // The record's version. Can be used for optimistic concurrency control. + Version int `json:"version"` // Encoding/Decoding errors Warnings *[]string `json:"warnings,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/record_meta_xata_highlight_value.go b/xata/internal/fern-workspace/generated/go/record_meta_xata_highlight_value.go index 8388f71..8e8049c 100644 --- a/xata/internal/fern-workspace/generated/go/record_meta_xata_highlight_value.go +++ b/xata/internal/fern-workspace/generated/go/record_meta_xata_highlight_value.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/records_metadata.go b/xata/internal/fern-workspace/generated/go/records_metadata.go index e5662fd..eb902b3 100644 --- a/xata/internal/fern-workspace/generated/go/records_metadata.go +++ b/xata/internal/fern-workspace/generated/go/records_metadata.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/records_metadata_page.go b/xata/internal/fern-workspace/generated/go/records_metadata_page.go index be603ef..d91eeb1 100644 --- a/xata/internal/fern-workspace/generated/go/records_metadata_page.go +++ b/xata/internal/fern-workspace/generated/go/records_metadata_page.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/remove_git_branches_entry_request.go b/xata/internal/fern-workspace/generated/go/remove_git_branches_entry_request.go index 648c85d..897ff1a 100644 --- a/xata/internal/fern-workspace/generated/go/remove_git_branches_entry_request.go +++ b/xata/internal/fern-workspace/generated/go/remove_git_branches_entry_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/resolve_branch_request.go b/xata/internal/fern-workspace/generated/go/resolve_branch_request.go index 29a1ed7..e2988bc 100644 --- a/xata/internal/fern-workspace/generated/go/resolve_branch_request.go +++ b/xata/internal/fern-workspace/generated/go/resolve_branch_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/resolve_branch_response.go b/xata/internal/fern-workspace/generated/go/resolve_branch_response.go index eba2c31..94e8c5a 100644 --- a/xata/internal/fern-workspace/generated/go/resolve_branch_response.go +++ b/xata/internal/fern-workspace/generated/go/resolve_branch_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason.go b/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason.go index 2e3743b..6480ddf 100644 --- a/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason.go +++ b/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason_code.go b/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason_code.go index 3dc37f6..ca37961 100644 --- a/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason_code.go +++ b/xata/internal/fern-workspace/generated/go/resolve_branch_response_reason_code.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/rev_link.go b/xata/internal/fern-workspace/generated/go/rev_link.go index 4ee0b03..5b6cd12 100644 --- a/xata/internal/fern-workspace/generated/go/rev_link.go +++ b/xata/internal/fern-workspace/generated/go/rev_link.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type RevLink struct { - Table string `json:"table"` Column string `json:"column"` + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/schema.go b/xata/internal/fern-workspace/generated/go/schema.go index b8b1a7b..0914c15 100644 --- a/xata/internal/fern-workspace/generated/go/schema.go +++ b/xata/internal/fern-workspace/generated/go/schema.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/schema_edit_script.go b/xata/internal/fern-workspace/generated/go/schema_edit_script.go index c0639b0..3092669 100644 --- a/xata/internal/fern-workspace/generated/go/schema_edit_script.go +++ b/xata/internal/fern-workspace/generated/go/schema_edit_script.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type SchemaEditScript struct { + Operations []*MigrationOp `json:"operations,omitempty"` SourceMigrationId *string `json:"sourceMigrationID,omitempty"` TargetMigrationId *string `json:"targetMigrationID,omitempty"` - Operations []*MigrationOp `json:"operations,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/search_and_filter_client.go b/xata/internal/fern-workspace/generated/go/search_and_filter_client.go index 2f9b4c2..6d0528e 100644 --- a/xata/internal/fern-workspace/generated/go/search_and_filter_client.go +++ b/xata/internal/fern-workspace/generated/go/search_and_filter_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -16,14 +14,14 @@ import ( ) type SearchAndFilterClient interface { - QueryTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *QueryTableRequest) (*QueryTableResponse, error) SearchBranch(ctx context.Context, dbBranchName DbBranchName, request *SearchBranchRequest) (*SearchBranchResponse, error) - SearchTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SearchTableRequest) (*SearchTableResponse, error) - VectorSearchTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *VectorSearchTableRequest) (*VectorSearchTableResponse, error) + AggregateTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AggregateTableRequest) (*AggregateTableResponse, error) AskTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AskTableRequest) (*AskTableResponse, error) AskTableSession(ctx context.Context, dbBranchName DbBranchName, tableName TableName, sessionId string, request *AskTableSessionRequest) (*AskTableSessionResponse, error) + QueryTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *QueryTableRequest) (*QueryTableResponse, error) + SearchTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SearchTableRequest) (*SearchTableResponse, error) SummarizeTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SummarizeTableRequest) (*SummarizeTableResponse, error) - AggregateTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AggregateTableRequest) (*AggregateTableResponse, error) + VectorSearchTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *VectorSearchTableRequest) (*VectorSearchTableResponse, error) } func NewSearchAndFilterClient(opts ...core.ClientOption) SearchAndFilterClient { @@ -44,6 +42,294 @@ type searchAndFilterClient struct { header http.Header } +// Run a free text search operation across the database branch. +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +func (s *searchAndFilterClient) SearchBranch(ctx context.Context, dbBranchName DbBranchName, request *SearchBranchRequest) (*SearchBranchResponse, error) { + baseURL := "/" + if s.baseURL != "" { + baseURL = s.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/search", dbBranchName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 503: + value := new(ServiceUnavailableError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *SearchBranchResponse + if err := core.DoRequest( + ctx, + s.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + s.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// This endpoint allows you to run aggregations (analytics) on the data from one table. +// While the summary endpoint is served from a transactional store and the results are strongly +// consistent, the aggregate endpoint is served from our columnar store and the results are +// only eventually consistent. On the other hand, the aggregate endpoint uses a +// store that is more appropiate for analytics, makes use of approximative algorithms +// (e.g for cardinality), and is generally faster and can do more complex aggregations. +// +// For usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate). +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +func (s *searchAndFilterClient) AggregateTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AggregateTableRequest) (*AggregateTableResponse, error) { + baseURL := "/" + if s.baseURL != "" { + baseURL = s.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/aggregate", dbBranchName, tableName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *AggregateTableResponse + if err := core.DoRequest( + ctx, + s.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + s.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's. +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +func (s *searchAndFilterClient) AskTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AskTableRequest) (*AskTableResponse, error) { + baseURL := "/" + if s.baseURL != "" { + baseURL = s.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/ask", dbBranchName, tableName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 429: + value := new(TooManyRequestsError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 503: + value := new(ServiceUnavailableError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *AskTableResponse + if err := core.DoRequest( + ctx, + s.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + s.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + +// Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's. +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +// +// The Table name +func (s *searchAndFilterClient) AskTableSession(ctx context.Context, dbBranchName DbBranchName, tableName TableName, sessionId string, request *AskTableSessionRequest) (*AskTableSessionResponse, error) { + baseURL := "/" + if s.baseURL != "" { + baseURL = s.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/ask/%v", dbBranchName, tableName, sessionId) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 429: + value := new(TooManyRequestsError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 503: + value := new(ServiceUnavailableError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *AskTableSessionResponse + if err := core.DoRequest( + ctx, + s.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + s.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} + // The Query Table API can be used to retrieve all records in a table. // The API support filtering, sorting, selecting a subset of columns, and pagination. // @@ -920,96 +1206,29 @@ type searchAndFilterClient struct { // When using special cursors like `page.after="end"` or `page.before="end"`, we // still allow `filter` and `sort` to be set. // -// Example of getting the last page: -// -// ```json -// POST /db/demo:main/tables/table/query -// -// { -// "page": { -// "size": 10, -// "before": "end" -// } -// } -// -// ``` -// -// The DBBranchName matches the pattern `{db_name}:{branch_name}`. -// -// The Table name -func (s *searchAndFilterClient) QueryTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *QueryTableRequest) (*QueryTableResponse, error) { - baseURL := "/" - if s.baseURL != "" { - baseURL = s.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/query", dbBranchName, tableName) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 401: - value := new(UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 503: - value := new(ServiceUnavailableError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - var response *QueryTableResponse - if err := core.DoRequest( - ctx, - s.httpClient, - endpointURL, - http.MethodPost, - request, - &response, - false, - s.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -// Run a free text search operation across the database branch. +// Example of getting the last page: +// +// ```json +// POST /db/demo:main/tables/table/query +// +// { +// "page": { +// "size": 10, +// "before": "end" +// } +// } +// +// ``` // // The DBBranchName matches the pattern `{db_name}:{branch_name}`. -func (s *searchAndFilterClient) SearchBranch(ctx context.Context, dbBranchName DbBranchName, request *SearchBranchRequest) (*SearchBranchResponse, error) { +// +// The Table name +func (s *searchAndFilterClient) QueryTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *QueryTableRequest) (*QueryTableResponse, error) { baseURL := "/" if s.baseURL != "" { baseURL = s.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/search", dbBranchName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/query", dbBranchName, tableName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -1051,7 +1270,7 @@ func (s *searchAndFilterClient) SearchBranch(ctx context.Context, dbBranchName D return apiError } - var response *SearchBranchResponse + var response *QueryTableResponse if err := core.DoRequest( ctx, s.httpClient, @@ -1134,223 +1353,6 @@ func (s *searchAndFilterClient) SearchTable(ctx context.Context, dbBranchName Db return response, nil } -// This endpoint can be used to perform vector-based similarity searches in a table. -// It can be used for implementing semantic search and product recommendation. To use this -// endpoint, you need a column of type vector. The input vector must have the same -// dimension as the vector column. -// -// The DBBranchName matches the pattern `{db_name}:{branch_name}`. -// -// The Table name -func (s *searchAndFilterClient) VectorSearchTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *VectorSearchTableRequest) (*VectorSearchTableResponse, error) { - baseURL := "/" - if s.baseURL != "" { - baseURL = s.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/vectorSearch", dbBranchName, tableName) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 401: - value := new(UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - var response *VectorSearchTableResponse - if err := core.DoRequest( - ctx, - s.httpClient, - endpointURL, - http.MethodPost, - request, - &response, - false, - s.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -// Ask your table a question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's. -// -// The DBBranchName matches the pattern `{db_name}:{branch_name}`. -// -// The Table name -func (s *searchAndFilterClient) AskTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AskTableRequest) (*AskTableResponse, error) { - baseURL := "/" - if s.baseURL != "" { - baseURL = s.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/ask", dbBranchName, tableName) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 401: - value := new(UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 429: - value := new(TooManyRequestsError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 503: - value := new(ServiceUnavailableError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - var response *AskTableResponse - if err := core.DoRequest( - ctx, - s.httpClient, - endpointURL, - http.MethodPost, - request, - &response, - false, - s.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - -// Ask a follow-up question. If the `Accept` header is set to `text/event-stream`, Xata will stream the results back as SSE's. -// -// The DBBranchName matches the pattern `{db_name}:{branch_name}`. -// -// The Table name -func (s *searchAndFilterClient) AskTableSession(ctx context.Context, dbBranchName DbBranchName, tableName TableName, sessionId string, request *AskTableSessionRequest) (*AskTableSessionResponse, error) { - baseURL := "/" - if s.baseURL != "" { - baseURL = s.baseURL - } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/ask/%v", dbBranchName, tableName, sessionId) - - errorDecoder := func(statusCode int, body io.Reader) error { - raw, err := io.ReadAll(body) - if err != nil { - return err - } - apiError := core.NewAPIError(statusCode, errors.New(string(raw))) - decoder := json.NewDecoder(bytes.NewReader(raw)) - switch statusCode { - case 400: - value := new(BadRequestError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 401: - value := new(UnauthorizedError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 404: - value := new(NotFoundError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 429: - value := new(TooManyRequestsError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - case 503: - value := new(ServiceUnavailableError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value - } - return apiError - } - - var response *AskTableSessionResponse - if err := core.DoRequest( - ctx, - s.httpClient, - endpointURL, - http.MethodPost, - request, - &response, - false, - s.header, - errorDecoder, - ); err != nil { - return response, err - } - return response, nil -} - // This endpoint allows you to (optionally) define groups, and then to run // calculations on the values in each group. This is most helpful when // you'd like to understand the data you have in your database. @@ -1475,24 +1477,20 @@ func (s *searchAndFilterClient) SummarizeTable(ctx context.Context, dbBranchName return response, nil } -// This endpoint allows you to run aggregations (analytics) on the data from one table. -// While the summary endpoint is served from a transactional store and the results are strongly -// consistent, the aggregate endpoint is served from our columnar store and the results are -// only eventually consistent. On the other hand, the aggregate endpoint uses a -// store that is more appropiate for analytics, makes use of approximative algorithms -// (e.g for cardinality), and is generally faster and can do more complex aggregations. -// -// For usage, see the [API Guide](https://xata.io/docs/api-guide/aggregate). +// This endpoint can be used to perform vector-based similarity searches in a table. +// It can be used for implementing semantic search and product recommendation. To use this +// endpoint, you need a column of type vector. The input vector must have the same +// dimension as the vector column. // // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -func (s *searchAndFilterClient) AggregateTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *AggregateTableRequest) (*AggregateTableResponse, error) { +func (s *searchAndFilterClient) VectorSearchTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *VectorSearchTableRequest) (*VectorSearchTableResponse, error) { baseURL := "/" if s.baseURL != "" { baseURL = s.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/aggregate", dbBranchName, tableName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/vectorSearch", dbBranchName, tableName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -1527,7 +1525,7 @@ func (s *searchAndFilterClient) AggregateTable(ctx context.Context, dbBranchName return apiError } - var response *AggregateTableResponse + var response *VectorSearchTableResponse if err := core.DoRequest( ctx, s.httpClient, diff --git a/xata/internal/fern-workspace/generated/go/search_branch_request.go b/xata/internal/fern-workspace/generated/go/search_branch_request.go index acc09f0..d142ec7 100644 --- a/xata/internal/fern-workspace/generated/go/search_branch_request.go +++ b/xata/internal/fern-workspace/generated/go/search_branch_request.go @@ -1,17 +1,15 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // SearchBranchRequest is an in-lined request used by the SearchBranch endpoint. type SearchBranchRequest struct { - // An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table. - Tables *[]*SearchBranchRequestTablesItem `json:"tables,omitempty"` - // The query string. `non-empty` - Query string `json:"query"` Fuzziness *FuzzinessExpression `json:"fuzziness,omitempty"` - Prefix *PrefixExpression `json:"prefix,omitempty"` Highlight *HighlightExpression `json:"highlight,omitempty"` Page *SearchPageConfig `json:"page,omitempty"` + Prefix *PrefixExpression `json:"prefix,omitempty"` + // The query string. `non-empty` + Query string `json:"query"` + // An array with the tables in which to search. By default, all tables are included. Optionally, filters can be included that apply to each table. + Tables *[]*SearchBranchRequestTablesItem `json:"tables,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item.go b/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item.go index 62e600b..404d13f 100644 --- a/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item.go +++ b/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item_boosters.go b/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item_boosters.go index f9f74ac..81472c7 100644 --- a/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item_boosters.go +++ b/xata/internal/fern-workspace/generated/go/search_branch_request_tables_item_boosters.go @@ -1,13 +1,11 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type SearchBranchRequestTablesItemBoosters struct { - // The name of the table. - Table string `json:"table"` - Filter *FilterExpression `json:"filter,omitempty"` - Target *TargetExpression `json:"target,omitempty"` Boosters *[]*BoosterExpression `json:"boosters,omitempty"` + Filter *FilterExpression `json:"filter,omitempty"` + // The name of the table. + Table string `json:"table"` + Target *TargetExpression `json:"target,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/search_branch_response.go b/xata/internal/fern-workspace/generated/go/search_branch_response.go index 559583c..69dfaca 100644 --- a/xata/internal/fern-workspace/generated/go/search_branch_response.go +++ b/xata/internal/fern-workspace/generated/go/search_branch_response.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type SearchBranchResponse struct { Records []*Record `json:"records,omitempty"` - Warning *string `json:"warning,omitempty"` // The total count of records matched. It will be accurately returned up to 10000 records. - TotalCount int `json:"totalCount"` + TotalCount int `json:"totalCount"` + Warning *string `json:"warning,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/search_page_config.go b/xata/internal/fern-workspace/generated/go/search_page_config.go index 39ec55b..100d62a 100644 --- a/xata/internal/fern-workspace/generated/go/search_page_config.go +++ b/xata/internal/fern-workspace/generated/go/search_page_config.go @@ -1,13 +1,11 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Pagination settings for the search endpoints. type SearchPageConfig struct { - // Set page size. - Size *int `json:"size,omitempty"` // Use offset to skip entries. To skip pages set offset to a multiple of size. Offset *int `json:"offset,omitempty"` + // Set page size. + Size *int `json:"size,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/search_table_request.go b/xata/internal/fern-workspace/generated/go/search_table_request.go index 0d5f66d..8185157 100644 --- a/xata/internal/fern-workspace/generated/go/search_table_request.go +++ b/xata/internal/fern-workspace/generated/go/search_table_request.go @@ -1,18 +1,16 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // SearchTableRequest is an in-lined request used by the SearchTable endpoint. type SearchTableRequest struct { - // The query string. `non-empty` - Query string `json:"query"` - Fuzziness *FuzzinessExpression `json:"fuzziness,omitempty"` - Target *TargetExpression `json:"target,omitempty"` - Prefix *PrefixExpression `json:"prefix,omitempty"` + Boosters *[]*BoosterExpression `json:"boosters,omitempty"` Filter *FilterExpression `json:"filter,omitempty"` + Fuzziness *FuzzinessExpression `json:"fuzziness,omitempty"` Highlight *HighlightExpression `json:"highlight,omitempty"` - Boosters *[]*BoosterExpression `json:"boosters,omitempty"` Page *SearchPageConfig `json:"page,omitempty"` + Prefix *PrefixExpression `json:"prefix,omitempty"` + // The query string. `non-empty` + Query string `json:"query"` + Target *TargetExpression `json:"target,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/search_table_response.go b/xata/internal/fern-workspace/generated/go/search_table_response.go index fb8ba8d..f920a05 100644 --- a/xata/internal/fern-workspace/generated/go/search_table_response.go +++ b/xata/internal/fern-workspace/generated/go/search_table_response.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type SearchTableResponse struct { Records []*Record `json:"records,omitempty"` - Warning *string `json:"warning,omitempty"` // The total count of records matched. It will be accurately returned up to 10000 records. - TotalCount int `json:"totalCount"` + TotalCount int `json:"totalCount"` + Warning *string `json:"warning,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/service_unavailable_error.go b/xata/internal/fern-workspace/generated/go/service_unavailable_error.go index ceb2064..f7abb53 100644 --- a/xata/internal/fern-workspace/generated/go/service_unavailable_error.go +++ b/xata/internal/fern-workspace/generated/go/service_unavailable_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/set_table_schema_request.go b/xata/internal/fern-workspace/generated/go/set_table_schema_request.go index 27151e3..2e84d01 100644 --- a/xata/internal/fern-workspace/generated/go/set_table_schema_request.go +++ b/xata/internal/fern-workspace/generated/go/set_table_schema_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/set_table_schema_response.go b/xata/internal/fern-workspace/generated/go/set_table_schema_response.go index 13fbb19..43b4ae3 100644 --- a/xata/internal/fern-workspace/generated/go/set_table_schema_response.go +++ b/xata/internal/fern-workspace/generated/go/set_table_schema_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/sort_expression.go b/xata/internal/fern-workspace/generated/go/sort_expression.go index acb0050..c7acbd8 100644 --- a/xata/internal/fern-workspace/generated/go/sort_expression.go +++ b/xata/internal/fern-workspace/generated/go/sort_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/sort_order.go b/xata/internal/fern-workspace/generated/go/sort_order.go index b74e562..28b6168 100644 --- a/xata/internal/fern-workspace/generated/go/sort_order.go +++ b/xata/internal/fern-workspace/generated/go/sort_order.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/sql_client.go b/xata/internal/fern-workspace/generated/go/sql_client.go new file mode 100644 index 0000000..d0d64d0 --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/sql_client.go @@ -0,0 +1,103 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + bytes "bytes" + context "context" + json "encoding/json" + errors "errors" + fmt "fmt" + core "github.com/xataio/xata-go/xata/internal/fern-workspace/generated/go/core" + io "io" + http "net/http" +) + +type SqlClient interface { + Query(ctx context.Context, dbBranchName DbBranchName, request *SqlQueryRequest) (*SqlQueryResponse, error) +} + +func NewSqlClient(opts ...core.ClientOption) SqlClient { + options := core.NewClientOptions() + for _, opt := range opts { + opt(options) + } + return &sqlClient{ + baseURL: options.BaseURL, + httpClient: options.HTTPClient, + header: options.ToHeader(), + } +} + +type sqlClient struct { + baseURL string + httpClient core.HTTPClient + header http.Header +} + +// Run an SQL query across the database branch. +// +// The DBBranchName matches the pattern `{db_name}:{branch_name}`. +func (s *sqlClient) Query(ctx context.Context, dbBranchName DbBranchName, request *SqlQueryRequest) (*SqlQueryResponse, error) { + baseURL := "/" + if s.baseURL != "" { + baseURL = s.baseURL + } + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/sql", dbBranchName) + + errorDecoder := func(statusCode int, body io.Reader) error { + raw, err := io.ReadAll(body) + if err != nil { + return err + } + apiError := core.NewAPIError(statusCode, errors.New(string(raw))) + decoder := json.NewDecoder(bytes.NewReader(raw)) + switch statusCode { + case 400: + value := new(BadRequestError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 401: + value := new(UnauthorizedError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 404: + value := new(NotFoundError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + case 503: + value := new(ServiceUnavailableError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value + } + return apiError + } + + var response *SqlQueryResponse + if err := core.DoRequest( + ctx, + s.httpClient, + endpointURL, + http.MethodPost, + request, + &response, + false, + s.header, + errorDecoder, + ); err != nil { + return response, err + } + return response, nil +} diff --git a/xata/internal/fern-workspace/generated/go/sql_query_request.go b/xata/internal/fern-workspace/generated/go/sql_query_request.go new file mode 100644 index 0000000..3d395f0 --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/sql_query_request.go @@ -0,0 +1,13 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +// SqlQueryRequest is an in-lined request used by the Query endpoint. +type SqlQueryRequest struct { + // The consistency level for this request. + Consistency *SqlQueryRequestConsistency `json:"consistency,omitempty"` + // The query parameter list. + Params *[]any `json:"params,omitempty"` + // The SQL statement. `non-empty` + Statement string `json:"statement"` +} diff --git a/xata/internal/fern-workspace/generated/go/sql_query_request_consistency.go b/xata/internal/fern-workspace/generated/go/sql_query_request_consistency.go new file mode 100644 index 0000000..b59f250 --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/sql_query_request_consistency.go @@ -0,0 +1,48 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +import ( + json "encoding/json" + fmt "fmt" + strconv "strconv" +) + +// The consistency level for this request. +type SqlQueryRequestConsistency uint8 + +const ( + SqlQueryRequestConsistencyStrong SqlQueryRequestConsistency = iota + 1 + SqlQueryRequestConsistencyEventual +) + +func (s SqlQueryRequestConsistency) String() string { + switch s { + default: + return strconv.Itoa(int(s)) + case SqlQueryRequestConsistencyStrong: + return "strong" + case SqlQueryRequestConsistencyEventual: + return "eventual" + } +} + +func (s SqlQueryRequestConsistency) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf("%q", s.String())), nil +} + +func (s *SqlQueryRequestConsistency) UnmarshalJSON(data []byte) error { + var raw string + if err := json.Unmarshal(data, &raw); err != nil { + return err + } + switch raw { + case "strong": + value := SqlQueryRequestConsistencyStrong + *s = value + case "eventual": + value := SqlQueryRequestConsistencyEventual + *s = value + } + return nil +} diff --git a/xata/internal/fern-workspace/generated/go/sql_query_response.go b/xata/internal/fern-workspace/generated/go/sql_query_response.go new file mode 100644 index 0000000..ebb506d --- /dev/null +++ b/xata/internal/fern-workspace/generated/go/sql_query_response.go @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +package api + +type SqlQueryResponse struct { + Columns *map[string]any `json:"columns,omitempty"` + Records *[]SqlRecord `json:"records,omitempty"` + // Number of selected columns + Total *int `json:"total,omitempty"` + Warning *string `json:"warning,omitempty"` +} diff --git a/xata/internal/fern-workspace/generated/go/sql_record.go b/xata/internal/fern-workspace/generated/go/sql_record.go index a400a77..53fbfa3 100644 --- a/xata/internal/fern-workspace/generated/go/sql_record.go +++ b/xata/internal/fern-workspace/generated/go/sql_record.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/started_from_metadata.go b/xata/internal/fern-workspace/generated/go/started_from_metadata.go index 7eeae88..326c8cf 100644 --- a/xata/internal/fern-workspace/generated/go/started_from_metadata.go +++ b/xata/internal/fern-workspace/generated/go/started_from_metadata.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/sum_agg.go b/xata/internal/fern-workspace/generated/go/sum_agg.go index c3708c9..53fa7a6 100644 --- a/xata/internal/fern-workspace/generated/go/sum_agg.go +++ b/xata/internal/fern-workspace/generated/go/sum_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/summarize_table_request.go b/xata/internal/fern-workspace/generated/go/summarize_table_request.go index f07a1fc..d220ac3 100644 --- a/xata/internal/fern-workspace/generated/go/summarize_table_request.go +++ b/xata/internal/fern-workspace/generated/go/summarize_table_request.go @@ -1,17 +1,15 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // SummarizeTableRequest is an in-lined request used by the SummarizeTable endpoint. type SummarizeTableRequest struct { - Filter *FilterExpression `json:"filter,omitempty"` - Columns *ColumnsProjection `json:"columns,omitempty"` - Summaries *SummaryExpressionList `json:"summaries,omitempty"` - Sort *SortExpression `json:"sort,omitempty"` - SummariesFilter *FilterExpression `json:"summariesFilter,omitempty"` + Columns *ColumnsProjection `json:"columns,omitempty"` // The consistency level for this request. - Consistency *SummarizeTableRequestConsistency `json:"consistency,omitempty"` - Page *SummarizeTableRequestPage `json:"page,omitempty"` + Consistency *SummarizeTableRequestConsistency `json:"consistency,omitempty"` + Filter *FilterExpression `json:"filter,omitempty"` + Page *SummarizeTableRequestPage `json:"page,omitempty"` + Sort *SortExpression `json:"sort,omitempty"` + Summaries *SummaryExpressionList `json:"summaries,omitempty"` + SummariesFilter *FilterExpression `json:"summariesFilter,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/summarize_table_request_consistency.go b/xata/internal/fern-workspace/generated/go/summarize_table_request_consistency.go index e656621..eca6c6e 100644 --- a/xata/internal/fern-workspace/generated/go/summarize_table_request_consistency.go +++ b/xata/internal/fern-workspace/generated/go/summarize_table_request_consistency.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/summarize_table_request_page.go b/xata/internal/fern-workspace/generated/go/summarize_table_request_page.go index ebd3a1c..8ab135c 100644 --- a/xata/internal/fern-workspace/generated/go/summarize_table_request_page.go +++ b/xata/internal/fern-workspace/generated/go/summarize_table_request_page.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/summarize_table_response.go b/xata/internal/fern-workspace/generated/go/summarize_table_response.go index 970ee75..e7a2b60 100644 --- a/xata/internal/fern-workspace/generated/go/summarize_table_response.go +++ b/xata/internal/fern-workspace/generated/go/summarize_table_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/summary_expression.go b/xata/internal/fern-workspace/generated/go/summary_expression.go index 35889bb..0ecc76c 100644 --- a/xata/internal/fern-workspace/generated/go/summary_expression.go +++ b/xata/internal/fern-workspace/generated/go/summary_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/summary_expression_list.go b/xata/internal/fern-workspace/generated/go/summary_expression_list.go index f17f932..cfc334f 100644 --- a/xata/internal/fern-workspace/generated/go/summary_expression_list.go +++ b/xata/internal/fern-workspace/generated/go/summary_expression_list.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/table.go b/xata/internal/fern-workspace/generated/go/table.go index cd883fd..247b43d 100644 --- a/xata/internal/fern-workspace/generated/go/table.go +++ b/xata/internal/fern-workspace/generated/go/table.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type Table struct { + Columns []*Column `json:"columns,omitempty"` Id *string `json:"id,omitempty"` Name TableName `json:"name"` - Columns []*Column `json:"columns,omitempty"` RevLinks *[]*RevLink `json:"revLinks,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/table_client.go b/xata/internal/fern-workspace/generated/go/table_client.go index b2c3f52..c789e99 100644 --- a/xata/internal/fern-workspace/generated/go/table_client.go +++ b/xata/internal/fern-workspace/generated/go/table_client.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -19,13 +17,13 @@ type TableClient interface { CreateTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*CreateTableResponse, error) UpdateTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *UpdateTableRequest) (*UpdateTableResponse, error) DeleteTable(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*DeleteTableResponse, error) - GetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableSchemaResponse, error) - SetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SetTableSchemaRequest) (*SetTableSchemaResponse, error) GetTableColumns(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableColumnsResponse, error) AddTableColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *Column) (*AddTableColumnResponse, error) GetColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName) (*Column, error) UpdateColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName, request *UpdateColumnRequest) (*UpdateColumnResponse, error) DeleteColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName) (*DeleteColumnResponse, error) + GetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableSchemaResponse, error) + SetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SetTableSchemaRequest) (*SetTableSchemaResponse, error) } func NewTableClient(opts ...core.ClientOption) TableClient { @@ -257,15 +255,18 @@ func (t *tableClient) DeleteTable(ctx context.Context, dbBranchName DbBranchName return response, nil } +// Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their +// full dot-separated path (flattened). +// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -func (t *tableClient) GetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableSchemaResponse, error) { +func (t *tableClient) GetTableColumns(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableColumnsResponse, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/schema", dbBranchName, tableName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns", dbBranchName, tableName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -300,7 +301,7 @@ func (t *tableClient) GetTableSchema(ctx context.Context, dbBranchName DbBranchN return apiError } - var response *GetTableSchemaResponse + var response *GetTableColumnsResponse if err := core.DoRequest( ctx, t.httpClient, @@ -317,15 +318,17 @@ func (t *tableClient) GetTableSchema(ctx context.Context, dbBranchName DbBranchN return response, nil } +// Adds a new column to the table. The body of the request should contain the column definition. +// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -func (t *tableClient) SetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SetTableSchemaRequest) (*SetTableSchemaResponse, error) { +func (t *tableClient) AddTableColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *Column) (*AddTableColumnResponse, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/schema", dbBranchName, tableName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns", dbBranchName, tableName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -356,23 +359,16 @@ func (t *tableClient) SetTableSchema(ctx context.Context, dbBranchName DbBranchN return err } return value - case 409: - value := new(ConflictError) - value.APIError = apiError - if err := decoder.Decode(value); err != nil { - return err - } - return value } return apiError } - var response *SetTableSchemaResponse + var response *AddTableColumnResponse if err := core.DoRequest( ctx, t.httpClient, endpointURL, - http.MethodPut, + http.MethodPost, request, &response, false, @@ -384,18 +380,18 @@ func (t *tableClient) SetTableSchema(ctx context.Context, dbBranchName DbBranchN return response, nil } -// Retrieves the list of table columns and their definition. This endpoint returns the column list with object columns being reported with their -// full dot-separated path (flattened). +// Get the definition of a single column. // // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -func (t *tableClient) GetTableColumns(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableColumnsResponse, error) { +// The Column name +func (t *tableClient) GetColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName) (*Column, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns", dbBranchName, tableName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns/%v", dbBranchName, tableName, columnName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -430,7 +426,7 @@ func (t *tableClient) GetTableColumns(ctx context.Context, dbBranchName DbBranch return apiError } - var response *GetTableColumnsResponse + var response *Column if err := core.DoRequest( ctx, t.httpClient, @@ -447,17 +443,18 @@ func (t *tableClient) GetTableColumns(ctx context.Context, dbBranchName DbBranch return response, nil } -// Adds a new column to the table. The body of the request should contain the column definition. +// Update column with partial data. Can be used for renaming the column by providing a new "name" field. // // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -func (t *tableClient) AddTableColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *Column) (*AddTableColumnResponse, error) { +// The Column name +func (t *tableClient) UpdateColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName, request *UpdateColumnRequest) (*UpdateColumnResponse, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns", dbBranchName, tableName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns/%v", dbBranchName, tableName, columnName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -492,12 +489,12 @@ func (t *tableClient) AddTableColumn(ctx context.Context, dbBranchName DbBranchN return apiError } - var response *AddTableColumnResponse + var response *UpdateColumnResponse if err := core.DoRequest( ctx, t.httpClient, endpointURL, - http.MethodPost, + http.MethodPatch, request, &response, false, @@ -509,13 +506,13 @@ func (t *tableClient) AddTableColumn(ctx context.Context, dbBranchName DbBranchN return response, nil } -// Get the definition of a single column. +// Deletes the specified column. // // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name // The Column name -func (t *tableClient) GetColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName) (*Column, error) { +func (t *tableClient) DeleteColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName) (*DeleteColumnResponse, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL @@ -555,12 +552,12 @@ func (t *tableClient) GetColumn(ctx context.Context, dbBranchName DbBranchName, return apiError } - var response *Column + var response *DeleteColumnResponse if err := core.DoRequest( ctx, t.httpClient, endpointURL, - http.MethodGet, + http.MethodDelete, nil, &response, false, @@ -572,18 +569,15 @@ func (t *tableClient) GetColumn(ctx context.Context, dbBranchName DbBranchName, return response, nil } -// Update column with partial data. Can be used for renaming the column by providing a new "name" field. -// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -// The Column name -func (t *tableClient) UpdateColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName, request *UpdateColumnRequest) (*UpdateColumnResponse, error) { +func (t *tableClient) GetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName) (*GetTableSchemaResponse, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns/%v", dbBranchName, tableName, columnName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/schema", dbBranchName, tableName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -618,13 +612,13 @@ func (t *tableClient) UpdateColumn(ctx context.Context, dbBranchName DbBranchNam return apiError } - var response *UpdateColumnResponse + var response *GetTableSchemaResponse if err := core.DoRequest( ctx, t.httpClient, endpointURL, - http.MethodPatch, - request, + http.MethodGet, + nil, &response, false, t.header, @@ -635,18 +629,15 @@ func (t *tableClient) UpdateColumn(ctx context.Context, dbBranchName DbBranchNam return response, nil } -// Deletes the specified column. -// // The DBBranchName matches the pattern `{db_name}:{branch_name}`. // // The Table name -// The Column name -func (t *tableClient) DeleteColumn(ctx context.Context, dbBranchName DbBranchName, tableName TableName, columnName ColumnName) (*DeleteColumnResponse, error) { +func (t *tableClient) SetTableSchema(ctx context.Context, dbBranchName DbBranchName, tableName TableName, request *SetTableSchemaRequest) (*SetTableSchemaResponse, error) { baseURL := "/" if t.baseURL != "" { baseURL = t.baseURL } - endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/columns/%v", dbBranchName, tableName, columnName) + endpointURL := fmt.Sprintf(baseURL+"/"+"db/%v/tables/%v/schema", dbBranchName, tableName) errorDecoder := func(statusCode int, body io.Reader) error { raw, err := io.ReadAll(body) @@ -677,17 +668,24 @@ func (t *tableClient) DeleteColumn(ctx context.Context, dbBranchName DbBranchNam return err } return value + case 409: + value := new(ConflictError) + value.APIError = apiError + if err := decoder.Decode(value); err != nil { + return err + } + return value } return apiError } - var response *DeleteColumnResponse + var response *SetTableSchemaResponse if err := core.DoRequest( ctx, t.httpClient, endpointURL, - http.MethodDelete, - nil, + http.MethodPut, + request, &response, false, t.header, diff --git a/xata/internal/fern-workspace/generated/go/table_migration.go b/xata/internal/fern-workspace/generated/go/table_migration.go index c0b76e8..d76c5b3 100644 --- a/xata/internal/fern-workspace/generated/go/table_migration.go +++ b/xata/internal/fern-workspace/generated/go/table_migration.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type TableMigration struct { - NewColumns *map[string]*Column `json:"newColumns,omitempty"` - RemovedColumns *[]string `json:"removedColumns,omitempty"` ModifiedColumns *[]*ColumnMigration `json:"modifiedColumns,omitempty"` NewColumnOrder []string `json:"newColumnOrder,omitempty"` + NewColumns *map[string]*Column `json:"newColumns,omitempty"` + RemovedColumns *[]string `json:"removedColumns,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/table_name.go b/xata/internal/fern-workspace/generated/go/table_name.go index e3a99c8..66a82aa 100644 --- a/xata/internal/fern-workspace/generated/go/table_name.go +++ b/xata/internal/fern-workspace/generated/go/table_name.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/table_op_add.go b/xata/internal/fern-workspace/generated/go/table_op_add.go index 7bd8feb..461eb06 100644 --- a/xata/internal/fern-workspace/generated/go/table_op_add.go +++ b/xata/internal/fern-workspace/generated/go/table_op_add.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/table_op_remove.go b/xata/internal/fern-workspace/generated/go/table_op_remove.go index a9478c3..8aba9fd 100644 --- a/xata/internal/fern-workspace/generated/go/table_op_remove.go +++ b/xata/internal/fern-workspace/generated/go/table_op_remove.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/table_op_rename.go b/xata/internal/fern-workspace/generated/go/table_op_rename.go index 6bfbd01..5dfee0b 100644 --- a/xata/internal/fern-workspace/generated/go/table_op_rename.go +++ b/xata/internal/fern-workspace/generated/go/table_op_rename.go @@ -1,10 +1,8 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type TableOpRename struct { - OldName string `json:"oldName"` NewName string `json:"newName"` + OldName string `json:"oldName"` } diff --git a/xata/internal/fern-workspace/generated/go/table_rename.go b/xata/internal/fern-workspace/generated/go/table_rename.go index d713f59..ca2d284 100644 --- a/xata/internal/fern-workspace/generated/go/table_rename.go +++ b/xata/internal/fern-workspace/generated/go/table_rename.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/target_expression.go b/xata/internal/fern-workspace/generated/go/target_expression.go index efaff77..bb4c454 100644 --- a/xata/internal/fern-workspace/generated/go/target_expression.go +++ b/xata/internal/fern-workspace/generated/go/target_expression.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/target_expression_item.go b/xata/internal/fern-workspace/generated/go/target_expression_item.go index be95246..4104a59 100644 --- a/xata/internal/fern-workspace/generated/go/target_expression_item.go +++ b/xata/internal/fern-workspace/generated/go/target_expression_item.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/target_expression_item_column.go b/xata/internal/fern-workspace/generated/go/target_expression_item_column.go index 94eddc6..ed35a6a 100644 --- a/xata/internal/fern-workspace/generated/go/target_expression_item_column.go +++ b/xata/internal/fern-workspace/generated/go/target_expression_item_column.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/too_many_requests_error.go b/xata/internal/fern-workspace/generated/go/too_many_requests_error.go index dadedb7..9f11007 100644 --- a/xata/internal/fern-workspace/generated/go/too_many_requests_error.go +++ b/xata/internal/fern-workspace/generated/go/too_many_requests_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/top_values_agg.go b/xata/internal/fern-workspace/generated/go/top_values_agg.go index 5de4207..85d01b6 100644 --- a/xata/internal/fern-workspace/generated/go/top_values_agg.go +++ b/xata/internal/fern-workspace/generated/go/top_values_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -7,9 +5,9 @@ package api // Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket. // The top values as ordered by the number of records (`$count`) are returned. type TopValuesAgg struct { + Aggs *AggExpressionMap `json:"aggs,omitempty"` // The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`. - Column string `json:"column"` - Aggs *AggExpressionMap `json:"aggs,omitempty"` + Column string `json:"column"` // The maximum number of unique values to return. Size *int `json:"size,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/transaction_delete_op.go b/xata/internal/fern-workspace/generated/go/transaction_delete_op.go index 125f123..aeee6d4 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_delete_op.go +++ b/xata/internal/fern-workspace/generated/go/transaction_delete_op.go @@ -1,16 +1,14 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // A delete operation. The transaction will continue if no record matches the ID by default. To override this behaviour, set failIfMissing to true. type TransactionDeleteOp struct { - // The table name - Table string `json:"table"` - Id RecordId `json:"id"` - // If true, the transaction will fail when the record doesn't exist. - FailIfMissing *bool `json:"failIfMissing,omitempty"` // If set, the call will return the requested fields as part of the response. Columns *[]string `json:"columns,omitempty"` + // If true, the transaction will fail when the record doesn't exist. + FailIfMissing *bool `json:"failIfMissing,omitempty"` + Id RecordId `json:"id"` + // The table name + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/transaction_error.go b/xata/internal/fern-workspace/generated/go/transaction_error.go index 4a50fc6..ea63349 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_error.go +++ b/xata/internal/fern-workspace/generated/go/transaction_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_failure.go b/xata/internal/fern-workspace/generated/go/transaction_failure.go index 7841c3a..a57173a 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_failure.go +++ b/xata/internal/fern-workspace/generated/go/transaction_failure.go @@ -1,13 +1,11 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // An array of errors, with indices, from the transaction. type TransactionFailure struct { - // The request ID. - Id string `json:"id"` // An array of errors from the submitted operations. Errors []*TransactionError `json:"errors,omitempty"` + // The request ID. + Id string `json:"id"` } diff --git a/xata/internal/fern-workspace/generated/go/transaction_get_op.go b/xata/internal/fern-workspace/generated/go/transaction_get_op.go index 1a2e70b..3e4edc6 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_get_op.go +++ b/xata/internal/fern-workspace/generated/go/transaction_get_op.go @@ -1,14 +1,12 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Get by id operation. type TransactionGetOp struct { - // The table name - Table string `json:"table"` - Id RecordId `json:"id"` // If set, the call will return the requested fields as part of the response. Columns *[]string `json:"columns,omitempty"` + Id RecordId `json:"id"` + // The table name + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/transaction_insert_op.go b/xata/internal/fern-workspace/generated/go/transaction_insert_op.go index 7aa9c56..f9440a5 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_insert_op.go +++ b/xata/internal/fern-workspace/generated/go/transaction_insert_op.go @@ -1,18 +1,11 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Insert operation type TransactionInsertOp struct { - // The table name - Table string `json:"table"` - // The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record. - Record map[string]any `json:"record,omitempty"` - // The version of the record you expect to be overwriting. Only valid with an - // explicit ID is also set in the `record` key. - IfVersion *int `json:"ifVersion,omitempty"` + // If set, the call will return the requested fields as part of the response. + Columns *[]string `json:"columns,omitempty"` // createOnly is used to change how Xata acts when an explicit ID is set in the `record` key. // // If `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata @@ -21,6 +14,11 @@ type TransactionInsertOp struct { // If `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no // conflict, the record is inserted. If there is a conflict, Xata will replace the record. CreateOnly *bool `json:"createOnly,omitempty"` - // If set, the call will return the requested fields as part of the response. - Columns *[]string `json:"columns,omitempty"` + // The version of the record you expect to be overwriting. Only valid with an + // explicit ID is also set in the `record` key. + IfVersion *int `json:"ifVersion,omitempty"` + // The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record. + Record map[string]any `json:"record,omitempty"` + // The table name + Table string `json:"table"` } diff --git a/xata/internal/fern-workspace/generated/go/transaction_operation.go b/xata/internal/fern-workspace/generated/go/transaction_operation.go index 8a97874..aa02cf2 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_operation.go +++ b/xata/internal/fern-workspace/generated/go/transaction_operation.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_operation_delete.go b/xata/internal/fern-workspace/generated/go/transaction_operation_delete.go index 434d7cb..6d6064b 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_operation_delete.go +++ b/xata/internal/fern-workspace/generated/go/transaction_operation_delete.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_operation_get.go b/xata/internal/fern-workspace/generated/go/transaction_operation_get.go index dbefadf..ed1e1a5 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_operation_get.go +++ b/xata/internal/fern-workspace/generated/go/transaction_operation_get.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_operation_insert.go b/xata/internal/fern-workspace/generated/go/transaction_operation_insert.go index cdf2070..c40f639 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_operation_insert.go +++ b/xata/internal/fern-workspace/generated/go/transaction_operation_insert.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_operation_update.go b/xata/internal/fern-workspace/generated/go/transaction_operation_update.go index 322e7d5..843a73c 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_operation_update.go +++ b/xata/internal/fern-workspace/generated/go/transaction_operation_update.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_result_columns.go b/xata/internal/fern-workspace/generated/go/transaction_result_columns.go index 71cf4a6..5405e23 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_result_columns.go +++ b/xata/internal/fern-workspace/generated/go/transaction_result_columns.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_result_delete.go b/xata/internal/fern-workspace/generated/go/transaction_result_delete.go index 0a948fc..80e0325 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_result_delete.go +++ b/xata/internal/fern-workspace/generated/go/transaction_result_delete.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,9 +8,9 @@ import ( // A result from a delete operation. type TransactionResultDelete struct { + Columns *TransactionResultColumns `json:"columns,omitempty"` // The number of deleted rows - Rows int `json:"rows"` - Columns *TransactionResultColumns `json:"columns,omitempty"` + Rows int `json:"rows"` operation string } diff --git a/xata/internal/fern-workspace/generated/go/transaction_result_get.go b/xata/internal/fern-workspace/generated/go/transaction_result_get.go index 2ba937a..5213013 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_result_get.go +++ b/xata/internal/fern-workspace/generated/go/transaction_result_get.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_result_insert.go b/xata/internal/fern-workspace/generated/go/transaction_result_insert.go index 6b85c53..8f91538 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_result_insert.go +++ b/xata/internal/fern-workspace/generated/go/transaction_result_insert.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,10 @@ import ( // A result from an insert operation. type TransactionResultInsert struct { + Columns *TransactionResultColumns `json:"columns,omitempty"` + Id RecordId `json:"id"` // The number of affected rows - Rows int `json:"rows"` - Id RecordId `json:"id"` - Columns *TransactionResultColumns `json:"columns,omitempty"` + Rows int `json:"rows"` operation string } diff --git a/xata/internal/fern-workspace/generated/go/transaction_result_update.go b/xata/internal/fern-workspace/generated/go/transaction_result_update.go index 45afe62..ce5341e 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_result_update.go +++ b/xata/internal/fern-workspace/generated/go/transaction_result_update.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -10,10 +8,10 @@ import ( // A result from an update operation. type TransactionResultUpdate struct { + Columns *TransactionResultColumns `json:"columns,omitempty"` + Id RecordId `json:"id"` // The number of updated rows - Rows int `json:"rows"` - Id RecordId `json:"id"` - Columns *TransactionResultColumns `json:"columns,omitempty"` + Rows int `json:"rows"` operation string } diff --git a/xata/internal/fern-workspace/generated/go/transaction_success.go b/xata/internal/fern-workspace/generated/go/transaction_success.go index 1bca4b4..3cdd3bd 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_success.go +++ b/xata/internal/fern-workspace/generated/go/transaction_success.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/transaction_success_results_item.go b/xata/internal/fern-workspace/generated/go/transaction_success_results_item.go index 52bca07..f13396b 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_success_results_item.go +++ b/xata/internal/fern-workspace/generated/go/transaction_success_results_item.go @@ -4,14 +4,6 @@ package api -//type TransactionSuccessResultsItem struct { -// typeName string -// TransactionResultInsert *TransactionResultInsert -// TransactionResultUpdate *TransactionResultUpdate -// TransactionResultDelete *TransactionResultDelete -// TransactionResultGet *TransactionResultGet -//} - type TransactionSuccessResultsItem struct { // The number of affected rows Rows int `json:"rows,omitempty"` @@ -19,84 +11,3 @@ type TransactionSuccessResultsItem struct { Columns *TransactionResultColumns `json:"columns,omitempty"` Operation string `json:"operation"` } - -//func NewTransactionSuccessResultsItemFromTransactionResultInsert(value *TransactionResultInsert) *TransactionSuccessResultsItem { -// return &TransactionSuccessResultsItem{typeName: "transactionResultInsert", TransactionResultInsert: value} -//} -// -//func NewTransactionSuccessResultsItemFromTransactionResultUpdate(value *TransactionResultUpdate) *TransactionSuccessResultsItem { -// return &TransactionSuccessResultsItem{typeName: "transactionResultUpdate", TransactionResultUpdate: value} -//} -// -//func NewTransactionSuccessResultsItemFromTransactionResultDelete(value *TransactionResultDelete) *TransactionSuccessResultsItem { -// return &TransactionSuccessResultsItem{typeName: "transactionResultDelete", TransactionResultDelete: value} -//} -// -//func NewTransactionSuccessResultsItemFromTransactionResultGet(value *TransactionResultGet) *TransactionSuccessResultsItem { -// return &TransactionSuccessResultsItem{typeName: "transactionResultGet", TransactionResultGet: value} -//} -// -//func (t *TransactionSuccessResultsItem) UnmarshalJSON(data []byte) error { -// valueTransactionResultInsert := new(TransactionResultInsert) -// if err := json.Unmarshal(data, &valueTransactionResultInsert); err == nil { -// t.typeName = "transactionResultInsert" -// t.TransactionResultInsert = valueTransactionResultInsert -// return nil -// } -// valueTransactionResultUpdate := new(TransactionResultUpdate) -// if err := json.Unmarshal(data, &valueTransactionResultUpdate); err == nil { -// t.typeName = "transactionResultUpdate" -// t.TransactionResultUpdate = valueTransactionResultUpdate -// return nil -// } -// valueTransactionResultDelete := new(TransactionResultDelete) -// if err := json.Unmarshal(data, &valueTransactionResultDelete); err == nil { -// t.typeName = "transactionResultDelete" -// t.TransactionResultDelete = valueTransactionResultDelete -// return nil -// } -// valueTransactionResultGet := new(TransactionResultGet) -// if err := json.Unmarshal(data, &valueTransactionResultGet); err == nil { -// t.typeName = "transactionResultGet" -// t.TransactionResultGet = valueTransactionResultGet -// return nil -// } -// return fmt.Errorf("%s cannot be deserialized as a %T", data, t) -//} -// -//func (t TransactionSuccessResultsItem) MarshalJSON() ([]byte, error) { -// switch t.typeName { -// default: -// return nil, fmt.Errorf("invalid type %s in %T", t.typeName, t) -// case "transactionResultInsert": -// return json.Marshal(t.TransactionResultInsert) -// case "transactionResultUpdate": -// return json.Marshal(t.TransactionResultUpdate) -// case "transactionResultDelete": -// return json.Marshal(t.TransactionResultDelete) -// case "transactionResultGet": -// return json.Marshal(t.TransactionResultGet) -// } -//} -// -//type TransactionSuccessResultsItemVisitor interface { -// VisitTransactionResultInsert(*TransactionResultInsert) error -// VisitTransactionResultUpdate(*TransactionResultUpdate) error -// VisitTransactionResultDelete(*TransactionResultDelete) error -// VisitTransactionResultGet(*TransactionResultGet) error -//} -// -//func (t *TransactionSuccessResultsItem) Accept(v TransactionSuccessResultsItemVisitor) error { -// switch t.typeName { -// default: -// return fmt.Errorf("invalid type %s in %T", t.typeName, t) -// case "transactionResultInsert": -// return v.VisitTransactionResultInsert(t.TransactionResultInsert) -// case "transactionResultUpdate": -// return v.VisitTransactionResultUpdate(t.TransactionResultUpdate) -// case "transactionResultDelete": -// return v.VisitTransactionResultDelete(t.TransactionResultDelete) -// case "transactionResultGet": -// return v.VisitTransactionResultGet(t.TransactionResultGet) -// } -//} diff --git a/xata/internal/fern-workspace/generated/go/transaction_update_op.go b/xata/internal/fern-workspace/generated/go/transaction_update_op.go index 90f0491..5412703 100644 --- a/xata/internal/fern-workspace/generated/go/transaction_update_op.go +++ b/xata/internal/fern-workspace/generated/go/transaction_update_op.go @@ -1,20 +1,18 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // Update operation type TransactionUpdateOp struct { - // The table name - Table string `json:"table"` - Id RecordId `json:"id"` + // If set, the call will return the requested fields as part of the response. + Columns *[]string `json:"columns,omitempty"` // The fields of the record you'd like to update Fields map[string]any `json:"fields,omitempty"` + Id RecordId `json:"id"` // The version of the record you expect to be updating IfVersion *int `json:"ifVersion,omitempty"` + // The table name + Table string `json:"table"` // Xata will insert this record if it cannot be found. Upsert *bool `json:"upsert,omitempty"` - // If set, the call will return the requested fields as part of the response. - Columns *[]string `json:"columns,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/unauthorized_error.go b/xata/internal/fern-workspace/generated/go/unauthorized_error.go index f575a3f..e0b78e9 100644 --- a/xata/internal/fern-workspace/generated/go/unauthorized_error.go +++ b/xata/internal/fern-workspace/generated/go/unauthorized_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/unique_count_agg.go b/xata/internal/fern-workspace/generated/go/unique_count_agg.go index d50fabe..2acd2f7 100644 --- a/xata/internal/fern-workspace/generated/go/unique_count_agg.go +++ b/xata/internal/fern-workspace/generated/go/unique_count_agg.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/unprocessable_entity_error.go b/xata/internal/fern-workspace/generated/go/unprocessable_entity_error.go index d3a6c16..345c882 100644 --- a/xata/internal/fern-workspace/generated/go/unprocessable_entity_error.go +++ b/xata/internal/fern-workspace/generated/go/unprocessable_entity_error.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_branch_schema_response.go b/xata/internal/fern-workspace/generated/go/update_branch_schema_response.go index 6691336..0e2d751 100644 --- a/xata/internal/fern-workspace/generated/go/update_branch_schema_response.go +++ b/xata/internal/fern-workspace/generated/go/update_branch_schema_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_column_request.go b/xata/internal/fern-workspace/generated/go/update_column_request.go index e328c92..783aec2 100644 --- a/xata/internal/fern-workspace/generated/go/update_column_request.go +++ b/xata/internal/fern-workspace/generated/go/update_column_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_column_response.go b/xata/internal/fern-workspace/generated/go/update_column_response.go index 4987429..3901f3c 100644 --- a/xata/internal/fern-workspace/generated/go/update_column_response.go +++ b/xata/internal/fern-workspace/generated/go/update_column_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_record_with_id_request.go b/xata/internal/fern-workspace/generated/go/update_record_with_id_request.go index 33c6a39..bc068c6 100644 --- a/xata/internal/fern-workspace/generated/go/update_record_with_id_request.go +++ b/xata/internal/fern-workspace/generated/go/update_record_with_id_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_record_with_id_response.go b/xata/internal/fern-workspace/generated/go/update_record_with_id_response.go index 2782fdd..efdbf04 100644 --- a/xata/internal/fern-workspace/generated/go/update_record_with_id_response.go +++ b/xata/internal/fern-workspace/generated/go/update_record_with_id_response.go @@ -4,67 +4,4 @@ package api -//import ( -// json "encoding/json" -// fmt "fmt" -//) - type UpdateRecordWithIdResponse map[string]interface{} - -// -//type UpdateRecordWithIdResponse struct { -// typeName string -// Record *Record -// UpdateRecordWithIdResponseId *UpdateRecordWithIdResponseId -//} -// -//func NewUpdateRecordWithIdResponseFromRecord(value *Record) *UpdateRecordWithIdResponse { -// return &UpdateRecordWithIdResponse{typeName: "record", Record: value} -//} -// -//func NewUpdateRecordWithIdResponseFromUpdateRecordWithIdResponseId(value *UpdateRecordWithIdResponseId) *UpdateRecordWithIdResponse { -// return &UpdateRecordWithIdResponse{typeName: "updateRecordWithIdResponseId", UpdateRecordWithIdResponseId: value} -//} -// -//func (u *UpdateRecordWithIdResponse) UnmarshalJSON(data []byte) error { -// valueRecord := new(Record) -// if err := json.Unmarshal(data, &valueRecord); err == nil { -// u.typeName = "record" -// u.Record = valueRecord -// return nil -// } -// valueUpdateRecordWithIdResponseId := new(UpdateRecordWithIdResponseId) -// if err := json.Unmarshal(data, &valueUpdateRecordWithIdResponseId); err == nil { -// u.typeName = "updateRecordWithIdResponseId" -// u.UpdateRecordWithIdResponseId = valueUpdateRecordWithIdResponseId -// return nil -// } -// return fmt.Errorf("%s cannot be deserialized as a %T", data, u) -//} -// -//func (u UpdateRecordWithIdResponse) MarshalJSON() ([]byte, error) { -// switch u.typeName { -// default: -// return nil, fmt.Errorf("invalid type %s in %T", u.typeName, u) -// case "record": -// return json.Marshal(u.Record) -// case "updateRecordWithIdResponseId": -// return json.Marshal(u.UpdateRecordWithIdResponseId) -// } -//} -// -//type UpdateRecordWithIdResponseVisitor interface { -// VisitRecord(*Record) error -// VisitUpdateRecordWithIdResponseId(*UpdateRecordWithIdResponseId) error -//} -// -//func (u *UpdateRecordWithIdResponse) Accept(v UpdateRecordWithIdResponseVisitor) error { -// switch u.typeName { -// default: -// return fmt.Errorf("invalid type %s in %T", u.typeName, u) -// case "record": -// return v.VisitRecord(u.Record) -// case "updateRecordWithIdResponseId": -// return v.VisitUpdateRecordWithIdResponseId(u.UpdateRecordWithIdResponseId) -// } -//} diff --git a/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id.go b/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id.go index d06741c..1aa35dd 100644 --- a/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id.go +++ b/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id_xata.go b/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id_xata.go index ddcef17..3190bd6 100644 --- a/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id_xata.go +++ b/xata/internal/fern-workspace/generated/go/update_record_with_id_response_id_xata.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type UpdateRecordWithIdResponseIdXata struct { - Version int `json:"version"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` + Version int `json:"version"` } diff --git a/xata/internal/fern-workspace/generated/go/update_table_request.go b/xata/internal/fern-workspace/generated/go/update_table_request.go index e638783..d99329e 100644 --- a/xata/internal/fern-workspace/generated/go/update_table_request.go +++ b/xata/internal/fern-workspace/generated/go/update_table_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/update_table_response.go b/xata/internal/fern-workspace/generated/go/update_table_response.go index c420e63..d0091ab 100644 --- a/xata/internal/fern-workspace/generated/go/update_table_response.go +++ b/xata/internal/fern-workspace/generated/go/update_table_response.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/upsert_record_with_id_request.go b/xata/internal/fern-workspace/generated/go/upsert_record_with_id_request.go index 4388676..4e591ce 100644 --- a/xata/internal/fern-workspace/generated/go/upsert_record_with_id_request.go +++ b/xata/internal/fern-workspace/generated/go/upsert_record_with_id_request.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id.go b/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id.go index 690d5cb..ee838a1 100644 --- a/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id.go +++ b/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api diff --git a/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id_xata.go b/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id_xata.go index d6b1b93..e992f66 100644 --- a/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id_xata.go +++ b/xata/internal/fern-workspace/generated/go/upsert_record_with_id_response_id_xata.go @@ -1,11 +1,9 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type UpsertRecordWithIdResponseIdXata struct { - Version int `json:"version"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` + Version int `json:"version"` } diff --git a/xata/internal/fern-workspace/generated/go/value_booster.go b/xata/internal/fern-workspace/generated/go/value_booster.go index 8b9e959..dead647 100644 --- a/xata/internal/fern-workspace/generated/go/value_booster.go +++ b/xata/internal/fern-workspace/generated/go/value_booster.go @@ -1,5 +1,3 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api @@ -8,9 +6,9 @@ package api type ValueBooster struct { // The column in which to look for the value. Column string `json:"column"` - // The exact value to boost. - Value *ValueBoosterValue `json:"value,omitempty"` // The factor with which to multiply the added boost. Factor float64 `json:"factor"` IfMatchesFilter *FilterExpression `json:"ifMatchesFilter,omitempty"` + // The exact value to boost. + Value *ValueBoosterValue `json:"value,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/vector_search_table_request.go b/xata/internal/fern-workspace/generated/go/vector_search_table_request.go index ef13f6c..585d5e5 100644 --- a/xata/internal/fern-workspace/generated/go/vector_search_table_request.go +++ b/xata/internal/fern-workspace/generated/go/vector_search_table_request.go @@ -1,20 +1,18 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api // VectorSearchTableRequest is an in-lined request used by the VectorSearchTable endpoint. type VectorSearchTableRequest struct { + // The vector column in which to search. It must be of type `vector`. + Column string `json:"column"` + Filter *FilterExpression `json:"filter,omitempty"` // The vector to search for similarities. Must have the same dimension as // the vector column used. QueryVector []float64 `json:"queryVector,omitempty"` - // The vector column in which to search. It must be of type `vector`. - Column string `json:"column"` // The function used to measure the distance between two points. Can be one of: // `cosineSimilarity`, `l1`, `l2`. The default is `cosineSimilarity`. SimilarityFunction *string `json:"similarityFunction,omitempty"` // Number of results to return. - Size *int `json:"size,omitempty"` - Filter *FilterExpression `json:"filter,omitempty"` + Size *int `json:"size,omitempty"` } diff --git a/xata/internal/fern-workspace/generated/go/vector_search_table_response.go b/xata/internal/fern-workspace/generated/go/vector_search_table_response.go index 0f45d16..b9bdc6a 100644 --- a/xata/internal/fern-workspace/generated/go/vector_search_table_response.go +++ b/xata/internal/fern-workspace/generated/go/vector_search_table_response.go @@ -1,12 +1,10 @@ -// SPDX-License-Identifier: Apache-2.0 - // This file was auto-generated by Fern from our API Definition. package api type VectorSearchTableResponse struct { Records []*Record `json:"records,omitempty"` - Warning *string `json:"warning,omitempty"` // The total count of records matched. It will be accurately returned up to 10000 records. - TotalCount int `json:"totalCount"` + TotalCount int `json:"totalCount"` + Warning *string `json:"warning,omitempty"` } diff --git a/xata/table_client.go b/xata/table_client.go index 51100f9..d5fb4d4 100644 --- a/xata/table_client.go +++ b/xata/table_client.go @@ -77,16 +77,16 @@ const ( ) type Column struct { - Name string `json:"name"` - Type ColumnType `json:"type,omitempty"` - Link *ColumnLink `json:"link,omitempty"` - Vector *ColumnVector `json:"vector,omitempty"` - File *ColumnFile `json:"file,omitempty"` - FileMap *ColumnFile `json:"fileMap,omitempty"` - NotNull *bool `json:"notNull,omitempty"` - DefaultValue *string `json:"defaultValue,omitempty"` - Unique *bool `json:"unique,omitempty"` - Columns *[]*Column `json:"columns,omitempty"` + Name string + Type ColumnType + Link *ColumnLink + Vector *ColumnVector + File *ColumnFile + FileMap *ColumnFile + NotNull *bool + DefaultValue *string + Unique *bool + Columns *[]*Column } type AddColumnRequest struct {