From 9077c33a265a89e57c633a7b118104df0e7bde46 Mon Sep 17 00:00:00 2001 From: "github-merge-queue[bot]" Date: Mon, 29 Jul 2024 14:33:36 +0000 Subject: [PATCH] Update OpenAPI Spec --- .../client/src/api/dataPlaneComponents.ts | 138 ++++++++++++++++++ .../client/src/api/dataPlaneParameters.ts | 2 + packages/client/src/api/dataPlaneSchemas.ts | 35 +++++ 3 files changed, 175 insertions(+) diff --git a/packages/client/src/api/dataPlaneComponents.ts b/packages/client/src/api/dataPlaneComponents.ts index 28c269cf6..a82af02a7 100644 --- a/packages/client/src/api/dataPlaneComponents.ts +++ b/packages/client/src/api/dataPlaneComponents.ts @@ -8,6 +8,76 @@ import { dataPlaneFetch, DataPlaneFetcherExtraProps } from './dataPlaneFetcher'; import type * as Schemas from './dataPlaneSchemas'; import type * as Responses from './dataPlaneResponses'; +export type GetTasksPathParams = { + workspace: string; + region: string; +}; + +export type GetTasksError = Fetcher.ErrorWrapper< + | { + status: 400; + payload: Responses.BadRequestError; + } + | { + status: 401; + payload: Responses.AuthError; + } + | { + status: 404; + payload: Responses.SimpleError; + } +>; + +export type GetTasksResponse = Schemas.TaskStatusResponse[]; + +export type GetTasksVariables = { + pathParams: GetTasksPathParams; +} & DataPlaneFetcherExtraProps; + +export const getTasks = (variables: GetTasksVariables, signal?: AbortSignal) => + dataPlaneFetch({ + url: '/tasks', + method: 'get', + ...variables, + signal + }); + +export type GetTaskStatusPathParams = { + /** + * The id of the branch creation task + */ + taskId: Schemas.TaskID; + workspace: string; + region: string; +}; + +export type GetTaskStatusError = Fetcher.ErrorWrapper< + | { + status: 400; + payload: Responses.BadRequestError; + } + | { + status: 401; + payload: Responses.AuthError; + } + | { + status: 404; + payload: Responses.SimpleError; + } +>; + +export type GetTaskStatusVariables = { + pathParams: GetTaskStatusPathParams; +} & DataPlaneFetcherExtraProps; + +export const getTaskStatus = (variables: GetTaskStatusVariables, signal?: AbortSignal) => + dataPlaneFetch({ + url: '/tasks/{taskId}', + method: 'get', + ...variables, + signal + }); + export type ListClusterBranchesPathParams = { /** * Cluster ID @@ -927,6 +997,72 @@ export const updateDatabaseSettings = (variables: UpdateDatabaseSettingsVariable UpdateDatabaseSettingsPathParams >({ url: '/dbs/{dbName}/settings', method: 'patch', ...variables, signal }); +export type CreateBranchAsyncPathParams = { + /** + * The DBBranchName matches the pattern `{db_name}:{branch_name}`. + */ + dbBranchName: Schemas.DBBranchName; + workspace: string; + region: string; +}; + +export type CreateBranchAsyncQueryParams = { + /** + * Name of source branch to branch the new schema from + */ + from?: string; +}; + +export type CreateBranchAsyncError = Fetcher.ErrorWrapper< + | { + status: 400; + payload: Responses.BadRequestError; + } + | { + status: 401; + payload: Responses.AuthError; + } + | { + status: 404; + payload: Responses.SimpleError; + } + | { + status: 423; + payload: Responses.SimpleError; + } +>; + +export type CreateBranchAsyncRequestBody = { + /** + * Select the branch to fork from. Defaults to 'main' + */ + from?: string; + /** + * Select the dedicated cluster to create on. Defaults to 'xata-cloud' + * + * @minLength 1 + * @x-internal true + */ + clusterID?: string; + metadata?: Schemas.BranchMetadata; +}; + +export type CreateBranchAsyncVariables = { + body?: CreateBranchAsyncRequestBody; + pathParams: CreateBranchAsyncPathParams; + queryParams?: CreateBranchAsyncQueryParams; +} & DataPlaneFetcherExtraProps; + +export const createBranchAsync = (variables: CreateBranchAsyncVariables, signal?: AbortSignal) => + dataPlaneFetch< + Schemas.CreateBranchResponse, + CreateBranchAsyncError, + CreateBranchAsyncRequestBody, + {}, + CreateBranchAsyncQueryParams, + CreateBranchAsyncPathParams + >({ url: '/db/{dbBranchName}/async', method: 'put', ...variables, signal }); + export type GetBranchDetailsPathParams = { /** * The DBBranchName matches the pattern `{db_name}:{branch_name}`. @@ -5693,6 +5829,7 @@ export const sqlBatchQuery = (variables: SqlBatchQueryVariables, signal?: AbortS }); export const operationsByTag = { + tasks: { getTasks, getTaskStatus }, cluster: { listClusterBranches, listClusterExtensions, @@ -5726,6 +5863,7 @@ export const operationsByTag = { }, branch: { getBranchList, + createBranchAsync, getBranchDetails, createBranch, deleteBranch, diff --git a/packages/client/src/api/dataPlaneParameters.ts b/packages/client/src/api/dataPlaneParameters.ts index 3ee987f06..710bdd800 100644 --- a/packages/client/src/api/dataPlaneParameters.ts +++ b/packages/client/src/api/dataPlaneParameters.ts @@ -5,6 +5,8 @@ */ import type * as Schemas from './dataPlaneSchemas'; +export type TaskIDParam = Schemas.TaskID; + export type ClusterIDParam = Schemas.ClusterID; export type PageSizeParam = Schemas.PageSize; diff --git a/packages/client/src/api/dataPlaneSchemas.ts b/packages/client/src/api/dataPlaneSchemas.ts index 5a561d852..5817933cb 100644 --- a/packages/client/src/api/dataPlaneSchemas.ts +++ b/packages/client/src/api/dataPlaneSchemas.ts @@ -3,6 +3,34 @@ * * @version 1.0 */ +export type TaskStatus = 'scheduled' | 'pending' | 'active' | 'retry' | 'archived' | 'completed'; + +export type TaskStatusResponse = { + /** + * The id of the task + */ + taskID: string; + /** + * The type of the task + */ + type: string; + /** + * The status of the task + */ + status: TaskStatus; + /** + * Any error message associated with the task + */ + error?: string; +}; + +/** + * @maxLength 255 + * @minLength 1 + * @pattern [a-zA-Z0-9_\-~]+ + */ +export type TaskID = string; + /** * @x-internal true * @pattern [a-zA-Z0-9_-~:]+ @@ -453,6 +481,13 @@ export type BranchMetadata = { labels?: string[]; }; +export type CreateBranchResponse = { + /** + * The id of the branch creation task + */ + taskID: string; +}; + export type StartedFromMetadata = { branchName: BranchName; dbBranchID: string;