|
1 | 1 | import axios from "axios";
|
2 | 2 | import dayjs from "dayjs";
|
3 |
| -import * as Types from "./types"; |
4 |
| -import { DeploymentConfig } from "./types"; |
5 | 3 | import * as TypesGen from "./typesGenerated";
|
6 | 4 | import { delay } from "utils/delay";
|
7 | 5 | import userAgentParser from "ua-parser-js";
|
@@ -365,8 +363,8 @@ export const createTemplate = async (
|
365 | 363 | export const updateActiveTemplateVersion = async (
|
366 | 364 | templateId: string,
|
367 | 365 | data: TypesGen.UpdateActiveTemplateVersion,
|
368 |
| -): Promise<Types.Message> => { |
369 |
| - const response = await axios.patch<Types.Message>( |
| 366 | +) => { |
| 367 | + const response = await axios.patch<TypesGen.Response>( |
370 | 368 | `/api/v2/templates/${templateId}/versions`,
|
371 | 369 | data,
|
372 | 370 | );
|
@@ -547,7 +545,7 @@ export const deleteWorkspace = (
|
547 | 545 |
|
548 | 546 | export const cancelWorkspaceBuild = async (
|
549 | 547 | workspaceBuildId: TypesGen.WorkspaceBuild["id"],
|
550 |
| -): Promise<Types.Message> => { |
| 548 | +): Promise<TypesGen.Response> => { |
551 | 549 | const response = await axios.patch(
|
552 | 550 | `/api/v2/workspacebuilds/${workspaceBuildId}/cancel`,
|
553 | 551 | );
|
@@ -595,7 +593,7 @@ export const restartWorkspace = async ({
|
595 | 593 |
|
596 | 594 | export const cancelTemplateVersionBuild = async (
|
597 | 595 | templateVersionId: TypesGen.TemplateVersion["id"],
|
598 |
| -): Promise<Types.Message> => { |
| 596 | +): Promise<TypesGen.Response> => { |
599 | 597 | const response = await axios.patch(
|
600 | 598 | `/api/v2/templateversions/${templateVersionId}/cancel`,
|
601 | 599 | );
|
@@ -985,6 +983,29 @@ export const getDeploymentSSHConfig =
|
985 | 983 | return response.data;
|
986 | 984 | };
|
987 | 985 |
|
| 986 | +// The Deployment types are not generated on from the Go generator yet because |
| 987 | +// it does not know how to generate OptionSet |
| 988 | +export interface DeploymentGroup { |
| 989 | + readonly name: string; |
| 990 | + readonly parent?: DeploymentGroup; |
| 991 | + readonly description: string; |
| 992 | + readonly children: DeploymentGroup[]; |
| 993 | +} |
| 994 | +export interface DeploymentOption { |
| 995 | + readonly name: string; |
| 996 | + readonly description: string; |
| 997 | + readonly flag: string; |
| 998 | + readonly flag_shorthand: string; |
| 999 | + readonly value: unknown; |
| 1000 | + readonly hidden: boolean; |
| 1001 | + readonly group?: DeploymentGroup; |
| 1002 | +} |
| 1003 | + |
| 1004 | +export type DeploymentConfig = { |
| 1005 | + readonly config: TypesGen.DeploymentValues; |
| 1006 | + readonly options: DeploymentOption[]; |
| 1007 | +}; |
| 1008 | + |
988 | 1009 | export const getDeploymentValues = async (): Promise<DeploymentConfig> => {
|
989 | 1010 | const response = await axios.get(`/api/v2/deployment/config`);
|
990 | 1011 | return response.data;
|
|
0 commit comments