Skip to content

Commit

Permalink
Update OpenAPI Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] authored and xata-bot committed Jul 29, 2024
1 parent cb9f483 commit 9077c33
Show file tree
Hide file tree
Showing 3 changed files with 175 additions and 0 deletions.
138 changes: 138 additions & 0 deletions packages/client/src/api/dataPlaneComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetTasksResponse, GetTasksError, undefined, {}, {}, GetTasksPathParams>({
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<Schemas.TaskStatusResponse, GetTaskStatusError, undefined, {}, {}, GetTaskStatusPathParams>({
url: '/tasks/{taskId}',
method: 'get',
...variables,
signal
});

export type ListClusterBranchesPathParams = {
/**
* Cluster ID
Expand Down Expand Up @@ -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}`.
Expand Down Expand Up @@ -5693,6 +5829,7 @@ export const sqlBatchQuery = (variables: SqlBatchQueryVariables, signal?: AbortS
});

export const operationsByTag = {
tasks: { getTasks, getTaskStatus },
cluster: {
listClusterBranches,
listClusterExtensions,
Expand Down Expand Up @@ -5726,6 +5863,7 @@ export const operationsByTag = {
},
branch: {
getBranchList,
createBranchAsync,
getBranchDetails,
createBranch,
deleteBranch,
Expand Down
2 changes: 2 additions & 0 deletions packages/client/src/api/dataPlaneParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
35 changes: 35 additions & 0 deletions packages/client/src/api/dataPlaneSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_-~:]+
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 9077c33

Please sign in to comment.